07-11-2008 11:37 AM
VersionHistory versionHistory = WebServiceFactory.getAuthoringService().getVersionHistory(ReferenceFactory.newReference(uuid, nodePath));
Version[] versions = versionHistory.getVersions();
for(Version nodeVersion : versions) {
if(nodeVersion.getLabel().equals(version)) {
InputStream result = null;
Reference reference = new Reference(new Store(Constants.WORKSPACE_STORE, "lightWeightVersionStore"), nodeVersion.getId().getUuid(), nodeVersion.getId().getPath());
Predicate predicate = new Predicate(new Reference[] { reference }, new Store(Constants.WORKSPACE_STORE, "lightWeightVersionStore"), null);
Content[] contents = WebServiceFactory.getContentService().read(predicate, Constants.TYPE_CONTENT);
result = ContentUtils.getContentAsInputStream(contents[0]);
return result;
}
}
08-05-2008 08:25 AM
08-06-2008 04:53 AM
org.alfresco.webservice.util.WebServiceException: Unable to get content as inputStream.
at org.alfresco.webservice.util.ContentUtils.getContentAsInputStream(ContentUtils.java:128)
at com.excilys.alfresco.service.impl.ContentService.getContentAsInputStream(ContentService.java:281)
at com.excilys.alfresco.service.impl.ContentServiceTest.getContentAsInputStreamShouldShould(ContentServiceTest.java:215)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:75)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:36)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.net.MalformedURLException: no protocol: null?ticket=TICKET_ef650f26-6394-11dd-849f-c75dd430314d
at java.net.URL.<init>(URL.java:583)
at java.net.URL.<init>(URL.java:480)
at java.net.URL.<init>(URL.java:429)
at org.alfresco.webservice.util.ContentUtils.getContentAsInputStream(ContentUtils.java:122)
… 22 more
08-07-2008 05:41 AM
08-10-2008 07:38 AM
08-28-2008 03:28 AM
08-28-2008 03:54 AM
08-29-2008 11:49 AM
11-27-2009 03:16 AM
[2009-11-27 06:08:12] exporting version 1.1 for randomdocument.doc (229.50 kB)
[2009-11-27 06:08:12] exporting version 1.0 for randomdocument.doc (0.00 B)
[2009-11-27 06:08:12] ////////// Exception Class: class org.alfresco.webservice.util.WebServiceException
[2009-11-27 06:08:12] ////////// Exception Message: Unable to get content as inputStream.
[2009-11-27 06:08:12] ////////// Exception Cause: java.net.MalformedURLException: no protocol: null?ticket=TICKET_eecd68c090194b694b7ac81aedac32c92fcccc79
private Store versionStore = new Store("versionStore", "lightWeightVersionStore");
05-28-2014 05:30 AM
public InputStream fetchFile( String alfrescoPath) throws Exception
{
InputStream is = null;
if(null!=alfrescoPath )
{
AuthenticationDetails details= WebServiceClient.startSession(getAlfUser(0), getAlfPassword(0));
try
{
Store store = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
Reference nodeRef = new Reference(store, null, alfrescoPath);
Content[] contArr = WebServiceClient.getContentService(details).read(new Predicate(new Reference[] { nodeRef }, store, null), Constants.PROP_CONTENT);
Content content = contArr[0];
is = ContentUtils.getContentAsInputStream(content);
}
finally
{
WebServiceClient.endSession(details);
}
}
return is;
}
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.