[jboss-svn-commits] JBL Code SVN: r36033 - in labs/jbossrules/trunk/drools-guvnor/src: main/java/org/drools/guvnor/client and 11 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Nov 23 09:13:08 EST 2010


Author: eaa
Date: 2010-11-23 09:13:06 -0500 (Tue, 23 Nov 2010)
New Revision: 36033

Added:
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneEditorService.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneEditorServiceAsync.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/StandaloneEditorManager.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/standalone/StandaloneEditorInvocationParameters.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/toolbar/StandaloneEditorIndividualActionToolbarButtonsConfigurationProvider.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/StandaloneEditor.html
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/StandaloneEditorServiceImplementation.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/StandaloneEditorServlet.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/BRLRuleAssetProvider.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/NewRuleAssetProvider.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/RuleAssetProvider.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/UUIDRuleAssetProvider.java
   labs/jbossrules/trunk/drools-guvnor/src/test/java/org/drools/guvnor/server/server/
   labs/jbossrules/trunk/drools-guvnor/src/test/java/org/drools/guvnor/server/server/GuvnorAPITest.java
Removed:
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneGuidedEditorService.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneGuidedEditorServiceAsync.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/GuidedEditorManager.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/standalone/StandaloneGuidedEditorInvocationParameters.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/toolbar/StandaloneGuidedEditorIndividualActionToolbarButtonsConfigurationProvider.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/GuidedEditor.html
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/GuidedEditorServlet.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/StandaloneGuidedEditorServiceImplementation.java
Modified:
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/Guvnor.gwt.xml
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/JBRMSEntryPoint.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/packages/WorkingSetManager.java
   labs/jbossrules/trunk/drools-guvnor/src/main/webapp/WEB-INF/web.xml
Log:
GUVNOR-681: Create a new top component to display and run the Guided Editor (RuleModeller) and all the things it needs in order to run in a "standalone" way
	- *GuidedEditor* was refactored as *StandaloneEditor*

Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/Guvnor.gwt.xml
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/Guvnor.gwt.xml	2010-11-23 14:10:35 UTC (rev 36032)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/Guvnor.gwt.xml	2010-11-23 14:13:06 UTC (rev 36033)
@@ -48,8 +48,8 @@
   <servlet path="/workflowmanager" class="org.gridcc.mce.mceworkflow.servlets.WorkflowManagerServlet"/>
   <servlet path="/wsdlparser" class="org.gridcc.mce.mceworkflow.servlets.WSDLParserServlet"/>
   <servlet path="/verificationService" class="org.drools.guvnor.server.VerificationServiceImplementation"/>
-  <servlet path="/guidedEditorServlet" class="org.drools.guvnor.server.GuidedEditorServlet"/>
-  <servlet path="/standaloneGuidedEditorService" class="org.drools.guvnor.server.StandaloneGuidedEditorServiceImplementation"/>
+  <servlet path="/standaloneEditorServlet" class="org.drools.guvnor.server.StandaloneEditorServlet"/>
+  <servlet path="/standaloneEditorService" class="org.drools.guvnor.server.StandaloneEditorServiceImplementation"/>
 
 
   <set-property name="gwt.suppressNonStaticFinalFieldWarnings" value="true" />

Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/JBRMSEntryPoint.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/JBRMSEntryPoint.java	2010-11-23 14:10:35 UTC (rev 36032)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/JBRMSEntryPoint.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -21,7 +21,7 @@
 import org.drools.guvnor.client.messages.Constants;
 import org.drools.guvnor.client.rpc.RepositoryServiceFactory;
 import org.drools.guvnor.client.rpc.UserSecurityContext;
-import org.drools.guvnor.client.ruleeditor.GuidedEditorManager;
+import org.drools.guvnor.client.ruleeditor.StandaloneEditorManager;
 import org.drools.guvnor.client.security.Capabilities;
 import org.drools.guvnor.client.security.CapabilitiesManager;
 
@@ -58,14 +58,14 @@
      * Creates the main view of Guvnor.
      * The path used to invoke guvnor is used to identify the 
      * view to show:
