1 17 package org.alfresco.web.config; 18 19 import org.alfresco.config.ConfigElement; 20 import org.alfresco.config.element.ConfigElementAdapter; 21 22 27 public class ClientConfigElement extends ConfigElementAdapter 28 { 29 public static final String CONFIG_ELEMENT_ID = "client"; 30 31 private String fromEmailAddress = "alfresco@alfresco.org"; 32 private String errorPage = null; 33 private String loginPage = null; 34 private int recentSpacesItems = 6; 35 private boolean shelfVisible = true; 36 private int searchMinimum = 3; 37 private boolean forceAndTerms = false; 38 private int searchMaxResults = -1; 39 private String helpUrl = null; 40 private String editLinkType = null; 41 private String homeSpacePermission = null; 42 43 46 public ClientConfigElement() 47 { 48 super(CONFIG_ELEMENT_ID); 49 } 50 51 56 public ClientConfigElement(String name) 57 { 58 super(name); 59 } 60 61 64 public ConfigElement combine(ConfigElement configElement) 65 { 66 ClientConfigElement existingElement = (ClientConfigElement)configElement; 67 ClientConfigElement newElement = new ClientConfigElement(); 68 69 if (existingElement.getEditLinkType() == null) 71 { 72 newElement.setEditLinkType(this.editLinkType); 73 } 74 else 75 { 76 newElement.setEditLinkType(existingElement.getEditLinkType()); 77 } 78 79 if (existingElement.getErrorPage() == null) 80 { 81 newElement.setErrorPage(this.errorPage); 82 } 83 else 84 { 85 newElement.setErrorPage(existingElement.getErrorPage()); 86 } 87 88 if (existingElement.getLoginPage() == null) 89 { 90 newElement.setLoginPage(this.loginPage); 91 } 92 else 93 { 94 newElement.setLoginPage(existingElement.getLoginPage()); 95 } 96 97 if (existingElement.getHelpUrl() == null ) 98 { 99 newElement.setHelpUrl(this.helpUrl); 100 } 101 else 102 { 103 newElement.setHelpUrl(existingElement.getHelpUrl()); 104 } 105 106 if (existingElement.getHomeSpacePermission() == null) 107 { 108 newElement.setHomeSpacePermission(this.homeSpacePermission); 109 } 110 else 111 { 112 newElement.setHomeSpacePermission(existingElement.getHomeSpacePermission()); 113 } 114 115 if (existingElement.getRecentSpacesItems() != newElement.getRecentSpacesItems()) 117 { 118 newElement.setRecentSpacesItems(existingElement.getRecentSpacesItems()); 119 } 120 121 if (existingElement.getSearchMinimum() != newElement.getSearchMinimum()) 122 { 123 newElement.setSearchMinimum(existingElement.getSearchMinimum()); 124 } 125 126 if (existingElement.getForceAndTerms() != newElement.getForceAndTerms()) 127 { 128 newElement.setForceAndTerms(existingElement.getForceAndTerms()); 129 } 130 131 if (existingElement.getSearchMaxResults() != newElement.getSearchMaxResults()) 132 { 133 newElement.setSearchMaxResults(existingElement.getSearchMaxResults()); 134 } 135 136 if (existingElement.isShelfVisible() != newElement.isShelfVisible()) 137 { 138 newElement.setShelfVisible(existingElement.isShelfVisible()); 139 } 140 141 if (existingElement.getFromEmailAddress() != null && 142 (existingElement.getFromEmailAddress().equals(newElement.getFromEmailAddress()) == false)) 143 { 144 newElement.setFromEmailAddress(existingElement.getFromEmailAddress()); 145 } 146 147 return newElement; 148 } 149 150 153 public int getRecentSpacesItems() 154 { 155 return this.recentSpacesItems; 156 } 157 158 161 void setRecentSpacesItems(int recentSpacesItems) 162 { 163 this.recentSpacesItems = recentSpacesItems; 164 } 165 166 169 public boolean isShelfVisible() 170 { 171 return this.shelfVisible; 172 } 173 174 177 void setShelfVisible(boolean shelfVisible) 178 { 179 this.shelfVisible = shelfVisible; 180 } 181 182 185 public String getErrorPage() 186 { 187 return this.errorPage; 188 } 189 190 193 void setErrorPage(String errorPage) 194 { 195 this.errorPage = errorPage; 196 } 197 198 201 public String getLoginPage() 202 { 203 return this.loginPage; 204 } 205 206 209 void setLoginPage(String loginPage) 210 { 211 this.loginPage = loginPage; 212 } 213 214 217 public String getHelpUrl() 218 { 219 return this.helpUrl; 220 } 221 222 225 void setHelpUrl(String helpUrl) 226 { 227 this.helpUrl = helpUrl; 228 } 229 230 234 public String getFromEmailAddress() 235 { 236 return this.fromEmailAddress; 237 } 238 239 242 void setFromEmailAddress(String fromEmailAddress) 243 { 244 this.fromEmailAddress = fromEmailAddress; 245 } 246 247 250 public String getEditLinkType() 251 { 252 return this.editLinkType; 253 } 254 255 258 void setEditLinkType(String editLinkType) 259 { 260 this.editLinkType = editLinkType; 261 } 262 263 266 public int getSearchMinimum() 267 { 268 return this.searchMinimum; 269 } 270 271 274 void setSearchMinimum(int searchMinimum) 275 { 276 this.searchMinimum = searchMinimum; 277 } 278 279 282 public boolean getForceAndTerms() 283 { 284 return this.forceAndTerms; 285 } 286 287 290 void setForceAndTerms(boolean forceAndTerms) 291 { 292 this.forceAndTerms = forceAndTerms; 293 } 294 295 300 301 public int getSearchMaxResults() 302 { 303 return searchMaxResults; 304 } 305 306 312 void setSearchMaxResults(int searchMaxResults) 313 { 314 this.searchMaxResults = searchMaxResults; 315 } 316 317 320 public String getHomeSpacePermission() 321 { 322 return this.homeSpacePermission; 323 } 324 325 328 void setHomeSpacePermission(String homeSpacePermission) 329 { 330 this.homeSpacePermission = homeSpacePermission; 331 } 332 } 333 | Popular Tags |