001    /**
002     * Copyright 2005-2013 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.rice.kim.impl.group;
017    
018    import org.kuali.rice.kim.api.group.Group;
019    import org.kuali.rice.kim.api.identity.Person;
020    import org.kuali.rice.kim.api.services.KimApiServiceLocator;
021    import org.kuali.rice.kim.framework.group.GroupEbo;
022    import org.kuali.rice.kim.impl.type.KimTypeBo;
023    import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
024    import org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter;
025    
026    import javax.persistence.Column;
027    import javax.persistence.MappedSuperclass;
028    import javax.persistence.Transient;
029    import java.util.List;
030    import java.util.Map;
031    
032    @MappedSuperclass
033    public abstract class GroupBase extends PersistableBusinessObjectBase implements GroupEbo {
034        private static final long serialVersionUID = 1L;
035    
036        @Column(name="GRP_NM")
037        private String name;
038    
039        @Column(name="GRP_DESC",length=4000)
040        private String description;
041    
042        @Column(name="ACTV_IND")
043        @javax.persistence.Convert(converter=BooleanYNConverter.class)
044        private boolean active;
045    
046        @Column(name="KIM_TYP_ID")
047        private String kimTypeId;
048    
049        @Column(name="NMSPC_CD")
050        private String namespaceCode;
051    
052        @Transient
053        private List<Person> memberPersons;
054    
055        @Transient
056        private List<Group> memberGroups;
057    
058        @Transient
059        protected Map<String,String> attributes;
060    
061    
062        @Override
063        public Map<String,String> getAttributes() {
064            return attributes;
065        }
066    
067        public void setAttributes(Map<String, String> attributes) {
068            this.attributes = attributes;
069        }
070    
071        @Override
072        public String getName() {
073            return name;
074        }
075    
076        public void setName(String name) {
077            this.name = name;
078        }
079    
080        @Override
081        public String getDescription() {
082            return description;
083        }
084    
085        public void setDescription(String description) {
086            this.description = description;
087        }
088    
089        @Override
090        public boolean isActive() {
091            return active;
092        }
093    
094        public void setActive(boolean active) {
095            this.active = active;
096        }
097    
098        @Override
099        public String getKimTypeId() {
100            return kimTypeId;
101        }
102    
103        public void setKimTypeId(String kimTypeId) {
104            this.kimTypeId = kimTypeId;
105        }
106    
107        @Override
108        public String getNamespaceCode() {
109            return namespaceCode;
110        }
111    
112        public void setNamespaceCode(String namespaceCode) {
113            this.namespaceCode = namespaceCode;
114        }
115    
116        public KimTypeBo getKimTypeInfo() {
117            return KimTypeBo.from(KimApiServiceLocator.getKimTypeInfoService().getKimType(this.kimTypeId));
118        }
119    }