-     * If the path contains "GuidedEditor.html" then the GuidedEditorManager is used
+     * If the path contains "StandaloneEditor.html" then the StandaloneGuidedEditorManager is used
      * to render the view.
      * If not, the default view (created by ExplorerLayoutManager) is shown.
      * @return Guvnor's main view.
      */
 	private Panel createMain() {
-		if (Window.Location.getPath().contains("GuidedEditor.html")){
-			return (new GuidedEditorManager().getBaseLayout());
+		if (Window.Location.getPath().contains("StandaloneEditor.html")){
+			return (new StandaloneEditorManager().getBaseLayout());
 		}
 		return (new ExplorerLayoutManager(loggedInUserInfo)).getBaseLayout();
 	}

Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/packages/WorkingSetManager.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/packages/WorkingSetManager.java	2010-11-23 14:10:35 UTC (rev 36032)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/packages/WorkingSetManager.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -86,15 +86,43 @@
      */
     public void applyWorkingSets(final String packageName, final Set<RuleAsset> wss, final Command done) {
 
+        this.applyWorkingSets(packageName, wss, false, done);
+
+    }
+    
+    public void applyTemporalWorkingSetForFactTypes(final String packageName, final Set<String> factTypes, final Command done) {
+        
+        Set<RuleAsset> workingSets = null; 
+        if (factTypes != null && !factTypes.isEmpty()) {
+            //create a temporal RuleAsset to hold the fact types.
+            final RuleAsset workingSet = new RuleAsset();
+            workingSet.uuid = "workingSetMock";
+            
+            WorkingSetConfigData wsConfig = new WorkingSetConfigData();
+            wsConfig.validFacts = factTypes.toArray(new String[factTypes.size()]);
+
+            workingSet.content = wsConfig;
+            
+            workingSets = new HashSet<RuleAsset>() {{this.add(workingSet);}};
+        }
+
+        this.applyWorkingSets(packageName, workingSets,true, done);
+
+    }
+    
+    private void applyWorkingSets(final String packageName, final Set<RuleAsset> wss, final boolean temporal, final Command done) {
+
+        
         Command cmd = new Command() {
 
             public void execute() {
-                //update the map
-                activeWorkingSets.remove(packageName);
-                if (wss != null && !wss.isEmpty()) {
-                    activeWorkingSets.put(packageName, wss);
+                if (!temporal){
+                    //update the map
+                    activeWorkingSets.remove(packageName);
+                    if (wss != null && !wss.isEmpty()) {
+                        activeWorkingSets.put(packageName, wss);
+                    }
                 }
-
                 if (done != null) {
                     done.execute();
                 }
@@ -104,8 +132,10 @@
         if (wss == null || wss.isEmpty()) {
             //if no WS, we refresh the SCE (release any filter)
             SuggestionCompletionCache.getInstance().refreshPackage(packageName, cmd);
-            //update the map
-            this.activeWorkingSets.remove(packageName);
+            if (!temporal){
+                //update the map
+                this.activeWorkingSets.remove(packageName);
+            }
             return;
         } else {
 
@@ -123,26 +153,6 @@
 
     }
 
-    public void applyTemporalWorkingSetForFactTypes(final String packageName, final Set<String> factTypes, final Command done) {
-        
-        Set<RuleAsset> workingSets = null; 
-        if (factTypes != null && !factTypes.isEmpty()) {
-            //create a temporal RuleAsset to hold the fact types.
-            final RuleAsset workingSet = new RuleAsset();
-            workingSet.uuid = "workingSetMock";
-            
-            WorkingSetConfigData wsConfig = new WorkingSetConfigData();
-            wsConfig.validFacts = factTypes.toArray(new String[factTypes.size()]);
-
-            workingSet.content = wsConfig;
-            
-            workingSets = new HashSet<RuleAsset>() {{this.add(workingSet);}};
-        }
-
-        this.applyWorkingSets(packageName, workingSets, done);
-
-    }
-
     /**
      * Returns the active WorkingSets for a package (as RuleAsset), or null if any.
      * @param packageName the package name

Copied: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneEditorService.java (from rev 36008, labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneGuidedEditorService.java)
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneEditorService.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneEditorService.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -0,0 +1,40 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.guvnor.client.rpc;
+
+
+import com.google.gwt.user.client.rpc.RemoteService;
+import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
+import com.google.gwt.user.client.rpc.SerializationException;
+import org.drools.guvnor.client.ruleeditor.standalone.StandaloneEditorInvocationParameters;
+
+/**
+ * 
+ * @author esteban.aliverti
+ *
+ */
+ at RemoteServiceRelativePath("standaloneEditorService")
+public interface StandaloneEditorService
+    extends
+    RemoteService {
+
+    
+     StandaloneEditorInvocationParameters getInvocationParameters(String parametersUUID) throws DetailedSerializationException;
+     String[] getAsstesDRL(RuleAsset[] assets) throws SerializationException;
+     String[] getAsstesBRL(RuleAsset[] assets) throws SerializationException;
+
+}

Copied: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneEditorServiceAsync.java (from rev 36008, labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneGuidedEditorServiceAsync.java)
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneEditorServiceAsync.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneEditorServiceAsync.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.guvnor.client.rpc;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import org.drools.guvnor.client.ruleeditor.standalone.StandaloneEditorInvocationParameters;
+
+/**
+ * 
+ * @author esteban.aliverti
+ *
+ */
+public interface StandaloneEditorServiceAsync {
+
+    void getInvocationParameters(String parametersUUID, AsyncCallback<StandaloneEditorInvocationParameters> asyncCallback);
+    void getAsstesDRL(RuleAsset[] assets, AsyncCallback<String[]> asyncCallback);
+    void getAsstesBRL(RuleAsset[] assets, AsyncCallback<String[]> asyncCallback);
+
+}

Deleted: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneGuidedEditorService.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneGuidedEditorService.java	2010-11-23 14:10:35 UTC (rev 36032)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneGuidedEditorService.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -1,40 +0,0 @@
-/**
- * Copyright 2010 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.drools.guvnor.client.rpc;
-
-
-import com.google.gwt.user.client.rpc.RemoteService;
-import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
-import com.google.gwt.user.client.rpc.SerializationException;
-import org.drools.guvnor.client.ruleeditor.standalone.StandaloneGuidedEditorInvocationParameters;
-
-/**
- * 
- * @author esteban.aliverti
- *
- */
- at RemoteServiceRelativePath("standaloneGuidedEditorService")
-public interface StandaloneGuidedEditorService
-    extends
-    RemoteService {
-
-    
-     StandaloneGuidedEditorInvocationParameters getInvocationParameters(String parametersUUID) throws DetailedSerializationException;
-     String[] getAsstesDRL(RuleAsset[] assets) throws SerializationException;
-     String[] getAsstesBRL(RuleAsset[] assets) throws SerializationException;
-
-}

Deleted: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneGuidedEditorServiceAsync.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneGuidedEditorServiceAsync.java	2010-11-23 14:10:35 UTC (rev 36032)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/StandaloneGuidedEditorServiceAsync.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -1,33 +0,0 @@
-/**
- * Copyright 2010 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.drools.guvnor.client.rpc;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import org.drools.guvnor.client.ruleeditor.standalone.StandaloneGuidedEditorInvocationParameters;
-
-/**
- * 
- * @author esteban.aliverti
- *
- */
-public interface StandaloneGuidedEditorServiceAsync {
-
-    void getInvocationParameters(String parametersUUID, AsyncCallback<StandaloneGuidedEditorInvocationParameters> asyncCallback);
-    void getAsstesDRL(RuleAsset[] assets, AsyncCallback<String[]> asyncCallback);
-    void getAsstesBRL(RuleAsset[] assets, AsyncCallback<String[]> asyncCallback);
-
-}

Deleted: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/GuidedEditorManager.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/GuidedEditorManager.java	2010-11-23 14:10:35 UTC (rev 36032)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/GuidedEditorManager.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -1,301 +0,0 @@
-package org.drools.guvnor.client.ruleeditor;
-
-import com.google.gwt.core.client.GWT;
-import org.drools.guvnor.client.common.GenericCallback;
-import org.drools.guvnor.client.common.LoadingPopup;
-import org.drools.guvnor.client.rpc.RuleAsset;
-import org.drools.guvnor.client.rulelist.EditItemEvent;
-
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.DockLayoutPanel;
-import com.google.gwt.user.client.ui.Panel;
-import com.google.gwt.user.client.ui.ScrollPanel;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-import org.drools.guvnor.client.messages.Constants;
-import org.drools.guvnor.client.modeldriven.ui.RuleModellerConfiguration;
-import org.drools.guvnor.client.packages.WorkingSetManager;
-import org.drools.guvnor.client.rpc.StandaloneGuidedEditorService;
-import org.drools.guvnor.client.rpc.StandaloneGuidedEditorServiceAsync;
-import org.drools.guvnor.client.ruleeditor.standalone.RealAssetsMultiViewEditorMenuBarCreator;
-import org.drools.guvnor.client.ruleeditor.standalone.StandaloneGuidedEditorInvocationParameters;
-import org.drools.guvnor.client.ruleeditor.standalone.TemporalAssetsMultiViewEditorMenuBarCreator;
-import org.drools.guvnor.client.ruleeditor.toolbar.StandaloneGuidedEditorIndividualActionToolbarButtonsConfigurationProvider;
-
-/**
- * Class used to manage the stand-alone version of the Guided Editor (RuleModeller)
- * @author esteban.aliverti at gmail.com
- *
- */
-public class GuidedEditorManager {
-
-    private DockLayoutPanel mainLayout;
-    private Constants constants = GWT.create(Constants.class);
-    private MultiViewEditor editor;
-    private StandaloneGuidedEditorServiceAsync standaloneGuidedEditorService = GWT.create(StandaloneGuidedEditorService.class);
-    private RuleAsset[] assets;
-
-    public Panel getBaseLayout() {
-
-        String parametersUUID = Window.Location.getParameter("pUUID");
-        if (parametersUUID == null || parametersUUID.trim().equals("")) {
-            return null;
-        }
-
-        //init JS hooks
-        this.setHooks(this);
-
-        mainLayout = new DockLayoutPanel(Unit.EM);
-
-        final ScrollPanel mainPanel = new ScrollPanel();
-
-        mainLayout.add(mainPanel);
-
-        //The package must exist (because we need at least a model to work with)
-        //To make things easier (to me), the category must exist too.
-        standaloneGuidedEditorService.getInvocationParameters(parametersUUID, new GenericCallback<StandaloneGuidedEditorInvocationParameters>() {
-
-            public void onSuccess(final StandaloneGuidedEditorInvocationParameters parameters) {
-
-                //no assets? This is an error!
-                if (parameters.getAssetsToBeEdited().length == 0) {
-                    Window.alert(constants.NoRulesFound());
-                    return;
-                }
-
-                //we need to store the assets.
-                GuidedEditorManager.this.assets = parameters.getAssetsToBeEdited();
-
-                //Load SCE and create a MultiViewEditor for the assets.
-                //We take the package from the first asset (because all the assets
-                //must belong to the same package)
-
-
-                Set<String> validFacts = null;
-                if (parameters.getValidFactTypes() != null){
-                    validFacts = new HashSet<String>();
-                    validFacts.addAll(Arrays.asList(parameters.getValidFactTypes()));
-                }
-                
-                WorkingSetManager.getInstance().applyTemporalWorkingSetForFactTypes(assets[0].metaData.packageName, validFacts, new Command() {
-
-                    public void execute() {
-                        LoadingPopup.close();
-
-                        //Configure RuleModeller
-                        RuleModellerConfiguration ruleModellerConfiguration = RuleModellerConfiguration.getInstance();
-                        ruleModellerConfiguration.setHideLHS(parameters.isHideLHS());
-                        ruleModellerConfiguration.setHideRHS(parameters.isHideRHS());
-                        ruleModellerConfiguration.setHideAttributes(parameters.isHideAttributes());
-
-                        //Create the editor
-                        MultiViewEditorMenuBarCreator editorMenuBarCreator;
-                        if (parameters.isTemporalAssets()) {
-                            editorMenuBarCreator = new TemporalAssetsMultiViewEditorMenuBarCreator(new Command() {
-                                //"Done" buton command
-
-                                public void execute() {
-                                    afterSaveAndClose();
-                                }
-                            }, new Command() {
-                                //"Cancel button command
-
-                                public void execute() {
-                                    afterCancelButtonCallbackFunction();
-                                }
-                            });
-                        } else {
-                            editorMenuBarCreator = new RealAssetsMultiViewEditorMenuBarCreator(new Command() {
-                                //"Cancel" button command
-
-                                public void execute() {
-                                    afterCancelButtonCallbackFunction();
-                                }
-                            });
-                        }
-
-                        editor = new MultiViewEditor(parameters.getAssetsToBeEdited(), new EditItemEvent() {
-
-                            public void open(MultiViewRow[] rows) {
-                                // TODO Auto-generated method stub
-                            }
-
-                            public void open(String key) {
-                                // TODO Auto-generated method stub
-                            }
-                        }, new StandaloneGuidedEditorIndividualActionToolbarButtonsConfigurationProvider(),
-                                editorMenuBarCreator);
-
-                        editor.setCloseCommand(new Command() {
-
-                            public void execute() {
-                                afterSaveAndClose();
-                            }
-                        });
-
-                        //Add the editor to main panel
-                        mainPanel.add(editor);
-                    }
-                });
-            }
-        });
-
-
-        return mainLayout;
-    }
-
-    /**
-     * This method should be invoked from JS using window.getEditorDRL().
-     * Returns the DRL of the assets we are editing. Because this method is 
-     * asynchronous, the DRL code is passed to a callback function specified
-     * in the JS invocation.
-     */
-    public void getDRLs() {
-        if (assets == null || assets.length == 0) {
-            returnDRL("");
-        }
-
-        standaloneGuidedEditorService.getAsstesDRL(assets, new GenericCallback<String[]>() {
-
-            public void onSuccess(String[] drls) {
-                String result = "";
-                if (drls != null) {
-                    for (String drl : drls) {
-                        result += drl + "\n\n";
-                    }
-                }
-
-                returnDRL(result);
-            }
-        });
-    }
-
-    /**
-     * This method should be invoked from JS using window.getEditorBRL().
-     * Returns the BRL of the assets we are editing. Because this method is 
-     * asynchronous, the BRL code is passed to a callback function specified
-     * in the JS invocation.
-     */
-    public void getBRLs() {
-        if (assets == null || assets.length == 0) {
-            returnDRL("");
-        }
-
-        standaloneGuidedEditorService.getAsstesBRL(assets, new GenericCallback<String[]>() {
-
-            public void onSuccess(String[] drls) {
-                String result = "";
-                if (drls != null) {
-                    for (String drl : drls) {
-                        result += drl + "\n\n";
-                    }
-                }
-
-                returnBRL(result);
-            }
-        });
-    }
-    
-    /**
-     * Returns the uuids of the assets that are being edited in JSON format.
-     * @return 
-     */
-    public String getAssetsUUIDs(){
-        StringBuilder uuids = new StringBuilder("[");
-        String separator = "";
-        for (int i = 0; i < this.assets.length; i++) {
-            uuids.append(separator);
-            uuids.append("'");
-            uuids.append(this.assets[i].uuid);
-            uuids.append("'");
-            if (separator.equals("")){
-                separator = ",";
-            }
-        }
-        uuids.append("]");
-        
-        return uuids.toString();
-    }
-
-    /**
-     * Creates 2 JS functions in window object: getDRLs() and getBRLs(). These
-     * functions are used to retrieve the source code of the assets this component
-     * is handling.
-     * @param app
-     */
-    public native void setHooks(GuidedEditorManager app)/*-{
-    
-    var guidedEditorObject = {
-    drlCallbackFunction: null,
-    brlCallbackFunction: null,
-    
-    //close function listener. The function you register here will be called
-    //after the "Save and Close" button is pressed                                                                                                                 
-    afterSaveAndCloseButtonCallbackFunction: null,
-    
-    afterCancelButtonCallbackFunction: null,
-    
-    getDRL: function (callbackFunction){
-    this.drlCallbackFunction = callbackFunction;
-    app. at org.drools.guvnor.client.ruleeditor.GuidedEditorManager::getDRLs()();
-    },
-    
-    getBRL: function (callbackFunction){
-    this.brlCallbackFunction = callbackFunction;
-    app. at org.drools.guvnor.client.ruleeditor.GuidedEditorManager::getBRLs()();
-    },
-    
-    registerAfterSaveAndCloseButtonCallbackFunction: function (callbackFunction){
-    this.afterSaveAndCloseButtonCallbackFunction = callbackFunction;
-    },
-    
-    registerAfterCancelButtonCallbackFunction: function (callbackFunction){
-    this.afterCancelButtonCallbackFunction = callbackFunction;
-    },
-    
-    getAssetsUUIDs: function(){
-    return app. at org.drools.guvnor.client.ruleeditor.GuidedEditorManager::getAssetsUUIDs()();
-    }
-    }    
-    $wnd.guidedEditorObject = guidedEditorObject;                                                                                                      
-    
-    }-*/;
-
-    /**
-     * Callback method invoked from getDRLs().
-     * @param drl
-     */
-    public native void returnDRL(String drl)/*-{
-    if ($wnd.guidedEditorObject.drlCallbackFunction){
-    $wnd.guidedEditorObject.drlCallbackFunction(drl);
-    }
-    }-*/;
-
-    /**
-     * Callback method invoked from getDRLs().
-     * @param drl
-     */
-    public native void returnBRL(String brl)/*-{
-    if ($wnd.guidedEditorObject.brlCallbackFunction){
-    $wnd.guidedEditorObject.brlCallbackFunction(brl);
-    }
-    }-*/;
-
-    /**
-     * Method invoked after the "Save an Close" button is pressed. 
-     */
-    public native void afterSaveAndClose()/*-{
-    if ($wnd.guidedEditorObject.afterSaveAndCloseButtonCallbackFunction){
-    $wnd.guidedEditorObject.afterSaveAndCloseButtonCallbackFunction();
-    }
-    }-*/;
-
-    public native void afterCancelButtonCallbackFunction()/*-{
-    if ($wnd.guidedEditorObject.afterCancelButtonCallbackFunction){
-    $wnd.guidedEditorObject.afterCancelButtonCallbackFunction();
-    }
-    }-*/;
-}

Copied: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/StandaloneEditorManager.java (from rev 36019, labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/GuidedEditorManager.java)
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/StandaloneEditorManager.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/StandaloneEditorManager.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -0,0 +1,301 @@
+package org.drools.guvnor.client.ruleeditor;
+
+import com.google.gwt.core.client.GWT;
+import org.drools.guvnor.client.common.GenericCallback;
+import org.drools.guvnor.client.common.LoadingPopup;
+import org.drools.guvnor.client.rpc.RuleAsset;
+import org.drools.guvnor.client.rulelist.EditItemEvent;
+
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.DockLayoutPanel;
+import com.google.gwt.user.client.ui.Panel;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import org.drools.guvnor.client.messages.Constants;
+import org.drools.guvnor.client.modeldriven.ui.RuleModellerConfiguration;
+import org.drools.guvnor.client.packages.WorkingSetManager;
+import org.drools.guvnor.client.rpc.StandaloneEditorService;
+import org.drools.guvnor.client.rpc.StandaloneEditorServiceAsync;
+import org.drools.guvnor.client.ruleeditor.standalone.RealAssetsMultiViewEditorMenuBarCreator;
+import org.drools.guvnor.client.ruleeditor.standalone.StandaloneEditorInvocationParameters;
+import org.drools.guvnor.client.ruleeditor.standalone.TemporalAssetsMultiViewEditorMenuBarCreator;
+import org.drools.guvnor.client.ruleeditor.toolbar.StandaloneEditorIndividualActionToolbarButtonsConfigurationProvider;
+
+/**
+ * Class used to manage the stand-alone version of Guvnor's Editors
+ * @author esteban.aliverti at gmail.com
+ *
+ */
+public class StandaloneEditorManager {
+
+    private DockLayoutPanel mainLayout;
+    private Constants constants = GWT.create(Constants.class);
+    private MultiViewEditor editor;
+    private StandaloneEditorServiceAsync standaloneEditorService = GWT.create(StandaloneEditorService.class);
+    private RuleAsset[] assets;
+
+    public Panel getBaseLayout() {
+
+        String parametersUUID = Window.Location.getParameter("pUUID");
+        if (parametersUUID == null || parametersUUID.trim().equals("")) {
+            return null;
+        }
+
+        //init JS hooks
+        this.setHooks(this);
+
+        mainLayout = new DockLayoutPanel(Unit.EM);
+
+        final ScrollPanel mainPanel = new ScrollPanel();
+
+        mainLayout.add(mainPanel);
+
+        //The package must exist (because we need at least a model to work with)
+        //To make things easier (to me), the category must exist too.
+        standaloneEditorService.getInvocationParameters(parametersUUID, new GenericCallback<StandaloneEditorInvocationParameters>() {
+
+            public void onSuccess(final StandaloneEditorInvocationParameters parameters) {
+
+                //no assets? This is an error!
+                if (parameters.getAssetsToBeEdited().length == 0) {
+                    Window.alert(constants.NoRulesFound());
+                    return;
+                }
+
+                //we need to store the assets.
+                StandaloneEditorManager.this.assets = parameters.getAssetsToBeEdited();
+
+                //Load SCE and create a MultiViewEditor for the assets.
+                //We take the package from the first asset (because all the assets
+                //must belong to the same package)
+
+
+                Set<String> validFacts = null;
+                if (parameters.getValidFactTypes() != null){
+                    validFacts = new HashSet<String>();
+                    validFacts.addAll(Arrays.asList(parameters.getValidFactTypes()));
+                }
+                
+                WorkingSetManager.getInstance().applyTemporalWorkingSetForFactTypes(assets[0].metaData.packageName, validFacts, new Command() {
+
+                    public void execute() {
+                        LoadingPopup.close();
+
+                        //Configure RuleModeller
+                        RuleModellerConfiguration ruleModellerConfiguration = RuleModellerConfiguration.getInstance();
+                        ruleModellerConfiguration.setHideLHS(parameters.isHideLHS());
+                        ruleModellerConfiguration.setHideRHS(parameters.isHideRHS());
+                        ruleModellerConfiguration.setHideAttributes(parameters.isHideAttributes());
+
+                        //Create the editor
+                        MultiViewEditorMenuBarCreator editorMenuBarCreator;
+                        if (parameters.isTemporalAssets()) {
+                            editorMenuBarCreator = new TemporalAssetsMultiViewEditorMenuBarCreator(new Command() {
+                                //"Done" buton command
+
+                                public void execute() {
+                                    afterSaveAndClose();
+                                }
+                            }, new Command() {
+                                //"Cancel button command
+
+                                public void execute() {
+                                    afterCancelButtonCallbackFunction();
+                                }
+                            });
+                        } else {
+                            editorMenuBarCreator = new RealAssetsMultiViewEditorMenuBarCreator(new Command() {
+                                //"Cancel" button command
+
+                                public void execute() {
+                                    afterCancelButtonCallbackFunction();
+                                }
+                            });
+                        }
+
+                        editor = new MultiViewEditor(parameters.getAssetsToBeEdited(), new EditItemEvent() {
+
+                            public void open(MultiViewRow[] rows) {
+                                // TODO Auto-generated method stub
+                            }
+
+                            public void open(String key) {
+                                // TODO Auto-generated method stub
+                            }
+                        }, new StandaloneEditorIndividualActionToolbarButtonsConfigurationProvider(),
+                                editorMenuBarCreator);
+
+                        editor.setCloseCommand(new Command() {
+
+                            public void execute() {
+                                afterSaveAndClose();
+                            }
+                        });
+
+                        //Add the editor to main panel
+                        mainPanel.add(editor);
+                    }
+                });
+            }
+        });
+
+
+        return mainLayout;
+    }
+
+    /**
+     * This method should be invoked from JS using window.getEditorDRL().
+     * Returns the DRL of the assets we are editing. Because this method is 
+     * asynchronous, the DRL code is passed to a callback function specified
+     * in the JS invocation.
+     */
+    public void getDRLs() {
+        if (assets == null || assets.length == 0) {
+            returnDRL("");
+        }
+
+        standaloneEditorService.getAsstesDRL(assets, new GenericCallback<String[]>() {
+
+            public void onSuccess(String[] drls) {
+                String result = "";
+                if (drls != null) {
+                    for (String drl : drls) {
+                        result += drl + "\n\n";
+                    }
+                }
+
+                returnDRL(result);
+            }
+        });
+    }
+
+    /**
+     * This method should be invoked from JS using window.getEditorBRL().
+     * Returns the BRL of the assets we are editing. Because this method is 
+     * asynchronous, the BRL code is passed to a callback function specified
+     * in the JS invocation.
+     */
+    public void getBRLs() {
+        if (assets == null || assets.length == 0) {
+            returnDRL("");
+        }
+
+        standaloneEditorService.getAsstesBRL(assets, new GenericCallback<String[]>() {
+
+            public void onSuccess(String[] drls) {
+                String result = "";
+                if (drls != null) {
+                    for (String drl : drls) {
+                        result += drl + "\n\n";
+                    }
+                }
+
+                returnBRL(result);
+            }
+        });
+    }
+    
+    /**
+     * Returns the uuids of the assets that are being edited in JSON format.
+     * @return 
+     */
+    public String getAssetsUUIDs(){
+        StringBuilder uuids = new StringBuilder("[");
+        String separator = "";
+        for (int i = 0; i < this.assets.length; i++) {
+            uuids.append(separator);
+            uuids.append("'");
+            uuids.append(this.assets[i].uuid);
+            uuids.append("'");
+            if (separator.equals("")){
+                separator = ",";
+            }
+        }
+        uuids.append("]");
+        
+        return uuids.toString();
+    }
+
+    /**
+     * Creates 2 JS functions in window object: getDRLs() and getBRLs(). These
+     * functions are used to retrieve the source code of the assets this component
+     * is handling.
+     * @param app
+     */
+    public native void setHooks(StandaloneEditorManager app)/*-{
+    
+    var guvnorEditorObject = {
+    drlCallbackFunction: null,
+    brlCallbackFunction: null,
+    
+    //close function listener. The function you register here will be called
+    //after the "Save and Close" button is pressed                                                                                                                 
+    afterSaveAndCloseButtonCallbackFunction: null,
+    
+    afterCancelButtonCallbackFunction: null,
+    
+    getDRL: function (callbackFunction){
+    this.drlCallbackFunction = callbackFunction;
+    app. at org.drools.guvnor.client.ruleeditor.StandaloneEditorManager::getDRLs()();
+    },
+    
+    getBRL: function (callbackFunction){
+    this.brlCallbackFunction = callbackFunction;
+    app. at org.drools.guvnor.client.ruleeditor.StandaloneEditorManager::getBRLs()();
+    },
+    
+    registerAfterSaveAndCloseButtonCallbackFunction: function (callbackFunction){
+    this.afterSaveAndCloseButtonCallbackFunction = callbackFunction;
+    },
+    
+    registerAfterCancelButtonCallbackFunction: function (callbackFunction){
+    this.afterCancelButtonCallbackFunction = callbackFunction;
+    },
+    
+    getAssetsUUIDs: function(){
+    return app. at org.drools.guvnor.client.ruleeditor.StandaloneEditorManager::getAssetsUUIDs()();
+    }
+    }    
+    $wnd.guvnorEditorObject = guvnorEditorObject;                                                                                                      
+    
+    }-*/;
+
+    /**
+     * Callback method invoked from getDRLs().
+     * @param drl
+     */
+    public native void returnDRL(String drl)/*-{
+    if ($wnd.guvnorEditorObject.drlCallbackFunction){
+    $wnd.guvnorEditorObject.drlCallbackFunction(drl);
+    }
+    }-*/;
+
+    /**
+     * Callback method invoked from getDRLs().
+     * @param drl
+     */
+    public native void returnBRL(String brl)/*-{
+    if ($wnd.guvnorEditorObject.brlCallbackFunction){
+    $wnd.guvnorEditorObject.brlCallbackFunction(brl);
+    }
+    }-*/;
+
+    /**
+     * Method invoked after the "Save an Close" button is pressed. 
+     */
+    public native void afterSaveAndClose()/*-{
+    if ($wnd.guvnorEditorObject.afterSaveAndCloseButtonCallbackFunction){
+    $wnd.guvnorEditorObject.afterSaveAndCloseButtonCallbackFunction();
+    }
+    }-*/;
+
+    public native void afterCancelButtonCallbackFunction()/*-{
+    if ($wnd.guvnorEditorObject.afterCancelButtonCallbackFunction){
+    $wnd.guvnorEditorObject.afterCancelButtonCallbackFunction();
+    }
+    }-*/;
+}

Copied: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/standalone/StandaloneEditorInvocationParameters.java (from rev 36017, labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/standalone/StandaloneGuidedEditorInvocationParameters.java)
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/standalone/StandaloneEditorInvocationParameters.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/standalone/StandaloneEditorInvocationParameters.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.guvnor.client.ruleeditor.standalone;
+
+import java.io.Serializable;
+import org.drools.guvnor.client.rpc.RuleAsset;
+
+/**
+ * This class contains all the parameters passed in the invocation of the
+ * standalone editor. 
+ * This object is used to pass those parameters from server to client side.
+ * @author esteban.aliverti
+ */
+public class StandaloneEditorInvocationParameters implements Serializable {
+    
+    static final long serialVersionUID = 520L;
+    
+    private RuleAsset[] assetsToBeEdited;
+    private String[] validFactTypes;
+    
+    private boolean temporalAssets;
+    
+    private boolean hideLHS;
+    private boolean hideRHS;
+    private boolean hideAttributes;
+
+    public RuleAsset[] getAssetsToBeEdited() {
+        return assetsToBeEdited;
+    }
+
+    public void setAssetsToBeEdited(RuleAsset[] assetsToBeEdited) {
+        this.assetsToBeEdited = assetsToBeEdited;
+    }
+
+    public boolean isHideAttributes() {
+        return hideAttributes;
+    }
+
+    public void setHideAttributes(boolean hideAttributes) {
+        this.hideAttributes = hideAttributes;
+    }
+
+    public boolean isHideLHS() {
+        return hideLHS;
+    }
+
+    public void setHideLHS(boolean hideLHS) {
+        this.hideLHS = hideLHS;
+    }
+
+    public boolean isHideRHS() {
+        return hideRHS;
+    }
+
+    public void setHideRHS(boolean hideRHS) {
+        this.hideRHS = hideRHS;
+    }
+
+    public boolean isTemporalAssets() {
+        return temporalAssets;
+    }
+
+    public void setTemporalAssets(boolean temporalAssets) {
+        this.temporalAssets = temporalAssets;
+    }
+
+    public String[] getValidFactTypes() {
+        return validFactTypes;
+    }
+
+    public void setValidFactTypes(String[] validFactTypes) {
+        this.validFactTypes = validFactTypes;
+    }
+    
+}

Deleted: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/standalone/StandaloneGuidedEditorInvocationParameters.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/standalone/StandaloneGuidedEditorInvocationParameters.java	2010-11-23 14:10:35 UTC (rev 36032)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/standalone/StandaloneGuidedEditorInvocationParameters.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -1,89 +0,0 @@
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.drools.guvnor.client.ruleeditor.standalone;
-
-import java.io.Serializable;
-import org.drools.guvnor.client.rpc.RuleAsset;
-
-/**
- * This class contains all the parameters passed in the invocation of the
- * standalone guided editor. 
- * This object is used to pass those parameters from server to client side.
- * @author esteban.aliverti
- */
-public class StandaloneGuidedEditorInvocationParameters implements Serializable {
-    
-    static final long serialVersionUID = 520L;
-    
-    private RuleAsset[] assetsToBeEdited;
-    private String[] validFactTypes;
-    
-    private boolean temporalAssets;
-    
-    private boolean hideLHS;
-    private boolean hideRHS;
-    private boolean hideAttributes;
-
-    public RuleAsset[] getAssetsToBeEdited() {
-        return assetsToBeEdited;
-    }
-
-    public void setAssetsToBeEdited(RuleAsset[] assetsToBeEdited) {
-        this.assetsToBeEdited = assetsToBeEdited;
-    }
-
-    public boolean isHideAttributes() {
-        return hideAttributes;
-    }
-
-    public void setHideAttributes(boolean hideAttributes) {
-        this.hideAttributes = hideAttributes;
-    }
-
-    public boolean isHideLHS() {
-        return hideLHS;
-    }
-
-    public void setHideLHS(boolean hideLHS) {
-        this.hideLHS = hideLHS;
-    }
-
-    public boolean isHideRHS() {
-        return hideRHS;
-    }
-
-    public void setHideRHS(boolean hideRHS) {
-        this.hideRHS = hideRHS;
-    }
-
-    public boolean isTemporalAssets() {
-        return temporalAssets;
-    }
-
-    public void setTemporalAssets(boolean temporalAssets) {
-        this.temporalAssets = temporalAssets;
-    }
-
-    public String[] getValidFactTypes() {
-        return validFactTypes;
-    }
-
-    public void setValidFactTypes(String[] validFactTypes) {
-        this.validFactTypes = validFactTypes;
-    }
-    
-}

Copied: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/toolbar/StandaloneEditorIndividualActionToolbarButtonsConfigurationProvider.java (from rev 36008, labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/toolbar/StandaloneGuidedEditorIndividualActionToolbarButtonsConfigurationProvider.java)
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/toolbar/StandaloneEditorIndividualActionToolbarButtonsConfigurationProvider.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/toolbar/StandaloneEditorIndividualActionToolbarButtonsConfigurationProvider.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.guvnor.client.ruleeditor.toolbar;
+
+/**
+ *
+ * @author esteban.aliverti
+ */
+public class StandaloneEditorIndividualActionToolbarButtonsConfigurationProvider implements ActionToolbarButtonsConfigurationProvider {
+
+    public boolean showSaveButton() {
+        return false;
+    }
+
+    public boolean showSaveAndCloseButton() {
+        return false;
+    }
+
+    public boolean showCopyButton() {
+        return false;
+    }
+
+    public boolean showPromoteToGlobalButton() {
+        return false;
+    }
+
+    public boolean showArchiveButton() {
+        return false;
+    }
+
+    public boolean showDeleteButton() {
+        return false;
+    }
+
+    public boolean showChangeStatusButton() {
+        return false;
+    }
+
+    public boolean showSelectWorkingSetsButton() {
+        return false;
+    }
+
+    public boolean showValidateButton() {
+        return true;
+    }
+
+    public boolean showVerifyButton() {
+        return true;
+    }
+
+    public boolean showViewSourceButton() {
+        return true;
+    }
+    
+    public boolean showStateLabel() {
+        return false;
+    }
+
+}

Deleted: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/toolbar/StandaloneGuidedEditorIndividualActionToolbarButtonsConfigurationProvider.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/toolbar/StandaloneGuidedEditorIndividualActionToolbarButtonsConfigurationProvider.java	2010-11-23 14:10:35 UTC (rev 36032)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/toolbar/StandaloneGuidedEditorIndividualActionToolbarButtonsConfigurationProvider.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -1,73 +0,0 @@
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.drools.guvnor.client.ruleeditor.toolbar;
-
-/**
- *
- * @author esteban.aliverti
- */
-public class StandaloneGuidedEditorIndividualActionToolbarButtonsConfigurationProvider implements ActionToolbarButtonsConfigurationProvider {
-
-    public boolean showSaveButton() {
-        return false;
-    }
-
-    public boolean showSaveAndCloseButton() {
-        return false;
-    }
-
-    public boolean showCopyButton() {
-        return false;
-    }
-
-    public boolean showPromoteToGlobalButton() {
-        return false;
-    }
-
-    public boolean showArchiveButton() {
-        return false;
-    }
-
-    public boolean showDeleteButton() {
-        return false;
-    }
-
-    public boolean showChangeStatusButton() {
-        return false;
-    }
-
-    public boolean showSelectWorkingSetsButton() {
-        return false;
-    }
-
-    public boolean showValidateButton() {
-        return true;
-    }
-
-    public boolean showVerifyButton() {
-        return true;
-    }
-
-    public boolean showViewSourceButton() {
-        return true;
-    }
-    
-    public boolean showStateLabel() {
-        return false;
-    }
-
-}

Deleted: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/GuidedEditor.html
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/GuidedEditor.html	2010-11-23 14:10:35 UTC (rev 36032)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/GuidedEditor.html	2010-11-23 14:13:06 UTC (rev 36033)
@@ -1,69 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-   <head>
-      <!-- Note you can append #asset=UUID to the end of the URL to preload a given asset.
-         Also, if you appent #asset=UUID&nochrome it will only show the asset without all the GUI "chrome"
-
-         To select a locale, specify &locale=en_US at the end of the URL to pick the appropriate bundle.
-         -->
-      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-      <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
-		<title>JBoss Guvnor</title>
-	    <link rel="shortcut icon" href="images/drools.gif" type="image/gif"/>
-	    <link rel="icon" href="images/drools.gif" type="image/gif"/>
-
-	        <!--CSS for loading message at application Startup-->
-		    <style type="text/css">
-		        #loading {
-		            position: absolute;
-		            left: 45%;
-		            top: 40%;
-		            padding: 2px;
-		            z-index: 20001;
-		            height: auto;
-		            border: 1px solid #ccc;
-		        }
-		        #loading a {
-		            color: #225588;
-		        }
-
-		        #loading .loading-indicator {
-		            background: white;
-		            color: #444;
-		            font: bold 13px tahoma, arial, helvetica;
-		            padding: 10px;
-		            margin: 0;
-		            height: auto;
-		        }
-
-		        #loading-msg {
-		            font: normal 10px arial, tahoma, sans-serif;
-		        }
-		    </style>
-
-		<link rel="stylesheet" href="Guvnor.css">
-		<link rel="stylesheet" href="Guvnor_DecoratedPopupPanel.css">
-		<link rel="stylesheet" href="ruleflow.css">
-		<link rel="stylesheet" href="header.css">
-   </head>
-   <body>
-      <iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
-
-      <!--add loading indicator while the app is being loaded-->
-		<div id="loading">
-		    <div class="loading-indicator">
-		        <img src="js/ext/resources/images/default/shared/large-loading.gif" width="32" height="32"
-		             style="margin-right:8px;float:left;vertical-align:top;"/>Please wait<br/>
-		        <span id="loading-msg">Loading application...</span></div>
-		</div>
-
-
-
-      <!-- The GWT js file generated at run time -->
-      <script type="text/javascript" src='org.drools.guvnor.Guvnor.nocache.js'></script>
-
-      <!--hide loading message-->
-	  <script type="text/javascript">Ext.get('loading').fadeOut({remove: true, duration:.25});</script>
-
-   </body>
-</html>
\ No newline at end of file

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/StandaloneEditor.html
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/StandaloneEditor.html	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/StandaloneEditor.html	2010-11-23 14:13:06 UTC (rev 36033)
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+   <head>
+      <!-- Note you can append #asset=UUID to the end of the URL to preload a given asset.
+         Also, if you appent #asset=UUID&nochrome it will only show the asset without all the GUI "chrome"
+
+         To select a locale, specify &locale=en_US at the end of the URL to pick the appropriate bundle.
+         -->
+      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+      <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
+		<title>JBoss Guvnor</title>
+	    <link rel="shortcut icon" href="images/drools.gif" type="image/gif"/>
+	    <link rel="icon" href="images/drools.gif" type="image/gif"/>
+
+	        <!--CSS for loading message at application Startup-->
+		    <style type="text/css">
+		        #loading {
+		            position: absolute;
+		            left: 45%;
+		            top: 40%;
+		            padding: 2px;
+		            z-index: 20001;
+		            height: auto;
+		            border: 1px solid #ccc;
+		        }
+		        #loading a {
+		            color: #225588;
+		        }
+
+		        #loading .loading-indicator {
+		            background: white;
+		            color: #444;
+		            font: bold 13px tahoma, arial, helvetica;
+		            padding: 10px;
+		            margin: 0;
+		            height: auto;
+		        }
+
+		        #loading-msg {
+		            font: normal 10px arial, tahoma, sans-serif;
+		        }
+		    </style>
+
+		<link rel="stylesheet" href="Guvnor.css">
+		<link rel="stylesheet" href="Guvnor_DecoratedPopupPanel.css">
+		<link rel="stylesheet" href="ruleflow.css">
+		<link rel="stylesheet" href="header.css">
+   </head>
+   <body>
+      <iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
+
+      <!--add loading indicator while the app is being loaded-->
+		<div id="loading">
+		    <div class="loading-indicator">
+		        <img src="js/ext/resources/images/default/shared/large-loading.gif" width="32" height="32"
+		             style="margin-right:8px;float:left;vertical-align:top;"/>Please wait<br/>
+		        <span id="loading-msg">Loading application...</span></div>
+		</div>
+
+
+
+      <!-- The GWT js file generated at run time -->
+      <script type="text/javascript" src='org.drools.guvnor.Guvnor.nocache.js'></script>
+
+      <!--hide loading message-->
+	  <script type="text/javascript">Ext.get('loading').fadeOut({remove: true, duration:.25});</script>
+
+   </body>
+</html>
\ No newline at end of file

