KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > applications > managementtool > actions > CreateServiceDefinitionAction


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.managementtool.actions;
25
26 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
27 import org.infoglue.cms.controllers.kernel.impl.simple.ServiceDefinitionController;
28 import org.infoglue.cms.entities.management.ServiceDefinitionVO;
29 import org.infoglue.cms.exception.ConstraintException;
30 import org.infoglue.cms.util.ConstraintExceptionBuffer;
31
32 public class CreateServiceDefinitionAction extends InfoGlueAbstractAction
33 {
34     private static final long serialVersionUID = 1L;
35     
36     private ServiceDefinitionVO serviceDefinitionVO;
37     private ConstraintExceptionBuffer ceb;
38     private String JavaDoc name;
39     private String JavaDoc description;
40     private String JavaDoc className;
41
42     
43     public CreateServiceDefinitionAction()
44     {
45         this(new ServiceDefinitionVO());
46     }
47     
48     public CreateServiceDefinitionAction(ServiceDefinitionVO serviceDefinitionVO)
49     {
50         this.serviceDefinitionVO = serviceDefinitionVO;
51         this.ceb = new ConstraintExceptionBuffer();
52             
53     }
54             
55     public java.lang.String JavaDoc getName()
56     {
57         if(this.name != null)
58             return this.name;
59             
60         return this.serviceDefinitionVO.getName();
61     }
62         
63     public void setName(java.lang.String JavaDoc name)
64     {
65         try
66         {
67             this.serviceDefinitionVO.setName(name);
68         }
69         catch(ConstraintException ce)
70         {
71             this.name = name;
72             this.ceb.add(new ConstraintExceptionBuffer(ce));
73         }
74     }
75
76     public java.lang.String JavaDoc getDescription()
77     {
78         if(this.description != null)
79             return this.description;
80             
81         return this.serviceDefinitionVO.getDescription();
82     }
83         
84     public void setDescription(java.lang.String JavaDoc description)
85     {
86         try
87         {
88             this.serviceDefinitionVO.setDescription(description);
89         }
90         catch(ConstraintException ce)
91         {
92             this.description = description;
93             this.ceb.add(new ConstraintExceptionBuffer(ce));
94         }
95     }
96     
97     public java.lang.String JavaDoc getClassName()
98     {
99         if(this.className != null)
100             return this.className;
101             
102         return this.serviceDefinitionVO.getClassName();
103     }
104         
105     public void setClassName(java.lang.String JavaDoc className)
106     {
107         try
108         {
109             this.serviceDefinitionVO.setClassName(className);
110         }
111         catch(ConstraintException ce)
112         {
113             this.className = className;
114             this.ceb.add(new ConstraintExceptionBuffer(ce));
115         }
116     }
117       
118     public String JavaDoc doExecute() throws Exception JavaDoc
119     {
120         ceb.add( this.serviceDefinitionVO.validate());
121         ceb.throwIfNotEmpty();
122         
123         ServiceDefinitionVO serviceDefinitionVO = ServiceDefinitionController.getController().create(this.serviceDefinitionVO);
124         
125         return "success";
126     }
127         
128     public String JavaDoc doInput() throws Exception JavaDoc
129     {
130         return "input";
131     }
132         
133 }
134
Popular Tags