[jbpm-commits] JBoss JBPM SVN: r5103 - in projects/gwt-console/trunk: gui/war/src/main/java/org/jboss/bpm/console/client/deployment and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jun 24 08:38:25 EDT 2009


Author: heiko.braun at jboss.com
Date: 2009-06-24 08:38:25 -0400 (Wed, 24 Jun 2009)
New Revision: 5103

Added:
   projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeleteDeploymentAction.java
   projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentDetailView.java
   projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/ResourcePanel.java
   projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/ResumeDeploymentAction.java
   projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/SuspendDeploymentAction.java
   projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/UpdateDeploymentDetailAction.java
Modified:
   projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/PropertyGrid.java
   projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentEditor.java
   projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentListView.java
   projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
   projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/DeploymentFacade.java
Log:
Suspend/resume depoyments

Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/PropertyGrid.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/PropertyGrid.java	2009-06-24 12:37:51 UTC (rev 5102)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/PropertyGrid.java	2009-06-24 12:38:25 UTC (rev 5103)
@@ -29,7 +29,7 @@
 /**
  * A simple property grid that displays name-value pairs.
  * <br>
- * Use styles:
+ * Used styles:
  * <ul>
  * <li>bpm-prop-grid
  * <li>bpm-prop-grid-label

Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeleteDeploymentAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeleteDeploymentAction.java	                        (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeleteDeploymentAction.java	2009-06-24 12:38:25 UTC (rev 5103)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.deployment;
+
+import org.jboss.bpm.console.client.common.AbstractRESTAction;
+import org.jboss.bpm.console.client.ApplicationContext;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class DeleteDeploymentAction extends AbstractRESTAction
+{
+
+  public final static String ID = DeleteDeploymentAction.class.getName();
+
+  public DeleteDeploymentAction(ApplicationContext appContetext)
+  {
+    super(appContetext);
+  }
+
+  public String getId()
+  {
+    return ID;
+  }
+
+  public String getUrl(Object event)
+  {
+    String id = (String)event;
+    return appContext.getUrlBuilder().getDeleteDeploymentUrl(id);
+  }
+
+  public RequestBuilder.Method getRequestMethod()
+  {
+    return RequestBuilder.POST;
+  }
+
+  public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
+  {
+    // refresh view
+    controller.handleEvent(
+        new Event(UpdateDeploymentListAction.ID, null)
+    );
+  }
+}

Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentDetailView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentDetailView.java	                        (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentDetailView.java	2009-06-24 12:38:25 UTC (rev 5103)
@@ -0,0 +1,198 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.deployment;
+
+import com.google.gwt.user.client.ui.ChangeListener;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.ViewInterface;
+import com.mvc4g.client.Event;
+import org.gwt.mosaic.ui.client.*;
+import org.gwt.mosaic.ui.client.layout.BoxLayoutData;
+import org.gwt.mosaic.ui.client.layout.BoxLayout;
+import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import org.jboss.bpm.console.client.common.PropertyGrid;
+import org.jboss.bpm.console.client.model.DeploymentRef;
+
+/**
+ * Detail panel associated with a selected deployment.
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class DeploymentDetailView extends CaptionLayoutPanel implements ViewInterface
+{
+  public final static String ID = DeploymentDetailView.class.getName();
+
+  private Controller controller;
+
+  private PropertyGrid grid;
+
+  private DeploymentRef currentDeployment;
+
+  private ResourcePanel resourcePanel;
+
+  ToolButton suspendBtn;
+  ToolButton resumeBtn;
+  
+  public DeploymentDetailView()
+  {
+    super("Deployment details");
+    super.setStyleName("bpm-detail-panel");
+
+    grid = new PropertyGrid(new String[] {"ID:", "Name:", "Processes:"});
+    LayoutPanel propLayout = new LayoutPanel(new BoxLayout(BoxLayout.Orientation.HORIZONTAL));
+    propLayout.add(grid, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+
+
+    suspendBtn =  new ToolButton("Suspend", new ClickListener() {
+      public void onClick(Widget sender) {
+
+        DeploymentRef deploymentRef = getSelection();
+        if(deploymentRef!=null)
+        {
+          MessageBox.confirm("Suspend deployment",
+              "Do you want to suspend this deployment? Any associated process will suspended aswell.",
+              new MessageBox.ConfirmationCallback() {
+                public void onResult(boolean doIt)
+                {
+                  if(doIt)
+                  {
+                    controller.handleEvent(
+                        new Event(
+                            SuspendDeploymentAction.ID,
+                            getSelection().getId()
+                        )
+                    );
+                  }
+                }
+              });
+        }
+        else
+        {
+          MessageBox.alert("Missing selection", "Please select a deployment");
+        }
+      }
+    }
+    );
+    resumeBtn =  new ToolButton("Resume", new ClickListener() {
+      public void onClick(Widget sender) {
+
+        DeploymentRef deploymentRef = getSelection();
+        if(deploymentRef!=null)
+        {
+          MessageBox.confirm("Resume deployment",
+              "Do you want to resume this deployment?",
+              new MessageBox.ConfirmationCallback() {
+                public void onResult(boolean doIt)
+                {
+                  if(doIt)
+                  {
+                    controller.handleEvent(
+                        new Event(
+                            ResumeDeploymentAction.ID,
+                            getSelection().getId()
+                        )
+                    );
+                  }
+                }
+              });
+        }
+        else
+        {
+          MessageBox.alert("Missing selection", "Please select a deployment");
+        }
+      }
+    }
+    );
+
+    propLayout.add(suspendBtn);
+    propLayout.add(resumeBtn);
+    
+    // properties
+    final DeckLayoutPanel deck = new DeckLayoutPanel();
+    deck.add(propLayout);
+
+    // resource info
+    resourcePanel = new ResourcePanel();
+
+    deck.add(resourcePanel);
+
+    // selection
+    final com.google.gwt.user.client.ui.ListBox dropBox = new com.google.gwt.user.client.ui.ListBox(false);
+    dropBox.setStyleName("bpm-operation-ui");
+    dropBox.addItem("Properties");
+    dropBox.addItem("Resources");
+    dropBox.addChangeListener(new ChangeListener() {
+      public void onChange(Widget sender) {
+        deck.showWidget(dropBox.getSelectedIndex());
+        deck.layout();
+      }
+    });
+
+    this.getHeader().add(dropBox, Caption.CaptionRegion.RIGHT);
+    this.add(deck, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+
+    deck.showWidget(dropBox.getSelectedIndex());
+
+    this.add(deck, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+
+  }
+
+  private DeploymentRef getSelection()
+  {
+    return currentDeployment;
+  }
+
+  public void setController(Controller controller)
+  {
+    this.controller = controller;
+    resourcePanel.setController(controller);
+  }
+
+  public void update(DeploymentRef deployment)
+  {
+    this.currentDeployment= deployment;
+
+    String[] values = new String[] {
+        deployment.getId(),
+        deployment.getName(),
+        deployment.getDefinitions().toString()
+    };
+
+    resumeBtn.setEnabled(deployment.isSuspended());
+    suspendBtn.setEnabled(!resumeBtn.isEnabled());    
+
+    grid.update(values);
+    resourcePanel.update(deployment);
+  }
+
+  public void clearView()
+  {
+    this.currentDeployment = null;
+    grid.clear();
+    resourcePanel.clearView();
+
+    suspendBtn.setEnabled(false);
+    resumeBtn.setEnabled(false);
+  }
+}

Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentEditor.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentEditor.java	2009-06-24 12:37:51 UTC (rev 5102)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentEditor.java	2009-06-24 12:38:25 UTC (rev 5103)
@@ -37,6 +37,7 @@
 import org.jboss.bpm.console.client.icons.ConsoleIconBundle;
 
 /**
+ * Manage depoyments (currently jbpm only)
  * @author Heiko.Braun <heiko.braun at jboss.com>
  */
 public class DeploymentEditor extends Editor