Deleted: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/GuidedEditorServlet.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/GuidedEditorServlet.java	2010-11-23 14:10:35 UTC (rev 36032)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/GuidedEditorServlet.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -1,92 +0,0 @@
-/**
- * Copyright 2010 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.drools.guvnor.server;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-public class GuidedEditorServlet extends HttpServlet {
-
-    public static enum GUIDED_EDITOR_SERVLET_PARAMETERS {
-
-        GE_PACKAGE_PARAMETER_NAME("packageName", false), 
-        GE_CATEGORY_PARAMETER_NAME("categoryName", false), 
-        GE_BRL_PARAMETER_NAME("brlSource", true), 
-        GE_ASSETS_UUIDS_PARAMETER_NAME("assetsUUIDs", true), 
-        GE_CREATE_NEW_ASSET_PARAMETER_NAME("createNewAsset", false),
-        
-        //Only used when creating a new Rule
-        GE_ASSET_NAME_PARAMETER_NAME("assetName", false),
-        GE_ASSET_FORMAT_PARAMETER_NAME("assetFormat", false),
-        
-        
-        GE_HIDE_RULE_LHS_PARAMETER_NAME("hideRuleLHS", false),
-        GE_HIDE_RULE_RHS_PARAMETER_NAME("hideRuleRHS", false), 
-        GE_HIDE_RULE_ATTRIBUTES_PARAMETER_NAME("hideRuleAttributes", false),
-        
-        GE_VALID_FACT_TYPE_PARAMETER_NAME("validFactType", true);
-        
-        private String parameterName;
-        private boolean multipleValues;
-
-        private GUIDED_EDITOR_SERVLET_PARAMETERS(String parameterName,
-                boolean multipleValues) {
-            this.parameterName = parameterName;
-            this.multipleValues = multipleValues;
-        }
-
-        public String getParameterName() {
-            return parameterName;
-        }
-
-        public boolean isMultipleValues() {
-            return multipleValues;
-        }
-    }
-
-    @Override
-    protected void doPost(HttpServletRequest req,
-            HttpServletResponse resp) throws ServletException,
-            IOException {
-        HttpSession session = req.getSession(true);
-        //Each request uses its own parameters map (this allows concurrent requests
-        //from the same cilent)
-        Map<String, Object> parameters = new HashMap<String, Object>();
-        //copy each registered parameter from request to session
-        for (GUIDED_EDITOR_SERVLET_PARAMETERS parameter : GUIDED_EDITOR_SERVLET_PARAMETERS.values()) {
-            if (parameter.isMultipleValues()) {
-                parameters.put(parameter.getParameterName(),
-                        req.getParameterValues(parameter.getParameterName()));
-            } else {
-                parameters.put(parameter.getParameterName(),
-                        req.getParameter(parameter.getParameterName()));
-            }
-        }
-
-        String parametersUUID = UUID.randomUUID().toString();
-        session.setAttribute(parametersUUID, parameters);
-
-        resp.sendRedirect("GuidedEditor.html?pUUID=" + parametersUUID + "&" + req.getQueryString());
-    }
-}

Copied: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/StandaloneEditorServiceImplementation.java (from rev 36019, labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/StandaloneGuidedEditorServiceImplementation.java)
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/StandaloneEditorServiceImplementation.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/StandaloneEditorServiceImplementation.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.drools.guvnor.server;
+
+import com.google.gwt.user.client.rpc.SerializationException;
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+import java.util.Map;
+import javax.servlet.http.HttpSession;
+import org.drools.guvnor.client.rpc.DetailedSerializationException;
+import org.drools.guvnor.client.rpc.RuleAsset;
+import org.drools.guvnor.client.rpc.StandaloneEditorService;
+import org.drools.guvnor.client.ruleeditor.standalone.StandaloneEditorInvocationParameters;
+import org.drools.guvnor.server.standalonededitor.BRLRuleAssetProvider;
+import org.drools.guvnor.server.standalonededitor.NewRuleAssetProvider;
+import org.drools.guvnor.server.standalonededitor.RuleAssetProvider;
+import org.drools.guvnor.server.standalonededitor.UUIDRuleAssetProvider;
+import org.drools.ide.common.client.modeldriven.brl.RuleModel;
+import org.drools.ide.common.server.util.BRLPersistence;
+import org.drools.repository.RulesRepository;
+import org.jboss.seam.annotations.In;
+
+import org.drools.ide.common.server.util.BRXMLPersistence;
+
+/**
+ * All the needed Services in order to get Guvnor's Editors running as standalone
+ * app.
+ * @author esteban.aliverti
+ */
+public class StandaloneEditorServiceImplementation extends RemoteServiceServlet
+    implements
+    StandaloneEditorService {
+
+    @In
+    public RulesRepository    repository;
+    private static final long serialVersionUID = 520l;
+
+    public RulesRepository getRulesRepository() {
+        return this.repository;
+    }
+
+    private ServiceImplementation getService() {
+        return RepositoryServiceServlet.getService();
+    }
+
+    public StandaloneEditorInvocationParameters getInvocationParameters(String parametersUUID) throws DetailedSerializationException {
+
+        HttpSession session = this.getThreadLocalRequest().getSession();
+        
+        try{
+            //Get the parameters from the session
+            Map<String, Object> sessionParameters = (Map<String, Object>
+            ) session.getAttribute(parametersUUID);
+
+            if (sessionParameters == null || sessionParameters.isEmpty()){
+                throw new DetailedSerializationException("Error initializing Guided Editor", "No initial parameters were supplied");
+            }
+
+            boolean hideLHSInEditor = false;
+            Object attribute =  sessionParameters.get( StandaloneEditorServlet.STANDALONE_EDITOR_SERVLET_PARAMETERS.GE_HIDE_RULE_LHS_PARAMETER_NAME.getParameterName() );
+            if ( attribute != null ) {
+                hideLHSInEditor = Boolean.parseBoolean( attribute.toString() );
+            }
+
+            boolean hideRHSInEditor = false;
+            attribute = sessionParameters.get( StandaloneEditorServlet.STANDALONE_EDITOR_SERVLET_PARAMETERS.GE_HIDE_RULE_RHS_PARAMETER_NAME.getParameterName() );
+            if ( attribute != null ) {
+                hideRHSInEditor = Boolean.parseBoolean( attribute.toString() );
+            }
+
+            boolean hideAttributesInEditor = false;
+            attribute = sessionParameters.get( StandaloneEditorServlet.STANDALONE_EDITOR_SERVLET_PARAMETERS.GE_HIDE_RULE_ATTRIBUTES_PARAMETER_NAME.getParameterName() );
+            if ( attribute != null ) {
+                hideAttributesInEditor = Boolean.parseBoolean( attribute.toString() );
+            }
+            
+            String[] validFactTypes = (String[])sessionParameters.get( StandaloneEditorServlet.STANDALONE_EDITOR_SERVLET_PARAMETERS.GE_VALID_FACT_TYPE_PARAMETER_NAME.getParameterName() );
+
+            StandaloneEditorInvocationParameters invocationParameters = new StandaloneEditorInvocationParameters();
+
+            this.loadRuleAssetsFromSessionParameters(sessionParameters, invocationParameters);
+
+            invocationParameters.setHideLHS( hideLHSInEditor );
+            invocationParameters.setHideRHS( hideRHSInEditor );
+            invocationParameters.setHideAttributes( hideAttributesInEditor );
+            invocationParameters.setValidFactTypes(validFactTypes);
+
+
+            return invocationParameters;
+        } finally{
+            //clear session parameters
+            session.removeAttribute(parametersUUID);
+        }
+        
+    }
+
+    /**
+     * To open the Standalone Editor, you should be gone through 
+     * StandaloneEditorServlet first. This servlet put all the POST parameters into
+     * session. This method takes those parameters and load the corresponding
+     * assets.
+     * This method will set the assets in parameters 
+     * @param parameters 
+     * @throws DetailedSerializationException
+     */
+    private void loadRuleAssetsFromSessionParameters(Map<String, Object> sessionParameters, StandaloneEditorInvocationParameters invocationParameters) throws DetailedSerializationException {
+
+        String packageName = (String)sessionParameters.get( StandaloneEditorServlet.STANDALONE_EDITOR_SERVLET_PARAMETERS.GE_PACKAGE_PARAMETER_NAME.getParameterName() );
+        String categoryName = (String)sessionParameters.get( StandaloneEditorServlet.STANDALONE_EDITOR_SERVLET_PARAMETERS.GE_CATEGORY_PARAMETER_NAME.getParameterName() );
+        String[] initialBRL = (String[])sessionParameters.get( StandaloneEditorServlet.STANDALONE_EDITOR_SERVLET_PARAMETERS.GE_BRL_PARAMETER_NAME.getParameterName() );
+        String[] assetsUUIDs = (String[])sessionParameters.get( StandaloneEditorServlet.STANDALONE_EDITOR_SERVLET_PARAMETERS.GE_ASSETS_UUIDS_PARAMETER_NAME.getParameterName() );
+
+        boolean createNewAsset = false;
+        Object attribute = sessionParameters.get( StandaloneEditorServlet.STANDALONE_EDITOR_SERVLET_PARAMETERS.GE_CREATE_NEW_ASSET_PARAMETER_NAME.getParameterName() );
+        if ( attribute != null ) {
+            createNewAsset = Boolean.parseBoolean( attribute.toString() );
+        }
+        String assetName = (String) sessionParameters.get( StandaloneEditorServlet.STANDALONE_EDITOR_SERVLET_PARAMETERS.GE_ASSET_NAME_PARAMETER_NAME.getParameterName() );
+        String assetFormat = (String) sessionParameters.get( StandaloneEditorServlet.STANDALONE_EDITOR_SERVLET_PARAMETERS.GE_ASSET_FORMAT_PARAMETER_NAME.getParameterName() );
+
+        RuleAssetProvider provider;
+        if ( createNewAsset ) {
+            provider = new NewRuleAssetProvider( packageName,
+                                                 categoryName,
+                                                 assetName,
+                                                 assetFormat);
+            invocationParameters.setTemporalAssets(false);
+        } else if ( assetsUUIDs != null ) {
+            provider = new UUIDRuleAssetProvider( assetsUUIDs );
+            invocationParameters.setTemporalAssets(false);
+        } else if ( initialBRL != null ) {
+            provider = new BRLRuleAssetProvider( packageName,
+                                                 initialBRL );
+            invocationParameters.setTemporalAssets(true);
+        } else {
+            throw new IllegalStateException();
+        }
+
+        invocationParameters.setAssetsToBeEdited(provider.getRuleAssets());
+
+    }
+
+    /**
+     * Returns the DRL source code of the given assets.
+     * @param assets
+     * @return
+     * @throws SerializationException
+     */
+    public String[] getAsstesDRL(RuleAsset[] assets) throws SerializationException {
+
+        String[] sources = new String[assets.length];
+
+        for ( int i = 0; i < assets.length; i++ ) {
+            sources[i] = this.getService().buildAssetSource( assets[i] );
+        }
+
+        return sources;
+    }
+
+    /**
+     * Returns the BRL source code of the given assets.
+     * @param assets
+     * @return
+     * @throws SerializationException
+     */
+    public String[] getAsstesBRL(RuleAsset[] assets) throws SerializationException {
+
+        String[] sources = new String[assets.length];
+
+        BRLPersistence converter = BRXMLPersistence.getInstance();
+        for ( int i = 0; i < assets.length; i++ ) {
+            sources[i] = converter.marshal( (RuleModel) assets[i].content );
+        }
+
+        return sources;
+    }
+}

