KickJava   Java API By Example, From Geeks To Geeks.

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


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 org.apache.log4j.Logger;
27 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
28 import org.infoglue.cms.controllers.kernel.impl.simple.ServiceBindingController;
29 import org.infoglue.cms.controllers.kernel.impl.simple.SiteNodeVersionController;
30 import org.infoglue.cms.entities.management.ServiceDefinitionVO;
31 import org.infoglue.cms.entities.structure.ServiceBindingVO;
32 import org.infoglue.cms.util.ConstraintExceptionBuffer;
33
34
35 /**
36  * This action represents the CreateSiteNode Usecase.
37  */

38
39 public class CreateServiceBindingAction extends InfoGlueAbstractAction
40 {
41     private final static Logger logger = Logger.getLogger(CreateServiceBindingAction.class.getName());
42
43     private Integer JavaDoc siteNodeVersionId;
44     private Integer JavaDoc repositoryId;
45     private Integer JavaDoc availableServiceBindingId;
46     //private Integer serviceBindingId;
47
private Integer JavaDoc serviceDefinitionId;
48     private Integer JavaDoc bindingTypeId;
49     private ConstraintExceptionBuffer ceb;
50     private Integer JavaDoc siteNodeId;
51     private ServiceDefinitionVO singleServiceDefinitionVO;
52     private String JavaDoc qualifyerXML;
53     
54     private ServiceBindingVO serviceBindingVO = null;
55    
56   
57     public CreateServiceBindingAction()
58     {
59         this(new ServiceBindingVO());
60     }
61     
62     public CreateServiceBindingAction(ServiceBindingVO serviceBindingVO)
63     {
64         this.serviceBindingVO = serviceBindingVO;
65         this.ceb = new ConstraintExceptionBuffer();
66     }
67
68     public void setSiteNodeVersionId(Integer JavaDoc siteNodeVersionId)
69     {
70         this.siteNodeVersionId = siteNodeVersionId;
71     }
72
73     public void setRepositoryId(Integer JavaDoc repositoryId)
74     {
75         this.repositoryId = repositoryId;
76     }
77
78     public void setAvailableServiceBindingId(Integer JavaDoc availableServiceBindingId)
79     {
80         this.availableServiceBindingId = availableServiceBindingId;
81     }
82
83     public void setServiceDefinitionId(Integer JavaDoc serviceDefinitionId)
84     {
85         this.serviceDefinitionId = serviceDefinitionId;
86     }
87
88     public void setServiceBindingId(Integer JavaDoc serviceBindingId)
89     {
90         this.serviceBindingVO.setServiceBindingId(serviceBindingId);
91     }
92
93     public void setBindingTypeId(Integer JavaDoc bindingTypeId)
94     {
95         this.serviceBindingVO.setBindingTypeId(bindingTypeId);
96     }
97
98     public void setPath(String JavaDoc path)
99     {
100         this.serviceBindingVO.setPath(path);
101     }
102     
103     public Integer JavaDoc getSiteNodeVersionId()
104     {
105         return this.siteNodeVersionId;
106     }
107
108     public Integer JavaDoc getSiteNodeId()
109     {
110         return this.siteNodeId;
111     }
112         
113     public Integer JavaDoc getRepositoryId()
114     {
115         return this.repositoryId;
116     }
117
118     public Integer JavaDoc getAvailableServiceBindingId()
119     {
120         return this.availableServiceBindingId;
121     }
122     
123     public Integer JavaDoc getServiceDefinitionId()
124     {
125         return this.singleServiceDefinitionVO.getServiceDefinitionId();
126     }
127     
128     public Integer JavaDoc getBindingTypeId()
129     {
130         return this.bindingTypeId;
131     }
132  
133     public ServiceDefinitionVO getSingleServiceDefinitionVO()
134     {
135         return this.singleServiceDefinitionVO;
136     }
137
138     public void setQualifyerXML(String JavaDoc qualifyerXML)
139     {
140         this.qualifyerXML = qualifyerXML;
141     }
142     
143     public String JavaDoc getQualifyerXML()
144     {
145         return this.qualifyerXML;
146     }
147      
148     /**
149      * This method creates the new serviceBinding.
150      */

151      
152     public String JavaDoc doExecute() throws Exception JavaDoc
153     {
154         logger.info("-------------------------->" + this.serviceBindingVO.getServiceBindingId());
155         if(this.serviceBindingVO.getServiceBindingId() == null)
156         {
157             ServiceBindingController.create(this.serviceBindingVO, qualifyerXML, this.availableServiceBindingId, this.siteNodeVersionId, this.serviceDefinitionId);
158         }
159         else
160         {
161             ServiceBindingController.update(this.serviceBindingVO, qualifyerXML);
162         }
163      
164         this.siteNodeId = SiteNodeVersionController.getController().getSiteNodeVersionVOWithId(this.siteNodeVersionId).getSiteNodeId();
165         return "success";
166     }
167         
168 }
169
Popular Tags