@@ -45,7 +46,9 @@
   public final static String ID = DeploymentEditor.class.getName();
 
   private TabLayoutPanel tabPanel;
-  
+
+  private DeploymentDetailView detailView;
+
   public DeploymentEditor(ApplicationContext appContext)
   {
     super(appContext);
@@ -83,13 +86,21 @@
 
       this.add(tabPanel, new BorderLayoutData(BorderLayout.Region.CENTER));
 
+      // detail panel
+      detailView = new DeploymentDetailView();
+      controller.addView(DeploymentDetailView.ID, detailView);
+      this.add(detailView, new BorderLayoutData(BorderLayout.Region.SOUTH,10,200));
+
       // create and register views
       registerView(DeploymentListView.ID, new DeploymentListView());
 
-      // create and register actions      
+      // create and register actions
       controller.addAction(UpdateDeploymentListAction.ID, new UpdateDeploymentListAction(appContext));
-      //controller.addAction(ViewDeploymentAction.ID, new ViewDeploymentAction());
-      
+      controller.addAction(UpdateDeploymentDetailAction.ID, new UpdateDeploymentDetailAction());
+      controller.addAction(DeleteDeploymentAction.ID, new DeleteDeploymentAction(appContext));
+      controller.addAction(SuspendDeploymentAction.ID, new SuspendDeploymentAction(appContext));
+      controller.addAction(ResumeDeploymentAction.ID, new ResumeDeploymentAction(appContext));
+
       // display tab, needs to visible for correct rendering
       tabPanel.selectTab(0);
 

Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentListView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentListView.java	2009-06-24 12:37:51 UTC (rev 5102)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentListView.java	2009-06-24 12:38:25 UTC (rev 5103)
@@ -40,6 +40,7 @@
 import java.util.List;
 
 /**
+ * List of deployments
  * @author Heiko.Braun <heiko.braun at jboss.com>
  */
 public class DeploymentListView extends AbstractView
@@ -103,10 +104,9 @@
         {
           DeploymentRef item = listBox.getItem(index);
 
-          // TODO: update details
-          /*controller.handleEvent(
-              new Event(UpdateProcessDetailAction.ID, item)
-          );*/
+          controller.handleEvent(
+              new Event(UpdateDeploymentDetailAction.ID, item)
+          );
         }
       }
     });
