View Javadoc

1   /*
2    * Created on Dec 11, 2004 by Justin Sher
3    *
4    *  ginp - Java Web Application for Viewing Photo Collections
5    *
6    *  This library is free software; you can redistribute it and/or
7    *  modify it under the terms of the GNU Lesser General Public
8    *  License as published by the Free Software Foundation; either
9    *  version 2.1 of the License, or any later version.
10   *
11   *  This library is distributed in the hope that it will be useful,
12   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   *  Lesser General Public License for more details.
15   *
16   *  You should have received a copy of the GNU Lesser General Public
17   *  License along with this library; if not, write to the Free Software
18   *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19   */
20  package net.sf.ginp.setup.data;
21  
22  
23  /**
24   * Object for holding information about per directory ginp configurations before they 
25   * are persisted to setup
26   * @author Justin Sher
27   */
28  public class DirectoryPref {
29  	String name;
30  	String rootDir;
31  	String users;
32  	String admins;
33  	String style;
34  	String type;
35  	
36  
37  	/**
38  	 *	So XSLT can get to this
39  	 */
40  	public final String fileSeparator=System.getProperty("file.separator");
41  	
42  
43  
44  
45  	/**
46  	 * <code>ADMIN_ONLY</code> - this directory is for admins only
47  	 */
48  	public static final String ADMIN_ONLY = "adminOnly";
49  	/**
50  	 * <code>PUBLIC</code> - this directory for all users
51  	 */
52  	public static final String PUBLIC = "public";
53  	
54  	/**
55  	 *<code>PRIVATE</code> - this directory only for authenticated user
56  	 */
57  	public static final String PRIVATE= "private";
58  	/**
59  	 * @return Returns the type.
60  	 */
61  	public String getType() {
62  		return type;
63  	}
64  	/**
65  	 * @param type The type to set.
66  	 */
67  	public void setType(String type) {
68  		this.type = type;
69  	}
70  
71  	/**
72  	 * @return Returns the style.
73  	 */
74  	public String getStyle() {
75  		return style;
76  	}
77  	/**
78  	 * @param style The style to set.
79  	 */
80  	public void setStyle(String style) {
81  		this.style = style;
82  	}
83  	/**
84  	 * @return Returns the admins.
85  	 */
86  	public String getAdmins() {
87  		return admins;
88  	}
89  	/**
90  	 * @param admins The admins to set.
91  	 */
92  	public void setAdmins(String admins) {
93  		this.admins = admins;
94  	}
95  	/**
96  	 * @return Returns the name.
97  	 */
98  	public String getName() {
99  		return name;
100 	}
101 	/**
102 	 * @param name The name to set.
103 	 */
104 	public void setName(String name) {
105 		this.name = name;
106 	}
107 	
108 	/**
109 	 * @return Returns the rootDir.
110 	 */
111 	public String getRootDir() {
112 		return rootDir;
113 	}
114 	/**
115 	 * @param rootDir The rootDir to set.
116 	 */
117 	public void setRootDir(String rootDir) {
118 		this.rootDir = rootDir;
119 	}
120 	/**
121 	 * @return Returns the users.
122 	 */
123 	public String getUsers() {
124 		return users;
125 	}
126 	/**
127 	 * @param users The users to set.
128 	 */
129 	public void setUsers(String users) {
130 		this.users = users;
131 	}
132 	/**
133 	 * 
134 	 */
135 	public void setUserVariables() {
136 		this.setName(getRootDir());
137 		if (this.type==null)  { return; }
138 		if (this.type.equals(DirectoryPref.ADMIN_ONLY)) { 
139 			this.admins="admin";
140 			this.users="admin";
141 		}
142 		if (this.type.equals(DirectoryPref.PRIVATE)) { 
143 			this.admins="admin";
144 			this.users="guest";		
145 		}
146 		if (this.type.equals(DirectoryPref.PUBLIC)) { 
147 			this.admins="admin";
148 			this.users="";		
149 		}
150 		
151 	}
152 }