2 * SLC API Client implementation :
3 * This class encapsulate the various SLC services available. It just creates the Request object
4 * and return them, it does not execute them.
5 * Available services are :
6 * + loadResult / removeResult / addResult
7 * + listCollection / listResults
8 * When using it, be sure the static constant DEFAULT_CONTEXT is pointing to the right URL.
10 qx
.Class
.define("org.argeo.slc.ria.SlcApi",
12 extend
: qx
.core
.Object
,
15 DEFAULT_CONTEXT
: "/org.argeo.slc.webapp",
17 REMOVE_RESULT_FROM_COLL_SERVICE
: "removeResultFromCollection.service",
18 ADD_RESULT_TO_COLL_SERVICE
: "addResultToCollection.service",
19 LIST_COLLECTIONS_SERVICE
: "listCollectionRefs.service",
20 LIST_RESULTS_SERVICE
: "listResultAttributes.service",
21 GET_RESULT_SERVICE
: "getResult.service",
23 LIST_AGENTS_SERVICE
: "listAgents.service",
27 * Standard Request getter
28 * @param serviceName {String} The name of the service to call (without base context)
29 * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent
30 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
31 * @return {qx.io.remote.Request}
33 getServiceRequest:function(serviceName
, fireReloadEventType
, iLoadStatusables
){
34 var serviceManager
= org
.argeo
.ria
.remote
.RequestManager
.getInstance();
35 return serviceManager
.getRequest(
36 org
.argeo
.slc
.ria
.SlcApi
.DEFAULT_CONTEXT
+"/"+serviceName
,
45 * Remove a result from a collection
46 * @param collectionId {String} Id of the destination collection
47 * @param resultId {String} Id of the test result to remove
48 * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent
49 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
50 * @return {qx.io.remote.Request}
52 getRemoveResultService : function(collectionId
, resultId
, fireReloadEventType
, iLoadStatusables
){
53 var request
= org
.argeo
.slc
.ria
.SlcApi
.getServiceRequest(
54 org
.argeo
.slc
.ria
.SlcApi
.REMOVE_RESULT_FROM_COLL_SERVICE
,
58 request
.setParameter("collectionId", collectionId
);
59 request
.setParameter("resultUuid", resultId
);
64 * Add a result to a given collection
65 * @param collectionId {String} Id of the destination collection
66 * @param resultId {String} Id of the test result to add
67 * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent
68 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
69 * @return {qx.io.remote.Request}
71 getAddResultService : function(collectionId
, resultId
, fireReloadEventType
, iLoadStatusables
){
72 var request
= org
.argeo
.slc
.ria
.SlcApi
.getServiceRequest(
73 org
.argeo
.slc
.ria
.SlcApi
.ADD_RESULT_TO_COLL_SERVICE
,
77 request
.setParameter("collectionId", collectionId
);
78 request
.setParameter("resultUuid", resultId
);
83 * List current collections
84 * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent
85 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
86 * @return {qx.io.remote.Request}
88 getListCollectionsService : function(fireReloadEventType
, iLoadStatusables
){
89 return org
.argeo
.slc
.ria
.SlcApi
.getServiceRequest(
90 org
.argeo
.slc
.ria
.SlcApi
.LIST_COLLECTIONS_SERVICE
,
97 * List all results or results of a given collection
98 * @param collectionId {String} Id of the collection to load
99 * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent
100 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
101 * @return {qx.io.remote.Request}
103 getListResultsService : function(collectionId
, fireReloadEventType
, iLoadStatusables
){
104 var request
= org
.argeo
.slc
.ria
.SlcApi
.getServiceRequest(
105 org
.argeo
.slc
.ria
.SlcApi
.LIST_RESULTS_SERVICE
,
110 request
.setParameter("id", collectionId
);
117 * @param resultId {String} Id of the test result to load
118 * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent
119 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
120 * @return {qx.io.remote.Request}
122 getLoadResultService : function(resultId
, fireReloadEventType
, iLoadStatusables
){
123 var request
= org
.argeo
.slc
.ria
.SlcApi
.getServiceRequest(
124 org
.argeo
.slc
.ria
.SlcApi
.GET_RESULT_SERVICE
,
128 request
.setParameter("uuid", resultId
);
133 * List currently available agents queues.
134 * @param fireReloadEventType {String} Event type to trigger (optionnal)
135 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
136 * @return {qx.io.remote.Request}
138 getListAgentsService:function(fireReloadEventType
, iLoadStatusables
){
139 return org
.argeo
.slc
.ria
.SlcApi
.getServiceRequest(
140 org
.argeo
.slc
.ria
.SlcApi
.LIST_AGENTS_SERVICE
,
147 * Send a JMS message to the AMQ_CONTEXT
148 * @param destination {String} The destination queue, in the form "topic://destination"
149 * @param message {org.argeo.slc.ria.SlcExecutionMessage} The message object
150 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
152 getSendAmqMessageRequest : function(destination
, message
, iLoadStatusables
){
153 var serviceManager
= org
.argeo
.ria
.remote
.RequestManager
.getInstance();
154 var request
= serviceManager
.getRequest(
155 org
.argeo
.slc
.ria
.SlcApi
.DEFAULT_CONTEXT
+"/"+org
.argeo
.slc
.ria
.SlcApi
.AMQ_SERVICE
,
161 request
.setParameter("destination", destination
);
162 request
.setParameter("message", message
.toXml());
163 request
.setParameter("type", "send");