001/**
002 * Copyright 2005-2015 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 */
016package org.kuali.rice.kim.ldap;
017
018import org.kuali.rice.kim.api.identity.type.EntityTypeContactInfoDefault;
019import org.kuali.rice.kim.util.Constants;
020import org.springframework.ldap.core.DirContextOperations;
021
022/**
023 * 
024 * @author Kuali Rice Team (rice.collab@kuali.org)
025 */
026public class EntityTypeContactInfoDefaultMapper extends BaseMapper<EntityTypeContactInfoDefault> {
027
028    private EntityAddressMapper addressMapper;
029    private EntityPhoneMapper phoneMapper;
030    private EntityEmailMapper emailMapper;
031
032    @Override
033    EntityTypeContactInfoDefault mapDtoFromContext(DirContextOperations context) {
034        EntityTypeContactInfoDefault.Builder builder = mapBuilderFromContext(context);
035        return builder != null ? builder.build() : null;
036    }
037
038    EntityTypeContactInfoDefault.Builder mapBuilderFromContext(DirContextOperations context) {
039        final EntityTypeContactInfoDefault.Builder retval = EntityTypeContactInfoDefault.Builder.create(); 
040        
041        retval.setDefaultAddress(getAddressMapper().mapBuilderFromContext(context));
042        retval.setDefaultPhoneNumber(getPhoneMapper().mapBuilderFromContext(context));
043        retval.setDefaultEmailAddress(getEmailMapper().mapBuilderFromContext(context));
044        retval.setEntityTypeCode(getConstants().getPersonEntityTypeCode());
045        // debug("Created Entity Type with code ", retval.getEntityTypeCode());
046        
047        return retval;
048    }
049
050    /**
051     * Gets the value of addressMapper
052     *
053     * @return the value of addressMapper
054     */
055    public final EntityAddressMapper getAddressMapper() {
056        return this.addressMapper;
057    }
058
059    /**
060     * Sets the value of addressMapper
061     *
062     * @param argAddressMapper Value to assign to this.addressMapper
063     */
064    public final void setAddressMapper(final EntityAddressMapper argAddressMapper) {
065        this.addressMapper = argAddressMapper;
066    }
067
068    /**
069     * Gets the value of phoneMapper
070     *
071     * @return the value of phoneMapper
072     */
073    public final EntityPhoneMapper getPhoneMapper() {
074        return this.phoneMapper;
075    }
076
077    /**
078     * Sets the value of phoneMapper
079     *
080     * @param argPhoneMapper Value to assign to this.phoneMapper
081     */
082    public final void setPhoneMapper(final EntityPhoneMapper argPhoneMapper) {
083        this.phoneMapper = argPhoneMapper;
084    }
085
086    /**
087     * Gets the value of emailMapper
088     *
089     * @return the value of emailMapper
090     */
091    public final EntityEmailMapper getEmailMapper() {
092        return this.emailMapper;
093    }
094
095    /**
096     * Sets the value of emailMapper
097     *
098     * @param argEmailMapper Value to assign to this.emailMapper
099     */
100    public final void setEmailMapper(final EntityEmailMapper argEmailMapper) {
101        this.emailMapper = argEmailMapper;
102    }
103}