001: /* Copyright 2001 The JA-SIG Collaborative. All rights reserved.
002: * See license distributed with this file and
003: * available online at http://www.uportal.org/license.html
004: */
005:
006: package org.jasig.portal.channels.groupsmanager;
007:
008: import java.util.ArrayList;
009: import java.util.Iterator;
010:
011: import javax.naming.Name;
012:
013: import org.jasig.portal.EntityIdentifier;
014: import org.jasig.portal.groups.GroupsException;
015: import org.jasig.portal.groups.IEntityGroup;
016: import org.jasig.portal.groups.IGroupMember;
017: import org.jasig.portal.groups.IIndividualGroupService;
018:
019: /**
020: * SearchResultsGroupImp summary description sentence goes here.
021: *
022: * @version $Revision: 34756 $
023: */
024:
025: public class SearchResultsGroupImpl implements IEntityGroup {
026: protected ArrayList members = new ArrayList();
027: protected String name;
028: protected String description;
029: protected String creator;
030: protected EntityIdentifier ei;
031: protected Class leafType;
032:
033: public SearchResultsGroupImpl(Class leafType) {
034: this .leafType = leafType;
035: ei = new EntityIdentifier(null, IEntityGroup.class);
036: }
037:
038: public void addMember(IGroupMember gm) throws GroupsException {
039: members.add(gm);
040: }
041:
042: public java.util.Iterator getMembers() throws GroupsException {
043: return members.iterator();
044: }
045:
046: public String getCreatorID() {
047: return this .creator;
048: }
049:
050: public String getDescription() {
051: return this .description;
052: }
053:
054: public String getLocalKey() {
055: return ei.getKey();
056: }
057:
058: public String getName() {
059: return this .name;
060: }
061:
062: public Name getServiceName() {
063: return null;
064: }
065:
066: public void removeMember(IGroupMember gm) {
067: /**@todo: Implement this org.jasig.portal.groups.IEntityGroup method*/
068: throw new java.lang.UnsupportedOperationException(
069: "Method removeMember() not yet implemented.");
070: }
071:
072: public void setCreatorID(String userID) {
073: this .creator = userID;
074: }
075:
076: public void setDescription(String name) {
077: this .description = name;
078: }
079:
080: public void setName(String name) throws GroupsException {
081: this .name = name;
082: }
083:
084: public void setLocalGroupService(
085: IIndividualGroupService groupService)
086: throws GroupsException {
087: /**@todo: Implement this org.jasig.portal.groups.IEntityGroup method*/
088: throw new java.lang.UnsupportedOperationException(
089: "Method setLocalGroupService() not yet implemented.");
090: }
091:
092: public boolean contains(IGroupMember gm) throws GroupsException {
093: Iterator members = getMembers();
094: while (members.hasNext()) {
095: IGroupMember m = (IGroupMember) members.next();
096: if (m.isGroup() && m.getKey().equals(gm.getKey())) {
097: return true;
098: }
099: }
100: return false;
101: }
102:
103: public boolean deepContains(IGroupMember gm) throws GroupsException {
104: /**@todo: Implement this org.jasig.portal.groups.IGroupMember method*/
105: throw new java.lang.UnsupportedOperationException(
106: "Method deepContains() not yet implemented.");
107: }
108:
109: public boolean equals(Object o) {
110: /**@todo: Implement this org.jasig.portal.groups.IGroupMember method*/
111: throw new java.lang.UnsupportedOperationException(
112: "Method equals() not yet implemented.");
113: }
114:
115: public Iterator getAllContainingGroups() throws GroupsException {
116: /**@todo: Implement this org.jasig.portal.groups.IGroupMember method*/
117: throw new java.lang.UnsupportedOperationException(
118: "Method getAllContainingGroups() not yet implemented.");
119: }
120:
121: public Iterator getAllEntities() throws GroupsException {
122: /**@todo: Implement this org.jasig.portal.groups.IGroupMember method*/
123: throw new java.lang.UnsupportedOperationException(
124: "Method getAllEntities() not yet implemented.");
125: }
126:
127: public Iterator getAllMembers() throws GroupsException {
128: /**@todo: Implement this org.jasig.portal.groups.IGroupMember method*/
129: throw new java.lang.UnsupportedOperationException(
130: "Method getAllMembers() not yet implemented.");
131: }
132:
133: public Iterator getContainingGroups() throws GroupsException {
134: /**@todo: Implement this org.jasig.portal.groups.IGroupMember method*/
135: throw new java.lang.UnsupportedOperationException(
136: "Method getContainingGroups() not yet implemented.");
137: }
138:
139: public Iterator getEntities() throws GroupsException {
140: /**@todo: Implement this org.jasig.portal.groups.IGroupMember method*/
141: throw new java.lang.UnsupportedOperationException(
142: "Method getEntities() not yet implemented.");
143: }
144:
145: public Class getEntityType() {
146: return leafType;
147: }
148:
149: public String getKey() {
150: return ei.getKey();
151: }
152:
153: public Class getLeafType() {
154: return leafType;
155: }
156:
157: public IEntityGroup getMemberGroupNamed(String name)
158: throws GroupsException {
159: /**@todo: Implement this org.jasig.portal.groups.IGroupMember method*/
160: throw new java.lang.UnsupportedOperationException(
161: "Method getMemberGroupNamed() not yet implemented.");
162: }
163:
164: public Class getType() {
165: return IEntityGroup.class;
166: }
167:
168: public EntityIdentifier getUnderlyingEntityIdentifier() {
169: return ei;
170: }
171:
172: public boolean isDeepMemberOf(IGroupMember gm)
173: throws GroupsException {
174: return false;
175: }
176:
177: public boolean isMemberOf(IGroupMember gm) throws GroupsException {
178: return false;
179: }
180:
181: public EntityIdentifier getEntityIdentifier() {
182: return ei;
183: }
184:
185: public void update() throws GroupsException {
186:
187: }
188:
189: public void updateMembers() throws GroupsException {
190:
191: }
192:
193: public boolean isEditable() throws GroupsException {
194: return true;
195: }
196:
197: public void delete() throws GroupsException {
198: /**@todo: Implement this org.jasig.portal.groups.IEntityGroup method*/
199: throw new java.lang.UnsupportedOperationException(
200: "Method delete() not yet implemented.");
201: }
202:
203: public boolean hasMembers() throws GroupsException {
204: if (members.size() > 0) {
205: return true;
206: }
207: return false;
208: }
209:
210: public boolean isEntity() {
211: return false;
212: }
213:
214: public boolean isGroup() {
215: return true;
216: }
217: }
|