문제

I'm trying to use the Alfresco OpenCMIS Extension for aspects in a Groovy script.

I'd like to be able to set an aspect on a document, but when I try to cast a Document as AlfrescoDocument, it throws an error. I'm pointing Groovy to the Alfresco Chemistry jar files that ship with Alfresco 4.1.5

I can create a document and look at the properties of it, but when I try to convert it to an AlfrescoDocument, it throws an error.

import org.apache.chemistry.opencmis.commons.*
import org.apache.chemistry.opencmis.commons.data.*
import org.apache.chemistry.opencmis.client.api.*
import org.apache.chemistry.opencmis.client.runtime.*
import org.alfresco.cmis.client.*;
import org.alfresco.cmis.client.impl.*;

def doc = (Document) session.getObject(id);
def adoc = (AlfrescoDocument) doc;

.

Caught: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object   'org.apache.chemistry.opencmis.client.runtime.DocumentImpl@3e0339' with class  'org.apache.chemistry.opencmis.client.runtime.DocumentImpl' to class 'org.alfresco.cmis.client.AlfrescoDocument'
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object  'org.apache.chemistry.opencmis.client.runtime.DocumentImpl@3e0339' with class 'org.apache.chemistry.opencmis.client.runtime.DocumentImpl' to class 'org.alfresco.cmis.client.AlfrescoDocument'
도움이 되었습니까?

해결책

Found the answer. The session needs to be wired to be able to use the Alfresco Extension:

parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top