Class DataElement

  • Direct Known Subclasses:
    MemberElement

    public class DataElement
    extends java.lang.Object
    JCMS OpenAPI provides many times JCMS data in XML as exported with the JCMS import/export form. This class provides a usefull way to get the informations in the wrapped JCMS data XML element.
    Since:
    JCMS-6.0.1
    Author:
    dissert
    • Constructor Detail

      • DataElement

        public DataElement​(org.jdom.Element element,
                           ClientSession session)
    • Method Detail

      • getId

        public java.lang.String getId()
        Gives the id of the JCMS data represented by the wrapped element.
        Returns:
        the id found as an attribute in the XML
      • getUrl

        public java.lang.String getUrl()
        Gives the url of the JCMS data represented by the wrapped element.
        Returns:
        the url found from an attribute in the XML
      • getMainLanguage

        public java.lang.String getMainLanguage()
        Gives the main language of the JCMS data represented by the wrapped element.
        Returns:
        the main language (ISO representation)
      • getTitle

        public java.lang.String getTitle()
        Returns:
        the title of the JCMS data represented by the wrapped element, in its main language.
      • getAbstractField

        public org.jdom.Element getAbstractField()
        The JDOM element corresponding to the abstract of the JCMS data represented by the wrapped element. It contains only the text in the main language of the data. an attribute gives the name of the element with multilingual values.
        Returns:
        the Jdom element corresponding to the abstract of the JCMS data represented by the wrapped element.
      • getAbstractMLName

        public java.lang.String getAbstractMLName()
        Returns:
        the value of the attribute 'name' of the XML element corresponding to the multitlingual version of the abstract
      • getField

        public org.jdom.Element getField​(java.lang.String name)
        Parameters:
        name -
        Returns:
        the JDOM element of the field element with this 'name' attribute value. (may be null)
      • getFieldText

        public java.lang.String getFieldText​(java.lang.String name)
        Return the text of the specified field.
        Parameters:
        name - the name of the field to retrieve
        Returns:
        the text of the specified field or null if could not be found
        Since:
        jcms-6.1.2
      • getMLField

        public org.jdom.Element getMLField​(org.jdom.Element field)
        Parameters:
        field - the element corresponding to a field in the main language of the data
        Returns:
        the JDOM element of the multilingual values correponding to this element. may be null.
      • getPdate

        public java.util.Date getPdate()
        Returns:
        if set, the Pdate of the data, as a Java object (it is parsed and decoded).
      • getCdate

        public java.util.Date getCdate()
        Returns:
        if set, the Cdate of the data, as a Java object (it is parsed and decoded).
      • getMdate

        public java.util.Date getMdate()
        Returns:
        if set, the Mdate of the data, as a Java object (it is parsed and decoded).
      • getElement

        public org.jdom.Element getElement()
        Returns:
        the main JDOM element correponding to the JCMS data.
      • getRelateds

        public Relateds getRelateds()
        Gives a representation of this DataElement related parameters.
        Returns:
        Relateds object encapsulating relateds datas
        Since:
        JCMS-6.1
      • getDataElementList

        public static java.util.List<DataElement> getDataElementList​(JcmsResource resource,
                                                                     ClientSession session)
        For a resource in dataset form, gives a list of corresponding DataElement object.
        Parameters:
        resource -
        session -
        Returns:
        a list of DataElement correponding to the data in the entity body of the response.
        Since:
        JCMS-6.1
      • getDataElementList

        public static java.util.List<DataElement> getDataElementList​(JcmsResource resource,
                                                                     ClientSession session,
                                                                     java.lang.String dataSetTag)
        For a resource in dataset form, gives a list of corresponding DataElement object.
        Parameters:
        resource -
        session -
        dataSetTag - specific enclosing tag name
        Returns:
        a list of DataElement correponding to the data in the entity body of the response.
        Since:
        JCMS-6.1
      • getFirstDataElement

        public static DataElement getFirstDataElement​(JcmsResource resource,
                                                      ClientSession session)
        For a single data in a resource, gives the corresponding DataElement object.
        Parameters:
        resource -
        session -
        Returns:
        a DataElement correponding to the data in the entity body of the response.
        Since:
        JCMS-6.1
      • getDataType

        public java.lang.String getDataType()
        Returns the jcms type of the data.
        Returns:
        the jcms type of the data.