1 23 24 package org.infoglue.deliver.applications.databeans; 25 26 import java.util.ArrayList ; 27 import java.util.Iterator ; 28 import java.util.List ; 29 30 import javax.servlet.http.HttpServletRequest ; 31 import javax.servlet.http.HttpServletResponse ; 32 33 import org.infoglue.cms.applications.common.Session; 34 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction; 35 36 42 43 public class DeliveryContext implements UsageListener 44 { 45 public static final String META_INFO_BINDING_NAME = "Meta information"; 46 public static final String TEMPLATE_ATTRIBUTE_NAME = "Template"; 47 public static final String TITLE_ATTRIBUTE_NAME = "Title"; 48 public static final String NAV_TITLE_ATTRIBUTE_NAME = "NavigationTitle"; 49 55 56 public static final boolean USE_LANGUAGE_FALLBACK = true; 57 public static final boolean DO_NOT_USE_LANGUAGE_FALLBACK = false; 58 public static final boolean USE_INHERITANCE = true; 59 public static final boolean DO_NOT_USE_INHERITANCE = false; 60 61 private Integer siteNodeId = null; 63 private Integer contentId = null; 64 private Integer languageId = null; 65 66 private String contentType = null; 68 69 private boolean disablePageCache = false; 71 72 private boolean showSimple = false; 74 75 private String repositoryName = null; 77 78 private String pageKey = null; 79 private String pagePath = null; 80 81 private HttpServletResponse httpServletResponse = null; 82 private HttpServletRequest httpServletRequest = null; 83 private Session session = null; 84 private InfoGlueAbstractAction infoglueAbstractAction = null; 85 86 private List usageListeners = new ArrayList (); 88 89 private List usedContents = new ArrayList (); 90 private List usedContentVersions = new ArrayList (); 91 private List usedSiteNodes = new ArrayList (); 92 private List usedSiteNodeVersions = new ArrayList (); 93 94 96 private boolean useFullUrl = false; 98 99 private boolean disableNiceUri = false; 101 102 private boolean trimResponse = false; 104 105 private boolean evaluateFullPage = true; 107 108 public static DeliveryContext getDeliveryContext() 109 { 110 return new DeliveryContext(); 111 } 112 113 private DeliveryContext() 114 { 115 } 116 127 128 public java.lang.Integer getSiteNodeId() 129 { 130 return this.siteNodeId; 131 } 132 133 public void setSiteNodeId(Integer siteNodeId) 134 { 135 this.siteNodeId = siteNodeId; 136 } 137 138 public Integer getContentId() 139 { 140 return this.contentId; 141 } 142 143 public void setContentId(Integer contentId) 144 { 145 this.contentId = contentId; 146 } 147 148 public Integer getLanguageId() 149 { 150 return this.languageId; 151 } 152 153 public void setLanguageId(Integer languageId) 154 { 155 this.languageId = languageId; 156 } 157 158 public String getRepositoryName() 159 { 160 return this.repositoryName; 161 } 162 163 public void setRepositoryName(String repositoryName) 164 { 165 this.repositoryName = repositoryName; 166 } 167 168 public String getPageKey() 169 { 170 return this.pageKey; 171 } 172 173 public String getPagePath() 174 { 175 return this.pagePath; 176 } 177 178 public void setPageKey(String pageKey) 179 { 180 this.pageKey = pageKey; 181 } 182 183 public void setPagePath(String pagePath) 184 { 185 this.pagePath = pagePath; 186 } 187 188 194 195 public String toString() 196 { 197 StringBuffer sb = new StringBuffer (); 198 199 sb.append("siteNodeId:" + this.siteNodeId); 200 sb.append("languageId:" + this.languageId); 201 sb.append("contentId:" + this.contentId); 202 204 return sb.toString(); 205 } 206 207 public Session getSession() 208 { 209 return this.session; 210 } 211 212 public void setSession(Session session) 213 { 214 this.session = session; 215 } 216 217 public InfoGlueAbstractAction getInfoGlueAbstractAction() 218 { 219 return infoglueAbstractAction; 220 } 221 222 public void setInfoGlueAbstractAction(InfoGlueAbstractAction action) 223 { 224 infoglueAbstractAction = action; 225 } 226 227 228 public HttpServletRequest getHttpServletRequest() 229 { 230 return httpServletRequest; 231 } 232 233 public void setHttpServletRequest(HttpServletRequest httpServletRequest) 234 { 235 this.httpServletRequest = httpServletRequest; 236 } 237 238 public HttpServletResponse getHttpServletResponse() 239 { 240 return httpServletResponse; 241 } 242 243 public void setHttpServletResponse(HttpServletResponse httpServletResponse) 244 { 245 this.httpServletResponse = httpServletResponse; 246 } 247 248 public void addUsedContent(String usedContent) 249 { 250 this.usedContents.add(usedContent); 251 252 Iterator iterator = this.getUsageListeners().iterator(); 253 while(iterator.hasNext()) 254 { 255 UsageListener usageListener = (UsageListener)iterator.next(); 256 usageListener.addUsedContent(usedContent); 257 } 258 } 259 260 public void addUsedSiteNode(String usedSiteNode) 261 { 262 this.usedSiteNodes.add(usedSiteNode); 263 264 Iterator iterator = this.getUsageListeners().iterator(); 265 while(iterator.hasNext()) 266 { 267 UsageListener usageListener = (UsageListener)iterator.next(); 268 usageListener.addUsedSiteNode(usedSiteNode); 269 } 270 } 271 272 public void addUsedContentVersion(String usedContentVersion) 273 { 274 this.usedContentVersions.add(usedContentVersion); 275 276 Iterator iterator = this.getUsageListeners().iterator(); 277 while(iterator.hasNext()) 278 { 279 UsageListener usageListener = (UsageListener)iterator.next(); 280 usageListener.addUsedContentVersion(usedContentVersion); 281 } 282 } 283 284 public void addUsedSiteNodeVersion(String usedSiteNodeVersion) 285 { 286 this.usedSiteNodeVersions.add(usedSiteNodeVersion); 287 288 Iterator iterator = this.getUsageListeners().iterator(); 289 while(iterator.hasNext()) 290 { 291 UsageListener usageListener = (UsageListener)iterator.next(); 292 usageListener.addUsedSiteNodeVersion(usedSiteNodeVersion); 293 } 294 } 295 296 public String [] getAllUsedEntities() 297 { 298 List list = new ArrayList (); 299 list.addAll(this.usedContents); 300 list.addAll(this.usedContentVersions); 301 list.addAll(this.usedSiteNodes); 302 list.addAll(this.usedSiteNodeVersions); 303 Object [] array = list.toArray(); 304 String [] groups = new String [array.length]; 305 for(int i=0; i<array.length; i++) 306 groups[i] = array[i].toString(); 307 308 return groups; 309 } 310 311 public List getUsageListeners() 312 { 313 return usageListeners; 314 } 315 316 public boolean getShowSimple() 317 { 318 return showSimple; 319 } 320 321 public void setShowSimple(boolean showSimple) 322 { 323 this.showSimple = showSimple; 324 } 325 326 public String getContentType() 327 { 328 return contentType; 329 } 330 331 public void setContentType(String contentType) 332 { 333 this.contentType = contentType; 334 } 335 336 public boolean getDisablePageCache() 337 { 338 return disablePageCache; 339 } 340 341 public void setDisablePageCache(boolean disablePageCache) 342 { 343 this.disablePageCache = disablePageCache; 344 } 345 346 public boolean getUseFullUrl() 347 { 348 return useFullUrl; 349 } 350 351 public void setUseFullUrl(boolean useFullUrl) 352 { 353 this.useFullUrl = useFullUrl; 354 } 355 356 public boolean getDisableNiceUri() 357 { 358 return this.disableNiceUri; 359 } 360 361 public void setDisableNiceUri(boolean disableNiceUri) 362 { 363 this.disableNiceUri = disableNiceUri; 364 } 365 366 public boolean getTrimResponse() 367 { 368 return this.trimResponse; 369 } 370 371 public void setTrimResponse(boolean trimResponse) 372 { 373 this.trimResponse = trimResponse; 374 } 375 376 public boolean getEvaluateFullPage() 377 { 378 return evaluateFullPage; 379 } 380 381 public void setEvaluateFullPage(boolean evaluateFullPage) 382 { 383 this.evaluateFullPage = evaluateFullPage; 384 } 385 } 386 | Popular Tags |