KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > deliver > taglib > structure > PageAsDigitalAssetUrlTag


1 /* ===============================================================================
2 *
3 * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4 *
5 * ===============================================================================
6 *
7 * Copyright (C)
8 *
9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 2, as published by the
11 * Free Software Foundation. See the file LICENSE.html for more information.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19 * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20 *
21 * ===============================================================================
22 */

23 package org.infoglue.deliver.taglib.structure;
24
25 import javax.servlet.jsp.JspException JavaDoc;
26
27 import org.infoglue.deliver.taglib.component.ComponentLogicTag;
28
29 /**
30  *
31  * @author mattias
32  *
33  */

34 public class PageAsDigitalAssetUrlTag extends ComponentLogicTag
35 {
36     /**
37      * This method calls an page and stores it as an digitalAsset - that way one can avoid having to
38      * serve javascript-files and css-files through InfoGlue. Not suitable for use if you have very dynamic
39      * css:es or scripts which includes logic depending on user info etc.. mostly usable if you have a static css
40      * or controls it on the pageCache parameters.
41      */

42
43     private static final long serialVersionUID = 4050485595074016051L;
44     
45     private String JavaDoc propertyName;
46     private boolean useInheritance = true;
47     private String JavaDoc fileSuffix = "";
48     
49     private Integer JavaDoc siteNodeId;
50     private Integer JavaDoc languageId;
51     private Integer JavaDoc contentId = new Integer JavaDoc(-1);
52
53     private String JavaDoc extraParameters;
54     
55     public PageAsDigitalAssetUrlTag()
56     {
57         super();
58     }
59
60     public int doEndTag() throws JspException JavaDoc
61     {
62         produceResult(getPageAsDigitalAssetUrl());
63         return EVAL_PAGE;
64     }
65
66     private String JavaDoc getPageAsDigitalAssetUrl() throws JspException JavaDoc
67     {
68         if(this.languageId == null)
69             this.languageId = getController().getDeliveryContext().getLanguageId();
70         
71         if(this.propertyName != null)
72             return getComponentLogic().getPageAsDigitalAssetUrl(propertyName, languageId, contentId, useInheritance, fileSuffix);
73         else
74             return getController().getPageAsDigitalAssetUrl(siteNodeId, languageId, contentId, fileSuffix);
75     }
76
77     public void setSiteNodeId(final String JavaDoc siteNodeId) throws JspException JavaDoc
78     {
79         this.siteNodeId = evaluateInteger("pageAsDigitalAssetUrl", "siteNodeId", siteNodeId);
80     }
81
82     public void setLanguageId(final String JavaDoc languageId) throws JspException JavaDoc
83     {
84         this.languageId = evaluateInteger("pageAsDigitalAssetUrl", "languageId", languageId);
85     }
86
87     public void setContentId(final String JavaDoc contentId) throws JspException JavaDoc
88     {
89         this.contentId = evaluateInteger("pageAsDigitalAssetUrl", "contentId", contentId);
90     }
91     
92     public void setPropertyName(String JavaDoc propertyName) throws JspException JavaDoc
93     {
94         this.propertyName = evaluateString("pageAsDigitalAssetUrl", "propertyName", propertyName);
95     }
96     
97     public void setUseInheritance(boolean useInheritance)
98     {
99         this.useInheritance = useInheritance;
100     }
101
102     public void setFileSuffix(String JavaDoc fileSuffix) throws JspException JavaDoc
103     {
104         this.fileSuffix = evaluateString("pageAsDigitalAssetUrl", "fileSuffix", fileSuffix);;
105     }
106
107     public void setExtraParameters(String JavaDoc extraParameters)
108     {
109         this.extraParameters = extraParameters;
110     }
111 }
112
Popular Tags