03-20-2014 09:52 AM
…
NodeRef nodeDocument = resultSetAllDocuments.getChildAssocRef(0).getChildRef();
ContentService contentService = serviceRegistry.getContentService();
ContentReader contentReader = contentService.getReader(nodeDocument, ContentModel.PROP_CONTENT);
InputStream is = contentReader.getContentInputStream();
Properties myProps = new Properties();
myProps.load(is);
…
Error: org.alfresco.service.cmr.repository.ContentIOException: 02200007 Failed to open stream onto channel:
accessor: ContentAccessor[ contentUrl=store://2014/3/20/14/21/cd19ab69-aaa1-43f1-b17b-caa646bc8965.bin, mimetype=text/plain, size=206, encoding=UTF-8, locale=en_US]
contentReader.getContentString();
mySetting1 = 123
mySetting2 = abc
mySetting3 = false
03-21-2014 11:30 AM
public class NodeContentGet extends DeclarativeWebScript {
private static final String PARAM_CONTENT = "content";
private NodeService nodeService;
private ContentService contentService;
public void setContentService(ContentService contentService) {
this.contentService = contentService;
}
public void setNodeService(NodeService nodeService) {
this.nodeService = nodeService;
}
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req,
Status status, Cache cache) {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, String> templateVars = req.getServiceMatch()
.getTemplateVars();
StoreRef store = new StoreRef(templateVars.get("store_type"),
templateVars.get("store_id"));
NodeRef nodeRef = new NodeRef(store, templateVars.get("id"));
if (!nodeService.exists(nodeRef)) {
String error = "Could not find node: " + nodeRef;
throw new WebScriptException(Status.STATUS_NOT_FOUND, error);
}
String contents;
ContentReader reader = contentService.getReader(nodeRef,
ContentModel.PROP_CONTENT);
if (reader != null) {
contents = reader.getContentString();
} else {
// No content was stored in the version history
contents = "";
}
model.put(PARAM_CONTENT, contents);
return model;
}
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.