Copied: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/StandaloneEditorServlet.java (from rev 36019, labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/GuidedEditorServlet.java)
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/StandaloneEditorServlet.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/StandaloneEditorServlet.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -0,0 +1,92 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.drools.guvnor.server;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+public class StandaloneEditorServlet extends HttpServlet {
+
+    public static enum STANDALONE_EDITOR_SERVLET_PARAMETERS {
+
+        GE_PACKAGE_PARAMETER_NAME("packageName", false), 
+        GE_CATEGORY_PARAMETER_NAME("categoryName", false), 
+        GE_BRL_PARAMETER_NAME("brlSource", true), 
+        GE_ASSETS_UUIDS_PARAMETER_NAME("assetsUUIDs", true), 
+        GE_CREATE_NEW_ASSET_PARAMETER_NAME("createNewAsset", false),
+        
+        //Only used when creating a new Rule
+        GE_ASSET_NAME_PARAMETER_NAME("assetName", false),
+        GE_ASSET_FORMAT_PARAMETER_NAME("assetFormat", false),
+        
+        
+        GE_HIDE_RULE_LHS_PARAMETER_NAME("hideRuleLHS", false),
+        GE_HIDE_RULE_RHS_PARAMETER_NAME("hideRuleRHS", false), 
+        GE_HIDE_RULE_ATTRIBUTES_PARAMETER_NAME("hideRuleAttributes", false),
+        
+        GE_VALID_FACT_TYPE_PARAMETER_NAME("validFactType", true);
+        
+        private String parameterName;
+        private boolean multipleValues;
+
+        private STANDALONE_EDITOR_SERVLET_PARAMETERS(String parameterName,
+                boolean multipleValues) {
+            this.parameterName = parameterName;
+            this.multipleValues = multipleValues;
+        }
+
+        public String getParameterName() {
+            return parameterName;
+        }
+
+        public boolean isMultipleValues() {
+            return multipleValues;
+        }
+    }
+
+    @Override
+    protected void doPost(HttpServletRequest req,
+            HttpServletResponse resp) throws ServletException,
+            IOException {
+        HttpSession session = req.getSession(true);
+        //Each request uses its own parameters map (this allows concurrent requests
+        //from the same cilent)
+        Map<String, Object> parameters = new HashMap<String, Object>();
+        //copy each registered parameter from request to session
+        for (STANDALONE_EDITOR_SERVLET_PARAMETERS parameter : STANDALONE_EDITOR_SERVLET_PARAMETERS.values()) {
+            if (parameter.isMultipleValues()) {
+                parameters.put(parameter.getParameterName(),
+                        req.getParameterValues(parameter.getParameterName()));
+            } else {
+                parameters.put(parameter.getParameterName(),
+                        req.getParameter(parameter.getParameterName()));
+            }
+        }
+
+        String parametersUUID = UUID.randomUUID().toString();
+        session.setAttribute(parametersUUID, parameters);
+
+        resp.sendRedirect("StandaloneEditor.html?pUUID=" + parametersUUID + "&" + req.getQueryString());
+    }
+}

