KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

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

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

30
31     private Map JavaDoc contentVersion = new HashMap JavaDoc();
32
33     private Integer JavaDoc contentVersionId;
34
35     /**
36      *
37      */

38     private InfoGluePrincipal principal;
39
40     /**
41      *
42      */

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

56     public int doStartTag() throws JspException JavaDoc
57     {
58         return EVAL_BODY_INCLUDE;
59     }
60
61     /**
62      *
63      */

64     public int doEndTag() throws JspException JavaDoc
65     {
66         try
67         {
68             if(this.contentVersionId != null)
69                 contentVersion.put("contentVersionId", this.contentVersionId);
70                 
71             this.invokeOperation("contentVersion", contentVersion);
72         }
73         catch (Exception JavaDoc e)
74         {
75             e.printStackTrace();
76             throw new JspTagException JavaDoc(e.getMessage());
77         }
78
79         contentVersion.clear();
80         this.contentVersionId = null;
81         
82         return EVAL_PAGE;
83     }
84
85     /**
86      *
87      */

88     public void setOperationName(final String JavaDoc operationName)
89     {
90         this.operationName = operationName;
91     }
92
93     /**
94      *
95      */

96     public void setPrincipal(final String JavaDoc principalString) throws JspException JavaDoc
97     {
98         this.principal = (InfoGluePrincipal) this.evaluate("remoteContentService", "principal", principalString, InfoGluePrincipal.class);
99     }
100
101     public void setContentVersionId(String JavaDoc contentVersionId) throws JspException JavaDoc
102     {
103         this.contentVersionId = evaluateInteger("deleteContentVersion", "contentVersionId", contentVersionId);
104     }
105
106     public String JavaDoc getOperationName()
107     {
108         return this.operationName;
109     }
110 }
Popular Tags