pt.digitalis.dif.dem.objects.parameters.types
Class DocumentParameter

java.lang.Object
  extended by pt.digitalis.dif.dem.objects.parameters.types.AbstractParameter<DocumentRepositoryEntry>
      extended by pt.digitalis.dif.dem.objects.parameters.types.DocumentParameter
All Implemented Interfaces:
Cloneable, IEditableParameter, IParameter<DocumentRepositoryEntry>

public class DocumentParameter
extends AbstractParameter<DocumentRepositoryEntry>

/** This class will define a numeric Parameter.

It will hold information relative to the Parameter value, ID key and validation constraints.

Author:
Pedro Viegas pviegas@digitalis.pt
Created on:
Nov 23, 2007

Constructor Summary
DocumentParameter()
           
 
Method Summary
 List<String> getSupportedClasses()
           
 BigDecimal getValueAsBigDecimal(IDIFContext context)
           
 boolean getValueAsBoolean(IDIFContext context)
           
 Date getValueAsDate(IDIFContext context)
           
 DocumentRepositoryEntry getValueAsDocument(IDIFContext context)
          Returns the parameter value as a Document Note: Only Document types parameters will correctly respond to this method.
 Double getValueAsDouble(IDIFContext context)
           
 Long getValueAsLong(IDIFContext context)
           
 String getValueAsString(IDIFContext context)
          Returns the parameter value as a String
 boolean isNumeric()
           
 boolean isStringSetterSupported()
           
 ParameterErrorList refreshParameterValue(IStageInstance stageInstance)
          Updates the value of the parameter from the relevant sources.
 ParameterErrorList setValue(DocumentRepositoryEntry value, IStageInstance stageInstance, boolean initializationInProgress)
          Sets the value of the parameter and runs all constraints and validations
 ParameterErrorList setValueFromString(String value, IStageInstance stageInstance, boolean initializationInProgress)
          Sets the value of the parameter converting if from a string representation and runs all constraints and validations
 
Methods inherited from class pt.digitalis.dif.dem.objects.parameters.types.AbstractParameter
addRule, automaticConstraints, clone, convertObjectToString, forceInitialize, getConstraints, getFormLinked, getId, getLanguage, getMessages, getParameterScope, getParentID, getParentType, getRules, getValidators, getValue, hasFormBeenSubmited, hasValue, initialize, isAllowAnonymous, isFirstInitialization, isFormConfigurable, isPersistToRepository, isReadonly, isReferencedInARuleFromAnotherParameter, isRequired, logWarning, setDefaultValue, setDefaultValue, setFirstInitialization, setFormConfigurable, setFormLinked, setReferencedInARuleFromAnotherParameter, setRequired, setValue, setValueFromString, toString, validateParameterValue
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DocumentParameter

public DocumentParameter()
Method Detail

getSupportedClasses

public List<String> getSupportedClasses()
Returns:
the list of supported class types for the parameter value
See Also:
IParameter.getSupportedClasses()

getValueAsBigDecimal

public BigDecimal getValueAsBigDecimal(IDIFContext context)
                                throws ParameterException
Parameters:
context - the DIF context to read if needed
Returns:
the value of the parameter as a Double
Throws:
ParameterException - if a conversion error occurs
See Also:
IParameter.getValueAsBigDecimal(pt.digitalis.dif.controller.interfaces.IDIFContext)

getValueAsBoolean

public boolean getValueAsBoolean(IDIFContext context)
                          throws ParameterException
Parameters:
context - the DIF context to read if needed
Returns:
the value of the parameter as a boolean
Throws:
ParameterException - if the parameter value cannot be read
See Also:
IParameter.getValueAsBoolean(IDIFContext)

getValueAsDate

public Date getValueAsDate(IDIFContext context)
                    throws ParameterException
Parameters:
context - the DIF context to read if needed
Returns:
the value of the parameter as a Date
Throws:
ParameterException - if a conversion error occurs
See Also:
IParameter.getValueAsDate(IDIFContext)

getValueAsDocument

public DocumentRepositoryEntry getValueAsDocument(IDIFContext context)
                                           throws ParameterException
Description copied from interface: IParameter
Returns the parameter value as a Document Note: Only Document types parameters will correctly respond to this method. All others will report an invalid usage ParameterException

Specified by:
getValueAsDocument in interface IParameter<DocumentRepositoryEntry>
Overrides:
getValueAsDocument in class AbstractParameter<DocumentRepositoryEntry>
Parameters:
context - the DIF context to read if needed
Returns:
the string representation of the parameter value
Throws:
ParameterException - if the parameter value cannot be read
See Also:
AbstractParameter.getValueAsDocument(pt.digitalis.dif.controller.interfaces.IDIFContext)

getValueAsDouble

public Double getValueAsDouble(IDIFContext context)
                        throws ParameterException
Parameters:
context - the DIF context to read if needed
Returns:
the value of the parameter as a Double
Throws:
ParameterException - if a conversion error occurs
See Also:
IParameter.getValueAsDouble(IDIFContext)

getValueAsLong

public Long getValueAsLong(IDIFContext context)
                    throws ParameterException
Parameters:
context - the DIF context to read if needed
Returns:
the value of the parameter as an Long
Throws:
ParameterException - if a conversion error occurs
See Also:
IParameter.getValueAsLong(IDIFContext)

getValueAsString

public String getValueAsString(IDIFContext context)
                        throws ParameterException
Description copied from interface: IParameter
Returns the parameter value as a String

Specified by:
getValueAsString in interface IParameter<DocumentRepositoryEntry>
Overrides:
getValueAsString in class AbstractParameter<DocumentRepositoryEntry>
Parameters:
context - the DIF context to read if needed
Returns:
the string representation of the parameter value
Throws:
ParameterException - if the parameter value cannot be read
See Also:
AbstractParameter.getValueAsString(pt.digitalis.dif.controller.interfaces.IDIFContext)

isNumeric

public boolean isNumeric()
Returns:
T if the current parameter is of a numeric type
See Also:
IParameter.isNumeric()

isStringSetterSupported

public boolean isStringSetterSupported()
Specified by:
isStringSetterSupported in interface IParameter<DocumentRepositoryEntry>
Overrides:
isStringSetterSupported in class AbstractParameter<DocumentRepositoryEntry>
Returns:
T if we can set the parameter with a String value representation
See Also:
AbstractParameter.isStringSetterSupported()

refreshParameterValue

public ParameterErrorList refreshParameterValue(IStageInstance stageInstance)
Description copied from interface: IParameter
Updates the value of the parameter from the relevant sources. This method will check a number of possible sources for the value of the parameter depending on it's scope and attributes.

Specified by:
refreshParameterValue in interface IParameter<DocumentRepositoryEntry>
Overrides:
refreshParameterValue in class AbstractParameter<DocumentRepositoryEntry>
Parameters:
stageInstance - the DIF stage to read if needed
Returns:
return the error message if the validation fails
See Also:
AbstractParameter.refreshParameterValue(pt.digitalis.dif.dem.interfaces.IStageInstance)

setValue

public ParameterErrorList setValue(DocumentRepositoryEntry value,
                                   IStageInstance stageInstance,
                                   boolean initializationInProgress)
Description copied from class: AbstractParameter
Sets the value of the parameter and runs all constraints and validations

Specified by:
setValue in interface IParameter<DocumentRepositoryEntry>
Overrides:
setValue in class AbstractParameter<DocumentRepositoryEntry>
Parameters:
value - the value to set
stageInstance - the DIF stage to read if needed. WARNING: If null is interpreted like an initialization and no scope repositories will be accessed/updated.
initializationInProgress - T if called within the dif parameter initialization
Returns:
return the error messages if the validation fails
See Also:
AbstractParameter.setValue(java.lang.Object, pt.digitalis.dif.dem.interfaces.IStageInstance, boolean)

setValueFromString

public ParameterErrorList setValueFromString(String value,
                                             IStageInstance stageInstance,
                                             boolean initializationInProgress)
Description copied from interface: IParameter
Sets the value of the parameter converting if from a string representation and runs all constraints and validations

Parameters:
value - the value to set
stageInstance - the DIF stage to read if needed.
initializationInProgress - T if called within the dif parameter initialization
Returns:
return the error messages if the validation fails
See Also:
IParameter.setValueFromString(java.lang.String, pt.digitalis.dif.dem.interfaces.IStageInstance, boolean)


Copyright © 2014 Digitalis Informática Lda. All Rights Reserved.