X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=org.argeo.slc.webapp%2Fsrc%2Fmain%2Fwebapp%2Fargeo-ria-lib%2Fslc%2Fclass%2Forg%2Fargeo%2Fslc%2Fria%2FSlcApi.js;h=3380e4063f91fc8f2f4b3c42a532bed5c5e0b350;hb=859114a86e3d1073b7b7aba89cee4224b8e897bf;hp=82486cf56fdd7f24412a080c84d2c899f5fbd355;hpb=fbb37515d94515993468c998516fe8341189ef84;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/SlcApi.js b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/SlcApi.js index 82486cf56..3380e4063 100644 --- a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/SlcApi.js +++ b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/SlcApi.js @@ -17,8 +17,15 @@ qx.Class.define("org.argeo.slc.ria.SlcApi", REMOVE_RESULT_FROM_COLL_SERVICE : "removeResultFromCollection.service", ADD_RESULT_TO_COLL_SERVICE : "addResultToCollection.service", LIST_COLLECTIONS_SERVICE : "listCollectionRefs.service", + COPY_COLLECTION_TO_COLL_SERVICE : "copyCollectionToCollection.service", LIST_RESULTS_SERVICE : "listResultAttributes.service", GET_RESULT_SERVICE : "getResult.service", + LIST_SLCEXEC_SERVICE : "listSlcExecutions.service", + + LIST_AGENTS_SERVICE : "listAgents.service", + LIST_MODULES_SERVICE : "listModulesDescriptors.service", + GET_EXECUTION_DESC_SERVICE : "getExecutionDescriptor.service", + AMQ_SERVICE : "amq", /** * Standard Request getter @@ -57,6 +64,29 @@ qx.Class.define("org.argeo.slc.ria.SlcApi", return request; }, + /** + * Remove a set of results from a collection. Either filtered by a given pattern, or the whole collection. + * @param collectionId {String} The id of the collection + * @param patternAttribute {String} An optional attribute name on which to filter + * @param patternValue {String} The pattern to use for filtering a subset of result + * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent + * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update + * @return {qx.io.remote.Request} The Request object + */ + getRemoveFromCollectionService : function(collectionId, patternAttribute, patternValue, fireReloadEventType, iLoadStatusables){ + var request = org.argeo.slc.ria.SlcApi.getServiceRequest( + org.argeo.slc.ria.SlcApi.REMOVE_RESULT_FROM_COLL_SERVICE, + fireReloadEventType, + iLoadStatusables + ); + request.setParameter("collectionId", collectionId); + if(patternAttribute && patternValue){ + request.setParameter("attrName", patternAttribute); + request.setParameter("attrPattern", patternValue); + } + return request; + }, + /** * Add a result to a given collection * @param collectionId {String} Id of the destination collection @@ -90,6 +120,31 @@ qx.Class.define("org.argeo.slc.ria.SlcApi", ); }, + /** + * Copy a whole collection or a subset of it to another collection. If a new id is provided for the target, it will be created. + * @param sourceCollectionId {String} The current collection from which to copy + * @param targetCollectionId {String} The target collection. If unknown, it will be created. + * @param patternAttribute {String} An optional attribute on which a filter can be applied to create a subset. + * @param patternValue {String} The associated pattern to filter on the atttribute's value. + * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent + * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update + * @return {qx.io.remote.Request} The request object + */ + getCopyCollectionService : function(sourceCollectionId, targetCollectionId, patternAttribute, patternValue, fireReloadEventType, iLoadStatusables){ + var request = org.argeo.slc.ria.SlcApi.getServiceRequest( + org.argeo.slc.ria.SlcApi.COPY_COLLECTION_TO_COLL_SERVICE, + fireReloadEventType, + iLoadStatusables + ); + request.setParameter("sourceCollectionId", sourceCollectionId); + request.setParameter("targetCollectionId", targetCollectionId); + if(patternAttribute && patternValue){ + request.setParameter("attrName", patternAttribute); + request.setParameter("attrPattern", patternValue); + } + return request; + }, + /** * List all results or results of a given collection * @param collectionId {String} Id of the collection to load @@ -124,6 +179,89 @@ qx.Class.define("org.argeo.slc.ria.SlcApi", ); request.setParameter("uuid", resultId); return request; + }, + + /** + * List currently registered SlcExecutions. + * @param fireReloadEventType {String} Event type to trigger (optionnal) + * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update + * @return {qx.io.remote.Request} + */ + getListSlcExecutionsService:function(fireReloadEventType, iLoadStatusables){ + return org.argeo.slc.ria.SlcApi.getServiceRequest( + org.argeo.slc.ria.SlcApi.LIST_SLCEXEC_SERVICE, + fireReloadEventType, + iLoadStatusables + ); + }, + + + /** + * List currently available agents queues. + * @param fireReloadEventType {String} Event type to trigger (optionnal) + * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update + * @return {qx.io.remote.Request} + */ + getListAgentsService:function(fireReloadEventType, iLoadStatusables){ + return org.argeo.slc.ria.SlcApi.getServiceRequest( + org.argeo.slc.ria.SlcApi.LIST_AGENTS_SERVICE, + fireReloadEventType, + iLoadStatusables + ); + }, + + /** + * Load the module descriptors + * @param fireReloadEventType {String} Event type to trigger (optionnal) + * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update + * @return {qx.io.remote.Request} + */ + getListModulesService : function(fireReloadEventType, iLoadStatusables){ + return org.argeo.slc.ria.SlcApi.getServiceRequest( + org.argeo.slc.ria.SlcApi.LIST_MODULES_SERVICE, + fireReloadEventType, + iLoadStatusables + ); + }, + + /** + * Get an execution module descriptor by its name and version + * @param moduleName {String} The name of the module to get + * @param moduleVersion {String} Its version, passed directly as a string + * @param fireReloadEventType {String} Event type to trigger (optionnal) + * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update + * @return {qx.io.remote.Request} + */ + getLoadExecutionDescriptorService : function(moduleName, moduleVersion, fireReloadEventType, iLoadStatusables){ + var req = org.argeo.slc.ria.SlcApi.getServiceRequest( + org.argeo.slc.ria.SlcApi.GET_EXECUTION_DESC_SERVICE, + fireReloadEventType, + iLoadStatusables + ); + req.setParameter("moduleName", moduleName); + req.setParameter("version", moduleVersion); + return req; + }, + + /** + * Send a JMS message to the AMQ_CONTEXT + * @param destination {String} The destination queue, in the form "topic://destination" + * @param message {org.argeo.slc.ria.SlcExecutionMessage} The message object + * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update + */ + getSendAmqMessageRequest : function(destination, message, iLoadStatusables){ + var serviceManager = org.argeo.ria.remote.RequestManager.getInstance(); + var request = serviceManager.getRequest( + org.argeo.slc.ria.SlcApi.DEFAULT_CONTEXT+"/"+org.argeo.slc.ria.SlcApi.AMQ_SERVICE, + "POST", + "text/plain", + null, + iLoadStatusables + ); + request.setParameter("destination", destination); + request.setParameter("message", message.toXml()); + request.setParameter("type", "send"); + return request; } }