KickJava   Java API By Example, From Geeks To Geeks.

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


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 DeleteDigitalAssetTag 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 = "deleteDigitalAsset";
26
27     /**
28      * The map containing the content that should be updated.
29      */

30
31     private Map JavaDoc digitalAsset = new HashMap JavaDoc();
32
33     private Integer JavaDoc contentVersionId;
34     private Integer JavaDoc languageId;
35     private Integer JavaDoc contentId;
36     private String JavaDoc assetKey;
37
38     /**
39      *
40      */

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

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

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

67     public int doEndTag() throws JspException JavaDoc
68     {
69         try
70         {
71             if(this.contentVersionId != null)
72                 digitalAsset.put("contentVersionId", this.contentVersionId);
73             if(this.contentId != null)
74                 digitalAsset.put("contentId", this.contentId);
75             if(this.languageId != null)
76                 digitalAsset.put("languageId", this.languageId);
77             if(this.assetKey != null)
78                 digitalAsset.put("assetKey", this.assetKey);
79                 
80             this.invokeOperation("digitalAsset", digitalAsset);
81         }
82         catch (Exception JavaDoc e)
83         {
84             e.printStackTrace();
85             throw new JspTagException JavaDoc(e.getMessage());
86         }
87
88         digitalAsset.clear();
89         this.contentVersionId = null;
90         this.contentId = null;
91         this.languageId = null;
92         this.assetKey = 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 setContentVersionId(String JavaDoc contentVersionId) throws JspException JavaDoc
114     {
115         this.contentVersionId = evaluateInteger("deleteDigitalAsset", "contentVersionId", contentVersionId);
116     }
117
118     public void setContentId(String JavaDoc contentId) throws JspException JavaDoc
119     {
120         this.contentId = evaluateInteger("deleteDigitalAsset", "contentId", contentId);
121     }
122
123     public void setLanguageId(String JavaDoc languageId) throws JspException JavaDoc
124     {
125         this.languageId = evaluateInteger("deleteDigitalAsset", "languageId", languageId);
126     }
127
128     public void setAssetKey(String JavaDoc assetKey) throws JspException JavaDoc
129     {
130         this.assetKey = evaluateString("deleteDigitalAsset", "assetKey", assetKey);
131     }
132
133
134     public String JavaDoc getOperationName()
135     {
136         return this.operationName;
137     }
138 }
Popular Tags