KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > applications > structuretool > actions > ViewContentTreeForServiceBindingAction


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.structuretool.actions;
25
26 import java.util.List JavaDoc;
27
28 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
29 import org.infoglue.cms.controllers.kernel.impl.simple.AvailableServiceBindingController;
30 import org.infoglue.cms.controllers.kernel.impl.simple.RepositoryController;
31 import org.infoglue.cms.entities.management.ServiceDefinitionVO;
32 import org.infoglue.cms.entities.structure.ServiceBindingVO;
33 import org.infoglue.cms.util.ConstraintExceptionBuffer;
34
35 /**
36  * This action shows the Content-tree when binding stuff.
37  */

38
39 public class ViewContentTreeForServiceBindingAction extends InfoGlueAbstractAction
40 {
41     private static final long serialVersionUID = 1L;
42
43     private Integer JavaDoc siteNodeVersionId;
44     private Integer JavaDoc repositoryId;
45     private Integer JavaDoc availableServiceBindingId;
46     private Integer JavaDoc serviceDefinitionId;
47     private Integer JavaDoc bindingTypeId;
48     private ConstraintExceptionBuffer ceb;
49     private Integer JavaDoc siteNodeId;
50     private ServiceDefinitionVO singleServiceDefinitionVO;
51     private String JavaDoc qualifyerXML;
52     private String JavaDoc tree;
53     private List JavaDoc repositories;
54     
55     private ServiceBindingVO serviceBindingVO = null;
56    
57   
58     public ViewContentTreeForServiceBindingAction()
59     {
60         this(new ServiceBindingVO());
61     }
62     
63     public ViewContentTreeForServiceBindingAction(ServiceBindingVO serviceBindingVO)
64     {
65         this.serviceBindingVO = serviceBindingVO;
66         this.ceb = new ConstraintExceptionBuffer();
67     }
68
69     public void setSiteNodeVersionId(Integer JavaDoc siteNodeVersionId)
70     {
71         this.siteNodeVersionId = siteNodeVersionId;
72     }
73
74     public void setRepositoryId(Integer JavaDoc repositoryId)
75     {
76         this.repositoryId = repositoryId;
77     }
78
79     public void setAvailableServiceBindingId(Integer JavaDoc availableServiceBindingId)
80     {
81         this.availableServiceBindingId = availableServiceBindingId;
82     }
83
84     public void setServiceDefinitionId(Integer JavaDoc serviceDefinitionId)
85     {
86         this.serviceDefinitionId = serviceDefinitionId;
87     }
88
89     public void setBindingTypeId(Integer JavaDoc bindingTypeId)
90     {
91         this.serviceBindingVO.setBindingTypeId(bindingTypeId);
92     }
93
94     public void setPath(String JavaDoc path)
95     {
96         this.serviceBindingVO.setPath(path);
97     }
98     
99     public Integer JavaDoc getSiteNodeVersionId()
100     {
101         return this.siteNodeVersionId;
102     }
103
104     public Integer JavaDoc getSiteNodeId()
105     {
106         return this.siteNodeId;
107     }
108         
109     public Integer JavaDoc getRepositoryId()
110     {
111         return this.repositoryId;
112     }
113
114     public Integer JavaDoc getAvailableServiceBindingId()
115     {
116         return this.availableServiceBindingId;
117     }
118     
119     public Integer JavaDoc getServiceDefinitionId()
120     {
121         return this.singleServiceDefinitionVO.getServiceDefinitionId();
122     }
123     
124     public Integer JavaDoc getBindingTypeId()
125     {
126         return this.bindingTypeId;
127     }
128
129     public ServiceDefinitionVO getSingleServiceDefinitionVO()
130     {
131         return this.singleServiceDefinitionVO;
132     }
133
134     public void setQualifyerXML(String JavaDoc qualifyerXML)
135     {
136         this.qualifyerXML = qualifyerXML;
137     }
138     
139     public String JavaDoc getQualifyerXML()
140     {
141         return this.qualifyerXML;
142     }
143      
144     public String JavaDoc getTree()
145     {
146         return tree;
147     }
148
149     public void setTree(String JavaDoc string)
150     {
151         tree = string;
152     }
153     
154     public String JavaDoc getCurrentAction()
155     {
156         return "ViewContentTreeForServiceBinding.action";
157     }
158     
159     public String JavaDoc doExecute() throws Exception JavaDoc
160     {
161         this.repositories = RepositoryController.getController().getAuthorizedRepositoryVOList(this.getInfoGluePrincipal(), true);
162         
163         if(this.repositoryId == null)
164             this.repositoryId = RepositoryController.getController().getFirstRepositoryVO().getRepositoryId();
165         
166         List JavaDoc serviceDefinitions = AvailableServiceBindingController.getController().getServiceDefinitionVOList(this.availableServiceBindingId);
167         if(serviceDefinitions == null || serviceDefinitions.size() == 0)
168         {
169             //throw new SystemException();
170
return "error";
171
172         }
173         else if(serviceDefinitions.size() == 1)
174         {
175             this.singleServiceDefinitionVO = (ServiceDefinitionVO)serviceDefinitions.get(0);
176             return "success";
177         }
178         else
179         {
180             return "chooseService";
181         }
182     }
183        
184     public List JavaDoc getRepositories()
185     {
186         return repositories;
187     }
188
189 }
190
Popular Tags