Class Variable

    • Constructor Detail

      • Variable

        protected Variable()
      • Variable

        public Variable​(String label,
                        String description)
        Constructs a new variable with the specified label and short description.
        Parameters:
        label - the label of this variable.
        description - a short description of this variable.
    • 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 the VariableValueSet instance returned by the getVariableValues() 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 interface Securable
        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 interface Securable
        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 interface Securable
        Parameters:
        user - a user in Silverpeas.
        Returns:
        true if the user can delete the data managed by this instance, false otherwise.