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",
22 LIST_SLCEXEC_SERVICE
: "listSlcExecutions.service",
24 LIST_AGENTS_SERVICE
: "listAgents.service",
28 * Standard Request getter
29 * @param serviceName {String} The name of the service to call (without base context)
30 * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent
31 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
32 * @return {qx.io.remote.Request}
34 getServiceRequest:function(serviceName
, fireReloadEventType
, iLoadStatusables
){
35 var serviceManager
= org
.argeo
.ria
.remote
.RequestManager
.getInstance();
36 return serviceManager
.getRequest(
37 org
.argeo
.slc
.ria
.SlcApi
.DEFAULT_CONTEXT
+"/"+serviceName
,
46 * Remove a result from a collection
47 * @param collectionId {String} Id of the destination collection
48 * @param resultId {String} Id of the test result to remove
49 * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent
50 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
51 * @return {qx.io.remote.Request}
53 getRemoveResultService : function(collectionId
, resultId
, fireReloadEventType
, iLoadStatusables
){
54 var request
= org
.argeo
.slc
.ria
.SlcApi
.getServiceRequest(
55 org
.argeo
.slc
.ria
.SlcApi
.REMOVE_RESULT_FROM_COLL_SERVICE
,
59 request
.setParameter("collectionId", collectionId
);
60 request
.setParameter("resultUuid", resultId
);
65 * Add a result to a given collection
66 * @param collectionId {String} Id of the destination collection
67 * @param resultId {String} Id of the test result to add
68 * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent
69 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
70 * @return {qx.io.remote.Request}
72 getAddResultService : function(collectionId
, resultId
, fireReloadEventType
, iLoadStatusables
){
73 var request
= org
.argeo
.slc
.ria
.SlcApi
.getServiceRequest(
74 org
.argeo
.slc
.ria
.SlcApi
.ADD_RESULT_TO_COLL_SERVICE
,
78 request
.setParameter("collectionId", collectionId
);
79 request
.setParameter("resultUuid", resultId
);
84 * List current collections
85 * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent
86 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
87 * @return {qx.io.remote.Request}
89 getListCollectionsService : function(fireReloadEventType
, iLoadStatusables
){
90 return org
.argeo
.slc
.ria
.SlcApi
.getServiceRequest(
91 org
.argeo
.slc
.ria
.SlcApi
.LIST_COLLECTIONS_SERVICE
,
98 * List all results or results of a given collection
99 * @param collectionId {String} Id of the collection to load
100 * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent
101 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
102 * @return {qx.io.remote.Request}
104 getListResultsService : function(collectionId
, fireReloadEventType
, iLoadStatusables
){
105 var request
= org
.argeo
.slc
.ria
.SlcApi
.getServiceRequest(
106 org
.argeo
.slc
.ria
.SlcApi
.LIST_RESULTS_SERVICE
,
111 request
.setParameter("id", collectionId
);
118 * @param resultId {String} Id of the test result to load
119 * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent
120 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
121 * @return {qx.io.remote.Request}
123 getLoadResultService : function(resultId
, fireReloadEventType
, iLoadStatusables
){
124 var request
= org
.argeo
.slc
.ria
.SlcApi
.getServiceRequest(
125 org
.argeo
.slc
.ria
.SlcApi
.GET_RESULT_SERVICE
,
129 request
.setParameter("uuid", resultId
);
134 * List currently registered SlcExecutions.
135 * @param fireReloadEventType {String} Event type to trigger (optionnal)
136 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
137 * @return {qx.io.remote.Request}
139 getListSlcExecutionsService:function(fireReloadEventType
, iLoadStatusables
){
140 return org
.argeo
.slc
.ria
.SlcApi
.getServiceRequest(
141 org
.argeo
.slc
.ria
.SlcApi
.LIST_SLCEXEC_SERVICE
,
149 * List currently available agents queues.
150 * @param fireReloadEventType {String} Event type to trigger (optionnal)
151 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
152 * @return {qx.io.remote.Request}
154 getListAgentsService:function(fireReloadEventType
, iLoadStatusables
){
155 return org
.argeo
.slc
.ria
.SlcApi
.getServiceRequest(
156 org
.argeo
.slc
.ria
.SlcApi
.LIST_AGENTS_SERVICE
,
163 * Send a JMS message to the AMQ_CONTEXT
164 * @param destination {String} The destination queue, in the form "topic://destination"
165 * @param message {org.argeo.slc.ria.SlcExecutionMessage} The message object
166 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
168 getSendAmqMessageRequest : function(destination
, message
, iLoadStatusables
){
169 var serviceManager
= org
.argeo
.ria
.remote
.RequestManager
.getInstance();
170 var request
= serviceManager
.getRequest(
171 org
.argeo
.slc
.ria
.SlcApi
.DEFAULT_CONTEXT
+"/"+org
.argeo
.slc
.ria
.SlcApi
.AMQ_SERVICE
,
177 request
.setParameter("destination", destination
);
178 request
.setParameter("message", message
.toXml());
179 request
.setParameter("type", "send");