View Javadoc

1   /*
2    * Copyright 2004-2006 the Seasar Foundation and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.seasar.tuigwaa.controller;
17  
18  import org.apache.struts.validator.ValidatorForm;
19  import org.seasar.tuigwaa.security.SecurityUtils;
20  import org.seasar.tuigwaa.system.SiteConfig;
21  
22  
23  public class SiteForm extends ValidatorForm {
24  
25  	//output dto
26  	
27  	private String[] skins;
28  	
29  	
30  	
31  	
32  	//
33  	private static final long serialVersionUID = 1294572379152037052L;
34  
35  	private boolean editMode;
36  
37  	private String name;
38  
39  	private String title;
40  
41  	private String[] roles;
42  
43  	private String description;
44  
45  	private boolean unauthenticated;
46  
47  	private boolean restriction;
48  		
49  	private boolean baseDatabase = true;
50  
51  	private String dbName;
52  	
53  	private String dbSchema;
54  
55  	private boolean easyMode = true;
56  
57  	private int pageEditMode = 0;
58  	
59  	private String skin;
60  	
61  	public SiteForm() {
62  	}
63  
64  	public SiteForm(SiteConfig siteConfig) {
65  		this.name = siteConfig.getName();
66  		this.title = siteConfig.getTitle();
67  		this.description = siteConfig.getDescription();
68  		String[] roleNames = siteConfig.getRoleNames();
69  		this.unauthenticated = SecurityUtils.hasUnauthenticated(roleNames);
70  		this.roles = SecurityUtils.removeUnauthenticated(roleNames);
71  		this.restriction = roleNames != null && roleNames.length > 0;
72  		this.editMode = true;
73  		this.easyMode = siteConfig.isEasyMode();
74  		this.pageEditMode = siteConfig.getPageEditMode();
75  		this.skin = siteConfig.getSkin();
76  	}
77  
78  	public static long getSerialVersionUID() {
79  		return serialVersionUID;
80  	}
81  
82  	public String getDescription() {
83  		return description;
84  	}
85  
86  	public void setDescription(String description) {
87  		this.description = description;
88  	}
89  
90  	public boolean isEditMode() {
91  		return editMode;
92  	}
93  
94  	public void setEditMode(boolean editMode) {
95  		this.editMode = editMode;
96  	}
97  
98  	public String getName() {
99  		return name;
100 	}
101 
102 	public void setName(String name) {
103 		this.name = name;
104 	}
105 
106 	public boolean isRestriction() {
107 		return restriction;
108 	}
109 
110 	public void setRestriction(boolean restriction) {
111 		this.restriction = restriction;
112 	}
113 
114 	public String[] getRoles() {
115 		return roles;
116 	}
117 
118 	public void setRoles(String[] roles) {
119 		this.roles = roles;
120 	}
121 
122 	public String getTitle() {
123 		return title;
124 	}
125 
126 	public void setTitle(String title) {
127 		this.title = title;
128 	}
129 
130 	public boolean isUnauthenticated() {
131 		return unauthenticated;
132 	}
133 
134 	public void setUnauthenticated(boolean unauthenticated) {
135 		this.unauthenticated = unauthenticated;
136 	}
137 	
138 	public boolean isBaseDatabase() {
139 		return baseDatabase;
140 	}
141 	
142 	public void setBaseDatabase(boolean baseDatabase) {
143 		this.baseDatabase = baseDatabase;
144 	}
145 	
146 	public String getDbName() {
147 		return dbName;
148 	}
149 	
150 	public String getDbSchema() {
151 		return dbSchema;
152 	}
153 	
154 	public void setDbName(String dbName) {
155 		this.dbName = dbName;
156 	}
157 	
158 	public void setDbSchema(String dbSchema) {
159 		this.dbSchema = dbSchema;
160 	}
161 	
162 	public boolean isEasyMode() {
163 		return easyMode;
164 	}
165 	
166 	public void setEasyMode(boolean easyMode) {
167 		this.easyMode = easyMode;
168 	}
169 	
170 	public int getPageEditMode() {
171 		return pageEditMode;
172 	}
173 	
174 	public void setPageEditMode(int pageEditMode) {
175 		this.pageEditMode = pageEditMode;
176 	}
177 	
178 	public void setSkin(String skin) {
179 		this.skin = skin;
180 	}
181 	
182 	public String getSkin() {
183 		return skin;
184 	}
185 	
186 	//[Start] ----- Output Dto -------
187 	
188 	public void setSkins(String[] skins) {
189 		this.skins = skins;
190 	}
191 	
192 	public String[] getSkins() {
193 		return skins;
194 	}
195 }