0
votes

So I've read about how apps for alfresco share can query data with jquery cmis on pages like http://blog.productivist.com/query-alfresco-using-cmis-and-jquery/

But what if I want to do the exact opposite? I've got a webapp that after receiving input from a user wants to change the value of custom property within a custom aspect(both there and working) of a predefined document in alfresco share. So far I haven't found any examples of actually changing things on alfresco using jquery ajax cmis.

So basicly can someone point me into the right direction as to change the property value trough jquery ajax cmis? Due to circumstances the deadline is already tomorrow morning and this is the only thing I wasn't done with yet, so fast help is very appreciated :D

Thanks for taking the time to read this!

1
What version of Alfresco are you using? The Browser Binding (JSON) for CMIS only came in with CMIS v1.1, so older versions of Alfresco which only supported CMIS v1.0 won't have it - Gagravarr
With a tight deadline, you might be better off just posting to the forms service, look at how the inline editing or title properties works from in Share. Otherwise, upgrade to 4.2.d (came out a couple of days ago), and use the JSON/Browser Binding of CMIS with that. See something like this to get started - Gagravarr
As I'm already using a python webservice on localhost to circumvent the cross-domain call for getting some data for the user from an external application with jQuery ajax. So I was thinking perhaps passing this python webservice the property in question, letting the python execute if(alfDoc.hasAspect("P:sc:customAspectofMine")) { Map<String, Object> properties = new HashMap<String, Object>(); properties.put("sc:customPropertyOfMine", ThePropertyValuePassedByPython); alfDoc.updateProperties(properties); } in java on OpenCMS client with Alfresco OpenCMIS Extension - MrHappy
So since I'm a total newbie to the CMIS client I'm not sure how to let python do that. Do I start the client with an argument which is a file with the this code in it? Newbie question I know xD - MrHappy
The exact code would be Document doc = (Document) session.getObject(...); AlfrescoDocument alfDoc = (AlfrescoDocument) doc; Map<String, Object> properties = new HashMap<String, Object>(); properties.put("sc:AttachmentType", ThePropertyValuePassedByPython); properties.put("sc:ItemID", ThePropertyValuePassedByPython2); alfDoc.updateProperties(properties) though I have no idea what to put in (Document) session.getObject(...); so far - MrHappy

1 Answers

1
votes

I agree with Gagravarr. Either use the form service, and skip CMIS altogether, see the docs, or because you are already in Python, grab cmislib as well as alfcmislib, which is the Python equivalent of the Alfresco OpenCMIS Extension, and use it to set the values.