MOB-356: CMIS Spec - deleteContentStream()

- AtomPub binding
- added testContentStreamEmpty()
- added testContentStreamDelete()
- some spec issues raised for CMIS TC

- also added delete() to ScriptContentData

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14643 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2009-06-10 17:55:40 +00:00
parent 2051b0709a
commit b9dd81cf3a

View File

@@ -27,6 +27,7 @@ package org.alfresco.repo.jscript;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Serializable;
import java.text.MessageFormat;
@@ -2814,6 +2815,29 @@ public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResol
this.contentData = (ContentData) services.getNodeService().getProperty(nodeRef, this.property);
}
/**
* Delete the content stream
*/
public void delete()
{
ContentService contentService = services.getContentService();
ContentWriter writer = contentService.getWriter(nodeRef, this.property, true);
OutputStream output = writer.getContentOutputStream();
try
{
output.close();
}
catch (IOException e)
{
// NOTE: fall-through
}
writer.setMimetype(null);
writer.setEncoding(null);
// update cached variables after putContent()
this.contentData = (ContentData) services.getNodeService().getProperty(nodeRef, this.property);
}
/**
* @return download URL to the content
*/