@@ -157,15 +157,30 @@
       toolBar.add(
           new ToolButton("Delete", new ClickListener() {
             public void onClick(Widget sender) {
-              // force loading
+              
               DeploymentRef deploymentRef = getSelection();
               if(deploymentRef!=null)
               {
-
+                MessageBox.confirm("Delete deployment",
+                  "Do you want to delete this deployment? Any related data will be removed.",
+                  new MessageBox.ConfirmationCallback() {
+                    public void onResult(boolean doIt)
+                    {
+                      if(doIt)
+                      {
+                        controller.handleEvent(
+                            new Event(
+                                DeleteDeploymentAction.ID,
+                                getSelection().getId()
+                            )
+                        );
+                      }
+                    }
+                  });
               }
               else
               {
-                MessageBox.alert("Missing selection", "Please select a deployment definition");
+                MessageBox.alert("Missing selection", "Please select a deployment");
               }
             }
           }
@@ -215,9 +230,9 @@
     }
 
     // clear details
-    /*controller.handleEvent(
-        new Event(UpdateProcessDetailAction.ID, null)
-    );*/
+    controller.handleEvent(
+        new Event(UpdateDeploymentDetailAction.ID, null)
+    );
   }
 
   public void select(String deploymentId)

Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/ResourcePanel.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/ResourcePanel.java	                        (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/ResourcePanel.java	2009-06-24 12:38:25 UTC (rev 5103)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.deployment;
+
+import com.mvc4g.client.Controller;
+import org.gwt.mosaic.ui.client.layout.BoxLayout;
+import org.gwt.mosaic.ui.client.layout.BoxLayoutData;
+import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import org.jboss.bpm.console.client.common.PropertyGrid;
+import org.jboss.bpm.console.client.model.DeploymentRef;
+
+/**
+ * List resources associated with a process deployment.
+ * 
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class ResourcePanel extends LayoutPanel
+{
+
+  private Controller controller;
+
+  private PropertyGrid propGrid;
+
+  private DeploymentRef currentDeployment = null;
+
+  private boolean initialized;
+
+  public ResourcePanel()
+  {
+    super(new BoxLayout(BoxLayout.Orientation.HORIZONTAL));
+
+  }
+
+  private void initialize()
+  {
+    if(!initialized)
+    {
+      this.propGrid = new PropertyGrid(new String[]{"Deployment ID:"});
+      this.add(propGrid, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));      
+      this.initialized = true;
+    }
+  }
+
+  public void setController(Controller controller)
+  {
+    this.controller = controller;
+  }
+
+  public void update(DeploymentRef deployment)
+  {
+    initialize();
+    this.currentDeployment = deployment;
+    propGrid.update(new String[]{deployment.getId()});
+  }
+
+  public void clearView()
+  {
+    initialize();
+    this.currentDeployment = null;
+    propGrid.clear();
+  }
+
+  private DeploymentRef getSelection()
+  {
+    return this.currentDeployment;
+  }
+}

Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/ResumeDeploymentAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/ResumeDeploymentAction.java	                        (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/ResumeDeploymentAction.java	2009-06-24 12:38:25 UTC (rev 5103)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.deployment;
+
+import org.jboss.bpm.console.client.common.AbstractRESTAction;
+import org.jboss.bpm.console.client.ApplicationContext;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class ResumeDeploymentAction extends AbstractRESTAction
+{
+  public final static String ID = ResumeDeploymentAction.class.getName();
+
+  public ResumeDeploymentAction(ApplicationContext appContetext)
+  {
+    super(appContetext);
+  }
+
+  public String getId()
+  {
+    return ID;
+  }
+
+  public String getUrl(Object event)
+  {
+    String id = (String)event;
+    return appContext.getUrlBuilder().getResumeDeploymentUrl(id);
+  }
+
+  public RequestBuilder.Method getRequestMethod()
+  {
+    return RequestBuilder.POST;
+  }
+
+  public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
+  {
+    // refresh view
+    controller.handleEvent(
+        new Event(UpdateDeploymentListAction.ID, null)
+    );
+  }
+}

Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/SuspendDeploymentAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/SuspendDeploymentAction.java	                        (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/SuspendDeploymentAction.java	2009-06-24 12:38:25 UTC (rev 5103)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.deployment;
+
+import org.jboss.bpm.console.client.common.AbstractRESTAction;
+import org.jboss.bpm.console.client.ApplicationContext;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class SuspendDeploymentAction extends AbstractRESTAction
+{
+  public final static String ID = SuspendDeploymentAction.class.getName();
+
+  public SuspendDeploymentAction(ApplicationContext appContetext)
+  {
+    super(appContetext);
+  }
+
+  public String getId()
+  {
+    return ID;
+  }
+
+  public String getUrl(Object event)
+  {
+    String id = (String)event;
+    return appContext.getUrlBuilder().getSuspendDeploymentUrl(id);
+  }
+
+  public RequestBuilder.Method getRequestMethod()
+  {
+    return RequestBuilder.POST;
+  }
+
+  public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
+  {
+    // refresh view
+    controller.handleEvent(
+        new Event(UpdateDeploymentListAction.ID, null)
+    );
+  }
+}

Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/UpdateDeploymentDetailAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/UpdateDeploymentDetailAction.java	                        (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/UpdateDeploymentDetailAction.java	2009-06-24 12:38:25 UTC (rev 5103)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.deployment;
+
+import com.mvc4g.client.ActionInterface;
+import com.mvc4g.client.Controller;
+import org.jboss.bpm.console.client.model.DeploymentRef;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class UpdateDeploymentDetailAction implements ActionInterface
+{
+  public final static String ID = UpdateDeploymentDetailAction.class.getName();
+
+  public void execute(Controller controller, Object object)
+  {
+    DeploymentRef ref = object!=null ? (DeploymentRef)object : null;
+    DeploymentDetailView view = (DeploymentDetailView)controller.getView(DeploymentDetailView.ID);
+
+    if(null==ref)
+    {
+      // clear view
+      view.clearView();
+    }
+    else
+    {
+      // update view
+      view.update(ref);
+    }
+  }
+}

Modified: projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
===================================================================
--- projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java	2009-06-24 12:37:51 UTC (rev 5102)
+++ projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java	2009-06-24 12:38:25 UTC (rev 5103)
@@ -196,4 +196,22 @@
   {
     return config.getConsoleServerUrl() + "/rs/repository/deployments";
   }
+
+  public String getSuspendDeploymentUrl(String id)
+  {
+    String encodedId = URL.encode(id);
+    return config.getConsoleServerUrl() + "/rs/repository/deployment/"+encodedId+"/suspend";
+  }
+
+  public String getResumeDeploymentUrl(String id)
+  {
+    String encodedId = URL.encode(id);
+    return config.getConsoleServerUrl() + "/rs/repository/deployment/"+encodedId+"/resume";
+  }
+
+  public String getDeleteDeploymentUrl(String id)
+  {
+    String encodedId = URL.encode(id);
+    return config.getConsoleServerUrl() + "/rs/repository/deployment/"+encodedId+"/delete";
+  }
 }

Modified: projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/DeploymentFacade.java
===================================================================
--- projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/DeploymentFacade.java	2009-06-24 12:37:51 UTC (rev 5102)
+++ projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/DeploymentFacade.java	2009-06-24 12:38:25 UTC (rev 5103)
@@ -50,7 +50,7 @@
   {
     if(null==this.deploymentPlugin)
     {
-      this.deploymentPlugin = PluginMgr.load(DeploymentPlugin.class);      
+      this.deploymentPlugin = PluginMgr.load(DeploymentPlugin.class);
     }
 
     return this.deploymentPlugin;
@@ -79,18 +79,33 @@
   }
 
   @POST
-  @Path("deployments/{id}/suspend")
+  @Path("deployment/{id}/suspend")
   @Produces("application/json")
   public Response suspendDeployment(
       @PathParam("id")
       String id
   )
   {
+    return doSuspend(id, true);
+  }
 
+  @POST
+  @Path("deployment/{id}/resume")
+  @Produces("application/json")
+  public Response resumeDeployment(
+      @PathParam("id")
+      String id
+  )
+  {
+    return doSuspend(id, false);
+  }
+
+  private Response doSuspend(String id, boolean suspended)
+  {
     DeploymentPlugin dplPlugin = getDeploymentPlugin();
     if(deploymentPlugin!=null)
     {
-      deploymentPlugin.setSuspended(id, true);
+      deploymentPlugin.setSuspended(id, suspended);
       return Response.ok().build();
     }
     else
@@ -98,11 +113,10 @@
       log.error("DeploymentPlugin not available");
       return Response.serverError().build();
     }
-
   }
 
   @POST
-  @Path("deployments/{id}/delete")
+  @Path("deployment/{id}/delete")
   @Produces("application/json")
   public Response deleteDeployment(
       @PathParam("id")




More information about the jbpm-commits mailing list