Package org.silverpeas.core.variables
Class VariableScheduledValue
- java.lang.Object
-
- org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity<E,I>
-
- org.silverpeas.core.persistence.datasource.model.jpa.SilverpeasJpaEntity<VariableScheduledValue,UuidIdentifier>
-
- org.silverpeas.core.variables.VariableScheduledValue
-
- All Implemented Interfaces:
Serializable
,Entity<VariableScheduledValue,UuidIdentifier>
,IdentifiableEntity
@Entity @DateRange(start="startDate", end="endDate") public class VariableScheduledValue extends SilverpeasJpaEntity<VariableScheduledValue,UuidIdentifier>
A scheduled value of a givenVariable
. Such a value is said scheduled because it is scheduled to be enabled during a given period of time; during this period, the related variable is then valued with this value. Don't forget that a variable can have then at the same time several possible values. In such a case, only the first obtained one will be valid (the first obtained one isn't necessary the first defined one; in that case we don't ensure any coherent behavior).- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
VariableScheduledValue()
VariableScheduledValue(String value, Period period)
Constructs a new variable value to schedule at the specified period of time.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
static List<VariableScheduledValue>
getCurrentOnes()
Gets all the variable scheduled values that are currently valid.Period
getPeriod()
Gets the period in time during which this variable's value will be active.String
getValue()
Gets the embedded value of this scheduled value.String
getValueForHTML()
Gets the value formatted in HTML.Variable
getVariable()
Gets the variable this scheduled value belongs to.int
hashCode()
void
merge(VariableScheduledValue value)
Merges this variable's value with the properties of the specified value.VariableScheduledValue
updateFrom(VariableScheduledValue newValue)
Updates both the value and the period in time this value is valid of this variable value from the specified another variable value.-
Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.SilverpeasJpaEntity
createdBy, createdBy, createdBy, getCreationDate, getCreator, getCreatorId, getLastUpdateDate, getLastUpdater, getLastUpdaterId, getVersion, hasBeenModified, lastUpdatedBy, markAsModified, performBeforePersist, performBeforeRemove, performBeforeUpdate, setCreationDate, setCreator, setLastUpdateDate, setLastUpdater, setVersion, updatedBy, updatedBy
-
Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity
getId, getNativeId, isPersisted, setId
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.persistence.datasource.model.IdentifiableEntity
getId, isPersisted
-
-
-
-
Method Detail
-
getCurrentOnes
public static List<VariableScheduledValue> getCurrentOnes()
Gets all the variable scheduled values that are currently valid. If a variable has several values that are scheduled at the current date, only one of them is returned (the first found one).- Returns:
- a list with the current scheduled variable values or an empty list if there is no variable values scheduled at the current date.
-
getPeriod
public Period getPeriod()
Gets the period in time during which this variable's value will be active.- Returns:
- the period in time. The start date and the end date are expressed in
LocalDate
-
getValue
public String getValue()
Gets the embedded value of this scheduled value.- Returns:
- the value.
-
getVariable
public Variable getVariable()
Gets the variable this scheduled value belongs to.- Returns:
- the variable that is valued by this value.
-
getValueForHTML
public String getValueForHTML()
Gets the value formatted in HTML.- Returns:
- the HTML-formatted value.
-
merge
public void merge(VariableScheduledValue value)
Merges this variable's value with the properties of the specified value.- Parameters:
value
- a variable value from which the merge has to be done.
-
updateFrom
public VariableScheduledValue updateFrom(VariableScheduledValue newValue)
Updates both the value and the period in time this value is valid of this variable value from the specified another variable value. Be cautious: the modification is automatically synchronized into the persistence context.- Parameters:
newValue
- the new variable value to set.
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classSilverpeasJpaEntity<VariableScheduledValue,UuidIdentifier>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classSilverpeasJpaEntity<VariableScheduledValue,UuidIdentifier>
-
-