Class ScriptNode.ScriptContentData

java.lang.Object
org.alfresco.repo.jscript.ScriptNode.ScriptContentData
All Implemented Interfaces:
Serializable, org.springframework.extensions.surf.util.Content
Enclosing class:
ScriptNode

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

    • ScriptContentData

      public ScriptContentData(ContentData contentData, QName property)
      Constructor
      Parameters:
      contentData - The ContentData object this object wraps
      property - The property the ContentData is attached too
  • Method Details

    • getContent

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

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

      public 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(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

      @Deprecated public void write(org.springframework.extensions.surf.util.Content content, boolean applyMimetype, boolean guessEncoding)
      Deprecated.
      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(org.springframework.extensions.surf.util.Content content, boolean applyMimetype, boolean guessEncoding, String fileName)
      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.
      fileName - The filename for the attachment.
    • write

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

      public void delete()
      Delete the content stream
    • getUrl

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

      public 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 String getMimetype()
      Specified by:
      getMimetype in interface org.springframework.extensions.surf.util.Content
    • getEncoding

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

      public void setEncoding(String encoding)
    • setMimetype

      public void setMimetype(String mimetype)
    • guessMimetype

      public void guessMimetype(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.