/**
  * Converts a immutable object to it's mutable bo counterpart
  *
  * @param im immutable object
  * @return the mutable bo
  */
 public static KewTypeAttributeBo from(KewTypeAttribute im, KewTypeBo kewType) {
   if (null == im) {
     return null;
   } else {
     KewTypeAttributeBo bo = new KewTypeAttributeBo();
     bo.setId(im.getId());
     bo.setType(kewType);
     bo.setSequenceNumber(im.getSequenceNumber());
     bo.setActive(im.isActive());
     bo.setAttributeDefinition(KewAttributeDefinitionBo.from(im.getAttributeDefinition()));
     return bo;
   }
 }
  /** Invoked to rebuild the type attribute bos and attributes value map based on the type id */
  public void rebuildTypeAttributes() {
    this.attributeBos = new ArrayList<PeopleFlowAttributeBo>();
    this.attributeValues = new HashMap<String, String>();

    KewTypeDefinition typeDefinition =
        KewApiServiceLocator.getKewTypeRepositoryService().getTypeById(this.typeId);
    if ((typeDefinition.getAttributes() != null) && !typeDefinition.getAttributes().isEmpty()) {
      List<KewTypeAttribute> typeAttributes =
          new ArrayList<KewTypeAttribute>(typeDefinition.getAttributes());

      List<String> sortAttributes = new ArrayList<String>();
      sortAttributes.add(KEWPropertyConstants.SEQUENCE_NUMBER);
      Collections.sort(typeAttributes, new BeanPropertyComparator(sortAttributes));

      for (KewTypeAttribute typeAttribute : typeAttributes) {
        PeopleFlowAttributeBo attributeBo =
            PeopleFlowAttributeBo.from(typeAttribute.getAttributeDefinition(), null, this, null);
        this.attributeBos.add(attributeBo);
        this.attributeValues.put(typeAttribute.getAttributeDefinition().getName(), "");
      }
    }
  }