001    /**
002     * Copyright 2004-2014 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.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/ecl2.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.kpme.core.location;
017    
018    import java.util.ArrayList;
019    import java.util.List;
020    
021    import javax.persistence.Transient;
022    
023    import org.kuali.kpme.core.api.location.LocationContract;
024    import org.kuali.kpme.core.bo.HrBusinessObject;
025    import org.kuali.kpme.core.role.location.LocationPrincipalRoleMemberBo;
026    import org.kuali.kpme.core.util.HrConstants;
027    
028    import com.google.common.collect.ImmutableList;
029    
030    public class Location extends HrBusinessObject implements LocationContract {
031    
032            private static final long serialVersionUID = 9015089510044249197L;
033            //KPME-2273/1965 Primary Business Keys List.    
034            public static final ImmutableList<String> EQUAL_TO_FIELDS = new ImmutableList.Builder<String>()
035                        .add("location")
036                        .build();
037            public static final String CACHE_NAME = HrConstants.CacheNamespace.NAMESPACE_PREFIX + "Location";
038    
039            private String hrLocationId;
040            private String location;
041            private String timezone;
042            private String description;
043            private String userPrincipalId;
044            private String history;
045            
046        @Transient
047        private List<LocationPrincipalRoleMemberBo> roleMembers = new ArrayList<LocationPrincipalRoleMemberBo>();
048        
049        @Transient
050        private List<LocationPrincipalRoleMemberBo> inactiveRoleMembers = new ArrayList<LocationPrincipalRoleMemberBo>();
051    
052            @Override
053            public String getUniqueKey() {
054                    return location;
055            }
056            
057            @Override
058            public String getId() {
059                    return getHrLocationId();
060            }
061    
062            @Override
063            public void setId(String id) {
064                    setHrLocationId(id);
065            }
066    
067            public String getHrLocationId() {
068                    return hrLocationId;
069            }
070    
071            public void setHrLocationId(String hrLocationId) {
072                    this.hrLocationId = hrLocationId;
073            }
074    
075            public String getLocation() {
076                    return location;
077            }
078    
079            public void setLocation(String location) {
080                    this.location = location;
081            }
082    
083            public String getTimezone() {
084                    return timezone;
085            }
086    
087            public void setTimezone(String timezone) {
088                    this.timezone = timezone;
089            }
090    
091            public String getDescription() {
092                    return description;
093            }
094    
095            public void setDescription(String description) {
096                    this.description = description;
097            }
098    
099            public String getUserPrincipalId() {
100                    return userPrincipalId;
101            }
102    
103            public void setUserPrincipalId(String userPrincipalId) {
104                    this.userPrincipalId = userPrincipalId;
105            }
106    
107            public String getHistory() {
108                    return history;
109            }
110    
111            public void setHistory(String history) {
112                    this.history = history;
113            }
114            
115            public List<LocationPrincipalRoleMemberBo> getRoleMembers() {
116                    return roleMembers;
117            }
118            
119            public void addRoleMember(LocationPrincipalRoleMemberBo roleMemberBo) {
120                    roleMembers.add(roleMemberBo);
121            }
122            
123            public void removeRoleMember(LocationPrincipalRoleMemberBo roleMemberBo) {
124                    roleMembers.remove(roleMemberBo);
125            }
126    
127            public void setRoleMembers(List<LocationPrincipalRoleMemberBo> roleMembers) {
128                    this.roleMembers = roleMembers;
129            }
130    
131            public List<LocationPrincipalRoleMemberBo> getInactiveRoleMembers() {
132                    return inactiveRoleMembers;
133            }
134            
135            public void addInactiveRoleMember(LocationPrincipalRoleMemberBo inactiveRoleMemberBo) {
136                    inactiveRoleMembers.add(inactiveRoleMemberBo);
137            }
138            
139            public void removeInactiveRoleMember(LocationPrincipalRoleMemberBo inactiveRoleMemberBo) {
140                    inactiveRoleMembers.remove(inactiveRoleMemberBo);
141            }
142    
143            public void setInactiveRoleMembers(List<LocationPrincipalRoleMemberBo> inactiveRoleMembers) {
144                    this.inactiveRoleMembers = inactiveRoleMembers;
145            }
146    
147    }