Deleted: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/StandaloneGuidedEditorServiceImplementation.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/StandaloneGuidedEditorServiceImplementation.java	2010-11-23 14:10:35 UTC (rev 36032)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/StandaloneGuidedEditorServiceImplementation.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -1,189 +0,0 @@
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.drools.guvnor.server;
-
-import com.google.gwt.user.client.rpc.SerializationException;
-import com.google.gwt.user.server.rpc.RemoteServiceServlet;
-import java.util.Map;
-import javax.servlet.http.HttpSession;
-import org.drools.guvnor.client.rpc.DetailedSerializationException;
-import org.drools.guvnor.client.rpc.RuleAsset;
-import org.drools.guvnor.client.rpc.StandaloneGuidedEditorService;
-import org.drools.guvnor.client.ruleeditor.standalone.StandaloneGuidedEditorInvocationParameters;
-import org.drools.guvnor.server.guidededitor.BRLRuleAssetProvider;
-import org.drools.guvnor.server.guidededitor.NewRuleAssetProvider;
-import org.drools.guvnor.server.guidededitor.RuleAssetProvider;
-import org.drools.guvnor.server.guidededitor.UUIDRuleAssetProvider;
-import org.drools.ide.common.client.modeldriven.brl.RuleModel;
-import org.drools.ide.common.server.util.BRLPersistence;
-import org.drools.repository.RulesRepository;
-import org.jboss.seam.annotations.In;
-
-import org.drools.ide.common.server.util.BRXMLPersistence;
-
-/**
- * All the needed Services in order to get the Guided Editor running as standalone
- * app.
- * @author esteban.aliverti
- */
-public class StandaloneGuidedEditorServiceImplementation extends RemoteServiceServlet
-    implements
-    StandaloneGuidedEditorService {
-
-    @In
-    public RulesRepository    repository;
-    private static final long serialVersionUID = 520l;
-
-    public RulesRepository getRulesRepository() {
-        return this.repository;
-    }
-
-    private ServiceImplementation getService() {
-        return RepositoryServiceServlet.getService();
-    }
-
-    public StandaloneGuidedEditorInvocationParameters getInvocationParameters(String parametersUUID) throws DetailedSerializationException {
-
-        HttpSession session = this.getThreadLocalRequest().getSession();
-        
-        try{
-            //Get the parameters from the session
-            Map<String, Object> sessionParameters = (Map<String, Object>
-            ) session.getAttribute(parametersUUID);
-
-            if (sessionParameters == null || sessionParameters.isEmpty()){
-                throw new DetailedSerializationException("Error initializing Guided Editor", "No initial parameters were supplied");
-            }
-
-            boolean hideLHSInEditor = false;
-            Object attribute =  sessionParameters.get( GuidedEditorServlet.GUIDED_EDITOR_SERVLET_PARAMETERS.GE_HIDE_RULE_LHS_PARAMETER_NAME.getParameterName() );
-            if ( attribute != null ) {
-                hideLHSInEditor = Boolean.parseBoolean( attribute.toString() );
-            }
-
-            boolean hideRHSInEditor = false;
-            attribute = sessionParameters.get( GuidedEditorServlet.GUIDED_EDITOR_SERVLET_PARAMETERS.GE_HIDE_RULE_RHS_PARAMETER_NAME.getParameterName() );
-            if ( attribute != null ) {
-                hideRHSInEditor = Boolean.parseBoolean( attribute.toString() );
-            }
-
-            boolean hideAttributesInEditor = false;
-            attribute = sessionParameters.get( GuidedEditorServlet.GUIDED_EDITOR_SERVLET_PARAMETERS.GE_HIDE_RULE_ATTRIBUTES_PARAMETER_NAME.getParameterName() );
-            if ( attribute != null ) {
-                hideAttributesInEditor = Boolean.parseBoolean( attribute.toString() );
-            }
-            
-            String[] validFactTypes = (String[])sessionParameters.get( GuidedEditorServlet.GUIDED_EDITOR_SERVLET_PARAMETERS.GE_VALID_FACT_TYPE_PARAMETER_NAME.getParameterName() );
-
-            StandaloneGuidedEditorInvocationParameters invocationParameters = new StandaloneGuidedEditorInvocationParameters();
-
-            this.loadRuleAssetsFromSessionParameters(sessionParameters, invocationParameters);
-
-            invocationParameters.setHideLHS( hideLHSInEditor );
-            invocationParameters.setHideRHS( hideRHSInEditor );
-            invocationParameters.setHideAttributes( hideAttributesInEditor );
-            invocationParameters.setValidFactTypes(validFactTypes);
-
-
-            return invocationParameters;
-        } finally{
-            //clear session parameters
-            session.removeAttribute(parametersUUID);
-        }
-        
-    }
-
-    /**
-     * To open the Guided Editor as standalone, you should be gone through 
-     * GuidedEditorServlet first. This servlet put all the POST parameters into
-     * session. This method takes those parameters and load the corresponding
-     * assets.
-     * This method will set the assets in parameters 
-     * @param parameters 
-     * @throws DetailedSerializationException
-     */
-    private void loadRuleAssetsFromSessionParameters(Map<String, Object> sessionParameters, StandaloneGuidedEditorInvocationParameters invocationParameters) throws DetailedSerializationException {
-
-        String packageName = (String)sessionParameters.get( GuidedEditorServlet.GUIDED_EDITOR_SERVLET_PARAMETERS.GE_PACKAGE_PARAMETER_NAME.getParameterName() );
-        String categoryName = (String)sessionParameters.get( GuidedEditorServlet.GUIDED_EDITOR_SERVLET_PARAMETERS.GE_CATEGORY_PARAMETER_NAME.getParameterName() );
-        String[] initialBRL = (String[])sessionParameters.get( GuidedEditorServlet.GUIDED_EDITOR_SERVLET_PARAMETERS.GE_BRL_PARAMETER_NAME.getParameterName() );
-        String[] assetsUUIDs = (String[])sessionParameters.get( GuidedEditorServlet.GUIDED_EDITOR_SERVLET_PARAMETERS.GE_ASSETS_UUIDS_PARAMETER_NAME.getParameterName() );
-
-        boolean createNewAsset = false;
-        Object attribute = sessionParameters.get( GuidedEditorServlet.GUIDED_EDITOR_SERVLET_PARAMETERS.GE_CREATE_NEW_ASSET_PARAMETER_NAME.getParameterName() );
-        if ( attribute != null ) {
-            createNewAsset = Boolean.parseBoolean( attribute.toString() );
-        }
-        String assetName = (String) sessionParameters.get( GuidedEditorServlet.GUIDED_EDITOR_SERVLET_PARAMETERS.GE_ASSET_NAME_PARAMETER_NAME.getParameterName() );
-        String assetFormat = (String) sessionParameters.get( GuidedEditorServlet.GUIDED_EDITOR_SERVLET_PARAMETERS.GE_ASSET_FORMAT_PARAMETER_NAME.getParameterName() );
-
-        RuleAssetProvider provider;
-        if ( createNewAsset ) {
-            provider = new NewRuleAssetProvider( packageName,
-                                                 categoryName,
-                                                 assetName,
-                                                 assetFormat);
-            invocationParameters.setTemporalAssets(false);
-        } else if ( assetsUUIDs != null ) {
-            provider = new UUIDRuleAssetProvider( assetsUUIDs );
-            invocationParameters.setTemporalAssets(false);
-        } else if ( initialBRL != null ) {
-            provider = new BRLRuleAssetProvider( packageName,
-                                                 initialBRL );
-            invocationParameters.setTemporalAssets(true);
-        } else {
-            throw new IllegalStateException();
-        }
-
-        invocationParameters.setAssetsToBeEdited(provider.getRuleAssets());
-
-    }
-
-    /**
-     * Returns the DRL source code of the given assets.
-     * @param assets
-     * @return
-     * @throws SerializationException
-     */
-    public String[] getAsstesDRL(RuleAsset[] assets) throws SerializationException {
-
-        String[] sources = new String[assets.length];
-
-        for ( int i = 0; i < assets.length; i++ ) {
-            sources[i] = this.getService().buildAssetSource( assets[i] );
-        }
-
-        return sources;
-    }
-
-    /**
-     * Returns the BRL source code of the given assets.
-     * @param assets
-     * @return
-     * @throws SerializationException
-     */
-    public String[] getAsstesBRL(RuleAsset[] assets) throws SerializationException {
-
-        String[] sources = new String[assets.length];
-
-        BRLPersistence converter = BRXMLPersistence.getInstance();
-        for ( int i = 0; i < assets.length; i++ ) {
-            sources[i] = converter.marshal( (RuleModel) assets[i].content );
-        }
-
-        return sources;
-    }
-}

Copied: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/BRLRuleAssetProvider.java (from rev 36008, labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/guidededitor/BRLRuleAssetProvider.java)
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/BRLRuleAssetProvider.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/BRLRuleAssetProvider.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.guvnor.server.standalonededitor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.guvnor.client.common.AssetFormats;
+import org.drools.guvnor.client.rpc.DetailedSerializationException;
+import org.drools.guvnor.client.rpc.MetaData;
+import org.drools.guvnor.client.rpc.RuleAsset;
+import org.drools.guvnor.server.RepositoryServiceServlet;
+import org.drools.guvnor.server.ServiceImplementation;
+import org.drools.ide.common.client.modeldriven.brl.RuleModel;
+import org.drools.ide.common.server.util.BRXMLPersistence;
+
+/**
+ * BRL -> RuleAsset converter used by standalone editor.
+ * For each brl provided, a new RuleAsset is created. The name of the RuleAsset
+ * will be the name present in the brl concatenated with a unique number.
+ * @author esteban.aliverti
+ */
+public class BRLRuleAssetProvider
+    implements
+    RuleAssetProvider {
+
+    private String   packageName;
+    private String[] initialBRLs;
+
+    public BRLRuleAssetProvider(String packageName,
+                                String[] initialBRLs) {
+        this.packageName = packageName;
+        this.initialBRLs = initialBRLs;
+    }
+
+    public RuleAsset[] getRuleAssets() throws DetailedSerializationException {
+
+        List<RuleModel> models = new ArrayList<RuleModel>( initialBRLs.length );
+        List<RuleAsset> assets = new ArrayList<RuleAsset>( initialBRLs.length );
+
+        //We wan't to avoid inconsistent states, that is why we first unmarshal
+        //each brl and then (if nothing fails) create each rule
+        for ( String brl : initialBRLs ) {
+            //convert the BRL to RuleModel
+            models.add( BRXMLPersistence.getInstance().unmarshal( brl ) );
+        }
+
+        //no unmarshal errors, it's time to create the rules
+        try {
+            for ( RuleModel ruleModel : models ) {
+                assets.add( this.createAsset( ruleModel ) );
+            }
+        } catch ( Exception e ) {
+            //if something failed, delete the generated assets
+            for ( RuleAsset ruleAsset : assets ) {
+                this.getService().removeAsset( ruleAsset.uuid );
+            }
+
+            if ( e instanceof DetailedSerializationException ) {
+                throw (DetailedSerializationException) e;
+            }
+
+            throw new DetailedSerializationException( "Error creating assets",
+                                                      e.getMessage() );
+        }
+
+        return assets.toArray( new RuleAsset[assets.size()] );
+    }
+
+    private RuleAsset createAsset(RuleModel ruleModel) {
+        RuleAsset asset = new RuleAsset();
+
+        asset.uuid = "mock";
+        asset.content = ruleModel;
+        asset.metaData = createMetaData( ruleModel );
+
+        return asset;
+    }
+
+    private MetaData createMetaData(RuleModel ruleModel) {
+        MetaData metaData = new MetaData();
+
+        metaData.name = ruleModel.name;
+        metaData.packageName = packageName;
+        metaData.format = AssetFormats.BUSINESS_RULE;
+
+        metaData.packageUUID = "mock";
+
+        return metaData;
+    }
+
+    private ServiceImplementation getService() {
+        return RepositoryServiceServlet.getService();
+    }
+
+}

Copied: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/NewRuleAssetProvider.java (from rev 36019, labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/guidededitor/NewRuleAssetProvider.java)
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/NewRuleAssetProvider.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/NewRuleAssetProvider.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.drools.guvnor.server.standalonededitor;
+
+import com.google.gwt.user.client.rpc.SerializationException;
+import org.drools.guvnor.client.common.AssetFormats;
+import org.drools.guvnor.client.rpc.DetailedSerializationException;
+import org.drools.guvnor.client.rpc.RuleAsset;
+import org.drools.guvnor.server.RepositoryServiceServlet;
+import org.drools.guvnor.server.ServiceImplementation;
+
+/**
+ * Creates a new RuleAsset.
+ * @author esteban.aliverti
+ */
+public class NewRuleAssetProvider implements RuleAssetProvider {
+
+    private String packageName;
+    private String categoryName; 
+    private String assetName;
+    private String assetFormat;
+
+    public NewRuleAssetProvider(String packageName, String categoryName, String assetName, String assetFormat) {
+        this.packageName = packageName;
+        this.categoryName = categoryName;
+        this.assetName = assetName;
+        this.assetFormat = assetFormat != null?assetFormat:AssetFormats.BUSINESS_RULE;
+    }
+    
+    public RuleAsset[] getRuleAssets() throws DetailedSerializationException {
+        try {
+            //creates a new empty asset with the given name and format in the
+            //given package.
+            String ruleUUID = this.getService().createNewRule(assetName, "created by standalone editor", categoryName, packageName, this.assetFormat);
+            RuleAsset newRule = this.getService().loadRuleAsset(ruleUUID);
+
+            return new RuleAsset[]{newRule};
+        } catch (SerializationException ex) {
+            throw new DetailedSerializationException("Error creating rule asset", ex.getMessage());
+        }
+
+    }
+
+    private ServiceImplementation getService() {
+        return RepositoryServiceServlet.getService();
+    }
+}

Copied: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/RuleAssetProvider.java (from rev 36008, labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/guidededitor/RuleAssetProvider.java)
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/RuleAssetProvider.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/RuleAssetProvider.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.guvnor.server.standalonededitor;
+
+import org.drools.guvnor.client.rpc.DetailedSerializationException;
+import org.drools.guvnor.client.rpc.RuleAsset;
+
+/**
+ * Interface used by the standalone editor to convert request parameters
+ * to RuleAssets.
+ * @author esteban.aliverti
+ */
+public interface RuleAssetProvider {
+    
+    RuleAsset[] getRuleAssets() throws DetailedSerializationException ; 
+    
+}

