mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -27,6 +27,7 @@ package org.alfresco.repo.jscript;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
@@ -2814,6 +2815,29 @@ public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResol
|
|||||||
this.contentData = (ContentData) services.getNodeService().getProperty(nodeRef, this.property);
|
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
|
* @return download URL to the content
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user