Hi All,
I was able to implement CTS Custom Plugin sucessfully. But I have a requirement to attach multiple renditions(JPEGs) to source document. To attach multiple renditions to the primary content, we have to follow the instructions given in CTS development Guide and provide a Custom task for pre and post processing of transformation request. In that they have to override the createRenditionOnSourceDocument(...) method to process multiple results.
My executeProfile() has the following code to prepare CTSResult.
File folder = new File(_outputFilePath);
_logger.debug("folder : "+ folder);
File[] listOfFiles = folder.listFiles();
mpResults = new CTSResult[listOfFiles.length];
//mpResults = new CTSResult[1];
for (int index = 0; index < listOfFiles.length; index++)
{
if (listOfFiles[index].isFile())
{
files = listOfFiles[index].getName();
if (files.endsWith(".jpg") || files.endsWith(".JPG"))
{
mpResults[index] = new CTSResult(listOfFiles[index].getAbsolutePath(), new IContentAttrValue[0]);
}
}
}
And I have created custom CTSTask class and processing the CTSResult as follows. I have overriden execTx() method to handle multiple values in CTSResult and calling createRenditionOnSourceDocument() for each result.
protected void execTx() throws Exception
{
// Now that the plugin has completed,we need to add the transformed
// object(s) back into the repository or whetever else you want to do with the result..
if ( (_resultsToUse != null) && (_resultsToUse.length != 0))
{
_logger.debug("Values in _resultsToUse : "+_resultsToUse.length);
int resultCount=_resultsToUse.length;
for(int counter=0;counter < resultCount;counter++)
{
ICTSResult localmpResults[] = (ICTSResult[])null;
localmpResults = new CTSResult[1];
localmpResults[0]=_resultsToUse[counter];
//you can either call/override this method to add the media properties
addProperties(localmpResults,getOriginalTargetFormat(), getTargetPageModifier(), getOriginalDocument());
//or call/override this method to add renditions
createRenditionOnSourceDocument(localmpResults);
}
}
}
But it is failing with the following error:
com.documentum.cts.exceptions.internal.CTSServerTaskException: [DM_XFRM_E_NO_FMT_AVAIL]error: "Unable to find a rendition for test.indd with format jpeg on page 0"
Cause Exception was:
com.documentum.cts.exceptions.CTSException: [DM_XFRM_E_NO_FMT_AVAIL]error: "test.indd with format jpeg on page 0"
Cause Exception was:
DfException:: THREAD: Thread-65; MSG: [DM_XFRM_E_NO_FMT_AVAIL]error: "Unable to find a rendition for test.indd with format jpeg on page 0"; ERRORCODE: 100; NEXT: null
at com.documentum.fc.client.impl.docbase.DocbaseExceptionMapper.newException(DocbaseExceptionMapper.java:57)
at com.documentum.fc.client.impl.connection.docbase.MessageEntry.getException(MessageEntry.java:39)
at com.documentum.fc.client.impl.connection.docbase.DocbaseMessageManager.getException(DocbaseMessageManager.java:137)
at com.documentum.fc.client.impl.connection.docbase.netwise.NetwiseDocbaseRpcClient$TypedDataIterator.getNextBatch(NetwiseDocbaseRpcClient.java:1325)
at com.documentum.fc.client.impl.connection.docbase.netwise.NetwiseDocbaseRpcClient$TypedDataIterator.hasNext(NetwiseDocbaseRpcClient.java:1305)
at com.documentum.fc.client.impl.connection.docbase.DocbaseConnection$IteratorSynchronizer.hasNext(DocbaseConnection.java:1772)
at com.documentum.fc.client.impl.collection.TypedDataCollection.next(TypedDataCollection.java:131)
at com.documentum.fc.client.impl.collection.CollectionHandle.next(CollectionHandle.java:47)
at com.documentum.services.dam.impl.rendition.RenditionService.setRenditionProperties(RenditionService.java:420)
at com.documentum.cts.impl.services.task.CTSTaskBase.addMediaProperties(CTSTaskBase.java:830)
at com.documentum.cts.impl.services.task.CTSTask.addProperties(CTSTask.java:1884)
at com.documentum.cts.impl.services.task.CTSTask.addProperties(CTSTask.java:1802)
at com.custom.cts.impl.services.task.indesign.IndesignProcessor.execTx(IndesignProcessor.java:68)
at com.documentum.cts.impl.services.task.CTSTaskBase.doExecuteTx(CTSTaskBase.java:516)
at com.documentum.cts.impl.services.task.CTSTaskBase.run(CTSTaskBase.java:469)
at com.documentum.cts.impl.services.thread.CTSTaskRunnable.run(CTSTaskRunnable.java:207)
at java.lang.Thread.run(Thread.java:619)
I am not having any clue how to fix this error. Please let me know what could be the reason.