org.kuali.student.r2.common.assembler
Class TransformUtility

java.lang.Object
  extended by org.kuali.student.r2.common.assembler.TransformUtility

public class TransformUtility
extends Object

Utility class containing utility methods to aide in DTO & Entity transformations


Field Summary
static String DYNAMIC_ATTRIBUTE_DATE_FORMAT
           
 
Constructor Summary
TransformUtility()
           
 
Method Summary
static String dateTimeToDynamicAttributeString(Date date)
          dateTime refers to a date where hours/minutes/seconds are important in addition to the month day year This is used to convert to and from a dynamic attribute which requires a string format.
static Date dynamicAttributeStringToDateTime(String formattedDateStr)
          Takes a dynamic attribute representing
static DynAttrConverter<? extends Object> getConverterByClass(Class clazz)
           
static
<A extends BaseAttributeEntity<O>,O extends AttributeOwner<A>>
List<Object>
mergeToEntityAttributes(Class<A> attributeClass, HasAttributes dto, O owner)
          This merges DTO attributes into Entity attributes and returns the orphaned attributes to delete
static
<A extends BaseAttributeEntity<O>,O extends AttributeOwner<A>>
List<AttributeInfo>
toAttributeInfoList(AttributeOwner<A> owner)
          Converts attributes from an entity to list of AttributeInfo objects for a DTO
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DYNAMIC_ATTRIBUTE_DATE_FORMAT

public static final String DYNAMIC_ATTRIBUTE_DATE_FORMAT
See Also:
Constant Field Values
Constructor Detail

TransformUtility

public TransformUtility()
Method Detail

mergeToEntityAttributes

public static <A extends BaseAttributeEntity<O>,O extends AttributeOwner<A>> List<Object> mergeToEntityAttributes(Class<A> attributeClass,
                                                                                                                  HasAttributes dto,
                                                                                                                  O owner)
This merges DTO attributes into Entity attributes and returns the orphaned attributes to delete

Parameters:
attributeClass - The attribute entity class for the attributes on the entity owner
dto - The dto to copy attributes from
owner - The owner entity of the attributes.
Returns:
The orphaned attributes to delete.

toAttributeInfoList

public static <A extends BaseAttributeEntity<O>,O extends AttributeOwner<A>> List<AttributeInfo> toAttributeInfoList(AttributeOwner<A> owner)
Converts attributes from an entity to list of AttributeInfo objects for a DTO

Parameters:
owner - The entity containing the attributes
Returns:
list of attributeInfo object

dateTimeToDynamicAttributeString

public static String dateTimeToDynamicAttributeString(Date date)
dateTime refers to a date where hours/minutes/seconds are important in addition to the month day year This is used to convert to and from a dynamic attribute which requires a string format.

Parameters:
date - A date object to convert
Returns:
The string version to save it as a dynamic attribute

dynamicAttributeStringToDateTime

public static Date dynamicAttributeStringToDateTime(String formattedDateStr)
                                             throws ParseException
Takes a dynamic attribute representing

Parameters:
formattedDateStr -
Returns:
Throws:
ParseException

getConverterByClass

public static DynAttrConverter<? extends Object> getConverterByClass(Class clazz)


Copyright © 2004-2013 The Kuali Foundation. All Rights Reserved.