Interface IContentObjectValue

  • All Superinterfaces:
    org.eclipse.core.runtime.IAdaptable, ch.ivyteam.ivy.cm.IContentManagementEntity

    public interface IContentObjectValue
    extends ch.ivyteam.ivy.cm.IContentManagementEntity
    Content Object Value
    API:
    This is a public API.
    • Method Detail

      • getLanguage

        Locale getLanguage()
        Gets the language
        Returns:
        language
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getContentObject

        IContentObject getContentObject()
        Gets the associated ContentObject (= parent)
        Returns:
        associated content object
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getContentObjectType

        IContentObjectType getContentObjectType()
        Gets the associated ContentObjectType
        Returns:
        associated content object type
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getContentAsString

        String getContentAsString()
        Gets the content as string (works for string and text type). If no content exists or if content was set to empty string, then null will be returned.
        Returns:
        content as string or null if no content exists
        Throws:
        UnsupportedOperationException - if datatype is binary
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getContentAsBinaryStream

        InputStream getContentAsBinaryStream()
        Gets the content as binary stream. If no content exists, then null will be returned.

        If this content value is a string or text type, then the string/text is UTF-8 encoded in the stream.

        Returns:
        content as binary stream or null if no content exists
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getContentAsCharacterStream

        Reader getContentAsCharacterStream()
        Gets the content as character stream. If no content exists, then null will be returned.
        Returns:
        content as character stream or null if no content exists
        Throws:
        UnsupportedOperationException - if datatype of value is not TEXT
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getContentAsByteArray

        byte[] getContentAsByteArray()
        Allows to get binary content directly as an array of bytes. If no content exists, then null will be returned.

        If this content value is a string or text type, then the string/text is UTF-8 encoded in the byte array.

        Returns:
        the content of this value as a byte array or null if no content exists
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.
      • setContent

        void setContent​(String content)
        Sets the content from a string
        Parameters:
        content - The content to set, can be null
        Throws:
        UnsupportedOperationException - if the datatype of this value is not STRING
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • setContent

        void setContent​(InputStream content,
                        int contentLength)
        Sets the content from a binary stream. If contentLength is given as 0 (i.e. read all) then the stream will be closed as soon as the content is read, which means that the stream will be closed upon return. If contentLength is > 0 then the stream will still be open when the method returns.
        Parameters:
        content - The content to set, can be null
        contentLength - length of the content to read and write (in bytes), 0 -> to end
        Throws:
        UnsupportedOperationException - if the datatype of this value is not BINARY
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • setContent

        void setContent​(Reader content,
                        int contentLength)
        Sets the content from a character stream. If contentLength is given as 0 (i.e. read all) then the reader will be closed as soon as the content is read, which means that the reader will be closed upon return. If contentLength is > 0 then the reader will still be open when the method returns.
        Parameters:
        content - The content to set, can be null
        contentLength - length of the content to read and write (in chars), 0 -> to end
        Throws:
        UnsupportedOperationException - if the datatype of this value is not TEXT
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • importContentFromFile

        void importContentFromFile​(File file,
                                   String encoding)
                            throws IOException
        Import the content from a file. If this value has a non-image (i.e. non-binary) type, then the encoding of the file will be important. It should thus be provided, if non-binary data is read. If encoding is not provided, the platform's default encoding will be used.
        Parameters:
        file - the file to import
        encoding - the encoding of the file to be read (may be null, in which case the platform's default encoding will be assumed). if this value's datatype is "image", the encoding will not be considered.
        Throws:
        IOException - if file could not be read
        UnsupportedEncodingException - if provided encoding is not supported
        UnsupportedOperationException - if the datatype of this value is neither TEXT nor BINARY
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • exportContentToFile

        void exportContentToFile​(File file,
                                 String encoding)
                          throws IOException
        Exports the content to a file using the provided character encoding. If this value is not a character-based type (i.e. of type "image"), the encoding will be ignored. If no encoding is provided, the platform's default encoding will be used by exporting. If the provided file already exists it will be overwritten.
        Parameters:
        file - the file to write to
        encoding - the encoding of the file to be written (may be null, in which case the platform's default encoding will be assumed). If this value's datatype is "image", the encoding will be ignored.
        Throws:
        IOException - if file could not be read
        UnsupportedEncodingException - if provided encoding is not supported
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • delete

        void delete()
        Deletes this content object value
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • isValid

        default boolean isValid()
        Returns true if the entry is valid. False, if the entry is invalid and should no longer be used. E.g. the entry was deleted and this instance should no longer be used.
        Returns:
        True if the entry is valid. False, if the entry is invalid.
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.