001: /*
002: * Lucane - a collaborative platform
003: * Copyright (C) 2003 Vincent Fiack <vfiack@mail15.com>
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: */
019:
020: package org.lucane.common.concepts;
021:
022: import java.util.*;
023:
024: public class GroupConcept extends Concept {
025: //links
026: private ArrayList parents;
027: private ArrayList services;
028: private ArrayList plugins;
029: private ArrayList users;
030:
031: public GroupConcept(String name) {
032: super (name, "");
033: this .parents = new ArrayList();
034: this .services = new ArrayList();
035: this .plugins = new ArrayList();
036: this .users = new ArrayList();
037: }
038:
039: //-- parents
040:
041: public void setParents(ArrayList parents) {
042: this .parents = parents;
043: }
044:
045: public void addParent(GroupConcept group) {
046: this .parents.add(group);
047: }
048:
049: public Iterator getParents() {
050: return this .parents.iterator();
051: }
052:
053: public boolean hasParent(GroupConcept group) {
054: return this .parents.contains(group);
055: }
056:
057: //-- services
058:
059: public void setServices(ArrayList services) {
060: this .services = services;
061: }
062:
063: public void addService(ServiceConcept service) {
064: this .services.add(service);
065: }
066:
067: public Iterator getServices() {
068: return this .services.iterator();
069: }
070:
071: public boolean hasService(ServiceConcept service) {
072: return this .services.contains(service);
073: }
074:
075: //-- plugins
076:
077: public void setPlugins(ArrayList plugins) {
078: this .plugins = plugins;
079: }
080:
081: public void addPlugin(PluginConcept plugin) {
082: this .plugins.add(plugin);
083: }
084:
085: public Iterator getPlugins() {
086: return this .plugins.iterator();
087: }
088:
089: public boolean hasPlugin(PluginConcept plugin) {
090: return this .plugins.contains(plugin);
091: }
092:
093: //-- users
094:
095: public void setUsers(ArrayList users) {
096: this .users = users;
097: }
098:
099: public void addUser(UserConcept user) {
100: this .users.add(user);
101: }
102:
103: public Iterator getUsers() {
104: return this .users.iterator();
105: }
106:
107: public void removeUser(UserConcept user) {
108: this .users.remove(user);
109: }
110:
111: public boolean hasUser(UserConcept user) {
112: return this .users.contains(user);
113: }
114:
115: //--
116:
117: public boolean equals(Object o) {
118: if (o instanceof GroupConcept)
119: return this .name.equals(((GroupConcept) o).name);
120:
121: return false;
122: }
123: }
|