KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > deliver > taglib > content > UpdateContentTag


1 package org.infoglue.deliver.taglib.content;
2
3 import java.util.Date JavaDoc;
4 import java.util.HashMap JavaDoc;
5 import java.util.Map JavaDoc;
6
7 import javax.servlet.jsp.JspException JavaDoc;
8 import javax.servlet.jsp.JspTagException JavaDoc;
9
10 import org.infoglue.cms.security.InfoGluePrincipal;
11
12 /**
13  * This tag helps update a content in the cms from the delivery application.
14  */

15
16 public class UpdateContentTag extends InfoGlueWebServiceTag
17 {
18     /**
19      * The universal version identifier.
20      */

21     private static final long serialVersionUID = -1904980538720103871L;
22
23     /**
24      *
25      */

26     private String JavaDoc operationName = "updateContent";
27
28     /**
29      * The map containing the content that should be updated.
30      */

31
32     private Map JavaDoc content = new HashMap JavaDoc();
33
34     private Integer JavaDoc contentId;
35     private String JavaDoc name;
36     private Date JavaDoc publishDateTime;
37     private Date JavaDoc expireDateTime;
38
39     /**
40      *
41      */

42     private InfoGluePrincipal principal;
43
44     /**
45      *
46      */

47     public UpdateContentTag()
48     {
49         super();
50     }
51
52     /**
53      * Initializes the parameters to make it accessible for the children tags
54      * (if any).
55      *
56      * @return indication of whether to evaluate the body or not.
57      * @throws JspException
58      * if an error occurred while processing this tag.
59      */

60     public int doStartTag() throws JspException JavaDoc
61     {
62         return EVAL_BODY_INCLUDE;
63     }
64
65     /**
66      *
67      */

68     public int doEndTag() throws JspException JavaDoc
69     {
70         try
71         {
72             content.put("contentId", this.contentId);
73             if(this.name != null)
74                 content.put("name", this.name);
75             if(this.publishDateTime != null)
76                 content.put("publishDateTime", this.publishDateTime);
77             if(this.expireDateTime != null)
78                 content.put("expireDateTime", this.expireDateTime);
79             
80             this.invokeOperation("content", content);
81         }
82         catch (Exception JavaDoc e)
83         {
84             e.printStackTrace();
85             throw new JspTagException JavaDoc(e.getMessage());
86         }
87
88         content.clear();
89         this.name = null;
90         this.contentId = null;
91         this.expireDateTime = null;
92         this.publishDateTime = null;
93
94         return EVAL_PAGE;
95     }
96
97     /**
98      *
99      */

100     public void setOperationName(final String JavaDoc operationName)
101     {
102         this.operationName = operationName;
103     }
104
105     /**
106      *
107      */

108     public void setPrincipal(final String JavaDoc principalString) throws JspException JavaDoc
109     {
110         this.principal = (InfoGluePrincipal) this.evaluate("remoteContentService", "principal", principalString, InfoGluePrincipal.class);
111     }
112
113     public void setContentId(String JavaDoc contentId) throws JspException JavaDoc
114     {
115         this.contentId = evaluateInteger("updateContent", "contentId", contentId);
116     }
117
118     public void setName(String JavaDoc name) throws JspException JavaDoc
119     {
120         this.name = evaluateString("updateContent", "name", name);
121     }
122
123     public void setExpireDateTime(String JavaDoc expireDateTime) throws JspException JavaDoc
124     {
125         this.expireDateTime = (Date JavaDoc) this.evaluate("updateContent", "expireDateTime", expireDateTime, Date JavaDoc.class);
126     }
127
128     public void setPublishDateTime(String JavaDoc publishDateTime) throws JspException JavaDoc
129     {
130         this.publishDateTime = (Date JavaDoc) this.evaluate("updateContent", "publishDateTime", publishDateTime, Date JavaDoc.class);
131     }
132
133     public String JavaDoc getOperationName()
134     {
135         return this.operationName;
136     }
137 }
Popular Tags