Class ParameterValueData<T>

java.lang.Object
net.sf.basedb.core.data.BasicData
net.sf.basedb.core.data.ParameterValueData<T>
All Implemented Interfaces:
IdentifiableData
Direct Known Subclasses:
BooleanParameterValueData, DateParameterValueData, DoubleParameterValueData, FloatParameterValueData, IntegerParameterValueData, ItemParameterValueData, LongParameterValueData, StringParameterValueData, TextParameterValueData, TimestampParameterValueData

public abstract class ParameterValueData<T>
extends BasicData
The base class for the different types of parameter values.
Version:
2.0
Author:
Nicklas, Samuel
See Also:
Developer documentation: Parameters
Last modified
$Date: 2016-12-12 08:50:49 +0100 (må, 12 dec 2016) $
Hibernate: class
table="`ParameterValues`" discriminator-value="-1" lazy="true" batch-size="10"
Hibernate: discriminator
column="`discriminator`" type="int"
  • Field Details

    • oldValues

      private transient List<T> oldValues
    • MAX_LABEL_LENGTH

      public static final int MAX_LABEL_LENGTH
      The maximum length of the label of the parameter that can be stored in the database.
      See Also:
      setLabel(String), Constant Field Values
    • label

      private String label
    • MAX_DESCRIPTION_LENGTH

      public static final int MAX_DESCRIPTION_LENGTH
      The maximum length of the description of the parameter that can be stored in the database.
      See Also:
      setDescription(String), Constant Field Values
    • description

      private String description
    • masked

      private boolean masked
  • Constructor Details

    • ParameterValueData

      ParameterValueData()
    • ParameterValueData

      @SafeVarargs ParameterValueData​(T... values)
  • Method Details

    • getLabel

      public String getLabel()
      Get the label of the parameter.
      Hibernate: property
      column="`label`" type="string" size="255" not-null="false"
    • setLabel

      public void setLabel​(String label)
    • getDescription

      public String getDescription()
      Get the description of the parameter.
      Hibernate: property
      column="`description`" type="text" not-null="false"
    • setDescription

      public void setDescription​(String description)
    • isMasked

      public boolean isMasked()
      A flag indicating if the value should be masked when displayed in client applications (eg. since it may be a password) NOTE! This property is mapped in hibernate-properties-ParameterValueData.xml since 'default' is not supported by XDoclet //hibernate.property type="boolean" //hibernate.column name="`masked`" type="boolean" not-null="true" default="false"
      Since:
      3.7
    • setMasked

      public void setMasked​(boolean masked)
    • getValueType

      public abstract int getValueType()
      Get the type of parameter values that are store in this parameter. The value should correspond to one of the Type.getValue() values, or 0 if the parameter has no corresponding type.
      Returns:
      An integer value found in the Type enumeration or 0
      Since:
      2.16
    • getValues

      public abstract List<T> getValues()
      Get values of this parameter. Hibernate mapped in each subclass to a bag containing all values for the parameter.
      Returns:
      Collection of values.
    • setValues

      abstract void setValues​(List<T> values)
      Set values of this parameter.

      NOTE! Used by Hibernate to initialize the object. Do not call AnnotationData.setLastUpdate(java.util.Date)!

      Parameters:
      values - Collection of values.
    • replaceValuesIfDifferent

      public boolean replaceValuesIfDifferent​(List<?> values, boolean checkOnly)
      Replace the values in the database with the new values in the specified list. It is expected that the list contains only objects of the correct type.

      NOTE! When this method is called to set annotation values for an AnnotationData, don't forget to also update the last update timestamp: AnnotationData.setLastUpdate(java.util.Date). and to invalidate the annotation set snapshot: AnnotationSet.setSnapshotInvalid()

      Parameters:
      checkOnly - Only check the values, do not replace them even if they are different
      Returns:
      TRUE if the values were replaced/different, FALSE if not
      Since:
      3.8, 3.10
    • storeCurrentValuesAsOld

      protected void storeCurrentValuesAsOld​(List<T> current)
      Store the current values as old values, except if there are no current values or if old values have already been stored.
      Since:
      3.8
    • getOldValues

      public List<T> getOldValues()
      Get the old values that has been replaced by new values in this session.
      Returns:
      A list or null if the values has not been replaced
      Since:
      3.3