From 9fb99816e48459b4a1098c9fb6c467dada42d972 Mon Sep 17 00:00:00 2001 From: Roy Wetherall Date: Wed, 2 Apr 2008 16:34:20 +0000 Subject: [PATCH] Merged V2.1-A to HEAD 7698: Added transform method to content web service git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8662 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../content/ContentServiceSoapPort.java | 5 ++ .../repo/webservice/content/deploy.wsdd | 10 +++- .../webservice/content/ContentWebService.java | 58 +++++++++++++++++++ source/web/WEB-INF/server-config.wsdd | 18 +++--- source/wsdl/content-service.wsdl | 49 +++++++++++++++- 5 files changed, 129 insertions(+), 11 deletions(-) diff --git a/source/generated/org/alfresco/repo/webservice/content/ContentServiceSoapPort.java b/source/generated/org/alfresco/repo/webservice/content/ContentServiceSoapPort.java index 96f2fb4f30..d2f660793a 100644 --- a/source/generated/org/alfresco/repo/webservice/content/ContentServiceSoapPort.java +++ b/source/generated/org/alfresco/repo/webservice/content/ContentServiceSoapPort.java @@ -23,4 +23,9 @@ public interface ContentServiceSoapPort extends java.rmi.Remote { * Clears content from the repository. */ public org.alfresco.repo.webservice.content.Content[] clear(org.alfresco.repo.webservice.types.Predicate items, java.lang.String property) throws java.rmi.RemoteException, org.alfresco.repo.webservice.content.ContentFault; + + /** + * Transforms content from one mimetype to another. + */ + public org.alfresco.repo.webservice.content.Content transform(org.alfresco.repo.webservice.types.Reference source, java.lang.String property, org.alfresco.repo.webservice.types.Reference destinationReference, java.lang.String destinationProperty, org.alfresco.repo.webservice.types.ContentFormat destinationFormat) throws java.rmi.RemoteException, org.alfresco.repo.webservice.content.ContentFault; } diff --git a/source/generated/org/alfresco/repo/webservice/content/deploy.wsdd b/source/generated/org/alfresco/repo/webservice/content/deploy.wsdd index 3a83b0edda..4dc373ee9b 100644 --- a/source/generated/org/alfresco/repo/webservice/content/deploy.wsdd +++ b/source/generated/org/alfresco/repo/webservice/content/deploy.wsdd @@ -37,7 +37,15 @@ - + + + + + + + + + callback = new RetryingTransactionCallback() + { + public Content execute() throws Throwable + { + // Get the nodes and property qname's + NodeRef sourceNodeRef = Utils.convertToNodeRef(source, ContentWebService.this.nodeService, ContentWebService.this.searchService, ContentWebService.this.namespaceService); + NodeRef destinationNodeRef = Utils.convertToNodeRef(destinationReference, ContentWebService.this.nodeService, ContentWebService.this.searchService, ContentWebService.this.namespaceService); + QName sourceQName = QName.createQName(property); + QName destinationQName = QName.createQName(destinationProperty); + + // Get the content reader + ContentReader contentReader = ContentWebService.this.contentService.getReader(sourceNodeRef, sourceQName); + if (contentReader == null) + { + throw new AlfrescoRuntimeException("Source content does not exist. Transform could not take place."); + } + + // Get the content writer + ContentWriter contentWriter = ContentWebService.this.contentService.getWriter(destinationNodeRef, destinationQName, true); + contentWriter.setEncoding(destinationFormat.getEncoding()); + contentWriter.setMimetype(destinationFormat.getMimetype()); + + // Transform the content + ContentWebService.this.contentService.transform(contentReader, contentWriter); + + // Return the content object to the user + return createContent(destinationNodeRef, destinationProperty); + } + }; + return Utils.getRetryingTransactionHelper(MessageContext.getCurrentContext()).doInTransaction(callback); + } + catch (Throwable e) + { + if (logger.isDebugEnabled()) + { + logger.error("Unexpected error occurred", e); + } + throw new ContentFault(0, e.getMessage()); + } + + } } diff --git a/source/web/WEB-INF/server-config.wsdd b/source/web/WEB-INF/server-config.wsdd index cc178f82cf..a4ffdc0a1f 100644 --- a/source/web/WEB-INF/server-config.wsdd +++ b/source/web/WEB-INF/server-config.wsdd @@ -903,7 +903,15 @@ - + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + @@ -122,6 +142,14 @@ + + + + + + + + @@ -144,6 +172,12 @@ + + + Transforms content from one mimetype to another. + + + @@ -186,7 +220,20 @@ - + + + Transforms content from one mimetype to another. + + + + + + + + + + +