Class ScriptNode.ScriptContentData

  • All Implemented Interfaces:
    java.io.Serializable, org.springframework.extensions.surf.util.Content
    Enclosing class:
    ScriptNode

    public class ScriptNode.ScriptContentData
    extends java.lang.Object
    implements org.springframework.extensions.surf.util.Content, java.io.Serializable
    Inner class wrapping and providing access to a ContentData property
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ScriptContentData​(org.alfresco.service.cmr.repository.ContentData contentData, org.alfresco.service.namespace.QName property)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void delete()
      Delete the content stream
      java.lang.String getContent()  
      java.lang.String getDownloadUrl()  
      java.lang.String getEncoding()  
      java.io.InputStream getInputStream()  
      java.lang.String getMimetype()  
      java.io.Reader getReader()  
      long getSize()  
      java.lang.String getUrl()  
      void guessEncoding()
      Guess the character encoding of a file.
      void guessMimetype​(java.lang.String filename)
      Guess the mimetype for the given filename - uses the extension to match on system mimetype map
      boolean isDirty()  
      void setContent​(java.lang.String content)
      Set the content stream
      void setEncoding​(java.lang.String encoding)  
      void setMimetype​(java.lang.String mimetype)  
      void write​(java.io.InputStream inputStream)
      Set the content stream from another input stream.
      void write​(org.springframework.extensions.surf.util.Content content)
      Set the content stream from another content object.
      void write​(org.springframework.extensions.surf.util.Content content, boolean applyMimetype, boolean guessEncoding)
      Set the content stream from another content object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScriptContentData

        public ScriptContentData​(org.alfresco.service.cmr.repository.ContentData contentData,
                                 org.alfresco.service.namespace.QName property)
        Constructor
        Parameters:
        contentData - The ContentData object this object wraps
        property - The property the ContentData is attached too
    • Method Detail

      • getContent

        public java.lang.String getContent()
        Specified by:
        getContent in interface org.springframework.extensions.surf.util.Content
      • getInputStream

        public java.io.InputStream getInputStream()
        Specified by:
        getInputStream in interface org.springframework.extensions.surf.util.Content
      • getReader

        public java.io.Reader getReader()
        Specified by:
        getReader in interface org.springframework.extensions.surf.util.Content
      • isDirty

        public boolean isDirty()
        Returns:
        true if the contentData has a binary (content URL) associated and the updates on contentData and related properties should be saved. false if the contentData has a temporary value and no actual binary to be persisted.
      • setContent

        public void setContent​(java.lang.String content)
        Set the content stream
        Parameters:
        content - Content string to set
      • write

        public void write​(org.springframework.extensions.surf.util.Content content)
        Set the content stream from another content object.
        Parameters:
        content - ScriptContent to set
      • write

        public void write​(org.springframework.extensions.surf.util.Content content,
                          boolean applyMimetype,
                          boolean guessEncoding)
        Set the content stream from another content object.
        Parameters:
        content - ScriptContent to set
        applyMimetype - If true, apply the mimetype from the Content object, else leave the original mimetype
        guessEncoding - If true, guess the encoding from the underlying input stream, else use encoding set in the Content object as supplied.
      • write

        public void write​(java.io.InputStream inputStream)
        Set the content stream from another input stream.
        Parameters:
        inputStream - InputStream
      • delete

        public void delete()
        Delete the content stream
      • getUrl

        public java.lang.String getUrl()
        Returns:
        download URL to the content
      • getDownloadUrl

        public java.lang.String getDownloadUrl()
        Returns:
        download URL to the content for a document item only
      • getSize

        public long getSize()
        Specified by:
        getSize in interface org.springframework.extensions.surf.util.Content
      • getMimetype

        public java.lang.String getMimetype()
        Specified by:
        getMimetype in interface org.springframework.extensions.surf.util.Content
      • getEncoding

        public java.lang.String getEncoding()
        Specified by:
        getEncoding in interface org.springframework.extensions.surf.util.Content
      • setEncoding

        public void setEncoding​(java.lang.String encoding)
      • setMimetype

        public void setMimetype​(java.lang.String mimetype)
      • guessMimetype

        public void guessMimetype​(java.lang.String filename)
        Guess the mimetype for the given filename - uses the extension to match on system mimetype map
      • guessEncoding

        public void guessEncoding()
        Guess the character encoding of a file. For non-text files UTF-8 default is applied, otherwise the appropriate encoding (such as UTF-16 or similar) will be appiled if detected.