1 31 32 package org.opencms.file; 33 34 import org.opencms.main.OpenCms; 35 import org.opencms.security.CmsPrincipal; 36 import org.opencms.security.I_CmsPrincipal; 37 import org.opencms.util.CmsUUID; 38 39 51 public class CmsGroup extends CmsPrincipal implements I_CmsPrincipal { 52 53 54 private CmsUUID m_parentId; 55 56 59 public CmsGroup() { 60 61 } 63 64 73 public CmsGroup(CmsUUID id, CmsUUID parentId, String name, String description, int flags) { 74 75 m_id = id; 76 m_name = name; 77 m_description = description; 78 m_flags = flags; 79 m_parentId = parentId; 80 } 81 82 92 public void checkName(String name) { 93 94 OpenCms.getValidationHandler().checkGroupName(name); 95 } 96 97 100 public Object clone() { 101 102 return new CmsGroup(m_id, m_parentId, m_name, m_description, m_flags); 103 } 104 105 112 public boolean getDisabled() { 113 114 return !isEnabled(); 115 } 116 117 122 public CmsUUID getParentId() { 123 124 return m_parentId; 125 } 126 127 132 public boolean getProjectCoWorker() { 133 134 return (getFlags() & I_CmsPrincipal.FLAG_GROUP_PROJECT_USER) == I_CmsPrincipal.FLAG_GROUP_PROJECT_USER; 135 } 136 137 142 public boolean getProjectManager() { 143 144 return (getFlags() & I_CmsPrincipal.FLAG_GROUP_PROJECT_MANAGER) == I_CmsPrincipal.FLAG_GROUP_PROJECT_MANAGER; 145 } 146 147 152 public boolean getRole() { 153 154 return (getFlags() & I_CmsPrincipal.FLAG_GROUP_WORKFLOW_ROLE) == I_CmsPrincipal.FLAG_GROUP_WORKFLOW_ROLE; 155 } 156 157 160 public boolean isGroup() { 161 162 return true; 163 } 164 165 168 public boolean isUser() { 169 170 return false; 171 } 172 173 178 public void setDisabled() { 179 180 setEnabled(false); 181 } 182 183 188 public void setEnabled() { 189 190 setEnabled(true); 191 } 192 193 198 public void setParentId(CmsUUID parentId) { 199 200 m_parentId = parentId; 201 } 202 203 208 public void setProjectCoWorker(boolean value) { 209 210 if (getProjectCoWorker() != value) { 211 setFlags(getFlags() ^ I_CmsPrincipal.FLAG_GROUP_PROJECT_USER); 212 } 213 } 214 215 220 public void setProjectManager(boolean value) { 221 222 if (getProjectManager() != value) { 223 setFlags(getFlags() ^ I_CmsPrincipal.FLAG_GROUP_PROJECT_MANAGER); 224 } 225 } 226 227 232 public void setRole(boolean value) { 233 234 if (getRole() != value) { 235 setFlags(getFlags() ^ I_CmsPrincipal.FLAG_GROUP_WORKFLOW_ROLE); 236 } 237 } 238 239 242 public String toString() { 243 244 StringBuffer result = new StringBuffer (); 245 result.append("[Group]"); 246 result.append(" name:"); 247 result.append(m_name); 248 result.append(" id:"); 249 result.append(m_id); 250 result.append(" description:"); 251 result.append(m_description); 252 return result.toString(); 253 } 254 } | Popular Tags |