Package org.alfresco.repo.jscript
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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ScriptContentData(ContentData contentData, QName property)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddelete()Delete the content streamStringgetContent()StringgetDownloadUrl()StringgetEncoding()InputStreamgetInputStream()StringgetMimetype()ReadergetReader()longgetSize()StringgetUrl()voidguessEncoding()Guess the character encoding of a file.voidguessMimetype(String filename)Guess the mimetype for the given filename - uses the extension to match on system mimetype mapbooleanisDirty()voidsetContent(String content)Set the content streamvoidsetEncoding(String encoding)voidsetMimetype(String mimetype)voidwrite(InputStream inputStream)Set the content stream from another input stream.voidwrite(org.springframework.extensions.surf.util.Content content)Set the content stream from another content object.voidwrite(org.springframework.extensions.surf.util.Content content, boolean applyMimetype, boolean guessEncoding)Deprecated.voidwrite(org.springframework.extensions.surf.util.Content content, boolean applyMimetype, boolean guessEncoding, String fileName)Set the content stream from another content object.
-
-
-
Constructor Detail
-
ScriptContentData
public ScriptContentData(ContentData contentData, QName property)
Constructor- Parameters:
contentData- The ContentData object this object wrapsproperty- The property the ContentData is attached too
-
-
Method Detail
-
getContent
public String getContent()
- Specified by:
getContentin interfaceorg.springframework.extensions.surf.util.Content
-
getInputStream
public InputStream getInputStream()
- Specified by:
getInputStreamin interfaceorg.springframework.extensions.surf.util.Content
-
getReader
public Reader getReader()
- Specified by:
getReaderin interfaceorg.springframework.extensions.surf.util.Content
-
isDirty
public boolean isDirty()
- Returns:
trueif the contentData has a binary (content URL) associated and the updates on contentData and related properties should be saved.falseif 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 setapplyMimetype- If true, apply the mimetype from the Content object, else leave the original mimetypeguessEncoding- 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 setapplyMimetype- If true, apply the mimetype from the Content object, else leave the original mimetypeguessEncoding- 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:
getSizein interfaceorg.springframework.extensions.surf.util.Content
-
getMimetype
public String getMimetype()
- Specified by:
getMimetypein interfaceorg.springframework.extensions.surf.util.Content
-
getEncoding
public String getEncoding()
- Specified by:
getEncodingin interfaceorg.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.
-
-