KickJava   Java API By Example, From Geeks To Geeks.

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


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 package org.infoglue.cms.applications.contenttool.actions;
25
26 import java.util.List JavaDoc;
27
28 import org.apache.log4j.Logger;
29 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
30 import org.infoglue.cms.controllers.kernel.impl.simple.RepositoryController;
31 import org.infoglue.cms.controllers.kernel.impl.simple.SiteNodeController;
32 import org.infoglue.cms.entities.structure.SiteNodeVO;
33
34 /**
35  * This action shows the Content-tree when binding stuff.
36  */

37
38 public class ViewLinkDialogAction extends InfoGlueAbstractAction
39 {
40     private final static Logger logger = Logger.getLogger(ViewLinkDialogAction.class.getName());
41
42     /**
43      *
44      */

45     private static final long serialVersionUID = -5831748113035322067L;
46     private Integer JavaDoc repositoryId;
47     private Integer JavaDoc contentId;
48     private Integer JavaDoc languageId;
49     private String JavaDoc textAreaId;
50     private String JavaDoc method;
51     private Integer JavaDoc oldContentId;
52     private String JavaDoc assetKey;
53     private Integer JavaDoc oldSiteNodeId;
54     
55     private String JavaDoc tree;
56     private List JavaDoc repositories;
57     
58     
59     public String JavaDoc doExecute() throws Exception JavaDoc
60     {
61         this.repositories = RepositoryController.getController().getAuthorizedRepositoryVOList(this.getInfoGluePrincipal(), true);
62
63         if(this.repositoryId == null)
64         {
65             this.repositoryId = (Integer JavaDoc)getHttpSession().getAttribute("repositoryId");
66             if(this.repositoryId == null)
67                 this.repositoryId = RepositoryController.getController().getFirstRepositoryVO().getRepositoryId();
68         }
69         
70         return "success";
71     }
72       
73     public String JavaDoc doViewLinkDialogForFCKEditor() throws Exception JavaDoc
74     {
75         this.repositories = RepositoryController.getController().getAuthorizedRepositoryVOList(this.getInfoGluePrincipal(), true);
76
77         if(this.repositoryId == null)
78         {
79             this.repositoryId = (Integer JavaDoc)getHttpSession().getAttribute("repositoryId");
80             if(this.repositoryId == null)
81                 this.repositoryId = RepositoryController.getController().getFirstRepositoryVO().getRepositoryId();
82         }
83         
84         return "viewLinkDialogForFCKEditor";
85     }
86     
87     public List JavaDoc getRepositories()
88     {
89         return repositories;
90     }
91         
92     public String JavaDoc getExpansion(Integer JavaDoc oldSiteNodeId)
93     {
94         String JavaDoc expansion = "/";
95         
96         if(oldSiteNodeId == null)
97             return "";
98         
99         try
100         {
101             SiteNodeVO parentSiteNodeVO = SiteNodeController.getController().getParentSiteNode(oldSiteNodeId);
102             while(parentSiteNodeVO != null)
103             {
104                 expansion += parentSiteNodeVO.getId() + "/";
105                 parentSiteNodeVO = SiteNodeController.getController().getParentSiteNode(parentSiteNodeVO.getId());
106             }
107         }
108         catch(Exception JavaDoc e)
109         {
110             logger.warn("Expansion not possible:" + e.getMessage(), e);
111         }
112         
113         return expansion;
114     }
115     
116     public void setRepositoryId(Integer JavaDoc repositoryId)
117     {
118         this.repositoryId = repositoryId;
119     }
120
121     public Integer JavaDoc getRepositoryId()
122     {
123         return this.repositoryId;
124     }
125    
126     public String JavaDoc getTree()
127     {
128         return tree;
129     }
130
131     public void setTree(String JavaDoc string)
132     {
133         tree = string;
134     }
135
136     public String JavaDoc getTextAreaId()
137     {
138         return textAreaId;
139     }
140
141     public void setTextAreaId(String JavaDoc string)
142     {
143         textAreaId = string;
144     }
145
146     public Integer JavaDoc getOldSiteNodeId()
147     {
148         return oldSiteNodeId;
149     }
150     
151     public void setOldSiteNodeId(Integer JavaDoc oldSiteNodeId)
152     {
153         this.oldSiteNodeId = oldSiteNodeId;
154     }
155
156     public Integer JavaDoc getOldContentId()
157     {
158         return oldContentId;
159     }
160     
161     public void setOldContentId(Integer JavaDoc oldContentId)
162     {
163         this.oldContentId = oldContentId;
164     }
165
166     public String JavaDoc getAssetKey()
167     {
168         return assetKey;
169     }
170     
171     public void setAssetKey(String JavaDoc assetKey)
172     {
173         this.assetKey = assetKey;
174     }
175     
176     public Integer JavaDoc getContentId()
177     {
178         return contentId;
179     }
180     
181     public void setContentId(Integer JavaDoc contentId)
182     {
183         this.contentId = contentId;
184     }
185     
186     public Integer JavaDoc getLanguageId()
187     {
188         return languageId;
189     }
190     
191     public void setLanguageId(Integer JavaDoc languageId)
192     {
193         this.languageId = languageId;
194     }
195     
196     public String JavaDoc getMethod()
197     {
198         return method;
199     }
200     
201     public void setMethod(String JavaDoc method)
202     {
203         this.method = method;
204     }
205     
206 }
207
Popular Tags