[jbpm-commits] JBoss JBPM SVN: r5089 - in projects/gwt-console/trunk: gui/war/src/main/java/org/jboss/bpm/console/client/deployment and 6 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Jun 23 06:08:08 EDT 2009
Author: heiko.braun at jboss.com
Date: 2009-06-23 06:08:08 -0400 (Tue, 23 Jun 2009)
New Revision: 5089
Added:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/
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/DeploymentEditorNavigation.java
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/UpdateDeploymentListAction.java
Modified:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/icons/ConsoleIconBundle.java
projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/workspace-default.cfg
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/model/DTOParser.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DeploymentRef.java
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/DeploymentFacade.java
Log:
More work on DeploymenEditor
Added: 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 (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentEditor.java 2009-06-23 10:08:08 UTC (rev 5089)
@@ -0,0 +1,133 @@
+/*
+ * 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.core.client.GWT;
+import com.google.gwt.user.client.ui.SourcesTabEvents;
+import com.google.gwt.user.client.ui.TabListener;
+import com.mvc4g.client.Event;
+import org.gwt.mosaic.ui.client.DecoratedTabLayoutPanel;
+import org.gwt.mosaic.ui.client.TabLayoutPanel;
+import org.gwt.mosaic.ui.client.layout.BorderLayout;
+import org.gwt.mosaic.ui.client.layout.BorderLayoutData;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.Editor;
+import org.jboss.bpm.console.client.LazyPanel;
+import org.jboss.bpm.console.client.MenuSection;
+import org.jboss.bpm.console.client.common.AbstractView;
+import org.jboss.bpm.console.client.icons.ConsoleIconBundle;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class DeploymentEditor extends Editor
+{
+
+ public final static String ID = DeploymentEditor.class.getName();
+
+ private TabLayoutPanel tabPanel;
+
+ public DeploymentEditor(ApplicationContext appContext)
+ {
+ super(appContext);
+ }
+
+ public void initialize()
+ {
+ if(!isInitialized)
+ {
+
+ // create inner tab layout
+ tabPanel = new DecoratedTabLayoutPanel();
+ tabPanel.setPadding(5);
+
+ tabPanel.addTabListener(
+ new TabListener()
+ {
+ public boolean onBeforeTabSelected(SourcesTabEvents sourcesTabEvents, int i)
+ {
+ boolean showTab = true;
+ return showTab;
+ }
+
+ public void onTabSelected(SourcesTabEvents sourcesTabEvents, int i)
+ {
+ LazyPanel lazyPanel = (LazyPanel) tabPanel.getWidget(i);
+ if(!lazyPanel.isInitialized())
+ {
+ lazyPanel.initialize();
+ appContext.refreshView(); // TODO: hack around rendering problems
+ }
+ }
+ }
+ );
+
+ this.add(tabPanel, new BorderLayoutData(BorderLayout.Region.CENTER));
+
+ // create and register views
+ registerView(DeploymentListView.ID, new DeploymentListView());
+
+ // create and register actions
+ controller.addAction(UpdateDeploymentListAction.ID, new UpdateDeploymentListAction(appContext));
+
+ // display tab, needs to visible for correct rendering
+ tabPanel.selectTab(0);
+
+ // force loading
+ super.controller.handleEvent(
+ new Event(UpdateDeploymentListAction.ID, null)
+ );
+
+ isInitialized = true;
+ }
+ }
+
+ private void registerView(String id, AbstractView view)
+ {
+ // register view with controller
+ super.controller.addView(id, view);
+
+ // add to tab layout
+ this.tabPanel.add(view, view.getIconTitle(), true);
+ }
+
+ public String getEditorId()
+ {
+ return ID;
+ }
+
+ public String getTitle()
+ {
+ return "Deployments";
+ }
+
+ public MenuSection provideMenuSection()
+ {
+ ConsoleIconBundle icons = GWT.create(ConsoleIconBundle.class);
+
+ return new MenuSection(
+ "Deployments",
+ icons.deploymentIcon(),
+ new DeploymentEditorNavigation(appContext)
+ );
+ }
+}
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentEditorNavigation.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentEditorNavigation.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentEditorNavigation.java 2009-06-23 10:08:08 UTC (rev 5089)
@@ -0,0 +1,62 @@
+/*
+ * 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.Tree;
+import com.google.gwt.user.client.ui.TreeItem;
+import com.google.gwt.user.client.ui.TreeListener;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.Workspace;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class DeploymentEditorNavigation extends Tree
+{
+
+ public DeploymentEditorNavigation(final ApplicationContext appContext)
+ {
+ super.setTitle("Deployments");
+
+ TreeItem root = addItem("Process Deployments");
+ TreeItem jbpmDeployments = root.addItem("Overview");
+
+ addTreeListener(
+ new TreeListener()
+ {
+ public void onTreeItemSelected(TreeItem treeItem)
+ {
+ if("Overview".equals(treeItem.getText()))
+ {
+ Workspace workspace = appContext.getWorkpace();
+ workspace.showEditor(DeploymentEditor.ID);
+ }
+ }
+
+ public void onTreeItemStateChanged(TreeItem treeItem)
+ {
+
+ }
+ }
+ );
+ }
+}
Added: 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 (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentListView.java 2009-06-23 10:08:08 UTC (rev 5089)
@@ -0,0 +1,224 @@
+/*
+ * 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.core.client.GWT;
+import com.google.gwt.user.client.ui.ChangeListener;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.Widget;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+import org.gwt.mosaic.ui.client.ListBox;
+import org.gwt.mosaic.ui.client.MessageBox;
+import org.gwt.mosaic.ui.client.ToolBar;
+import org.gwt.mosaic.ui.client.ToolButton;
+import org.gwt.mosaic.ui.client.layout.*;
+import org.gwt.mosaic.ui.client.list.DefaultListModel;
+import org.jboss.bpm.console.client.common.AbstractView;
+import org.jboss.bpm.console.client.icons.ConsoleIconBundle;
+import org.jboss.bpm.console.client.model.DeploymentRef;
+import org.jboss.bpm.console.client.process.UpdateInstancesAction;
+import org.jboss.bpm.console.client.process.UpdateProcessDetailAction;
+
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class DeploymentListView extends AbstractView
+{
+ public final static String ID = DeploymentListView.class.getName();
+
+ private Controller controller;
+
+ private boolean initialized;
+
+ private LayoutPanel deploymentList = null;
+
+ private ListBox<DeploymentRef> listBox;
+
+ private DeploymentRef selection = null;
+
+ public DeploymentListView()
+ {
+ super();
+ ConsoleIconBundle icons = GWT.create(ConsoleIconBundle.class);
+ setTitle("Deployment Overview");
+ setIcon(icons.deploymentIcon());
+
+ listBox = createListBox();
+ }
+
+ private ListBox createListBox()
+ {
+ final ListBox<DeploymentRef> listBox =
+ new ListBox<DeploymentRef>(
+ new String[] {
+ "ID", "Name", "Suspended"}
+ );
+
+
+ listBox.setCellRenderer(new ListBox.CellRenderer<DeploymentRef>() {
+ public void renderCell(ListBox<DeploymentRef> listBox, int row, int column,
+ DeploymentRef item) {
+ switch (column) {
+ case 0:
+ listBox.setText(row, column, item.getId());
+ break;
+ case 1:
+ listBox.setText(row, column, item.getName());
+ break;
+ case 2:
+ listBox.setText(row, column, String.valueOf(item.isSuspended()));
+ break;
+ default:
+ throw new RuntimeException("Unexpected column size");
+ }
+ }
+ });
+
+ listBox.addChangeListener(new ChangeListener()
+ {
+ public void onChange(Widget widget)
+ {
+ int index = listBox.getSelectedIndex();
+ if(index!=-1)
+ {
+ DeploymentRef item = listBox.getItem(index);
+
+ // TODO: update details
+ /*controller.handleEvent(
+ new Event(UpdateProcessDetailAction.ID, item)
+ );*/
+ }
+ }
+ });
+
+ return listBox;
+ }
+
+ public void setController(Controller controller)
+ {
+ this.controller = controller;
+ }
+
+ public boolean isInitialized()
+ {
+ return initialized;
+ }
+
+ public void initialize()
+ {
+ if(!initialized)
+ {
+ deploymentList = new LayoutPanel( new BoxLayout(BoxLayout.Orientation.VERTICAL));
+ deploymentList.setPadding(0);
+ deploymentList.setWidgetSpacing(0);
+
+ // toolbar
+
+ final LayoutPanel toolBox = new LayoutPanel();
+ toolBox.setPadding(0);
+ toolBox.setWidgetSpacing(5);
+ //toolBox.setLayout(new BoxLayout(BoxLayout.Orientation.VERTICAL));
+
+ final ToolBar toolBar = new ToolBar();
+ toolBar.add(
+ new ToolButton("Refresh", new ClickListener() {
+ public void onClick(Widget sender) {
+ // force loading
+ controller.handleEvent(
+ new Event(UpdateDeploymentListAction.ID, null)
+ );
+ }
+ }
+ )
+ );
+
+ toolBar.addSeparator();
+
+ toolBar.add(
+ new ToolButton("Delete", new ClickListener() {
+ public void onClick(Widget sender) {
+ // force loading
+ DeploymentRef deploymentRef = getSelection();
+ if(deploymentRef!=null)
+ {
+
+ }
+ else
+ {
+ MessageBox.alert("Missing selection", "Please select a deployment definition");
+ }
+ }
+ }
+ )
+ );
+
+ toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+
+ this.deploymentList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+ this.deploymentList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+
+ // layout
+ LayoutPanel layout = new LayoutPanel(new BorderLayout());
+ layout.add(deploymentList, new BorderLayoutData(BorderLayout.Region.CENTER));
+
+ // details
+ /*ProcessDetailView detailsView = new ProcessDetailView();
+ controller.addView(ProcessDetailView.ID, detailsView);
+ controller.addAction(UpdateProcessDetailAction.ID, new UpdateProcessDetailAction());
+ layout.add(detailsView, new BorderLayoutData(BorderLayout.Region.SOUTH, 10,200));
+ */
+
+ this.add(layout);
+
+ initialized = true;
+ }
+ }
+
+ public DeploymentRef getSelection()
+ {
+ DeploymentRef selection = null;
+ if(isInitialized() && listBox.getSelectedIndex()!=-1)
+ selection = listBox.getItem( listBox.getSelectedIndex());
+ return selection;
+ }
+
+ public void update(List<DeploymentRef> deployments)
+ {
+ final DefaultListModel<DeploymentRef> model =
+ (DefaultListModel<DeploymentRef>) listBox.getModel();
+
+ model.clear();
+
+ for(DeploymentRef dpl : deployments)
+ {
+ model.add(dpl);
+ }
+
+ // clear details
+ /*controller.handleEvent(
+ new Event(UpdateProcessDetailAction.ID, null)
+ );*/
+ }
+}
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/UpdateDeploymentListAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/UpdateDeploymentListAction.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/UpdateDeploymentListAction.java 2009-06-23 10:08:08 UTC (rev 5089)
@@ -0,0 +1,75 @@
+/*
+ * 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 org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.DTOParser;
+import org.jboss.bpm.console.client.model.DeploymentRef;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.json.client.JSONValue;
+import com.google.gwt.json.client.JSONParser;
+import com.mvc4g.client.Controller;
+
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class UpdateDeploymentListAction extends AbstractRESTAction
+{
+
+ public final static String ID = UpdateDeploymentListAction.class.getName();
+
+
+ public UpdateDeploymentListAction(ApplicationContext appContext)
+ {
+ super(appContext);
+ }
+
+ public String getId()
+ {
+ return ID;
+ }
+
+ public String getUrl(Object event)
+ {
+ return appContext.getUrlBuilder().getDeploymentsUrl();
+ }
+
+ public RequestBuilder.Method getRequestMethod()
+ {
+ return RequestBuilder.GET;
+ }
+
+ public void handleSuccessfulResponse(
+ final Controller controller, final Object event, Response response)
+ {
+ JSONValue json = JSONParser.parse(response.getText());
+ List<DeploymentRef> deployments = DTOParser.parseDeploymentRefList(json);
+
+ DeploymentListView view = (DeploymentListView)controller.getView(DeploymentListView.ID);
+ view.update(deployments);
+ }
+}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/icons/ConsoleIconBundle.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/icons/ConsoleIconBundle.java 2009-06-23 08:50:55 UTC (rev 5088)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/icons/ConsoleIconBundle.java 2009-06-23 10:08:08 UTC (rev 5089)
@@ -113,4 +113,9 @@
* @gwt.resource report.png
*/
AbstractImagePrototype reportIcon();
+
+ /**
+ * @gwt.resource deployment.png
+ */
+ AbstractImagePrototype deploymentIcon();
}
Modified: projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/workspace-default.cfg
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/workspace-default.cfg 2009-06-23 08:50:55 UTC (rev 5088)
+++ projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/workspace-default.cfg 2009-06-23 10:08:08 UTC (rev 5089)
@@ -1,4 +1,5 @@
org.jboss.bpm.console.client.SettingsEditor
org.jboss.bpm.console.client.process.ProcessEditor
org.jboss.bpm.console.client.task.TaskEditor
-org.jboss.bpm.console.client.report.ReportEditor
\ No newline at end of file
+org.jboss.bpm.console.client.report.ReportEditor
+org.jboss.bpm.console.client.deployment.DeploymentEditor
\ No newline at end of file
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-23 08:50:55 UTC (rev 5088)
+++ projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2009-06-23 10:08:08 UTC (rev 5089)
@@ -191,4 +191,9 @@
url += "&id=birt";
return url;
}
+
+ public String getDeploymentsUrl()
+ {
+ return config.getConsoleServerUrl() + "/rs/repository/deployments";
+ }
}
Modified: projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
===================================================================
--- projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2009-06-23 08:50:55 UTC (rev 5088)
+++ projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2009-06-23 10:08:08 UTC (rev 5089)
@@ -39,11 +39,11 @@
public static List<ProcessDefinitionRef> parseProcessDefinitions(JSONValue jso)
{
List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>();
-
+
JSONArray arr = JSONWalk.on(jso).next("definitions").asArray();
for(int i=0; i<arr.size(); i++)
{
- results.add(parseProcessDefinition(arr.get(i)));
+ results.add(parseProcessDefinition(arr.get(i)));
}
return results;
}
@@ -51,7 +51,7 @@
public static ProcessDefinitionRef parseProcessDefinition(JSONValue root)
{
ConsoleLog.debug("parse " + root);
-
+
String id = JSONWalk.on(root).next("id").asString();
Long version = JSONWalk.on(root).next("version").asLong();
String name = JSONWalk.on(root).next("name").asString();
@@ -92,7 +92,7 @@
public static List<TaskRef> parseTaskReferenceList(String json)
{
- List<TaskRef> results = new ArrayList<TaskRef>();
+ List<TaskRef> results = new ArrayList<TaskRef>();
JSONValue root = JSONParser.parse(json);
JSONArray array = JSONWalk.on(root).next("tasks").asArray();
@@ -135,7 +135,7 @@
}
else
{
- ref.setUrl("");
+ ref.setUrl("");
}
// participant users
@@ -188,7 +188,7 @@
Date due = createDate.asDate();
ref.setDueDate(due);
}
-
+
return ref;
}
@@ -200,7 +200,7 @@
boolean isGroup = JSONWalk.on(jsonValue).next("isGroup").asBool();
p.setGroup(isGroup);
-
+
return p;
}
@@ -219,7 +219,7 @@
public static ProcessInstanceRef parseProcessInstance(JSONValue root)
{
ConsoleLog.debug("parse " + root);
-
+
String id = JSONWalk.on(root).next("id").asString();
String definitionId = JSONWalk.on(root).next("definitionId").asString();
Date start = JSONWalk.on(root).next("startDate").asDate();
@@ -247,7 +247,7 @@
public static TokenReference parseTokenReference(JSONObject jso)
{
ConsoleLog.debug("parse " + jso);
-
+
String rootTokenId = JSONWalk.on(jso).next("id").asString();
//String name = JSONWalk.on(jso).next("name").asString();
String nodeName = JSONWalk.on(jso).next("currentNodeName").asString();
@@ -308,11 +308,11 @@
public static ServerStatus parseStatus(JSONValue json)
{
ConsoleLog.debug("parse " + json);
-
+
ServerStatus status = new ServerStatus();
JSONArray jsonArray = JSONWalk.on(json).next("plugins").asArray();
- for (int i = 0; i < jsonArray.size(); i++)
+ for (int i = 0; i < jsonArray.size(); i++)
{
JSONValue item = jsonArray.get(i);
String type = JSONWalk.on(item).next("type").asString();
@@ -323,4 +323,29 @@
return status;
}
+ public static List<DeploymentRef> parseDeploymentRefList(JSONValue json)
+ {
+ List<DeploymentRef> result = new ArrayList<DeploymentRef>();
+
+ JSONArray jsonArray = JSONWalk.on(json).next("deployments").asArray();
+ for (int i = 0; i < jsonArray.size(); i++)
+ {
+ JSONValue item = jsonArray.get(i);
+ String id = JSONWalk.on(item).next("id").asString();
+ boolean suspended = JSONWalk.on(item).next("suspended").asBool();
+
+ String name = JSONWalk.on(item).next("name").asString();
+ long ts = JSONWalk.on(item).next("timestamp").asLong();
+
+ DeploymentRef ref = new DeploymentRef(id, suspended);
+ ref.setName(name);
+ ref.setTimestamp(ts);
+
+ // todo: parse definitions
+
+ result.add(ref);
+ }
+
+ return result;
+ }
}
Modified: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DeploymentRef.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DeploymentRef.java 2009-06-23 08:50:55 UTC (rev 5088)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DeploymentRef.java 2009-06-23 10:08:08 UTC (rev 5089)
@@ -33,6 +33,10 @@
private boolean suspended;
+ private String name;
+
+ private long timestamp;
+
private List<ProcessDefinitionRef> definitions = new ArrayList<ProcessDefinitionRef>();
public DeploymentRef()
@@ -69,4 +73,24 @@
{
return definitions;
}
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public long getTimestamp()
+ {
+ return timestamp;
+ }
+
+ public void setTimestamp(long timestamp)
+ {
+ this.timestamp = timestamp;
+ }
}
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-23 08:50:55 UTC (rev 5088)
+++ projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/DeploymentFacade.java 2009-06-23 10:08:08 UTC (rev 5089)
@@ -21,22 +21,17 @@
*/
package org.jboss.bpm.console.server;
+import com.google.gson.Gson;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.console.client.model.DeploymentRef;
+import org.jboss.bpm.console.client.model.DeploymentRefWrapper;
import org.jboss.bpm.console.server.gson.GsonFactory;
import org.jboss.bpm.console.server.plugin.DeploymentPlugin;
import org.jboss.bpm.console.server.plugin.PluginMgr;
-import org.jboss.bpm.console.server.integration.ManagementFactory;
-import org.jboss.bpm.console.client.model.DeploymentRef;
-import org.jboss.bpm.console.client.model.DeploymentRefWrapper;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import javax.ws.rs.Path;
-import javax.ws.rs.GET;
-import javax.ws.rs.Produces;
+import javax.ws.rs.*;
import javax.ws.rs.core.Response;
-
-import com.google.gson.Gson;
-
import java.util.List;
/**
@@ -83,6 +78,52 @@
}
+ @POST
+ @Path("deployments/{id}/suspend")
+ @Produces("application/json")
+ public Response suspendDeployment(
+ @PathParam("id")
+ String id
+ )
+ {
+
+ DeploymentPlugin dplPlugin = getDeploymentPlugin();
+ if(deploymentPlugin!=null)
+ {
+ deploymentPlugin.setSuspended(id, true);
+ return Response.ok().build();
+ }
+ else
+ {
+ log.error("DeploymentPlugin not available");
+ return Response.serverError().build();
+ }
+
+ }
+
+ @POST
+ @Path("deployments/{id}/delete")
+ @Produces("application/json")
+ public Response deleteDeployment(
+ @PathParam("id")
+ String id
+ )
+ {
+
+ DeploymentPlugin dplPlugin = getDeploymentPlugin();
+ if(deploymentPlugin!=null)
+ {
+ deploymentPlugin.deleteDeployment(id);
+ return Response.ok().build();
+ }
+ else
+ {
+ log.error("DeploymentPlugin not available");
+ return Response.serverError().build();
+ }
+
+ }
+
private Response createJsonResponse(Object wrapper)
{
Gson gson = GsonFactory.createInstance();
More information about the jbpm-commits
mailing list