|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpt.digitalis.dif.dem.objects.parameters.types.AbstractParameter<T>
T - generic type of the parameterpublic abstract class AbstractParameter<T>
This class will define a Parameter.
It will hold information relative to the Parameter value, ID key and validation constraints.
| Constructor Summary | |
|---|---|
AbstractParameter()
|
|
| Method Summary | |
|---|---|
void |
addRule(IParameterRule<T> rule)
Modifier for the 'rules' attribute. |
protected String |
automaticConstraints()
To override in each parameter type class as needed |
IParameter<T> |
clone()
Creates a new instance of the current object |
protected String |
convertObjectToString(Object obj)
Converts an object to strong format, according to any rules necessary in conversion of the given parameter type |
void |
forceInitialize(boolean allowAnonymous,
Map<String,IParameterConstraint> constraints,
T defaultValue,
String formLinked,
String id,
ParameterScope parameterScope,
String parentID,
Entity parentType,
boolean persistToRepository,
boolean readonly,
boolean referencedInARuleFromAnotherParameter,
boolean required,
boolean formConfigurable,
List<IParameterRule<T>> rules,
Map<String,IParameterValidator> validators,
T value)
Parameter Initializer. |
Map<String,IParameterConstraint> |
getConstraints()
|
String |
getFormLinked()
|
String |
getId()
|
protected String |
getLanguage(IDIFContext context)
Return the language from the context of the default if not available |
static MessageList |
getMessages()
Lazy loading getter of messages |
ParameterScope |
getParameterScope()
|
String |
getParentID()
|
Entity |
getParentType()
|
List<IParameterRule<T>> |
getRules()
Inspector for the 'rules' attribute. |
Map<String,IParameterValidator> |
getValidators()
|
T |
getValue(IDIFContext context)
Returns the parameter value. |
DocumentRepositoryEntry |
getValueAsDocument(IDIFContext context)
Returns the parameter value as a Document Note: Only Document types parameters will correctly respond to this method. |
String |
getValueAsString(IDIFContext context)
Returns the parameter value as a String |
protected boolean |
hasFormBeenSubmited(IDIFContext context)
|
protected boolean |
hasValue()
|
void |
initialize(String id,
Entity parentType,
String parentID,
boolean formConfigurable,
boolean persistToRepository,
boolean allowAnonymousAccess,
ParameterScope parameterScope,
String defaultValue,
String constraintDefinition,
Map<String,IParameterValidator> validators,
List<IParameterRule<T>> rules)
Parameter Initializer. |
boolean |
isAllowAnonymous()
|
boolean |
isFirstInitialization()
Inspector for the 'firstInitialization' attribute. |
boolean |
isFormConfigurable()
Inspector for the 'formConfigurable' attribute. |
boolean |
isPersistToRepository()
|
boolean |
isReadonly()
|
boolean |
isReferencedInARuleFromAnotherParameter()
Inspector for the 'referencedInARuleFromAnotherParameter' attribute. |
boolean |
isRequired()
|
boolean |
isStringSetterSupported()
|
protected void |
logWarning(String warning)
Logs a warning |
ParameterErrorList |
refreshParameterValue(IStageInstance stageInstance)
Updates the value of the parameter from the relevant sources. |
ParameterErrorList |
setDefaultValue(IStageInstance stageInstance)
Sets the value of the parameter to its default and runs all constraints and validations |
ParameterErrorList |
setDefaultValue(IStageInstance stageInstance,
boolean initializationInProgress)
Sets the value of the parameter to its default and runs all constraints and validations |
void |
setFirstInitialization(boolean firstInitialization)
Modifier for the 'firstInitialization' attribute. |
void |
setFormConfigurable(boolean formConfigurable)
Modifier for the 'formConfigurable' attribute. |
void |
setFormLinked(String formLinked)
|
void |
setReferencedInARuleFromAnotherParameter(boolean referencedInARuleFromAnotherParameter)
Modifier for the 'referencedInARuleFromAnotherParameter' attribute. |
void |
setRequired(boolean required)
|
ParameterErrorList |
setValue(T value,
IStageInstance stageInstance)
Sets the value of the parameter and runs all constraints and validations |
ParameterErrorList |
setValue(T value,
IStageInstance stageInstance,
boolean initializationInProgress)
Sets the value of the parameter and runs all constraints and validations |
ParameterErrorList |
setValueFromString(String value,
IStageInstance stageInstance)
Sets the value of the parameter converting if from a string representation and runs all constraints and validations |
String |
toString()
|
protected ParameterErrorList |
validateParameterValue(T value,
IStageInstance stageInstance,
boolean initializationInProgress)
Validate a parameter value on type, constraints, validators and rules, if applied. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface pt.digitalis.dif.dem.objects.parameters.IParameter |
|---|
getSupportedClasses, getValueAsBigDecimal, getValueAsBoolean, getValueAsDate, getValueAsDouble, getValueAsLong, isNumeric, setValueFromString |
| Constructor Detail |
|---|
public AbstractParameter()
| Method Detail |
|---|
public static MessageList getMessages()
public void addRule(IParameterRule<T> rule)
rule - the new rule to addprotected String automaticConstraints()
public IParameter<T> clone()
throws CloneNotSupportedException
IParameter
clone in interface IParameter<T>clone in class ObjectIParameter clone
CloneNotSupportedExceptionObject.clone()protected String convertObjectToString(Object obj)
obj - the object to convert
public void forceInitialize(boolean allowAnonymous,
Map<String,IParameterConstraint> constraints,
T defaultValue,
String formLinked,
String id,
ParameterScope parameterScope,
String parentID,
Entity parentType,
boolean persistToRepository,
boolean readonly,
boolean referencedInARuleFromAnotherParameter,
boolean required,
boolean formConfigurable,
List<IParameterRule<T>> rules,
Map<String,IParameterValidator> validators,
T value)
IParameter
forceInitialize in interface IParameter<T>allowAnonymous - if a USER scoped parameter should allow anonymous accessconstraints - the string that defines the constraints to applydefaultValue - the parameter default valueformLinked - the form name of null if not setid - the parameter idparameterScope - the scope of the parameterparentID - the id of the parent entityparentType - the parent entity typepersistToRepository - if the parameter value should be persisted to the repositoryreferencedInARuleFromAnotherParameter - the new referencedInARuleFromAnotherParameter value to setformConfigurable - T if the form is configurablerules - the parameter rulesvalidators - a validator list to validate the parameter valuesIParameter.forceInitialize(boolean, java.util.Map, java.lang.Object,
java.lang.String, java.lang.String, pt.digitalis.dif.dem.objects.parameters.ParameterScope,
java.lang.String, pt.digitalis.dif.dem.Entity, boolean, boolean, boolean, boolean, boolean, java.util.List,
java.util.Map, java.lang.Object)public Map<String,IParameterConstraint> getConstraints()
getConstraints in interface IParameter<T>public String getFormLinked()
getFormLinked in interface IParameter<T>IParameter.getFormLinked()public String getId()
getId in interface IParameter<T>protected String getLanguage(IDIFContext context)
context - the context
public ParameterScope getParameterScope()
getParameterScope in interface IParameter<T>public String getParentID()
getParentID in interface IParameter<T>public Entity getParentType()
getParentType in interface IParameter<T>public List<IParameterRule<T>> getRules()
IParameter
getRules in interface IParameter<T>IParameter.getRules()public Map<String,IParameterValidator> getValidators()
getValidators in interface IParameter<T>
public T getValue(IDIFContext context)
throws ParameterException
IParameter
getValue in interface IParameter<T>context - the DIF context to read if needed
ParameterException - if the parameter could not be readIParameter.getValue(IDIFContext)
public DocumentRepositoryEntry getValueAsDocument(IDIFContext context)
throws ParameterException
IParameterParameterException
getValueAsDocument in interface IParameter<T>context - the DIF context to read if needed
ParameterException - if the parameter value cannot be readIParameter.getValueAsDocument(pt.digitalis.dif.controller.interfaces.IDIFContext)
public String getValueAsString(IDIFContext context)
throws ParameterException
IParameter
getValueAsString in interface IParameter<T>context - the DIF context to read if needed
ParameterException - if the parameter value cannot be readIParameter.getValueAsString(IDIFContext)protected boolean hasFormBeenSubmited(IDIFContext context)
context - the current stage context
protected boolean hasValue()
public void initialize(String id,
Entity parentType,
String parentID,
boolean formConfigurable,
boolean persistToRepository,
boolean allowAnonymousAccess,
ParameterScope parameterScope,
String defaultValue,
String constraintDefinition,
Map<String,IParameterValidator> validators,
List<IParameterRule<T>> rules)
throws ParameterException
IParameter
initialize in interface IParameter<T>id - the parameter idparentType - the parent entity typeparentID - the id of the parent entityformConfigurable - if the parameter can be configured for a given formpersistToRepository - if the parameter value should be persisted to the repositoryallowAnonymousAccess - if a USER scoped parameter should allow anonymous accessparameterScope - the scope of the parameterdefaultValue - the parameter default valueconstraintDefinition - the string that defines the constraints to applyvalidators - a validator list to validate the parameter valuesrules - the parameter rules
ParameterException - if the default value can't be converted to the inner parameter typeIParameter.initialize(java.lang.String, pt.digitalis.dif.dem.Entity,
java.lang.String, boolean, boolean, boolean, pt.digitalis.dif.dem.objects.parameters.ParameterScope,
java.lang.String, java.lang.String, java.util.Map, java.util.List)public boolean isAllowAnonymous()
isAllowAnonymous in interface IParameter<T>IParameter.isAllowAnonymous()public boolean isFirstInitialization()
public boolean isFormConfigurable()
IParameter
isFormConfigurable in interface IParameter<T>IParameter.isFormConfigurable()public boolean isPersistToRepository()
isPersistToRepository in interface IParameter<T>public boolean isReadonly()
isReadonly in interface IParameter<T>public boolean isReferencedInARuleFromAnotherParameter()
IParameter
isReferencedInARuleFromAnotherParameter in interface IParameter<T>IParameter.isReferencedInARuleFromAnotherParameter()public boolean isRequired()
isRequired in interface IParameter<T>IParameter.isRequired()public boolean isStringSetterSupported()
isStringSetterSupported in interface IParameter<T>IParameter.isStringSetterSupported()protected void logWarning(String warning)
warning - the warning message to logpublic ParameterErrorList refreshParameterValue(IStageInstance stageInstance)
IParameter
refreshParameterValue in interface IParameter<T>stageInstance - the DIF stage to read if needed
IParameter.refreshParameterValue(pt.digitalis.dif.dem.interfaces.IStageInstance)public ParameterErrorList setDefaultValue(IStageInstance stageInstance)
IParameter
setDefaultValue in interface IParameter<T>stageInstance - the requested stage
IParameter.setDefaultValue(pt.digitalis.dif.dem.interfaces.IStageInstance)
public ParameterErrorList setDefaultValue(IStageInstance stageInstance,
boolean initializationInProgress)
IParameter
setDefaultValue in interface IParameter<T>stageInstance - the requested stageinitializationInProgress - T if called within the dif parameter initialization
IParameter.setDefaultValue(pt.digitalis.dif.dem.interfaces.IStageInstance,
boolean)public void setFirstInitialization(boolean firstInitialization)
firstInitialization - the new firstInitialization value to setpublic void setFormConfigurable(boolean formConfigurable)
IParameter
setFormConfigurable in interface IParameter<T>formConfigurable - the new formConfigurable value to setIParameter.setFormConfigurable(boolean)public void setFormLinked(String formLinked)
setFormLinked in interface IParameter<T>IParameter.setFormLinked(java.lang.String)public void setReferencedInARuleFromAnotherParameter(boolean referencedInARuleFromAnotherParameter)
IParameter
setReferencedInARuleFromAnotherParameter in interface IParameter<T>referencedInARuleFromAnotherParameter - the new referencedInARuleFromAnotherParameter value to setIParameter.setReferencedInARuleFromAnotherParameter(boolean)public void setRequired(boolean required)
setRequired in interface IEditableParameterrequired - if T the parameter will now become mandatoryIEditableParameter.setRequired(boolean)
public ParameterErrorList setValue(T value,
IStageInstance stageInstance)
setValue in interface IParameter<T>value - the value to setstageInstance - the DIF stage to read if needed. WARNING: If null is interpreted like an initialization and no scope
repositories will be accessed/updated.
public ParameterErrorList setValue(T value,
IStageInstance stageInstance,
boolean initializationInProgress)
setValue in interface IParameter<T>value - the value to setstageInstance - 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
public final ParameterErrorList setValueFromString(String value,
IStageInstance stageInstance)
IParameter
setValueFromString in interface IParameter<T>value - the value to setstageInstance - the DIF stage to read if needed.
IParameter.setValueFromString(java.lang.String,
pt.digitalis.dif.dem.interfaces.IStageInstance)public String toString()
toString in class ObjectObject.toString()
protected ParameterErrorList validateParameterValue(T value,
IStageInstance stageInstance,
boolean initializationInProgress)
value - the value to validatestageInstance - the stage where the parameter is being validatedinitializationInProgress - T if called within the dif parameter initialization
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||