0

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!

MrHappy
  • 81
  • 1
  • 1
  • 10
  • 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 Sep 04 '13 at 11:12
  • 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](https://weblogs.java.net/blog/manningpubs/archive/2013/07/02/browser-binding-cmis-repository) to get started – Gagravarr Sep 04 '13 at 14:27
  • 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 properties = new HashMap(); properties.put("sc:customPropertyOfMine", ThePropertyValuePassedByPython); alfDoc.updateProperties(properties); }` in java on OpenCMS client with **Alfresco OpenCMIS Extension** – MrHappy Sep 04 '13 at 15:43
  • 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 Sep 04 '13 at 15:46
  • The exact code would be `Document doc = (Document) session.getObject(...); AlfrescoDocument alfDoc = (AlfrescoDocument) doc; Map properties = new HashMap(); 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 Sep 04 '13 at 16:10
  • If you want to go with CMIS, I'd strongly suggest buying the book "CMIS and Apache Chemistry in Action", that'll explain all of that, and tell you how to do it with Java, JS, Python etc. You can get it as an ebook and start reading straight away! – Gagravarr Sep 04 '13 at 16:35

1 Answers1

1

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.

Jeff Potts
  • 10,468
  • 17
  • 40