KickJava   Java API By Example, From Geeks To Geeks.

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


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.controllers.kernel.impl.simple.LanguageController;
27 import org.infoglue.cms.entities.management.LanguageVO;
28 import org.infoglue.cms.exception.ConstraintException;
29 import org.infoglue.cms.util.ConstraintExceptionBuffer;
30
31
32 /**
33   * This is the action-class for UpdateLanguage
34   *
35   * @author Mattias Bogeblad
36   */

37 public class UpdateLanguageAction extends ViewLanguageAction //WebworkAbstractAction
38
{
39     
40     private LanguageVO languageVO;
41     private Integer JavaDoc languageId;
42     private String JavaDoc name;
43     private String JavaDoc languageCode;
44     private ConstraintExceptionBuffer ceb;
45     
46     public UpdateLanguageAction()
47     {
48         this(new LanguageVO());
49     }
50     
51     public UpdateLanguageAction(LanguageVO languageVO)
52     {
53         this.languageVO = languageVO;
54         this.ceb = new ConstraintExceptionBuffer();
55     }
56     
57     public String JavaDoc doExecute() throws Exception JavaDoc
58     {
59         super.initialize(getLanguageId());
60
61         ceb.add(this.languageVO.validate());
62         ceb.throwIfNotEmpty();
63         
64         LanguageController.getController().update(this.languageVO);
65         
66         return "success";
67     }
68
69     public String JavaDoc doSaveAndExit() throws Exception JavaDoc
70     {
71         doExecute();
72                         
73         return "saveAndExit";
74     }
75
76     public void setLanguageId(Integer JavaDoc languageId)
77     {
78         this.languageVO.setLanguageId(languageId);
79     }
80
81     public java.lang.Integer JavaDoc getLanguageId()
82     {
83         return this.languageVO.getLanguageId();
84     }
85         
86     public java.lang.String JavaDoc getName()
87     {
88         if(this.name != null)
89             return this.name;
90     
91         return this.languageVO.getName();
92     }
93         
94     public void setName(java.lang.String JavaDoc name)
95     {
96         try
97         {
98             this.languageVO.setName(name);
99         }
100         catch(ConstraintException ce)
101         {
102             this.name = name;
103             this.ceb.add(new ConstraintExceptionBuffer(ce));
104         }
105     }
106
107     public String JavaDoc getLanguageCode()
108     {
109         if(this.languageCode != null)
110             return this.languageCode;
111             
112         return this.languageVO.getLanguageCode();
113     }
114         
115     public void setLanguageCode(String JavaDoc languageCode)
116     {
117         try
118         {
119             this.languageVO.setLanguageCode(languageCode);
120         }
121         catch(ConstraintException ce)
122         {
123             this.languageCode = languageCode;
124             this.ceb.add(new ConstraintExceptionBuffer(ce));
125         }
126     }
127     
128     public java.lang.String JavaDoc getCharset()
129     {
130         return this.languageVO.getCharset();
131     }
132         
133     public void setCharset(java.lang.String JavaDoc charset)
134     {
135         this.languageVO.setCharset(charset);
136     }
137
138 }
139
Popular Tags