Package org.silverpeas.core.variables
Class Variable
- java.lang.Object
-
- org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity<E,I>
-
- org.silverpeas.core.persistence.datasource.model.jpa.SilverpeasJpaEntity<Variable,UuidIdentifier>
-
- org.silverpeas.core.variables.Variable
-
- All Implemented Interfaces:
Serializable
,Entity<Variable,UuidIdentifier>
,IdentifiableEntity
,Securable
@Entity public class Variable extends SilverpeasJpaEntity<Variable,UuidIdentifier> implements Securable
A variable is a mapping between a literal and one or more values, each of them being scheduled in a given period. Its then a place-holder of a value in the time. It is used to be referred by the content of contributions so that the content can be kept to date when the value of the variable change.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canBeAccessedBy(User user)
Checks the given user can access this resource.boolean
canBeDeletedBy(User user)
Checks the given user can delete this resource.boolean
canBeModifiedBy(User user)
Checks the given user can modify this resource.void
delete()
Deletes this variable in the persistence context so it will be lost once the transaction terminated.boolean
equals(Object obj)
static List<Variable>
getAll()
Gets all the variables available in the persistence context (data source).static Variable
getById(String id)
Gets the variable by its unique identifier.String
getDescription()
Gets this variable's description.String
getLabel()
Gets this variable's label.int
getNumberOfValues()
VariableValueSet
getVariableValues()
Gets all the values that are scheduled for this variable.int
hashCode()
void
merge(Variable variable)
Merges the attributes of this variable with the ones from the specified variable.Variable
save()
Saves this variable into the persistence context.void
setDescription(String description)
Changes the description of this variable.void
setLabel(String label)
Changes the label of this variable.-
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
-
Methods inherited from interface org.silverpeas.core.security.Securable
canBeFiledInBy
-
-
-
-
Method Detail
-
getById
public static Variable getById(String id)
Gets the variable by its unique identifier.- Parameters:
id
- the unique identifier of the variable to get.- Returns:
- the variable or null if no such variable exists with the specified identifier.
-
getAll
public static List<Variable> getAll()
Gets all the variables available in the persistence context (data source).- Returns:
- a list of all of the available defined variables or an empty list if no variables has been yet created.
-
getLabel
public String getLabel()
Gets this variable's label.- Returns:
- the label of this variable.
-
getDescription
public String getDescription()
Gets this variable's description.- Returns:
- a short description of this variable.
-
setLabel
public void setLabel(String label)
Changes the label of this variable.- Parameters:
label
- the new label.
-
setDescription
public void setDescription(String description)
Changes the description of this variable.- Parameters:
description
- the new description of this variable.
-
getVariableValues
public VariableValueSet getVariableValues()
Gets all the values that are scheduled for this variable.- Returns:
- a set of this variable's scheduled values.
-
getNumberOfValues
public int getNumberOfValues()
-
merge
public void merge(Variable variable)
Merges the attributes of this variable with the ones from the specified variable. Only the title and the description are merged. For the different values, please see theVariableValueSet
instance returned by thegetVariableValues()
method.- Parameters:
variable
- the variable with which the attributes of this variable are merged.
-
save
public Variable save()
Saves this variable into the persistence context.- Returns:
- the variable from the persistence context once saved.
-
delete
public void delete()
Deletes this variable in the persistence context so it will be lost once the transaction terminated.
-
canBeAccessedBy
public boolean canBeAccessedBy(User user)
Description copied from interface:Securable
Checks the given user can access this resource.- Specified by:
canBeAccessedBy
in interfaceSecurable
- Parameters:
user
- a user in Silverpeas.- Returns:
- true if the user can access the data managed by this instance, false otherwise.
-
canBeModifiedBy
public boolean canBeModifiedBy(User user)
Description copied from interface:Securable
Checks the given user can modify this resource. By default, if the user can access this securable resource, then it can also modify it.- Specified by:
canBeModifiedBy
in interfaceSecurable
- Parameters:
user
- a user in Silverpeas.- Returns:
- true if the user can modify the data managed by this instance, false otherwise.
-
canBeDeletedBy
public boolean canBeDeletedBy(User user)
Description copied from interface:Securable
Checks the given user can delete this resource. By default, if the user can modify this securable resource, then it can also delete it.- Specified by:
canBeDeletedBy
in interfaceSecurable
- Parameters:
user
- a user in Silverpeas.- Returns:
- true if the user can delete the data managed by this instance, false otherwise.
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classSilverpeasJpaEntity<Variable,UuidIdentifier>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classSilverpeasJpaEntity<Variable,UuidIdentifier>
-
-