We are using CS SDK 2.0 , looking to use CMIS to keep versionning of .indd file. The uss case as following:
the problem there is no sufficent sample code for, even was thinking to use Adobe Drive, but there is no Adobe Drive SDK for Flex.
i used to fuse the sdk, but
| private function getFileByPath(sPath:String):Fileable { | |||||||||
| appStatus = ">> get File By Path"; | |||||||||
| message = ""; | |||||||||
| viewEnabled = false; | |||||||||
| var request:GetObjectByPathRequest = new GetObjectByPathRequest(session); | |||||||||
| var oFileable:Fileable; | |||||||||
| request.path = sPath; | |||||||||
| request.execute(onSuccess, onError); | |||||||||
| function onSuccess (event:GetObjectByPathResponse) : void { | |||||||||
| oFileable = event.object; | |||||||||
| //var oDoc2:Document = new Document(event.object); | |||||||||
| doc = event.object as Document ; | |||||||||
| //children = new ArrayCollection(vectorToArray(event.target)); | |||||||||
| appStatus = ">> getFileByPath : Success"; | |||||||||
| viewEnabled = true; | |||||||||
| } | |||||||||
| return oFileable; | |||||||||
| } | |||||||||
| private function checkOutFile(oFile:Document):Document{ | |||||||||
| appStatus = ">> Check Out File"; | |||||||||
| message = ""; | |||||||||
| viewEnabled = false; | |||||||||
| var request:CheckoutRequest = new CheckoutRequest(session); | |||||||||
| request.object = doc; | |||||||||
| var oDocument:Document; | |||||||||
| request.execute(onSuccess, onError); | |||||||||
| function onSuccess (event:CheckoutResponse) : void { | |||||||||
| oDocument = event.object ; | |||||||||
| appStatus = ">> Check Out File : Success"; | |||||||||
| viewEnabled = true; | |||||||||
| } | |||||||||
| return oDocument; | |||||||||
| } |
private function openTestFile():void {
appStatus = "Open Test File";
message = "";
viewEnabled = false;
var oFile:Fileable = getFileByPath("/Collaboration/test.indd");
//var oDoc2:Document = new Document(oFile);
var oDoc:Document = checkOutFile(doc);
}
i do not know what method in the CS SDK to open document fom active window and how to map CMIS Document to com.adobe.indesign Document ?
Adobe Drive is not scriptable so it is not an option here. But you can use the CMIS library swc to achieve what you want to do. A sample project - CMISWorkflow - for ExtensionBuilder 2 is attached.
You want to stucture your code so that the classes that deal with InDesign and those that deal with the CMIS library are distinct so that the collision on the Document type name (InDesign versus CMIS) is less confusing. In the sample code the InDesignController deals with InDesign documents and the CMISController deals with CMIS documents.
To integrate the distinct layers you can use a local file cache class such as FileCache in the sample code. Documents are downloaded from the CMIS repository and cached in files in a well known location on your local filesystem - under the ~/CMISWorkflow/cache folder in the case of the sample.
You can map from a CMIS document to an InDesign document as follows:
1) Download the CMIS document's content stream into a flash.filesystem.File on your local drive. The approach taken by the sample code is to reflect the structure of the remote repository in the structure of the local cache - so a file with a path /foo/bar.indd on the server gets downloaded into ~/CMISWorkflow/cache/foo/bar.indd. Then it is easy to map from local path to the associated path on the CMIS server.
2) Use InDesign.app.open() to open the file as an InDesign Document.
Entries in the sample FileCache are keyed by the local file. You can store the CMIS document object associated with a file being edited in the FileCache so that you can check it back in later.
Hope this info helps you get started.
Best regards,
Seoras
Dear
There is an issue when export new pdf triggered by onSave , the following trace raise
nSave: afterSave [object Document]
saveHandler: [IndexEvent type="documentSaved" document=[object Document] bubbles=false cancelable=false eventPhase=2]
8/30/2012 13:04:05.168 [INFO] CSAWLib.CSLogger TypeConUtils.getAnyPossibleClassDefinitionFor() Failed to find any class definition for com.adobe.indesign::File
8/30/2012 13:04:05.169 [INFO] CSAWLib.CSLogger TypeConUtils.getAnyPossibleClassDefinitionFor() Failed to find any class definition for com.adobe.indesign::File
upload: \Collaboration\test2.indd.pdf
Creating document at path: \Collaboration\test2.indd.pdf
ERROR: GetObjectByPathRequest has invalid arguments(400)
i am usuing a local Nuxeo DAM server ...
i think this error raise in the following line
[line 164] var getObjectRequest:GetObjectByPathRequest = new GetObjectByPathRequest(_session);
in CMISController.as
any idea ?
Dear Seoras
i fixed the to return the cmis path:
public function resolveRemotePath(file:File):String
{
if (file.nativePath.indexOf(LOCAL_FILE_CACHE.nativePath) != 0)
return null;
var remoptePath:String =file.nativePath.substr(LOCAL_FILE_CACHE.nativePath.length);
trace("resolveRemotePath [11] : "+ remoptePath);
if(File.separator!="/") {
//var pattern:RegExp = /(\/)/g;
var pattern:RegExp = /(\\)/g;
remoptePath = remoptePath.replace(pattern ,"/");
trace("resolveRemotePath [22] : "+ remoptePath);
}
return remoptePath;
}
i have another issue, why everytime update the generated pdf it creates new pdf file with same name in the cmis repo .. does the pdf is not updatable over the cmis service ???
Regards
Step through the upload code in the debugger.
Are you somehow calling CreateDocumentRequest repeatedly with a path that already exists in the server? That seems the most likely cause of what you are observing. There is a call to GetObjectByPathRequest that should fail if the document does not already exist and needs to be created. Is that logic working?
Or are you saying that calling SetContentStreamRequest on an existing document causes a new document with the same name to be created in your server?
Seoras
yes i run the extension through the debugger ,, you think that the issue ??
i use ur code as it is .. i make changes to the indesign file and make save several time, each time new pdf uploaded with the same name up to your implemented senario.
the use case is, as we use cmis to keep versionning of InDesign file, we have also to keep versionning of generated exported .pdf and .swf. i still examine your code .. did not change any, do i have to check put the previous generated pdf, and stream the new pdf to the old version remote .pdf then check in ???
Best Regards
North America
Europe, Middle East and Africa
Asia Pacific