001    /*
002     * Copyright 2011 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.kfs.module.endow.businessobject;
017    
018    import java.sql.Date;
019    import java.util.LinkedHashMap;
020    
021    import org.apache.commons.lang.StringUtils;
022    import org.kuali.kfs.module.endow.EndowPropertyConstants;
023    import org.kuali.kfs.sys.KFSConstants;
024    import org.kuali.kfs.sys.context.SpringContext;
025    import org.kuali.rice.kim.bo.Person;
026    import org.kuali.rice.kns.bo.Inactivateable;
027    import org.kuali.rice.kns.bo.KualiCodeBase;
028    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
029    
030    public class TicklerRecipientPrincipal extends PersistableBusinessObjectBase implements Inactivateable
031    {
032        private String number;
033        private String principalId;
034        private boolean active;
035        
036        private Person contact;
037        
038        /**
039         * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
040         */
041        @Override
042        protected LinkedHashMap<String, String> toStringMapper() 
043        {
044            LinkedHashMap<String, String> m = new LinkedHashMap<String, String>();
045            m.put(EndowPropertyConstants.TICKLER_NUMBER,getNumber());
046            m.put(EndowPropertyConstants.TICKLER_RECIPIENT_PRINCIPALID,getPrincipalId());
047            return m;
048        }
049    
050        public boolean isActive() {
051            return active;
052        }
053    
054        public void setActive(boolean active) {
055            this.active = active;
056        }
057    
058        public String getNumber() {
059            return number;
060        }
061    
062    
063        public void setNumber(String number) {
064            this.number = number;
065        }
066    
067        public String getPrincipalId() {
068            return principalId;
069        }
070    
071        public void setPrincipalId(String principalId) {
072            this.principalId = principalId;
073        }
074    
075        public Person getContact() {
076            contact = SpringContext.getBean(org.kuali.rice.kim.service.PersonService.class).updatePersonIfNecessary(principalId, contact);
077            return contact;
078        }
079    
080        public void setContact(Person contact) {
081            this.contact = contact;
082        }
083        
084        public String getContectNameAndID()
085        {
086            contact = SpringContext.getBean(org.kuali.rice.kim.service.PersonService.class).updatePersonIfNecessary(principalId, contact);
087            return contact.getPrincipalName() + " - " + getPrincipalId();
088        }
089    
090    }