1 31 32 package org.opencms.file; 33 34 import org.opencms.main.CmsIllegalArgumentException; 35 import org.opencms.util.CmsStringUtil; 36 import org.opencms.util.CmsUUID; 37 38 47 public class CmsPropertyDefinition implements Cloneable , Comparable { 48 49 50 public static final String NAME_CONSTRAINTS = "-._~$"; 51 52 53 public static final String PROPERTY_ACTIV = "activemethod"; 54 55 56 public static final String PROPERTY_AVAILABLE_LOCALES = "locale-available"; 57 58 59 public static final String PROPERTY_BODY_CLASS = "templateclass"; 60 61 62 public static final String PROPERTY_CACHE = "cache"; 63 64 65 public static final String PROPERTY_CHANNELID = "ChannelId"; 66 67 68 public static final String PROPERTY_CONTENT_CONVERSION = "content-conversion"; 69 70 71 public static final String PROPERTY_CONTENT_ENCODING = "content-encoding"; 72 73 74 public static final String PROPERTY_DEFAULT_FILE = "default-file"; 75 76 77 public static final String PROPERTY_DESCRIPTION = "Description"; 78 79 80 public static final String PROPERTY_ENABLE_NOTIFICATION = "enable-notification"; 81 82 83 public static final String PROPERTY_EXPORT = "export"; 84 85 86 public static final String PROPERTY_EXPORTNAME = "exportname"; 87 88 89 public static final String PROPERTY_EXPORTSUFFIX = "exportsuffix"; 90 91 92 public static final String PROPERTY_FOLDERS_AVAILABLE = "folders.available"; 93 94 95 public static final String PROPERTY_IMAGE_SIZE = "image.size"; 96 97 98 public static final String PROPERTY_INTERNAL = "internal"; 99 100 101 public static final String PROPERTY_KEYWORDS = "Keywords"; 102 103 104 public static final String PROPERTY_LOCALE = "locale"; 105 106 107 public static final String PROPERTY_LOCALE_DEFAULT = "locale-default"; 108 109 110 public static final String PROPERTY_LOGIN_FORM = "login-form"; 111 112 113 public static final String PROPERTY_NAVIMAGE = "NavImage"; 114 115 116 public static final String PROPERTY_NAVINFO = "NavInfo"; 117 118 119 public static final String PROPERTY_NAVPOS = "NavPos"; 120 121 122 public static final String PROPERTY_NAVTEXT = "NavText"; 123 124 125 public static final String PROPERTY_NOTIFICATION_INTERVAL = "notification-interval"; 126 127 128 public static final String PROPERTY_RELATIVEROOT = "relativeroot"; 129 130 131 public static final String PROPERTY_RESTYPES_AVAILABLE = "restypes.available"; 132 133 134 public static final String PROPERTY_SEARCH_CATEGORY = "category"; 135 136 137 public static final String PROPERTY_SEARCH_EXTRACTIONCLASS = "search.extractionclass"; 138 139 140 public static final String PROPERTY_SEARCH_PRIORITY = "search.priority"; 141 142 143 public static final String PROPERTY_SECURE = "secure"; 144 145 146 public static final String PROPERTY_STYLESHEET = "stylesheet"; 147 148 149 public static final String PROPERTY_TEMPLATE = "template"; 150 151 152 public static final String PROPERTY_TEMPLATE_ELEMENTS = "template-elements"; 153 154 155 public static final String PROPERTY_TITLE = "Title"; 156 157 158 public static final String PROPERTY_VISIBLE = "visiblemethod"; 159 160 161 public static final int PROPERYDEFINITION_RESOURCE = 1; 162 163 164 private static final CmsPropertyDefinition NULL_PROPERTY_DEFINITION = new CmsPropertyDefinition( 165 CmsUUID.getNullUUID(), 166 ""); 167 168 169 private CmsUUID m_id; 170 171 172 private String m_name; 173 174 179 public CmsPropertyDefinition(CmsUUID id, String name) { 180 181 m_id = id; 182 m_name = name; 183 } 184 185 196 public static void checkPropertyName(String name) throws CmsIllegalArgumentException { 197 198 if (CmsStringUtil.isEmptyOrWhitespaceOnly(name)) { 199 throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_BAD_PROPERTYNAME_EMPTY_0, name)); 200 } 201 202 CmsStringUtil.checkName(name, NAME_CONSTRAINTS, Messages.ERR_BAD_PROPERTYNAME_4, Messages.get()); 203 } 204 205 210 public static CmsPropertyDefinition getNullPropertyDefinition() { 211 212 return CmsPropertyDefinition.NULL_PROPERTY_DEFINITION; 213 } 214 215 220 public Object clone() { 221 222 return new CmsPropertyDefinition(m_id, m_name); 223 } 224 225 228 public int compareTo(Object obj) { 229 230 if (obj == this) { 231 return 0; 232 } 233 if (obj instanceof CmsPropertyDefinition) { 234 return m_name.compareTo(((CmsPropertyDefinition)obj).m_name); 235 } 236 return 0; 237 } 238 239 242 public boolean equals(Object obj) { 243 244 if (obj == this) { 245 return true; 246 } 247 if (obj instanceof CmsPropertyDefinition) { 248 return ((CmsPropertyDefinition)obj).m_id.equals(m_id); 249 } 250 return false; 251 } 252 253 258 public CmsUUID getId() { 259 260 return m_id; 261 } 262 263 268 public String getName() { 269 270 return m_name; 271 } 272 273 276 public int hashCode() { 277 278 if (m_name != null) { 279 return m_name.hashCode(); 280 } 281 return 0; 282 } 283 284 287 public String toString() { 288 289 StringBuffer result = new StringBuffer (); 290 result.append("[Propertydefinition]"); 291 result.append(" name:"); 292 result.append(m_name); 293 result.append(" id:"); 294 result.append(m_id); 295 return result.toString(); 296 } 297 } | Popular Tags |