java.lang.Object
org.ametys.plugins.repository.data.repositorydata.impl.JCRRepositoryData
All Implemented Interfaces:
ModifiableRepositoryData, RepositoryData

public class JCRRepositoryData extends Object implements ModifiableRepositoryData
Class for data values management in JCR repository
  • Constructor Details

    • JCRRepositoryData

      public JCRRepositoryData(javax.jcr.Node node)
      Creates a JCR repository data from the given node
      Parameters:
      node - the Node supporting this repository data
    • JCRRepositoryData

      public JCRRepositoryData(javax.jcr.Node node, String defaultPrefix)
      Creates a JCR repository data from the given node
      Parameters:
      node - the Node supporting this repository data
      defaultPrefix - prefix to use for properties and child nodes
  • Method Details

    • getString

      public String getString(String name, String prefix)
      Description copied from interface: RepositoryData
      Retrieves the value of the string data stored in the repository with the given name
      Specified by:
      getString in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the value of the data
    • getStrings

      public String[] getStrings(String name, String prefix)
      Description copied from interface: RepositoryData
      Retrieves the values of the multiple string data stored in the repository with the given name
      Specified by:
      getStrings in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the values of the data as a string array
    • getDate

      public Calendar getDate(String name, String prefix)
      Description copied from interface: RepositoryData
      Retrieves the value of the date data stored as calendar in the repository with the given name
      Specified by:
      getDate in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the value of the data
    • getDates

      public Calendar[] getDates(String name, String prefix)
      Description copied from interface: RepositoryData
      Retrieves the values of the multiple date data as calendar stored in the repository with the given name
      Specified by:
      getDates in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the values of the data as a date array
    • getLong

      public Long getLong(String name, String prefix)
      Description copied from interface: RepositoryData
      Retrieves the value of the long data stored in the repository with the given name
      Specified by:
      getLong in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the value of the data
    • getLongs

      public Long[] getLongs(String name, String prefix)
      Description copied from interface: RepositoryData
      Retrieves the values of the multiple long data stored in the repository with the given name
      Specified by:
      getLongs in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the values of the data as a long array
    • getDouble

      public Double getDouble(String name, String prefix)
      Description copied from interface: RepositoryData
      Retrieves the value of the double data stored in the repository with the given name
      Specified by:
      getDouble in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the value of the data
    • getDoubles

      public Double[] getDoubles(String name, String prefix)
      Description copied from interface: RepositoryData
      Retrieves the values of the multiple double data stored in the repository with the given name
      Specified by:
      getDoubles in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the values of the data as a double array
    • getBoolean

      public Boolean getBoolean(String name, String prefix)
      Description copied from interface: RepositoryData
      Retrieves the value of the boolean data stored in the repository with the given name
      Specified by:
      getBoolean in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the value of the data
    • getBooleans

      public Boolean[] getBooleans(String name, String prefix)
      Description copied from interface: RepositoryData
      Retrieves the values of the multiple boolean data stored in the repository with the given name
      Specified by:
      getBooleans in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the values of the data as a boolean array
    • getStreams

      public InputStream[] getStreams(String name, String prefix)
      Description copied from interface: RepositoryData
      Retrieves the values of the multiple stream data stored in the repository with the given name
      Specified by:
      getStreams in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the values of the data as an input stream array
    • getStream

      public InputStream getStream(String name, String prefix)
      Description copied from interface: RepositoryData
      Retrieves the value of the stream data stored in the repository with the given name
      Specified by:
      getStream in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the value of the data
    • getStreamLength

      public Long getStreamLength(String name, String prefix)
      Description copied from interface: RepositoryData
      Retrieves the length of the value of the stream data stored in the repository with the given name
      Specified by:
      getStreamLength in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the length of the value of the data
    • getRepositoryData

      Description copied from interface: RepositoryData
      Retrieves the value of the repository data stored in the repository with the given name
      Specified by:
      getRepositoryData in interface ModifiableRepositoryData
      Specified by:
      getRepositoryData in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the value of the data
    • getAllRepositoryData

      Description copied from interface: RepositoryData
      Retrieves the values of all the repository data stored in the repository with the given name
      Specified by:
      getAllRepositoryData in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the values of the data
    • getDataNames

      Description copied from interface: RepositoryData
      Retrieves the names of data in this repository data with the given prefix
      Specified by:
      getDataNames in interface RepositoryData
      Parameters:
      prefix - prefix of the data names to retrieve. If null, retrieves all the data names of this repository data
      Returns:
      the names of data by this repository data
      Throws:
      AmetysRepositoryException
    • getName

      public String getName()
      Description copied from interface: RepositoryData
      Retrieves the name of the current repository data, excluding its prefix
      Specified by:
      getName in interface RepositoryData
      Returns:
      the name of the current repository data
    • getName

      protected String getName(javax.jcr.Node node) throws javax.jcr.RepositoryException
      Retrieves the name of the given node, excluding its prefix
      Parameters:
      node - the node
      Returns:
      the name of the given node
      Throws:
      javax.jcr.RepositoryException - if an error occurs
    • hasValue

      public boolean hasValue(String name, String prefix)
      Description copied from interface: RepositoryData
      Checks if there is a value for the data stored in the repository with the given name
      Specified by:
      hasValue in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      true if there is value for the data, false otherwise
    • getType

      public String getType(String name, String prefix) throws UnknownDataException
      Description copied from interface: RepositoryData
      Retrieves the type of the value for the data stored in the repository with the given name
      Specified by:
      getType in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the value's type of the data
      Throws:
      UnknownDataException - if there is no data stored with the given name
    • isMultiple

      public boolean isMultiple(String name, String prefix) throws UnknownDataException
      Description copied from interface: RepositoryData
      Checks if the value for the data stored in the repository with the given name is multiple
      Specified by:
      isMultiple in interface RepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      true if the value for the data is multiple, false otherwise
      Throws:
      UnknownDataException - if there is no data stored with the given name
    • rename

      public void rename(String newName, String prefix)
      Description copied from interface: ModifiableRepositoryData
      Rename the current repository data
      Specified by:
      rename in interface ModifiableRepositoryData
      Parameters:
      newName - the new name
      prefix - prefix of the data name, to use instead of the default one.
    • setValue

      public void setValue(String name, String value, String prefix)
      Description copied from interface: ModifiableRepositoryData
      Sets the value of the string data stored in the repository with the given name
      Specified by:
      setValue in interface ModifiableRepositoryData
      Parameters:
      name - name of the data
      value - the value to set
      prefix - prefix of the data name, to use instead of the default one.
    • setValues

      public void setValues(String name, String[] values, String prefix)
      Description copied from interface: ModifiableRepositoryData
      Sets the values of the multiple string data stored in the repository with the given name
      Specified by:
      setValues in interface ModifiableRepositoryData
      Parameters:
      name - name of the data
      values - the value to set
      prefix - prefix of the data name, to use instead of the default one.
    • setValue

      public void setValue(String name, Calendar value, String prefix)
      Description copied from interface: ModifiableRepositoryData
      Sets the value of the date data stored in the repository with the given name
      Specified by:
      setValue in interface ModifiableRepositoryData
      Parameters:
      name - name of the data
      value - the value to set
      prefix - prefix of the data name, to use instead of the default one.
    • setValues

      public void setValues(String name, Calendar[] values, String prefix)
      Description copied from interface: ModifiableRepositoryData
      Sets the values of the multiple date data stored in the repository with the given name
      Specified by:
      setValues in interface ModifiableRepositoryData
      Parameters:
      name - name of the data
      values - the value to set
      prefix - prefix of the data name, to use instead of the default one.
    • setValue

      public void setValue(String name, Long value, String prefix)
      Description copied from interface: ModifiableRepositoryData
      Sets the value of the long data stored in the repository with the given name
      Specified by:
      setValue in interface ModifiableRepositoryData
      Parameters:
      name - name of the data
      value - the value to set
      prefix - prefix of the data name, to use instead of the default one.
    • setValues

      public void setValues(String name, Long[] values, String prefix)
      Description copied from interface: ModifiableRepositoryData
      Sets the values of the multiple long data stored in the repository with the given name
      Specified by:
      setValues in interface ModifiableRepositoryData
      Parameters:
      name - name of the data
      values - the value to set
      prefix - prefix of the data name, to use instead of the default one.
    • setValue

      public void setValue(String name, Double value, String prefix)
      Description copied from interface: ModifiableRepositoryData
      Sets the value of the double data stored in the repository with the given name
      Specified by:
      setValue in interface ModifiableRepositoryData
      Parameters:
      name - name of the data
      value - the value to set
      prefix - prefix of the data name, to use instead of the default one.
    • setValues

      public void setValues(String name, Double[] values, String prefix)
      Description copied from interface: ModifiableRepositoryData
      Sets the values of the multiple double data stored in the repository with the given name
      Specified by:
      setValues in interface ModifiableRepositoryData
      Parameters:
      name - name of the data
      values - the value to set
      prefix - prefix of the data name, to use instead of the default one.
    • setValue

      public void setValue(String name, Boolean value, String prefix)
      Description copied from interface: ModifiableRepositoryData
      Sets the value of the boolean data stored in the repository with the given name
      Specified by:
      setValue in interface ModifiableRepositoryData
      Parameters:
      name - name of the data
      value - the value to set
      prefix - prefix of the data name, to use instead of the default one.
    • setValues

      public void setValues(String name, Boolean[] values, String prefix)
      Description copied from interface: ModifiableRepositoryData
      Sets the values of the multiple boolean data stored in the repository with the given name
      Specified by:
      setValues in interface ModifiableRepositoryData
      Parameters:
      name - name of the data
      values - the value to set
      prefix - prefix of the data name, to use instead of the default one.
    • setValue

      public void setValue(String name, InputStream value, String prefix)
      Description copied from interface: ModifiableRepositoryData
      Sets the value of the input stream data stored in the repository with the given name
      Specified by:
      setValue in interface ModifiableRepositoryData
      Parameters:
      name - name of the data
      value - the value to set
      prefix - prefix of the data name, to use instead of the default one.
    • setValues

      public void setValues(String name, InputStream[] values, String prefix)
      Description copied from interface: ModifiableRepositoryData
      Sets the values of the multiple input stream data stored in the repository with the given name
      Specified by:
      setValues in interface ModifiableRepositoryData
      Parameters:
      name - name of the data
      values - the value to set
      prefix - prefix of the data name, to use instead of the default one.
    • addRepositoryData

      public ModifiableRepositoryData addRepositoryData(String name, String dataTypeName, String prefix)
      Description copied from interface: ModifiableRepositoryData
      Creates a repository data and stores it in the repository with the given name
      Specified by:
      addRepositoryData in interface ModifiableRepositoryData
      Parameters:
      name - name of the data
      dataTypeName - data type name to use on creation
      prefix - prefix of the data name, to use instead of the default one.
      Returns:
      the value of the data
    • removeValue

      public void removeValue(String name, String prefix) throws UnknownDataException
      Description copied from interface: ModifiableRepositoryData
      Removes the value of the data stored in the repository with the given name
      Specified by:
      removeValue in interface ModifiableRepositoryData
      Parameters:
      name - name of the data
      prefix - prefix of the data name, to use instead of the default one.
      Throws:
      UnknownDataException - if there is no data stored with the given name
    • getNode

      public javax.jcr.Node getNode()
      Retrieves the underlying node.
      Returns:
      the underlying node.
    • getSession

      public javax.jcr.Session getSession() throws AmetysRepositoryException
      Retrieves the current session
      Returns:
      he session
      Throws:
      AmetysRepositoryException - if an error occurs
    • getDefaultPrefix

      Description copied from interface: RepositoryData
      Retrieves the default prefix
      Specified by:
      getDefaultPrefix in interface RepositoryData
      Returns:
      the default prefix
    • toString

      public String toString()
      Overrides:
      toString in class Object