Copied: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/UUIDRuleAssetProvider.java (from rev 36008, labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/guidededitor/UUIDRuleAssetProvider.java)
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/UUIDRuleAssetProvider.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/standalonededitor/UUIDRuleAssetProvider.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.drools.guvnor.server.standalonededitor;
+
+import com.google.gwt.user.client.rpc.SerializationException;
+import org.drools.guvnor.client.rpc.DetailedSerializationException;
+import org.drools.guvnor.client.rpc.RuleAsset;
+import org.drools.guvnor.server.RepositoryServiceServlet;
+import org.drools.guvnor.server.ServiceImplementation;
+
+/**
+ * Creates a new RuleAsset.
+ * @author esteban.aliverti
+ */
+public class UUIDRuleAssetProvider implements RuleAssetProvider {
+
+    private String[] assetsUUIDs;
+
+    public UUIDRuleAssetProvider(String[] assetsUUIDs) {
+        this.assetsUUIDs = assetsUUIDs;
+    }
+    
+    public RuleAsset[] getRuleAssets() throws DetailedSerializationException {
+        try {
+
+            RuleAsset[] assets = new RuleAsset[assetsUUIDs.length];
+            
+            for (int i = 0; i < assetsUUIDs.length; i++) {
+                String uuid = assetsUUIDs[i];
+                assets[i] = this.getService().loadRuleAsset(uuid);
+            }
+            
+            return assets;
+        } catch (SerializationException ex) {
+            throw new DetailedSerializationException("Error creating rule asset", ex.getMessage());
+        }
+
+
+    }
+
+    private ServiceImplementation getService() {
+        return RepositoryServiceServlet.getService();
+    }
+
+}

