KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > users > filesystem > FileSystemGroup


1 /*
2 Copyright (c) 2003 eInnovation Inc. All rights reserved
3
4 This library is free software; you can redistribute it and/or modify it under the terms
5 of the GNU Lesser General Public License as published by the Free Software Foundation;
6 either version 2.1 of the License, or (at your option) any later version.
7
8 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the GNU Lesser General Public License for more details.
11 */

12
13 package com.openedit.users.filesystem;
14
15 import java.io.Serializable JavaDoc;
16 import java.util.Collection JavaDoc;
17 import java.util.HashSet JavaDoc;
18 import java.util.Set JavaDoc;
19
20 import org.apache.commons.logging.Log;
21 import org.apache.commons.logging.LogFactory;
22
23 import com.openedit.users.Group;
24 import com.openedit.users.UserManagerException;
25
26 /**
27  * DOCUMENT ME!
28  *
29  * @author avery To change this generated comment edit the template variable "typecomment":
30  * Window>Preferences>Java>Templates.
31  */

32 public class FileSystemGroup extends FileSystemObject implements Group, Serializable JavaDoc
33 {
34     protected long fieldLastModified;
35     
36     private transient static Log log = null;
37     private Log getLog()
38     {
39         if( log == null)
40         {
41             log = LogFactory.getLog(FileSystemGroup.class);
42         }
43         return log;
44     }
45
46     protected Set JavaDoc fieldPermissions;
47     protected String JavaDoc fieldName;
48
49     /**
50      * Constructor for FileSystemGroup.
51      *
52      * @param inLocator DOCUMENT ME!
53      * @param inGroupFile DOCUMENT ME!
54      *
55      * @throws UserManagerException DOCUMENT ME!
56      */

57     public FileSystemGroup()
58     {
59     }
60
61     /**
62      * @see com.openedit.users.Group#getName()
63      */

64     public String JavaDoc getName()
65     {
66         return fieldName;
67     }
68
69     /**
70      * @see com.openedit.users.Group#getPermissions()
71      */

72     public Collection JavaDoc getPermissions()
73     {
74         if (fieldPermissions == null)
75         {
76             fieldPermissions = new HashSet JavaDoc();
77         }
78         return fieldPermissions;
79     }
80     /* (non-Javadoc)
81      * @see com.openedit.users.Group#addPermission(String)
82      */

83     public void addPermission(String JavaDoc inPermission) throws UserManagerException
84     {
85         getPermissions().add(inPermission);
86     }
87
88
89     /* (non-Javadoc)
90      * @see com.openedit.users.Group#hasPermission(String)
91      */

92     public boolean hasPermission(String JavaDoc inPermission)
93     {
94         return getPermissions().contains(inPermission);
95     }
96
97     /* (non-Javadoc)
98      * @see com.openedit.users.Group#removePermission(String)
99      */

100     public void removePermission(String JavaDoc inPermission)
101         throws UserManagerException
102     {
103         getPermissions().remove(inPermission);
104     }
105
106     /**
107      * Returns the string representation of this object, that can be used when sorting groups
108      * alphabetically.
109      *
110      * @return string representing this group
111      */

112     public String JavaDoc toString()
113     {
114         return getName();
115     }
116
117     public void setName(String JavaDoc inGroupName)
118     {
119         fieldName = inGroupName;
120     }
121
122     public long getLastModified()
123     {
124         return fieldLastModified;
125     }
126
127     public void setLastModified(long inLastModified)
128     {
129         fieldLastModified = inLastModified;
130     }
131
132 }
133
Popular Tags