]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
New services
authorCharles du Jeu <charles.dujeu@gmail.com>
Tue, 27 Jan 2009 11:43:59 +0000 (11:43 +0000)
committerCharles du Jeu <charles.dujeu@gmail.com>
Tue, 27 Jan 2009 11:43:59 +0000 (11:43 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2136 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/LauncherApplet.js
org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/SlcApi.js
org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/remote/JmsClient.js

index c84b1fcabb7b23125a9da210de2fa8c06b3ee18e..526fbd0bb3f07626fed8bf347cdb4f227e35b868 100644 (file)
@@ -90,7 +90,7 @@ qx.Class.define("org.argeo.slc.ria.LauncherApplet",
        load : function(){
                this.getView().setViewTitle("Execution Launcher");
                this.addListener("changeRegisteredTopics", function(event){
-                       this._refreshTopicsSubscriptions(event);
+                       //this._refreshTopicsSubscriptions(event);
                        this._feedSelector(event);
                }, this);
                var reloadHandler = function(message){
@@ -304,6 +304,7 @@ qx.Class.define("org.argeo.slc.ria.LauncherApplet",
                formObject.pane.add(entryPane);
        },
        
+       /*
        _refreshTopicsSubscriptions : function(changeTopicsEvent){
                var oldTopics = changeTopicsEvent.getOldData() || {};
                var newTopics = changeTopicsEvent.getData();
@@ -320,6 +321,7 @@ qx.Class.define("org.argeo.slc.ria.LauncherApplet",
                        }                       
                }
        },
+       */
                
        _feedSelector : function(changeTopicsEvent){
                var topics = changeTopicsEvent.getData();
@@ -333,6 +335,7 @@ qx.Class.define("org.argeo.slc.ria.LauncherApplet",
                }
        },
        
+       /*
        _addAmqListener: function(uuid){
                this._amqClient.addListener("slcExec", "topic://agent."+uuid+".newExecution", function(response){
                        var message = org.argeo.ria.util.Element.selectSingleNode(response, "slc:slc-execution");                               
@@ -347,6 +350,7 @@ qx.Class.define("org.argeo.slc.ria.LauncherApplet",
        _removeAmqListener : function(uuid){
                this._amqClient.removeListener("slcExec", "topic://agent."+uuid+".newExecution");
        },
+       */
        
        _prepareSlcExecutionMessage : function(crtPartId, slcExec, fields, hiddenFields, freeFields){
                if(crtPartId == "standard"){
@@ -386,9 +390,12 @@ qx.Class.define("org.argeo.slc.ria.LauncherApplet",
                }
                
                this._prepareSlcExecutionMessage(crtPartId, slcExec, fields, hiddenFields, freeFields);
-               
-               var destination = "topic://agent."+currentUuid+".newExecution";
-               this._amqClient.sendMessage(destination, slcExec.toXml());
+                               
+               this._amqClient.sendMessage(
+                       "topic://agent.newExecution", 
+                       slcExec.toXml(), 
+                       {"slc-agentId":currentUuid}
+               );
                // Force logs refresh right now!
                qx.event.Timer.once(function(){
                        var command = org.argeo.ria.event.CommandsManager.getInstance().getCommandById("reloadlogs");
index 1bab2a46e30b40e0674df66d0bb02db45c2651cb..687ae6acd5a5ed56a1f9b1492c0b031512dfff87 100644 (file)
@@ -17,6 +17,7 @@ qx.Class.define("org.argeo.slc.ria.SlcApi",
        REMOVE_RESULT_FROM_COLL_SERVICE : "removeResultFromCollection.service",\r
        ADD_RESULT_TO_COLL_SERVICE : "addResultToCollection.service",\r
        LIST_COLLECTIONS_SERVICE : "listCollectionRefs.service",\r
+       COPY_COLLECTION_TO_COLL_SERVICE : "copyCollectionToCollection.service",\r
        LIST_RESULTS_SERVICE : "listResultAttributes.service",\r
        GET_RESULT_SERVICE : "getResult.service",\r
        LIST_SLCEXEC_SERVICE : "listSlcExecutions.service",\r
@@ -61,6 +62,29 @@ qx.Class.define("org.argeo.slc.ria.SlcApi",
                return request;\r
        },\r
        \r
+       /**\r
+        * Remove a set of results from a collection. Either filtered by a given pattern, or the whole collection.\r
+        * @param collectionId {String} The id of the collection\r
+        * @param patternAttribute {String} An optional attribute name on which to filter\r
+        * @param patternValue {String} The pattern to use for filtering a subset of result\r
+        * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent\r
+        * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update\r
+        * @return {qx.io.remote.Request} The Request object\r
+        */\r
+       getRemoveFromCollectionService : function(collectionId, patternAttribute, patternValue, fireReloadEventType, iLoadStatusables){\r
+               var request = org.argeo.slc.ria.SlcApi.getServiceRequest(\r
+                       org.argeo.slc.ria.SlcApi.REMOVE_RESULT_FROM_COLL_SERVICE, \r
+                       fireReloadEventType, \r
+                       iLoadStatusables\r
+               );\r
+               request.setParameter("collectionId", collectionId);\r
+               if(patternAttribute && patternValue){\r
+                       request.setParameter("attrName", patternAttribute);\r
+                       request.setParameter("attrPattern", patternValue);\r
+               }\r
+               return request;\r
+       },\r
+       \r
        /**\r
         * Add a result to a given collection\r
         * @param collectionId {String} Id of the destination collection\r
@@ -94,6 +118,31 @@ qx.Class.define("org.argeo.slc.ria.SlcApi",
                );\r
        },\r
        \r
+       /**\r
+        * 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.\r
+        * @param sourceCollectionId {String} The current collection from which to copy\r
+        * @param targetCollectionId {String} The target collection. If unknown, it will be created.\r
+        * @param patternAttribute {String} An optional attribute on which a filter can be applied to create a subset.\r
+        * @param patternValue {String} The associated pattern to filter on the atttribute's value.\r
+        * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent\r
+        * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update\r
+        * @return {qx.io.remote.Request} The request object\r
+        */\r
+       getCopyCollectionService : function(sourceCollectionId, targetCollectionId, patternAttribute, patternValue, fireReloadEventType, iLoadStatusables){\r
+               var request = org.argeo.slc.ria.SlcApi.getServiceRequest(\r
+                       org.argeo.slc.ria.SlcApi.COPY_COLLECTION_TO_COLL_SERVICE, \r
+                       fireReloadEventType, \r
+                       iLoadStatusables                        \r
+               );\r
+               request.setParameter("sourceCollectionId", sourceCollectionId);\r
+               request.setParameter("targetCollectionId", targetCollectionId);\r
+               if(patternAttribute && patternValue){\r
+                       request.setParameter("attrName", patternAttribute);\r
+                       request.setParameter("attrPattern", patternValue);\r
+               }\r
+               return request;\r
+       },\r
+       \r
        /**\r
         * List all results or results of a given collection \r
         * @param collectionId {String} Id of the collection to load\r
index 0b4fec48761933c61bac08f0fbe0fd6e6c462734..bcf6e3a6d90d3e46fd431e84ed25b295c584760d 100644 (file)
@@ -8,7 +8,7 @@ qx.Class.define("org.argeo.ria.remote.JmsClient", {
        },\r
        members : {\r
                // The URI of the MessageListenerServlet\r
-               uri : '../amq',         \r
+               uri : '../amqMessage',          \r
 \r
                // Polling. Set to true (default) if waiting poll for messages is needed\r
                poll : true,\r
@@ -70,8 +70,8 @@ qx.Class.define("org.argeo.ria.remote.JmsClient", {
 \r
                // Send a JMS message to a destination (eg topic://MY.TOPIC).  Message should be xml or encoded\r
                // xml content.\r
-               sendMessage : function(destination, message) {\r
-                       this._sendMessage(destination, message, 'send');\r
+               sendMessage : function(destination, message, properties) {\r
+                       this._sendMessage(destination, message, 'send', properties);\r
                },\r
 \r
                // Listen on a channel or topic.   handler must be a function taking a message arguement\r
@@ -86,11 +86,16 @@ qx.Class.define("org.argeo.ria.remote.JmsClient", {
                        this._sendMessage(destination, id, 'unlisten');\r
                },\r
 \r
-               _sendMessage : function(destination, message, type) {\r
+               _sendMessage : function(destination, message, type, properties) {\r
                        var req = new qx.io.remote.Request(this.uri, "POST", "text/plain");\r
                        req.setParameter("destination", destination);\r
                        req.setParameter("message", message);\r
                        req.setParameter("type", type);\r
+                       if(properties){\r
+                               for(var key in properties){\r
+                                       req.setParameter(key, properties[key]);\r
+                               }\r
+                       }\r
                        //req.addListener("completed", this.endBatch, this);\r
                        req.send();\r
                },\r