Modified: labs/jbossrules/trunk/drools-guvnor/src/main/webapp/WEB-INF/web.xml
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/webapp/WEB-INF/web.xml	2010-11-23 14:10:35 UTC (rev 36032)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/webapp/WEB-INF/web.xml	2010-11-23 14:13:06 UTC (rev 36033)
@@ -1,136 +1,135 @@
-<?xml version="1.0"?>
-<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
-                         "http://java.sun.com/dtd/web-app_2_3.dtd">
-<web-app>
-	<display-name>JBoss Drools Guvnor</display-name>
-	<filter>
-		<filter-name>Seam Filter</filter-name>
-		<filter-class>org.jboss.seam.web.ContextFilter</filter-class>
-	</filter>
-	<filter-mapping>
-		<filter-name>Seam Filter</filter-name>
-		<url-pattern>/*</url-pattern>
-	</filter-mapping>
-	<listener>
-		<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
-	</listener>
-	<!-- servlets - mostly to do with file management -->
-	<servlet>
-		<servlet-name>guvnorService</servlet-name>
-		<servlet-class>org.drools.guvnor.server.RepositoryServiceServlet</servlet-class>
-	</servlet>
-	<servlet>
-		<servlet-name>securityService</servlet-name>
-		<servlet-class>org.drools.guvnor.server.SecurityServiceServlet</servlet-class>
-	</servlet>
-	<servlet>
-		<servlet-name>AssetFileServlet</servlet-name>
-		<servlet-class>org.drools.guvnor.server.files.AssetFileServlet</servlet-class>
-	</servlet>
-	<servlet>
-		<servlet-name>PackageDeploymentServlet</servlet-name>
-		<servlet-class>org.drools.guvnor.server.files.PackageDeploymentServlet</servlet-class>
-	</servlet>
-	<servlet>
-		<servlet-name>RepositoryBackupServlet</servlet-name>
-		<servlet-class>org.drools.guvnor.server.files.RepositoryBackupServlet</servlet-class>
-	</servlet>
-	<servlet>
-		<servlet-name>WebdavServlet</servlet-name>
-		<servlet-class>org.drools.guvnor.server.files.WebdavServlet</servlet-class>
-	</servlet>
-	<servlet>
-		<servlet-name>RestAPIServlet</servlet-name>
-		<servlet-class>org.drools.guvnor.server.files.RestAPIServlet</servlet-class>
-	</servlet>
-	<servlet>
-		<servlet-name>FeedServlet</servlet-name>
-		<servlet-class>org.drools.guvnor.server.files.FeedServlet</servlet-class>
-	</servlet>
-	<servlet>
-		<servlet-name>WorkflowManagerServlet</servlet-name>
-		<servlet-class>org.gridcc.mce.mceworkflow.servlets.WorkflowManagerServlet</servlet-class>
-	</servlet>
-	<servlet>
-		<servlet-name>WSDLParserServlet</servlet-name>
-		<servlet-class>org.gridcc.mce.mceworkflow.servlets.WSDLParserServlet</servlet-class>
-	</servlet>
-	<servlet>
-		<servlet-name>guvnorAPI</servlet-name>
-		<servlet-class>org.drools.guvnor.server.GuvnorAPIServlet</servlet-class>
-	</servlet>
-	<servlet>
-		<servlet-name>verificationService</servlet-name>
-		<servlet-class>org.drools.guvnor.server.VerificationServiceImplementation</servlet-class>
-	</servlet>
-	<servlet>
-		<servlet-name>standaloneGuidedEditorService</servlet-name>
-		<servlet-class>org.drools.guvnor.server.StandaloneGuidedEditorServiceImplementation</servlet-class>
-	</servlet>
-	<servlet>
-		<servlet-name>guidedEditorServlet</servlet-name>
-		<servlet-class>org.drools.guvnor.server.GuidedEditorServlet</servlet-class>
-	</servlet>
-	<servlet-mapping>
-		<servlet-name>guvnorService</servlet-name>
-		<url-pattern>/org.drools.guvnor.Guvnor/guvnorService</url-pattern>
-	</servlet-mapping>
-	<servlet-mapping>
-		<servlet-name>securityService</servlet-name>
-		<url-pattern>/org.drools.guvnor.Guvnor/securityService</url-pattern>
-	</servlet-mapping>
-	<servlet-mapping>
-		<servlet-name>AssetFileServlet</servlet-name>
-		<url-pattern>/org.drools.guvnor.Guvnor/asset</url-pattern>
-	</servlet-mapping>
-	<servlet-mapping>
-		<servlet-name>PackageDeploymentServlet</servlet-name>
-		<url-pattern>/org.drools.guvnor.Guvnor/package/*</url-pattern>
-	</servlet-mapping>
-	<servlet-mapping>
-		<servlet-name>RepositoryBackupServlet</servlet-name>
-		<url-pattern>/org.drools.guvnor.Guvnor/backup</url-pattern>
-	</servlet-mapping>
-	<servlet-mapping>
-		<servlet-name>WebdavServlet</servlet-name>
-		<url-pattern>/org.drools.guvnor.Guvnor/webdav/*</url-pattern>
-	</servlet-mapping>
-	<servlet-mapping>
-		<servlet-name>RestAPIServlet</servlet-name>
-		<url-pattern>/org.drools.guvnor.Guvnor/api/*</url-pattern>
-	</servlet-mapping>
-	<servlet-mapping>
-		<servlet-name>FeedServlet</servlet-name>
-		<url-pattern>/org.drools.guvnor.Guvnor/feed/*</url-pattern>
-	</servlet-mapping>
-	<servlet-mapping>
-		<servlet-name>WorkflowManagerServlet</servlet-name>
-		<url-pattern>/org.drools.guvnor.Guvnor/workflowmanager/*</url-pattern>
-	</servlet-mapping>
-	<servlet-mapping>
-		<servlet-name>WSDLParserServlet</servlet-name>
-		<url-pattern>/org.drools.guvnor.Guvnor/wsdlparser/*</url-pattern>
-	</servlet-mapping>
-	<servlet-mapping>
-		<servlet-name>guvnorAPI</servlet-name>
-		<url-pattern>/org.drools.guvnor.Guvnor/guvnorAPI</url-pattern>
-	</servlet-mapping>
-	<servlet-mapping>
-		<servlet-name>verificationService</servlet-name>
-		<url-pattern>/org.drools.guvnor.Guvnor/verificationService</url-pattern>
-	</servlet-mapping>
-	<servlet-mapping>
-		<servlet-name>standaloneGuidedEditorService</servlet-name>
-		<url-pattern>/org.drools.guvnor.Guvnor/standaloneGuidedEditorService</url-pattern>
-	</servlet-mapping>
-	<servlet-mapping>
-		<servlet-name>guidedEditorServlet</servlet-name>
-		<url-pattern>/org.drools.guvnor.Guvnor/guidedEditorServlet</url-pattern>
-	</servlet-mapping>
-	<session-config>
-		<session-timeout>180</session-timeout>
-	</session-config>
-	<login-config>
-		<auth-method>BASIC</auth-method>
-	</login-config>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+    <display-name>JBoss Drools Guvnor</display-name>
+    <filter>
+        <filter-name>Seam Filter</filter-name>
+        <filter-class>org.jboss.seam.web.ContextFilter</filter-class>
+    </filter>
+    <filter-mapping>
+        <filter-name>Seam Filter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+    <listener>
+        <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
+    </listener>
+    <!-- servlets - mostly to do with file management -->
+    <servlet>
+        <servlet-name>guvnorService</servlet-name>
+        <servlet-class>org.drools.guvnor.server.RepositoryServiceServlet</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>securityService</servlet-name>
+        <servlet-class>org.drools.guvnor.server.SecurityServiceServlet</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>AssetFileServlet</servlet-name>
+        <servlet-class>org.drools.guvnor.server.files.AssetFileServlet</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>PackageDeploymentServlet</servlet-name>
+        <servlet-class>org.drools.guvnor.server.files.PackageDeploymentServlet</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>RepositoryBackupServlet</servlet-name>
+        <servlet-class>org.drools.guvnor.server.files.RepositoryBackupServlet</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>WebdavServlet</servlet-name>
+        <servlet-class>org.drools.guvnor.server.files.WebdavServlet</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>RestAPIServlet</servlet-name>
+        <servlet-class>org.drools.guvnor.server.files.RestAPIServlet</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>FeedServlet</servlet-name>
+        <servlet-class>org.drools.guvnor.server.files.FeedServlet</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>WorkflowManagerServlet</servlet-name>
+        <servlet-class>org.gridcc.mce.mceworkflow.servlets.WorkflowManagerServlet</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>WSDLParserServlet</servlet-name>
+        <servlet-class>org.gridcc.mce.mceworkflow.servlets.WSDLParserServlet</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>guvnorAPI</servlet-name>
+        <servlet-class>org.drools.guvnor.server.GuvnorAPIServlet</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>verificationService</servlet-name>
+        <servlet-class>org.drools.guvnor.server.VerificationServiceImplementation</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>standaloneEditorService</servlet-name>
+        <servlet-class>org.drools.guvnor.server.StandaloneEditorServiceImplementation</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>standaloneEditorServlet</servlet-name>
+        <servlet-class>org.drools.guvnor.server.StandaloneEditorServlet</servlet-class>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>guvnorService</servlet-name>
+        <url-pattern>/org.drools.guvnor.Guvnor/guvnorService</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>securityService</servlet-name>
+        <url-pattern>/org.drools.guvnor.Guvnor/securityService</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>AssetFileServlet</servlet-name>
+        <url-pattern>/org.drools.guvnor.Guvnor/asset</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>PackageDeploymentServlet</servlet-name>
+        <url-pattern>/org.drools.guvnor.Guvnor/package/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>RepositoryBackupServlet</servlet-name>
+        <url-pattern>/org.drools.guvnor.Guvnor/backup</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>WebdavServlet</servlet-name>
+        <url-pattern>/org.drools.guvnor.Guvnor/webdav/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>RestAPIServlet</servlet-name>
+        <url-pattern>/org.drools.guvnor.Guvnor/api/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>FeedServlet</servlet-name>
+        <url-pattern>/org.drools.guvnor.Guvnor/feed/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>WorkflowManagerServlet</servlet-name>
+        <url-pattern>/org.drools.guvnor.Guvnor/workflowmanager/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>WSDLParserServlet</servlet-name>
+        <url-pattern>/org.drools.guvnor.Guvnor/wsdlparser/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>guvnorAPI</servlet-name>
+        <url-pattern>/org.drools.guvnor.Guvnor/guvnorAPI</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>verificationService</servlet-name>
+        <url-pattern>/org.drools.guvnor.Guvnor/verificationService</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>standaloneEditorService</servlet-name>
+        <url-pattern>/org.drools.guvnor.Guvnor/standaloneEditorService</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>standaloneEditorServlet</servlet-name>
+        <url-pattern>/org.drools.guvnor.Guvnor/standaloneEditorServlet</url-pattern>
+    </servlet-mapping>
+    <session-config>
+        <session-timeout>180</session-timeout>
+    </session-config>
+    <login-config>
+        <auth-method>BASIC</auth-method>
+    </login-config>
 </web-app>

Added: labs/jbossrules/trunk/drools-guvnor/src/test/java/org/drools/guvnor/server/server/GuvnorAPITest.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/test/java/org/drools/guvnor/server/server/GuvnorAPITest.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/test/java/org/drools/guvnor/server/server/GuvnorAPITest.java	2010-11-23 14:13:06 UTC (rev 36033)
@@ -0,0 +1,165 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.drools.guvnor.server.server;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Map;
+import org.drools.guvnor.server.GuvnorAPIServlet;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ * @author esteban
+ */
+public class GuvnorAPITest {
+
+    public GuvnorAPITest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+
+    @Before
+    public void setUp() {
+    }
+
+    @After
+    public void tearDown() {
+    }
+
+    @Test
+    public void testExtract() throws Exception {
+        String json =
+                "{\"resourceId\":\"oryx-canvas123\",\"childShapes\":[{\"dockers\":[{\"y\":44.5,\"x\":52.5},{\"y\":15,\"x\":15}],\"bounds\":{\"lowerRight\":{\"y\":179.5,\"x\":229.5},\"upperLeft\":{\"y\":179.5,\"x\":229.5}},\"resourceId\":\"_6-oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\",\"target\":{\"resourceId\":\"oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\"},\"childShapes\":[],\"properties\":{\"name\":\"\",\"conditiontype\":\"None\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\"}]},{\"dockers\":[{\"y\":15,\"x\":15},{\"y\":20,\"x\":20}],\"bounds\":{\"lowerRight\":{\"y\":179,\"x\":40},\"upperLeft\":{\"y\":179,\"x\":40}},\"resourceId\":\"oryx_0EE1FEF4-2AF5-4374-A183-3A454BF44321-_4\",\"target\":{\"resourceId\":\"_4\"},\"childShapes\":[],\"properties\":{\"name\":\"\",\"conditiontype\":\"None\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_4\"}]},{\"dockers\":[{\"y\":20,\"x\":20},{\"y\":!
 59,\"x\":120},{\"y\":43.5,\"x\":52.5}],\"bounds\":{\"lowerRight\":{\"y\":179,\"x\":120},\"upperLeft\":{\"y\":59,\"x\":120}},\"resourceId\":\"_4-_5\",\"target\":{\"resourceId\":\"_5\"},\"childShapes\":[],\"properties\":{\"name\":\"constraint1\",\"conditiontype\":\"None\",\"conditionexpression\":\"<rule><name>Constraint1</name><modelVersion>1.0</modelVersion><attributes/><lhs/><rhs/></rule>\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_5\"}]},{\"dockers\":[{\"y\":20,\"x\":20},{\"y\":44.5,\"x\":52.5}],\"bounds\":{\"lowerRight\":{\"y\":179,\"x\":120},\"upperLeft\":{\"y\":179,\"x\":120}},\"resourceId\":\"_4-_6\",\"target\":{\"resourceId\":\"_6\"},\"childShapes\":[],\"properties\":{\"name\":\"constraint2\",\"conditiontype\":\"None\",\"conditionexpression\":\"this is constraint 2\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_6\"}]},{\"dockers\":[{\"y\":20,\"x\":20},{\"y\":301,\"x\":120},{\"y\":46,\"x\":52.5}],\"bounds\":{\"lo!
 werRight\":{\"y\":301,\"x\":120},\"upperLeft\":{\"y\":179,\"x\!
 ":120}},
\"resourceId\":\"_4-_7\",\"target\":{\"resourceId\":\"_7\"},\"childShapes\":[],\"properties\":{\"name\":\"constraint3\",\"conditiontype\":\"None\",\"conditionexpression\":\"this is constraint 3\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_7\"}]},{\"dockers\":[{\"y\":43.5,\"x\":52.5},{\"y\":15,\"x\":15}],\"bounds\":{\"lowerRight\":{\"y\":59.5,\"x\":229.5},\"upperLeft\":{\"y\":59.5,\"x\":229.5}},\"resourceId\":\"_5-_8\",\"target\":{\"resourceId\":\"_8\"},\"childShapes\":[],\"properties\":{\"name\":\"\",\"conditiontype\":\"None\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_8\"}]},{\"dockers\":[{\"y\":46,\"x\":52.5},{\"y\":15,\"x\":15}],\"bounds\":{\"lowerRight\":{\"y\":302,\"x\":229.5},\"upperLeft\":{\"y\":302,\"x\":229.5}},\"resourceId\":\"_7-_9\",\"target\":{\"resourceId\":\"_9\"},\"childShapes\":[],\"properties\":{\"name\":\"\",\"conditiontype\":\"None\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceI!
 d\":\"_9\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":194,\"x\":55},\"upperLeft\":{\"y\":164,\"x\":25}},\"resourceId\":\"oryx_0EE1FEF4-2AF5-4374-A183-3A454BF44321\",\"childShapes\":[],\"properties\":{\"name\":\"\"},\"stencil\":{\"id\":\"StartNoneEvent\"},\"outgoing\":[{\"resourceId\":\"oryx_0EE1FEF4-2AF5-4374-A183-3A454BF44321-_4\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":194,\"x\":353},\"upperLeft\":{\"y\":164,\"x\":323}},\"resourceId\":\"oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\",\"childShapes\":[],\"properties\":{\"name\":\"\"},\"stencil\":{\"id\":\"EndNoneEvent\"},\"outgoing\":[]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":199,\"x\":140},\"upperLeft\":{\"y\":159,\"x\":100}},\"resourceId\":\"_4\",\"childShapes\":[],\"properties\":{\"name\":\"Gateway\",\"markervisible\":\"false\"},\"stencil\":{\"id\":\"Exclusive_Databased_Gateway\"},\"outgoing\":[{\"resourceId\":\"_4-_5\"},{\"resourceId\":\"_4-_6\"},{\"resourceId\":\"_4-_7\"}]},{\"dockers\":[!
 ],\"bounds\":{\"lowerRight\":{\"y\":103,\"x\":282},\"upperLeft!
 \":{\"y\
":16,\"x\":177}},\"resourceId\":\"_5\",\"childShapes\":[],\"properties\":{\"tasktype\":\"Script\",\"name\":\"Script\",\"script\":\"\",\"scriptLanguage\":\"\"},\"stencil\":{\"id\":\"Task\"},\"outgoing\":[{\"resourceId\":\"_5-_8\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":224,\"x\":282},\"upperLeft\":{\"y\":135,\"x\":177}},\"resourceId\":\"_6\",\"childShapes\":[],\"properties\":{\"tasktype\":\"Script\",\"name\":\"Script\",\"script\":\"\",\"scriptLanguage\":\"\"},\"stencil\":{\"id\":\"Task\"},\"outgoing\":[{\"resourceId\":\"_6-oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":348,\"x\":282},\"upperLeft\":{\"y\":256,\"x\":177}},\"resourceId\":\"_7\",\"childShapes\":[],\"properties\":{\"tasktype\":\"Script\",\"name\":\"Script\",\"script\":\"\",\"scriptLanguage\":\"\"},\"stencil\":{\"id\":\"Task\"},\"outgoing\":[{\"resourceId\":\"_7-_9\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":74,\"x\":353},\"upperLeft\":{\"y\"!
 :44,\"x\":323}},\"resourceId\":\"_8\",\"childShapes\":[],\"properties\":{\"name\":\"End\"},\"stencil\":{\"id\":\"EndNoneEvent\"},\"outgoing\":[]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":317,\"x\":353},\"upperLeft\":{\"y\":287,\"x\":323}},\"resourceId\":\"_9\",\"childShapes\":[],\"properties\":{\"name\":\"End\"},\"stencil\":{\"id\":\"EndNoneEvent\"},\"outgoing\":[]}],\"properties\":{},\"ssextensions\":[],\"stencilset\":{\"url\":\"/Process Designer/stencilsets/bpmn2.0/bpmn2.0.json\",\"namespace\":\"http://b3mn.org/stencilset/bpmn2.0#\"},\"stencil\":{\"id\":\"BPMNDiagram\"}}";
+        GuvnorAPIServlet.extract(json);
+    }
+
+    @Test
+    public void testExtract2() throws Exception {
+        OutputStream out = null;
+        InputStream content = null;
+        ByteArrayOutputStream bos = null;
+
+        try {
+            String json =
+                    "{\"resourceId\":\"oryx-canvas123\",\"childShapes\":[{\"dockers\":[{\"y\":44.5,\"x\":52.5},{\"y\":15,\"x\":15}],\"bounds\":{\"lowerRight\":{\"y\":179.5,\"x\":229.5},\"upperLeft\":{\"y\":179.5,\"x\":229.5}},\"resourceId\":\"_6-oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\",\"target\":{\"resourceId\":\"oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\"},\"childShapes\":[],\"properties\":{\"name\":\"\",\"conditiontype\":\"None\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\"}]},{\"dockers\":[{\"y\":15,\"x\":15},{\"y\":20,\"x\":20}],\"bounds\":{\"lowerRight\":{\"y\":179,\"x\":40},\"upperLeft\":{\"y\":179,\"x\":40}},\"resourceId\":\"oryx_0EE1FEF4-2AF5-4374-A183-3A454BF44321-_4\",\"target\":{\"resourceId\":\"_4\"},\"childShapes\":[],\"properties\":{\"name\":\"\",\"conditiontype\":\"None\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_4\"}]},{\"dockers\":[{\"y\":20,\"x\":20},{\"!
 y\":59,\"x\":120},{\"y\":43.5,\"x\":52.5}],\"bounds\":{\"lowerRight\":{\"y\":179,\"x\":120},\"upperLeft\":{\"y\":59,\"x\":120}},\"resourceId\":\"_4-_5\",\"target\":{\"resourceId\":\"_5\"},\"childShapes\":[],\"properties\":{\"name\":\"constraint1\",\"conditiontype\":\"None\",\"conditionexpression\":\"this is constraint 1\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_5\"}]},{\"dockers\":[{\"y\":20,\"x\":20},{\"y\":44.5,\"x\":52.5}],\"bounds\":{\"lowerRight\":{\"y\":179,\"x\":120},\"upperLeft\":{\"y\":179,\"x\":120}},\"resourceId\":\"_4-_6\",\"target\":{\"resourceId\":\"_6\"},\"childShapes\":[],\"properties\":{\"name\":\"constraint2\",\"conditiontype\":\"None\",\"conditionexpression\":\"this is constraint 2\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_6\"}]},{\"dockers\":[{\"y\":20,\"x\":20},{\"y\":301,\"x\":120},{\"y\":46,\"x\":52.5}],\"bounds\":{\"lowerRight\":{\"y\":301,\"x\":120},\"upperLeft\":{\"y\":179,\"x\":120}},!
 \"resourceId\":\"_4-_7\",\"target\":{\"resourceId\":\"_7\"},\"!
 childSha
pes\":[],\"properties\":{\"name\":\"constraint3\",\"conditiontype\":\"None\",\"conditionexpression\":\"this is constraint 3\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_7\"}]},{\"dockers\":[{\"y\":43.5,\"x\":52.5},{\"y\":15,\"x\":15}],\"bounds\":{\"lowerRight\":{\"y\":59.5,\"x\":229.5},\"upperLeft\":{\"y\":59.5,\"x\":229.5}},\"resourceId\":\"_5-_8\",\"target\":{\"resourceId\":\"_8\"},\"childShapes\":[],\"properties\":{\"name\":\"\",\"conditiontype\":\"None\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_8\"}]},{\"dockers\":[{\"y\":46,\"x\":52.5},{\"y\":15,\"x\":15}],\"bounds\":{\"lowerRight\":{\"y\":302,\"x\":229.5},\"upperLeft\":{\"y\":302,\"x\":229.5}},\"resourceId\":\"_7-_9\",\"target\":{\"resourceId\":\"_9\"},\"childShapes\":[],\"properties\":{\"name\":\"\",\"conditiontype\":\"None\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_9\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":194,\"!
 x\":55},\"upperLeft\":{\"y\":164,\"x\":25}},\"resourceId\":\"oryx_0EE1FEF4-2AF5-4374-A183-3A454BF44321\",\"childShapes\":[],\"properties\":{\"name\":\"\"},\"stencil\":{\"id\":\"StartNoneEvent\"},\"outgoing\":[{\"resourceId\":\"oryx_0EE1FEF4-2AF5-4374-A183-3A454BF44321-_4\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":194,\"x\":353},\"upperLeft\":{\"y\":164,\"x\":323}},\"resourceId\":\"oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\",\"childShapes\":[],\"properties\":{\"name\":\"\"},\"stencil\":{\"id\":\"EndNoneEvent\"},\"outgoing\":[]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":199,\"x\":140},\"upperLeft\":{\"y\":159,\"x\":100}},\"resourceId\":\"_4\",\"childShapes\":[],\"properties\":{\"name\":\"Gateway\",\"markervisible\":\"false\"},\"stencil\":{\"id\":\"Exclusive_Databased_Gateway\"},\"outgoing\":[{\"resourceId\":\"_4-_5\"},{\"resourceId\":\"_4-_6\"},{\"resourceId\":\"_4-_7\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":103,\"x\":282},\"upperLeft\":{\"y\!
 ":16,\"x\":177}},\"resourceId\":\"_5\",\"childShapes\":[],\"pr!
 operties
\":{\"tasktype\":\"Script\",\"name\":\"Script\",\"script\":\"\",\"scriptLanguage\":\"\"},\"stencil\":{\"id\":\"Task\"},\"outgoing\":[{\"resourceId\":\"_5-_8\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":224,\"x\":282},\"upperLeft\":{\"y\":135,\"x\":177}},\"resourceId\":\"_6\",\"childShapes\":[],\"properties\":{\"tasktype\":\"Script\",\"name\":\"Script\",\"script\":\"\",\"scriptLanguage\":\"\"},\"stencil\":{\"id\":\"Task\"},\"outgoing\":[{\"resourceId\":\"_6-oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":348,\"x\":282},\"upperLeft\":{\"y\":256,\"x\":177}},\"resourceId\":\"_7\",\"childShapes\":[],\"properties\":{\"tasktype\":\"Script\",\"name\":\"Script\",\"script\":\"\",\"scriptLanguage\":\"\"},\"stencil\":{\"id\":\"Task\"},\"outgoing\":[{\"resourceId\":\"_7-_9\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":74,\"x\":353},\"upperLeft\":{\"y\":44,\"x\":323}},\"resourceId\":\"_8\",\"childShapes\":[],\"properties\!
 ":{\"name\":\"End\"},\"stencil\":{\"id\":\"EndNoneEvent\"},\"outgoing\":[]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":317,\"x\":353},\"upperLeft\":{\"y\":287,\"x\":323}},\"resourceId\":\"_9\",\"childShapes\":[],\"properties\":{\"name\":\"End\"},\"stencil\":{\"id\":\"EndNoneEvent\"},\"outgoing\":[]}],\"properties\":{},\"ssextensions\":[],\"stencilset\":{\"url\":\"/Process Designer/stencilsets/bpmn2.0/bpmn2.0.json\",\"namespace\":\"http://b3mn.org/stencilset/bpmn2.0#\"},\"stencil\":{\"id\":\"BPMNDiagram\"}}";
+            URL bpmn2_0SerializationURL = new URL("http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/guvnorAPI");
+            String params = "action=extract&json=" + URLEncoder.encode(json, "UTF-8");
+            byte[] bytes = params.getBytes("UTF-8");
+
+            HttpURLConnection connection = (HttpURLConnection) bpmn2_0SerializationURL.openConnection();
+            connection.setRequestMethod("POST");
+            connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
+            connection.setFixedLengthStreamingMode(bytes.length);
+            connection.setDoOutput(true);
+            out = connection.getOutputStream();
+            out.write(bytes);
+            out.close();
+
+            content = connection.getInputStream();
+
+            bos = new ByteArrayOutputStream();
+            int b = 0;
+            while ((b = content.read()) > -1) {
+                bos.write(b);
+            }
+            bytes = bos.toByteArray();
+            content.close();
+            bos.close();
+            System.out.println(new String(bytes));
+        } finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (content != null) {
+                    content.close();
+                }
+                if (bos != null) {
+                    bos.close();
+                }
+            } catch (IOException e) {
+            }
+        }
+    }
+
+    public void testInject() throws Exception {
+        String json =
+                "{\"resourceId\":\"oryx-canvas123\",\"childShapes\":[{\"dockers\":[{\"y\":44.5,\"x\":52.5},{\"y\":15,\"x\":15}],\"bounds\":{\"lowerRight\":{\"y\":179.5,\"x\":229.5},\"upperLeft\":{\"y\":179.5,\"x\":229.5}},\"resourceId\":\"_6-oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\",\"target\":{\"resourceId\":\"oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\"},\"childShapes\":[],\"properties\":{\"name\":\"\",\"conditiontype\":\"None\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\"}]},{\"dockers\":[{\"y\":15,\"x\":15},{\"y\":20,\"x\":20}],\"bounds\":{\"lowerRight\":{\"y\":179,\"x\":40},\"upperLeft\":{\"y\":179,\"x\":40}},\"resourceId\":\"oryx_0EE1FEF4-2AF5-4374-A183-3A454BF44321-_4\",\"target\":{\"resourceId\":\"_4\"},\"childShapes\":[],\"properties\":{\"name\":\"\",\"conditiontype\":\"None\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_4\"}]},{\"dockers\":[{\"y\":20,\"x\":20},{\"y\":!
 59,\"x\":120},{\"y\":43.5,\"x\":52.5}],\"bounds\":{\"lowerRight\":{\"y\":179,\"x\":120},\"upperLeft\":{\"y\":59,\"x\":120}},\"resourceId\":\"_4-_5\",\"target\":{\"resourceId\":\"_5\"},\"childShapes\":[],\"properties\":{\"name\":\"constraint1\",\"conditiontype\":\"None\",\"conditionexpression\":\"this is constraint 1\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_5\"}]},{\"dockers\":[{\"y\":20,\"x\":20},{\"y\":44.5,\"x\":52.5}],\"bounds\":{\"lowerRight\":{\"y\":179,\"x\":120},\"upperLeft\":{\"y\":179,\"x\":120}},\"resourceId\":\"_4-_6\",\"target\":{\"resourceId\":\"_6\"},\"childShapes\":[],\"properties\":{\"name\":\"constraint2\",\"conditiontype\":\"None\",\"conditionexpression\":\"this is constraint 2\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_6\"}]},{\"dockers\":[{\"y\":20,\"x\":20},{\"y\":301,\"x\":120},{\"y\":46,\"x\":52.5}],\"bounds\":{\"lowerRight\":{\"y\":301,\"x\":120},\"upperLeft\":{\"y\":179,\"x\":120}},\"re!
 sourceId\":\"_4-_7\",\"target\":{\"resourceId\":\"_7\"},\"chil!
 dShapes\
":[],\"properties\":{\"name\":\"constraint3\",\"conditiontype\":\"None\",\"conditionexpression\":\"this is constraint 3\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_7\"}]},{\"dockers\":[{\"y\":43.5,\"x\":52.5},{\"y\":15,\"x\":15}],\"bounds\":{\"lowerRight\":{\"y\":59.5,\"x\":229.5},\"upperLeft\":{\"y\":59.5,\"x\":229.5}},\"resourceId\":\"_5-_8\",\"target\":{\"resourceId\":\"_8\"},\"childShapes\":[],\"properties\":{\"name\":\"\",\"conditiontype\":\"None\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_8\"}]},{\"dockers\":[{\"y\":46,\"x\":52.5},{\"y\":15,\"x\":15}],\"bounds\":{\"lowerRight\":{\"y\":302,\"x\":229.5},\"upperLeft\":{\"y\":302,\"x\":229.5}},\"resourceId\":\"_7-_9\",\"target\":{\"resourceId\":\"_9\"},\"childShapes\":[],\"properties\":{\"name\":\"\",\"conditiontype\":\"None\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_9\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":194,\"x\":!
 55},\"upperLeft\":{\"y\":164,\"x\":25}},\"resourceId\":\"oryx_0EE1FEF4-2AF5-4374-A183-3A454BF44321\",\"childShapes\":[],\"properties\":{\"name\":\"\"},\"stencil\":{\"id\":\"StartNoneEvent\"},\"outgoing\":[{\"resourceId\":\"oryx_0EE1FEF4-2AF5-4374-A183-3A454BF44321-_4\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":194,\"x\":353},\"upperLeft\":{\"y\":164,\"x\":323}},\"resourceId\":\"oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\",\"childShapes\":[],\"properties\":{\"name\":\"\"},\"stencil\":{\"id\":\"EndNoneEvent\"},\"outgoing\":[]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":199,\"x\":140},\"upperLeft\":{\"y\":159,\"x\":100}},\"resourceId\":\"_4\",\"childShapes\":[],\"properties\":{\"name\":\"Gateway\",\"markervisible\":\"false\"},\"stencil\":{\"id\":\"Exclusive_Databased_Gateway\"},\"outgoing\":[{\"resourceId\":\"_4-_5\"},{\"resourceId\":\"_4-_6\"},{\"resourceId\":\"_4-_7\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":103,\"x\":282},\"upperLeft\":{\"y\":16!
 ,\"x\":177}},\"resourceId\":\"_5\",\"childShapes\":[],\"proper!
 ties\":{
