01-08-2013 07:40 PM
public static Content download(String name, Reference folder,
AuthenticationDetails session) throws NodeAlfrescoException {
Content content = null;
try {
AuthenticationUtils.setAuthenticationDetails(session);
String alfrescoRoot = Utils.appProperties().getProperty("alfresco.url");
alfrescoRoot += "api";
WebServiceFactory.setEndpointAddress(alfrescoRoot);
Reference ref = new Reference(STORE, null, folder.getPath()
+ "/cm:" + name);
Content[] read = getContentService().read(
new Predicate(new Reference[]{ref}, STORE, null),
Constants.PROP_CONTENT);
content = read[0];
} catch (Exception e) {
e.printStackTrace();
throw new NodeAlfrescoException();
}
return content;
}
Please any help01-09-2013 04:30 PM
public static OutputStream download(String name, Reference folder,
AuthenticationDetails session, boolean f) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
AuthenticationUtils.setAuthenticationDetails(session);
String alfrescoRoot = Utils.appProperties().getProperty(
"alfresco.url");
alfrescoRoot += "api";
WebServiceFactory.setEndpointAddress(alfrescoRoot);
WebServiceFactory.setTimeoutMilliseconds(120000);
Reference ref = new Reference(STORE, null, folder.getPath()
+ "/cm:" + name);
Content[] read = getContentService().read(
new Predicate(new Reference[] { ref }, STORE, null),
Constants.PROP_CONTENT);
Content content = read[0];
ContentUtils.copy(ContentUtils.getContentAsInputStream(content), out);
return out;
}
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.