This customer support case offers a tweak to our code to get it to play nice with Open Text. Addressing this ticket comes in 2 parts:
1. Ask [Deleted] Fagan if we're even allowed by legal to use the code offered to us here.
2. Assuming we're allowed, test the code with FileNet and AlFresco and deliver it only if it works with these CMS.
Here's the description on the CS ticket....
A Proof-Of-Concept (POC) was implemented on the CPIN project, where it was demonstrated that C�ram-CMIS integrates successfully with the OpenText Content Management System. However, a few extensions were made to the CMIS Infrastructure code in order to successfully integrate with OpenText for document creation, retrieval and modification. This Support Case describes the extensions, so they can be tested and if possible, introuced in a future release of the product.
Submitter Steps to Reproduce:
1) For document creation: The following java class - EJBServer/components/CMISInfrastructure_src/curam/cmis/client/chemistry/doc/impl/CMISDocumentUpload.java
contains a call to the setContentStream() method on the Document Object.
// check out and update with file content
ObjectId pwcObjectId = doc.checkOut();
Document pwc = (Document) this.sessionHolder.session().getObject(pwcObjectId);
pwc.setContentStream(contentStream, true);
Since the content stream does not exist at the time of this method call and since the repository has to create the content stream with this method call, we had to change boolean flag to FALSE in the method call. Additionally, a call to the setContentStream() on the checked out document was causing the OpenText Content Server to throw an 'Internal Server Error' Exception. Debugging the code and analysing the HTTP traffic between C�ram and OpenText (with the help of WireShark) did not reveal any helpful information regarding this Exception. Interestingly, on introducing exception handling on the client side, it was verified that this exception had no impact on successfully filing (creating) the document on the Content Server. Therefore, in the above code snippet, the call to the setContentStream() was refactored and rewritten as -
try {
pwc.setContentStream(contentStream, false);
} catch {CmisRuntimeException ex) {
// Intentionally ignore this exception from OpenText
}
2) For document modification: The following code snipped in the java class -
EJBServer/components/CMISInfrastructure_src/curam/cmis/client/chemistry/doc/impl/CMISDocumentReplace.java had to be refactored in order to successfully update documents on the OpenText Content Server.
List parents = doc.getParents();
List parentsUnderRoot = new ArrayList();
for (Folder folder: parents) {
if (folder.getPath().startsWith(withinFolder)) {
parentsUnderRoot.add(folder);
}
}
// While customers are free to use multi-filing, there is one restriction.
// There must be only one location within the root folder specified.
if (parentsUnderRoot.size() == 0) {
throw new FileNotFoundException(cmisFilename + "|" + withinFolder + "|" + objectID);
} else if (parentsUnderRoot.size() > 1) {
throw new CMISMultiFilingException(cmisFilename, withinFolder, objectID);
}
StringBuffer filepath = new StringBuffer(parentsUnderRoot.get(0).getPath());
filepath.append('/');
filepath.append(cmisFilename);
In the above code, the method getParents() on the object of type FileableCmisObject incorrectly returns only the root C�ram directory (this is the root directory set as part of the system admin properties) and does not return a list of parent folders that contain the document. As a fix, the code above was replaced with the following code snippet:
// Get the complete path to the document
StringBuffer filepath = new StringBuffer(getDocumentPath(doc.getId()));
/* Where getDocumentPath(documentID) was defined
as a private method in the same class as follows - */
private String getDocumentPath(final String documentId) throws FileNotFoundException {
try {
CmisObject cmisObject = sessionHolder.session().getObject(documentId);
Document object = (Document) cmisObject;
return object.getParents().get(0).getPath() + "/" + object.getName();
} catch(CmisObjectNotFoundException ex) {
AppException e1 = new AppException(..., ex);
e1.setStackTrace(ex.getStackTrace());
e1.setLoggable(true);
throw e1;
}
}
This code returns the complete path to the document on the Content Server starting from the C�ram root directory. This ensured that the document was updated successfully. I have attached a draft of the POC findings which describes the above extensions to the OOTB CMIS Infrastructure code. Please refer to the doc for more detailed explanations of the extensions that had to be made to successfully integrate with OpenText using the CMIS infrastrucure on the CPIN project. Thanks!
Hi,
We acknowledge that this is a valid enhancement request. It will be considered for inclusion in a future release of the product. Thank you for your interest in the Cúram product.
Thanks,
Eloise O'Riordan, Cúram SPM Offering Management team