\"tasktype\":\"Script\",\"name\":\"Script\",\"script\":\"\",\"scriptLanguage\":\"\"},\"stencil\":{\"id\":\"Task\"},\"outgoing\":[{\"resourceId\":\"_5-_8\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":224,\"x\":282},\"upperLeft\":{\"y\":135,\"x\":177}},\"resourceId\":\"_6\",\"childShapes\":[],\"properties\":{\"tasktype\":\"Script\",\"name\":\"Script\",\"script\":\"\",\"scriptLanguage\":\"\"},\"stencil\":{\"id\":\"Task\"},\"outgoing\":[{\"resourceId\":\"_6-oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":348,\"x\":282},\"upperLeft\":{\"y\":256,\"x\":177}},\"resourceId\":\"_7\",\"childShapes\":[],\"properties\":{\"tasktype\":\"Script\",\"name\":\"Script\",\"script\":\"\",\"scriptLanguage\":\"\"},\"stencil\":{\"id\":\"Task\"},\"outgoing\":[{\"resourceId\":\"_7-_9\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":74,\"x\":353},\"upperLeft\":{\"y\":44,\"x\":323}},\"resourceId\":\"_8\",\"childShapes\":[],\"properties\":{\!
 "name\":\"End\"},\"stencil\":{\"id\":\"EndNoneEvent\"},\"outgoing\":[]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":317,\"x\":353},\"upperLeft\":{\"y\":287,\"x\":323}},\"resourceId\":\"_9\",\"childShapes\":[],\"properties\":{\"name\":\"End\"},\"stencil\":{\"id\":\"EndNoneEvent\"},\"outgoing\":[]}],\"properties\":{},\"ssextensions\":[],\"stencilset\":{\"url\":\"/Process Designer/stencilsets/bpmn2.0/bpmn2.0.json\",\"namespace\":\"http://b3mn.org/stencilset/bpmn2.0#\"},\"stencil\":{\"id\":\"BPMNDiagram\"}}";
+        Map<String, String> constraints = new HashMap<String, String>();
+        constraints.put("_5", "brl for constraint1");
+        constraints.put("_6", "brl for constraint2");
+        constraints.put("_7", "brl for constraint3");
+        String result = GuvnorAPIServlet.inject(json, constraints);
+        System.out.println(result);
+    }
+
+    public void testInject2() throws Exception {
+        OutputStream out = null;
+        InputStream content = null;
+        ByteArrayOutputStream bos = null;
+
+        try {
+            String json =
+                    "{\"resourceId\":\"oryx-canvas123\",\"childShapes\":[{\"dockers\":[{\"y\":44.5,\"x\":52.5},{\"y\":15,\"x\":15}],\"bounds\":{\"lowerRight\":{\"y\":179.5,\"x\":229.5},\"upperLeft\":{\"y\":179.5,\"x\":229.5}},\"resourceId\":\"_6-oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\",\"target\":{\"resourceId\":\"oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\"},\"childShapes\":[],\"properties\":{\"name\":\"\",\"conditiontype\":\"None\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\"}]},{\"dockers\":[{\"y\":15,\"x\":15},{\"y\":20,\"x\":20}],\"bounds\":{\"lowerRight\":{\"y\":179,\"x\":40},\"upperLeft\":{\"y\":179,\"x\":40}},\"resourceId\":\"oryx_0EE1FEF4-2AF5-4374-A183-3A454BF44321-_4\",\"target\":{\"resourceId\":\"_4\"},\"childShapes\":[],\"properties\":{\"name\":\"\",\"conditiontype\":\"None\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_4\"}]},{\"dockers\":[{\"y\":20,\"x\":20},{\"!
 y\":59,\"x\":120},{\"y\":43.5,\"x\":52.5}],\"bounds\":{\"lowerRight\":{\"y\":179,\"x\":120},\"upperLeft\":{\"y\":59,\"x\":120}},\"resourceId\":\"_4-_5\",\"target\":{\"resourceId\":\"_5\"},\"childShapes\":[],\"properties\":{\"name\":\"constraint1\",\"conditiontype\":\"None\",\"conditionexpression\":\"this is constraint 1\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_5\"}]},{\"dockers\":[{\"y\":20,\"x\":20},{\"y\":44.5,\"x\":52.5}],\"bounds\":{\"lowerRight\":{\"y\":179,\"x\":120},\"upperLeft\":{\"y\":179,\"x\":120}},\"resourceId\":\"_4-_6\",\"target\":{\"resourceId\":\"_6\"},\"childShapes\":[],\"properties\":{\"name\":\"constraint2\",\"conditiontype\":\"None\",\"conditionexpression\":\"this is constraint 2\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_6\"}]},{\"dockers\":[{\"y\":20,\"x\":20},{\"y\":301,\"x\":120},{\"y\":46,\"x\":52.5}],\"bounds\":{\"lowerRight\":{\"y\":301,\"x\":120},\"upperLeft\":{\"y\":179,\"x\":120}},!
 \"resourceId\":\"_4-_7\",\"target\":{\"resourceId\":\"_7\"},\"!
 childSha
pes\":[],\"properties\":{\"name\":\"constraint3\",\"conditiontype\":\"None\",\"conditionexpression\":\"this is constraint 3\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_7\"}]},{\"dockers\":[{\"y\":43.5,\"x\":52.5},{\"y\":15,\"x\":15}],\"bounds\":{\"lowerRight\":{\"y\":59.5,\"x\":229.5},\"upperLeft\":{\"y\":59.5,\"x\":229.5}},\"resourceId\":\"_5-_8\",\"target\":{\"resourceId\":\"_8\"},\"childShapes\":[],\"properties\":{\"name\":\"\",\"conditiontype\":\"None\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_8\"}]},{\"dockers\":[{\"y\":46,\"x\":52.5},{\"y\":15,\"x\":15}],\"bounds\":{\"lowerRight\":{\"y\":302,\"x\":229.5},\"upperLeft\":{\"y\":302,\"x\":229.5}},\"resourceId\":\"_7-_9\",\"target\":{\"resourceId\":\"_9\"},\"childShapes\":[],\"properties\":{\"name\":\"\",\"conditiontype\":\"None\"},\"stencil\":{\"id\":\"SequenceFlow\"},\"outgoing\":[{\"resourceId\":\"_9\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":194,\"!
 x\":55},\"upperLeft\":{\"y\":164,\"x\":25}},\"resourceId\":\"oryx_0EE1FEF4-2AF5-4374-A183-3A454BF44321\",\"childShapes\":[],\"properties\":{\"name\":\"\"},\"stencil\":{\"id\":\"StartNoneEvent\"},\"outgoing\":[{\"resourceId\":\"oryx_0EE1FEF4-2AF5-4374-A183-3A454BF44321-_4\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":194,\"x\":353},\"upperLeft\":{\"y\":164,\"x\":323}},\"resourceId\":\"oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\",\"childShapes\":[],\"properties\":{\"name\":\"\"},\"stencil\":{\"id\":\"EndNoneEvent\"},\"outgoing\":[]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":199,\"x\":140},\"upperLeft\":{\"y\":159,\"x\":100}},\"resourceId\":\"_4\",\"childShapes\":[],\"properties\":{\"name\":\"Gateway\",\"markervisible\":\"false\"},\"stencil\":{\"id\":\"Exclusive_Databased_Gateway\"},\"outgoing\":[{\"resourceId\":\"_4-_5\"},{\"resourceId\":\"_4-_6\"},{\"resourceId\":\"_4-_7\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":103,\"x\":282},\"upperLeft\":{\"y\!
 ":16,\"x\":177}},\"resourceId\":\"_5\",\"childShapes\":[],\"pr!
 operties
\":{\"tasktype\":\"Script\",\"name\":\"Script\",\"script\":\"\",\"scriptLanguage\":\"\"},\"stencil\":{\"id\":\"Task\"},\"outgoing\":[{\"resourceId\":\"_5-_8\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":224,\"x\":282},\"upperLeft\":{\"y\":135,\"x\":177}},\"resourceId\":\"_6\",\"childShapes\":[],\"properties\":{\"tasktype\":\"Script\",\"name\":\"Script\",\"script\":\"\",\"scriptLanguage\":\"\"},\"stencil\":{\"id\":\"Task\"},\"outgoing\":[{\"resourceId\":\"_6-oryx_17D8BC5E-C308-47F4-97CB-12706C4AEB8D\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":348,\"x\":282},\"upperLeft\":{\"y\":256,\"x\":177}},\"resourceId\":\"_7\",\"childShapes\":[],\"properties\":{\"tasktype\":\"Script\",\"name\":\"Script\",\"script\":\"\",\"scriptLanguage\":\"\"},\"stencil\":{\"id\":\"Task\"},\"outgoing\":[{\"resourceId\":\"_7-_9\"}]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":74,\"x\":353},\"upperLeft\":{\"y\":44,\"x\":323}},\"resourceId\":\"_8\",\"childShapes\":[],\"properties\!
 ":{\"name\":\"End\"},\"stencil\":{\"id\":\"EndNoneEvent\"},\"outgoing\":[]},{\"dockers\":[],\"bounds\":{\"lowerRight\":{\"y\":317,\"x\":353},\"upperLeft\":{\"y\":287,\"x\":323}},\"resourceId\":\"_9\",\"childShapes\":[],\"properties\":{\"name\":\"End\"},\"stencil\":{\"id\":\"EndNoneEvent\"},\"outgoing\":[]}],\"properties\":{},\"ssextensions\":[],\"stencilset\":{\"url\":\"/Process Designer/stencilsets/bpmn2.0/bpmn2.0.json\",\"namespace\":\"http://b3mn.org/stencilset/bpmn2.0#\"},\"stencil\":{\"id\":\"BPMNDiagram\"}}";
+            URL bpmn2_0SerializationURL = new URL("http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/guvnorAPI");
+            String params = "action=inject&json=" + URLEncoder.encode(json, "UTF-8");
+            params += "&constraint=_5:brl for constraint1";
+            params += "&constraint=_6:brl for constraint2";
+            params += "&constraint=_7:brl for constraint3";
+            byte[] bytes = params.getBytes("UTF-8");
+
+            HttpURLConnection connection = (HttpURLConnection) bpmn2_0SerializationURL.openConnection();
+            connection.setRequestMethod("POST");
+            connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
+            connection.setFixedLengthStreamingMode(bytes.length);
+            connection.setDoOutput(true);
+            out = connection.getOutputStream();
+            out.write(bytes);
+            out.close();
+
+            content = connection.getInputStream();
+
+            bos = new ByteArrayOutputStream();
+            int b = 0;
+            while ((b = content.read()) > -1) {
+                bos.write(b);
+            }
+            bytes = bos.toByteArray();
+            content.close();
+            bos.close();
+            System.out.println(new String(bytes));
+        } finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (content != null) {
+                    content.close();
+                }
+                if (bos != null) {
+                    bos.close();
+                }
+            } catch (IOException e) {
+            }
+        }
+    }
+}



More information about the jboss-svn-commits mailing list