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;
}
}
05-28-2014 11:34 AM
System.out.println(content.getUrl());
05-29-2014 04:23 AM
05-29-2014 05:30 AM
05-29-2014 06:15 AM
alfrescoEPhttp://10.0.0.162:8081/alfresco/soapapi
org.alfresco.webservice.util.WebServiceException: Unable to get content as inputStream.
at org.alfresco.webservice.util.ContentUtils.getContentAsInputStream(ContentUtils.java:139)
at com.rtq.dms.AlfrescoDmsManagement.fetchFile(AlfrescoDmsManagement.java:215)
at com.rtq.processinitiator.servlets.downloadServlet.service(downloadServlet.java:41)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at sun.reflect.GeneratedMethodAccessor457.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67)
at com.sun.proxy.$Proxy527.doFilter(Unknown Source)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:165)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:74)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.NullPointerException
at org.alfresco.webservice.util.ContentUtils.getContentAsInputStream(ContentUtils.java:132)
… 34 more
05-29-2014 07:05 AM
System.out.print(AuthenticationUtils.getAuthenticationDetails().getSessionId());
05-28-2014 05:35 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.