org.kuali.rice.kew.api.document.attribute
Class DocumentAttributeFactory

java.lang.Object
  extended by org.kuali.rice.kew.api.document.attribute.DocumentAttributeFactory

public class DocumentAttributeFactory
extends Object

A factory that helps with creation of new DocumentAttribute instances as well as translation to concrete instances from a DocumentAttributeContract

Author:
Kuali Rice Team (rice.collab@kuali.org)

Constructor Summary
DocumentAttributeFactory()
           
 
Method Summary
static DocumentAttributeDateTime createDateTimeAttribute(String name, Calendar value)
          Constructs a document attribute containing date/time data from the given attribute name and Calendar object.
static DocumentAttributeDateTime createDateTimeAttribute(String name, Date value)
          Constructs a document attribute containing date/time data from the given attribute name and Date object.
static DocumentAttributeDateTime createDateTimeAttribute(String name, org.joda.time.DateTime value)
          Constructs a document attribute containing date/time data from the given attribute name and DateTime object.
static DocumentAttributeDateTime createDateTimeAttribute(String name, long instant)
          Constructs a document attribute containing date/time data from the given attribute name and a numeric long representing the number of milliseconds from 1970-01-01T00:00:00Z in the default time zone.
static DocumentAttributeDecimal createDecimalAttribute(String name, BigDecimal value)
          Constructs a document attribute containing real number data from the given attribute name and BigDecimal object.
static DocumentAttributeDecimal createDecimalAttribute(String name, Number value)
          Constructs a document attribute containing real number data from the given attribute name and Number object.
static DocumentAttributeInteger createIntegerAttribute(String name, BigInteger value)
          Constructs a document attribute containing integer number data from the given attribute name and BigInteger object.
static DocumentAttributeInteger createIntegerAttribute(String name, Number value)
          Constructs a document attribute containing integer number data from the given attribute name and Number object.
static DocumentAttributeString createStringAttribute(String name, String value)
          Constructs a document attribute containing character data from the given attribute name and String value.
static DocumentAttribute.AbstractBuilder<?> loadContractIntoBuilder(DocumentAttributeContract contract)
          Loads the given DocumentAttributeContract into the appropriate builder instance based on the type of the given contract implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentAttributeFactory

public DocumentAttributeFactory()
Method Detail

createStringAttribute

public static DocumentAttributeString createStringAttribute(String name,
                                                            String value)
Constructs a document attribute containing character data from the given attribute name and String value.

Parameters:
name - the name of the attribute to construct, must not be a null or blank value
value - the value of the attribute as a String
Returns:
a constructed DocumentAttributeString representing the document attribute
Throws:
IllegalArgumentException - if name is a null or blank value

createDateTimeAttribute

public static DocumentAttributeDateTime createDateTimeAttribute(String name,
                                                                org.joda.time.DateTime value)
Constructs a document attribute containing date/time data from the given attribute name and DateTime object.

Parameters:
name - the name of the attribute to construct, must not be a null or blank value
value - the value of the attribute as a DateTime
Returns:
a constructed DocumentAttributeDateTime representing the document attribute
Throws:
IllegalArgumentException - if name is a null or blank value

createDateTimeAttribute

public static DocumentAttributeDateTime createDateTimeAttribute(String name,
                                                                Date value)
Constructs a document attribute containing date/time data from the given attribute name and Date object.

Parameters:
name - the name of the attribute to construct, must not be a null or blank value
value - the value of the attribute as a Date
Returns:
a constructed DocumentAttributeDateTime representing the document attribute
Throws:
IllegalArgumentException - if name is a null or blank value

createDateTimeAttribute

public static DocumentAttributeDateTime createDateTimeAttribute(String name,
                                                                long instant)
Constructs a document attribute containing date/time data from the given attribute name and a numeric long representing the number of milliseconds from 1970-01-01T00:00:00Z in the default time zone.

Parameters:
name - the name of the attribute to construct, must not be a null or blank value
instant - the instant value represented as milliseconds from 1970-01-01T00:00:00Z
Returns:
a constructed DocumentAttributeDateTime representing the document attribute
Throws:
IllegalArgumentException - if name is a null or blank value

createDateTimeAttribute

public static DocumentAttributeDateTime createDateTimeAttribute(String name,
                                                                Calendar value)
Constructs a document attribute containing date/time data from the given attribute name and Calendar object.

Parameters:
name - the name of the attribute to construct, must not be a null or blank value
value - the value of the attribute as a Calendar
Returns:
a constructed DocumentAttributeDateTime representing the document attribute
Throws:
IllegalArgumentException - if name is a null or blank value

createDecimalAttribute

public static DocumentAttributeDecimal createDecimalAttribute(String name,
                                                              BigDecimal value)
Constructs a document attribute containing real number data from the given attribute name and BigDecimal object.

Parameters:
name - the name of the attribute to construct, must not be a null or blank value
value - the value of the attribute as a BigDecimal
Returns:
a constructed DocumentAttributeDecimal representing the document attribute
Throws:
IllegalArgumentException - if name is a null or blank value

createDecimalAttribute

public static DocumentAttributeDecimal createDecimalAttribute(String name,
                                                              Number value)
Constructs a document attribute containing real number data from the given attribute name and Number object. The given number is first translated to a BigDecimal using Number.doubleValue().

Parameters:
name - the name of the attribute to construct, must not be a null or blank value
value - the value of the attribute as a Number
Returns:
a constructed DocumentAttributeDecimal representing the document attribute
Throws:
IllegalArgumentException - if name is a null or blank value

createIntegerAttribute

public static DocumentAttributeInteger createIntegerAttribute(String name,
                                                              BigInteger value)
Constructs a document attribute containing integer number data from the given attribute name and BigInteger object.

Parameters:
name - the name of the attribute to construct, must not be a null or blank value
value - the value of the attribute as a BigInteger
Returns:
a constructed DocumentAttributeInteger representing the document attribute
Throws:
IllegalArgumentException - if name is a null or blank value

createIntegerAttribute

public static DocumentAttributeInteger createIntegerAttribute(String name,
                                                              Number value)
Constructs a document attribute containing integer number data from the given attribute name and Number object. The given number is first translated to a BigInteger using Number.longValue().

Parameters:
name - the name of the attribute to construct, must not be a null or blank value
value - the value of the attribute as a Number
Returns:
a constructed DocumentAttributeInteger representing the document attribute
Throws:
IllegalArgumentException - if name is a null or blank value

loadContractIntoBuilder

public static DocumentAttribute.AbstractBuilder<?> loadContractIntoBuilder(DocumentAttributeContract contract)
Loads the given DocumentAttributeContract into the appropriate builder instance based on the type of the given contract implementation.

Parameters:
contract - the contract to load into a builder
Returns:
an implementation of DocumentAttribute.AbstractBuilder which handles instance of the given contract
Throws:
IllegalArgumentException - if the given contract is null
IllegalArgumentException - if a builder implementation could not be determined into which to load the given contract implementation


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.