Interface StructuredDataNode

  • All Superinterfaces:
    BaseAsset

    public interface StructuredDataNode
    extends BaseAsset
    Represents a single Structured Data Node
    • Method Detail

      • getIdentifier

        java.lang.String getIdentifier()
        Get the text identifier of this node. This is the string that uniquely identifies this node
      • isGroup

        boolean isGroup()
        Determine if this node is the head of a group.
        Returns:
        true if this node can contain a group, false otherwise.
      • isText

        boolean isText()
        Determine if this node contains text data.
        Returns:
        true if this node can contain simple text data, false otherwise.
      • getTextNodeOptions

        TextNodeOptions getTextNodeOptions()
        Get the options that are available on a text node.
      • isAsset

        boolean isAsset()
        Determine if this node references an asset.
        Returns:
        true if this node can contain an asset reference, false otherwise
      • getGroup

        @Deprecated
        StructuredDataNode[] getGroup()
        Deprecated.
        deprecated as of 7.6 in favor of getChildren()
        When this node is the head of a group, get the group's contents by calling this method. This will return null if the node is not a group node, or empty if this node is the head of a group but the group has nothing in it.
        Returns:
        the child/nested group this node contains
      • getChildren

        StructuredDataNode[] getChildren()
        When this node is the head of a group, get the group's contents by calling this method. This will return null if the node is not a group node, or empty if this node is the head of a group but the group has nothing in it.
        Returns:
        returns the top level children of this group or null if it's not a group
      • getChildrenWithFieldId

        java.util.List<StructuredDataNode> getChildrenWithFieldId​(java.lang.String definitionFieldId)
        Returns:
        child StructuredDataNodes that match given definitionFieldId
      • getChildWithFieldId

        StructuredDataNode getChildWithFieldId​(java.lang.String definitionFieldId)
        Returns:
        first found child StructuredDataNode that matches given definitionFieldId
      • getChild

        StructuredDataNode getChild​(java.lang.String identifier)
        Returns the child of a group having the supplied identifier. Will only return the first child matching the supplied identifier in the case where there are multiple children with the same identifier. If the current node is not a group or no child with the identifier is found, this method returns null.
        Parameters:
        identifier - identifier of the node to find
        Returns:
        returns a StructuredDataNode or null
      • getChildren

        StructuredDataNode[] getChildren​(java.lang.String identifier)
        Returns all children of a group with the given identifier. If this node is not a group, this method will return null.
        Parameters:
        identifier - the identifier to search for
        Returns:
        returns an array of StructuredDataNodes or null
      • getTextValues

        java.lang.String[] getTextValues()
                                  throws java.lang.Exception
        Get the text value(s) for this text node, or null if this node is not a text node. If no value has been supplied this will return an empty array (length == 0)

        This function could return multiple values in the following cases:

        When isCheckbox() is true When isMultiselect() is true

        For each text field sub-type, the return values will be the following:

        When isPlainText() == true: a single string with the value of the text box

        When isCheckbox() == true each value in the array corresponds to the value of a checked checkbox

        When isRadio() == true a single string, whose value is the value of the selected radio button

        When isCalendar() == true a single string, of the form "MM-dd-yyyy"

        When isDatetime() == true a single string, of the native java long date format (milliseconds since midnight, 1 Jan 1970)

        When isDropdown() == true a single string, corresponding to the selected value in the dropdown field.

        When isMultiselect() == true multiple strings, each corresponding to a selected value in the multiselect field.

        When isWysiwyg() == true a single string, the XHTML content of the WYSIWYG will be updated links for cross site.

        Returns:
        the text value(s) of this node
        Throws:
        java.lang.Exception - An exception will be thrown if it's a WYSIWYG field but the value is not a valid XML
      • getTextValue

        java.lang.String getTextValue()
                               throws java.lang.Exception
        Returns the text value for plain text node. If it's a WYSIWYG field, links will be updated for cross site as well.
        Throws:
        java.lang.Exception - An exception will be thrown if it's a WYSIWYG field but the value is not a valid XML
      • getTextValueAsXMLElement

        org.jdom.Element getTextValueAsXMLElement()
                                           throws java.lang.Exception
        Get the structure data node's text value as XML element if it's a WYSIWYG field. Otherwise, null will be returned. The text value is wrapped in system-xml tag to allow single Element to be returned.
        Throws:
        java.lang.Exception
      • getAssetIdentifier

        PathIdentifier getAssetIdentifier()
        When this node is an asset node, this will return the identifier of the asset selected, or null if no asset was selected. The value of this function when isAsset() == false has no meaning.
      • getAsset

        FolderContainedAsset getAsset()
        Returns:
        When this node is an asset node, this will return the selected asset or null if no asset was selected or the selected asset is recycled. The value of this function when isAsset() == false has no meaning.
      • setTextValue

        void setTextValue​(java.lang.String value)
        Sets the text value of a structured data text node. Supports all text node types. Does not support setting multiple values for multi-select and checkbox nodes. Use setTextValues(String[]) to set multiple values.

        If the current node is not a text node, this method does nothing.

        Calendar nodes must contain a String of the form MM-dd-yyyy to be valid. Datetime nodes must be Long values (representing a unix time) in String form.

        Parameters:
        value - the value to set
      • setTextValues

        void setTextValues​(java.lang.String[] values)
        Sets multiple values for a text structured data node. Supports multi-select and checkbox text nodes.

        If the current node is not a text node or is not a multi-select or checkbox node, this method does nothing.

        Parameters:
        values - an array of string values for this particular structured data node; if null, this method does nothing
      • isAllowCustomValues

        boolean isAllowCustomValues()
        True if this field is a dropdown field and allows entering custom values
      • hasTextValue

        boolean hasTextValue​(java.lang.String value)
                      throws java.lang.Exception
        Parameters:
        value - A value to check
        Returns:
        Returns true if getTextValues() contains given value.
        Throws:
        java.lang.Exception - An exception will be thrown if it's a WYSIWYG field but the value is not a valid XML
      • getLabel

        java.lang.String getLabel()
        Returns:
        The label for the field
      • getPossibleFieldItems

        java.util.List<FieldItem> getPossibleFieldItems()
        Gets all possible field items for a checkbox, radio or dropdown field.
        Returns:
        The possible field items, or empty list if the field is not a checkbox, radio or dropdown field.
      • getSelectedFieldItems

        java.util.List<FieldItem> getSelectedFieldItems()
        Gets all selected field items, including custom values added by the user, for a checkbox, radio or dropdown field.
        Returns:
        The selected field items, or empty list if the field is not a checkbox, radio or dropdown field.
      • getDefinitionFieldId

        java.lang.String getDefinitionFieldId()
        Returns:
        The field-id attribute value from corresponding field in Data Definition