WebScript: query fails
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2012 06:53 AM
Hi all,
I am new in webscripts. I have created the following components in /com/greenenergy/em/lab3/:
1. Descriptor xml
2. Controller js
3. Template ftl
I am getting the following error when I call the webscipt:
Please note the I have checked for the existence of geem:serialnum in the custom type geem:equipment. I am using alfresco 4 community.
Thanks!
I am new in webscripts. I have created the following components in /com/greenenergy/em/lab3/:
1. Descriptor xml
<webscript> <shortname>Get ConfigDoc Test</shortname> <description>Get ConfigDoc Test</description> <family>Green Energy</family> <url>/com/greenenergy/em/lab3/getconfigdoc/{serialnum}</url> <format default="html"/> <authentication>user</authentication></webscript>
2. Controller js
var serialnum = url.templateArgs["serialnum"];var docquery = 'select e.* from geem:equipment as e where e.geem:serialnum='+serialnum;var def = {query:docquery,language:"cmis-alfresco"};var results = search.query(def);if(results!=null) { doc = results[0]; model.docnode = doc; }else { status.redirect=true; status.code=401; status.message="Equipment document with serial number: " + serialnum + ", was not found!"; }
3. Template ftl
<a href="${url.serviceContext}/api/node/content/${docnode.nodeRef.storeRef.protocol}/${docnode.nodeRef.storeRef.identifier}/${docnode.nodeRef.id}/${docnode.name?url}">${docnode.name}</a>
I am getting the following error when I call the webscipt:
08260046 Wrapped Exception (with status template): 08260338 Failed to execute script '/com/greenenergy/em/lab3/getConfigDoc.get.js (in repository store workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions)': 08260337 Failed to execute search: select e.* from geem:equipment as e where e.geem:serialnum=77777
Please note the I have checked for the existence of geem:serialnum in the custom type geem:equipment. I am using alfresco 4 community.
Thanks!
Labels:
- Labels:
-
Archive
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2012 06:52 AM
Hi,
I am not familiar with CMIS query, but You can acheive the same with Lucene query.
I am not familiar with CMIS query, but You can acheive the same with Lucene query.
var serialnum = url.templateArgs["serialnum"];var results = search.luceneSearch("@geem\:serialnum:\"'+serialnum+"\""); if(results!=null){ doc = results[0]; model.docnode = doc;}else{ status.redirect=true; status.code=401; status.message="Equipment document with serial number: " + serialnum + ", was not found!";}
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2012 02:19 AM
Hi,
Thanks I have now got both queries working, the Lucene and cmis.
Thanks I have now got both queries working, the Lucene and cmis.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2012 02:30 AM
Hi,
I am following the example on the ff url : https://partage.inria.fr/share/service/script/org/alfresco/modules/create-event.get
It is failing with the following error:
I am following the example on the ff url : https://partage.inria.fr/share/service/script/org/alfresco/modules/create-event.get
It is failing with the following error:
09150016 Wrapped Exception (with status template): 09150114 Failed to execute script '/com/greenenergy/em/Calendar Event/create-event.get.js (in repository store workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions)': syntax error (workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions/com/greenenergy/em/Calendar Event/create-event.get.js#7)
in the ff javascript:<import resource="classpath:alfresco/site-webscripts/org/alfresco/callutils.js">if (args['uri']) { var uri = unescape(args['uri']); // Call the repo for the event information model.event = doGetCall(uri); model.edit = true;}else{ model.event = {}; model.event.what = model.event.location = model.event.description = ''; model.edit =false;}
