KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > applications > contenttool > actions > SimpleContentXmlServiceAction


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
24 /**
25  * @author Stefan Sik
26  * @version 0.1
27  * @since 1.3
28  *
29  * TODO: Quick due to sudden changes. Refactor as soon as possible
30  *
31  * @deprecated
32  */

33
34 package org.infoglue.cms.applications.contenttool.actions;
35
36 import java.io.PrintWriter JavaDoc;
37
38 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
39 import org.infoglue.cms.controllers.kernel.impl.simple.DigitalAssetController;
40 import org.infoglue.cms.entities.content.DigitalAssetVO;
41
42 public class SimpleContentXmlServiceAction extends InfoGlueAbstractAction
43 {
44     private static final long serialVersionUID = 1L;
45     
46     private String JavaDoc serviceRequest = null;
47     private Integer JavaDoc contentVersionId = null;
48     private Integer JavaDoc languageId = null;
49     private Integer JavaDoc contentId = null;
50     private Integer JavaDoc digitalAssetId = null;
51     private String JavaDoc digitalAssetKey = null;
52
53     public SimpleContentXmlServiceAction() {
54     }
55
56     public String JavaDoc getDigitalAssetInfo() throws Exception JavaDoc {
57         String JavaDoc ret = "";
58         DigitalAssetVO digitalAssetVO = null;
59
60         if (digitalAssetId != null) {
61             digitalAssetVO = DigitalAssetController
62                     .getDigitalAssetVOWithId(digitalAssetId);
63         } else {
64             digitalAssetVO = DigitalAssetController.getDigitalAssetVO(
65                     contentId, languageId, digitalAssetKey, true);
66         }
67
68         ret = "<digitalAssetInfo>"
69                 + "<assetURL>"
70                 + DigitalAssetController.getDigitalAssetUrl(digitalAssetVO.getId())
71                 + "</assetURL>"
72                 + "<assetId>"
73                 + digitalAssetVO.getId()
74                 + "</assetId>"
75                 + "</digitalAssetInfo>";
76
77         return ret;
78     }
79
80     public String JavaDoc doExecute() throws Exception JavaDoc {
81         String JavaDoc resp;
82         try {
83             resp = getDigitalAssetInfo();
84         } catch (Exception JavaDoc e) {
85             resp = "<exception>" + e.toString() + "</exception>";
86         }
87
88         getResponse().setContentType("text/xml");
89         getResponse().setContentLength(resp.length());
90         PrintWriter JavaDoc out = getResponse().getWriter();
91         out.println(resp);
92
93         return null;
94     }
95
96     public java.lang.Integer JavaDoc getContentVersionId() {
97         return this.contentVersionId;
98     }
99
100     public void setContentVersionId(java.lang.Integer JavaDoc contentVersionId) {
101         this.contentVersionId = contentVersionId;
102     }
103
104     public Integer JavaDoc getDigitalAssetId() {
105         return digitalAssetId;
106     }
107
108     public void setDigitalAssetId(Integer JavaDoc digitalAssetId) {
109         this.digitalAssetId = digitalAssetId;
110     }
111
112     public String JavaDoc getServiceRequest() {
113         return serviceRequest;
114     }
115
116     public void setServiceRequest(String JavaDoc serviceRequest) {
117         this.serviceRequest = serviceRequest;
118     }
119
120     public void setDigitalAssetKey(String JavaDoc digitalAssetKey) {
121         this.digitalAssetKey = digitalAssetKey;
122     }
123
124     public String JavaDoc getDigitalAssetKey() {
125         return digitalAssetKey;
126     }
127
128     /**
129      * @return Returns the contentId.
130      */

131     public Integer JavaDoc getContentId() {
132         return contentId;
133     }
134
135     /**
136      * @param contentId
137      * The contentId to set.
138      */

139     public void setContentId(Integer JavaDoc contentId) {
140         this.contentId = contentId;
141     }
142
143     /**
144      * @return Returns the languageId.
145      */

146     public Integer JavaDoc getLanguageId() {
147         return languageId;
148     }
149
150     /**
151      * @param languageId
152      * The languageId to set.
153      */

154     public void setLanguageId(Integer JavaDoc languageId) {
155         this.languageId = languageId;
156     }
157 }
Popular Tags