001: /*
002: * Copyright 2005-2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.kuali.core.bo.user;
017:
018: import java.util.Collections;
019: import java.util.Iterator;
020: import java.util.LinkedHashMap;
021: import java.util.List;
022:
023: import org.kuali.core.bo.PersistableBusinessObjectBase;
024:
025: /**
026: * Kuali Group Pojo to access Group Information.
027: *
028: *
029: */
030: public class KualiGroup extends PersistableBusinessObjectBase {
031:
032: public static final KualiGroup KUALI_UNIVERSAL_GROUP = new KualiUniversalGroup();
033:
034: /* *****************************************************************
035: * DO NOT PUT WORKGROUP NAME CONSTANTS HERE
036: *
037: * This is a core system module class and should not have references to any other module.
038: * Any workgroup constants should be added to FS_PARM_T and loaded from there via the configuration service.
039: *
040: * *****************************************************************/
041:
042: // -----------------------------------
043: // from fs_work_grp_t
044: // -----------------------------------
045: // FS_WORK_GRP_ID;12;VARCHAR2;10;;;NO;;
046: // FS_WORK_GRP_DESC;12;VARCHAR2;40;;;YES;;
047: // FIN_COA_CD;12;VARCHAR2;2;;;YES;; -- not included to allow for potential future integration with workflow regarding workgroups
048: // ORG_CD;12;VARCHAR2;4;;;YES;; -- not included to allow for potential future integration with workflow regarding workgroups
049: private static final long serialVersionUID = 6228441443664145127L;
050: private String groupName;
051: private String groupDescription;
052: private List groupUsers;
053:
054: /**
055: * No args constructor
056: *
057: */
058: public KualiGroup() {
059: this .groupUsers = Collections.EMPTY_LIST;
060: }
061:
062: /**
063: * Constructor taking a single argument of groupName
064: *
065: * @param groupName
066: */
067: public KualiGroup(String groupName) {
068: this .groupName = groupName;
069: this .groupUsers = Collections.EMPTY_LIST;
070: }
071:
072: /**
073: * Constructor taking arguments for groupName and for groupUsers
074: *
075: * @param groupName
076: * @param groupUsers
077: */
078: public KualiGroup(String groupName, List groupMembers) {
079: this .groupName = groupName;
080: this .groupUsers = groupMembers;
081: }
082:
083: /**
084: * @return Returns the groupUsers.
085: */
086: public List getGroupUsers() {
087: return groupUsers;
088: }
089:
090: /**
091: * @param groupUsers The groupUsers to set.
092: */
093: public void setGroupUsers(List groupMembers) {
094: this .groupUsers = groupMembers;
095: }
096:
097: /**
098: * @return Returns the groupName.
099: */
100: public String getGroupName() {
101: return groupName;
102: }
103:
104: /**
105: * @param groupName The groupName to set.
106: */
107: public void setGroupName(String groupName) {
108: this .groupName = groupName;
109: }
110:
111: /**
112: * @return Returns the groupDescription.
113: */
114: public String getGroupDescription() {
115: return groupDescription;
116: }
117:
118: /**
119: * @param groupDescription The groupDescription to set.
120: */
121: public void setGroupDescription(String groupDescription) {
122: this .groupDescription = groupDescription;
123: }
124:
125: /**
126: * boolean check to determine if a user is a member of a group
127: *
128: * @param kualiUser
129: * @return true if the group has the member passed in
130: */
131: public boolean hasMember(UniversalUser universalUser) {
132: if (universalUser != null
133: && universalUser.getPersonUniversalIdentifier() != null) {
134: for (Iterator iter = groupUsers.iterator(); iter.hasNext();) {
135: String groupMemberNetworkId = (String) iter.next();
136: if (universalUser.getPersonUserIdentifier()
137: .toLowerCase().equals(
138: groupMemberNetworkId.toLowerCase())) {
139: return true;
140: }
141: }
142: }
143: return false;
144: }
145:
146: /**
147: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
148: */
149: protected LinkedHashMap toStringMapper() {
150: LinkedHashMap m = new LinkedHashMap();
151:
152: m.put("groupName", getGroupName());
153:
154: return m;
155: }
156: }
|