Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2005-2012 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.opensource.org/licenses/ecl2.php Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.kuali.rice.kim.impl.common.attribute;
 
 
 
 import java.util.List;
 import java.util.Map;
 
 public abstract class KimAttributeDataBo extends PersistableBusinessObjectBase implements KimAttributeDataContract {
     private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(KimAttributeDataBo.class);
     private static final long serialVersionUID = 1L;
 
     private String id;
     private String attributeValue;
     private String kimAttributeId;
     private KimAttributeBo kimAttribute;
     private String kimTypeId;
     @Transient
     private KimTypeBo kimType;
 
     public abstract void setAssignedToId(String s);
 
     @Override
     public KimAttributeBo getKimAttribute() {
         if(ObjectUtils.isNull(this.)
                 && StringUtils.isNotBlank()) {
             this.refreshReferenceObject("kimAttribute");
         }
         return ;
     }
 
     @Override
     public KimTypeBo getKimType() {
         if ( == null && StringUtils.isNotEmpty()) {
              = KimTypeBo.from(KimApiServiceLocator.getKimTypeInfoService().getKimType());
         }
         return ;
     }
 
     public static <T extends KimAttributeDataBoMap<StringStringtoAttributes(Collection<T> bos) {
         Map<StringStringm = new HashMap<StringString>();
         if(CollectionUtils.isNotEmpty(bos)) {
             for (T it : bos) {
                 if (it != null) {
                     KimTypeAttribute attribute = null;
                     if ( it.kimType != null ) {
                         attribute = KimTypeBo.to(it.kimType).getAttributeDefinitionById(it.getKimAttributeId());
                     }
                     if ( attribute != null ) {
                         m.put(attribute.getKimAttribute().getAttributeName(), it.getAttributeValue());
                     } else {
                         m.put(it.getKimAttribute().getAttributeName(), it.getAttributeValue());
                     }
                 }
             }
         }
         return m;
     }

    
creates a list of KimAttributeDataBos from attributes, kimTypeId, and assignedToId.
 
     public static <T extends KimAttributeDataBoList<T> createFrom(Class<T> typeMap<StringStringattributesString kimTypeId) {
         if (attributes == null) {
             //purposely not using Collections.emptyList() b/c we do not want to return an unmodifiable list.
             return new ArrayList<T>();
         }
         List<T> attrs = new ArrayList<T>();
         for (Map.Entry<StringStringit : attributes.entrySet()) {
         //return attributes.entrySet().collect {
             KimTypeAttribute attr = KimApiServiceLocator.getKimTypeInfoService().getKimType(kimTypeId).getAttributeDefinitionByName(it.getKey());
             if (attr != null && StringUtils.isNotBlank(it.getValue())) {
                 try {
                     T newDetail = type.newInstance();
                     newDetail.setKimAttributeId(attr.getKimAttribute().getId());
                    newDetail.setKimAttribute(KimAttributeBo.from(attr.getKimAttribute()));
                    newDetail.setKimTypeId(kimTypeId);
                    newDetail.setAttributeValue(it.getValue());
                    attrs.add(newDetail);
                } catch (InstantiationException e) {
                    .error(e.getMessage(), e);
                } catch (IllegalAccessException e) {
                    .error(e.getMessage(), e);
                }
                
            }
        }
        return attrs;
    }
    @Override
    public String getId() {
        return ;
    }
    public void setId(String id) {
        this. = id;
    }
    @Override
    public String getAttributeValue() {
        return ;
    }
    public void setAttributeValue(String attributeValue) {
        this. = attributeValue;
    }
    public String getKimAttributeId() {
        return ;
    }
    public void setKimAttributeId(String kimAttributeId) {
        this. = kimAttributeId;
    }
    @Override
    public String getKimTypeId() {
        return ;
    }
    public void setKimTypeId(String kimTypeId) {
        this. = kimTypeId;
    }
    public void setKimType(KimTypeBo kimType) {
        this. = kimType;
    }
    
    public void setKimAttribute(KimAttributeBo kimAttribute) {
        this. = kimAttribute;
    }
New to GrepCode? Check out our FAQ X