de.decidr.workflowmodeleditor.client.DebugStandAloneApp.java Source code

Java tutorial

Introduction

Here is the source code for de.decidr.workflowmodeleditor.client.DebugStandAloneApp.java

Source

/*
 * The DecidR Development Team licenses this file to you 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 de.decidr.workflowmodeleditor.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>. Only needed for test
 * purposes. This enables the workflow model editor to run as stand-alone
 * widget.
 */
public class DebugStandAloneApp implements EntryPoint {

    /**
     * This is the entry point method.
     */
    @Override
    public void onModuleLoad() {
        // Some test user data
        String users = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><userlist><user id=\"23\" name=\"Clark Kent\"/><user id=\"42\" name=\"Bruce Wayne\"/><user id=\"113\" name=\"Peter Parker\"/></userlist>";

        // A very basic workflow
        String dwdl = getSampleProcess();

        // Create widget
        WorkflowEditorWidget modelingToolWidget = new WorkflowEditorWidget();
        RootPanel.get().add(modelingToolWidget);

        // Set test data
        modelingToolWidget.setUsers(users);
        modelingToolWidget.setDWDL(dwdl);
    }

    private String getSampleProcess() {
        // dilettante's approach
        String dwdl = Window.prompt("Enter DWDL (or leave empty for default)", "");
        if (dwdl.isEmpty()) {
            return "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <workflow name=\"HumanTaskTest\" id=\"1\" targetNamespace=\"http://decidr.de/DefaultTenant/processes/302\" xmlns=\"http://decidr.de/model/schema/Dwdl\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://decidr.de/model/schema/Dwdl Dwdl.xsd\"> <description>This is a test process for human task testing</description> <variables> <variable name=\"L1260445451575\" label=\"my_faultMesssage\" type=\"string\" configurationVariable=\"no\"> <initialValue>This fault message is created by the fault handler of the corresponding BPEL process</initialValue> </variable> <variable name=\"L1260445559543\" label=\"my_successMessage\" type=\"string\" configurationVariable=\"no\"> <initialValue>BPEL process successfully completed.</initialValue> </variable> <variable name=\"L1260455349758\" label=\"my_taskname\" type=\"string\" configurationVariable=\"no\"> <initialValue>doIT</initialValue> </variable> <variable name=\"L1260455377884\" label=\"my_form\" type=\"form\" configurationVariable=\"no\" /> <variable name=\"L1260455400647\" label=\"my_taskdescription\" type=\"string\" configurationVariable=\"no\"> <initialValue>This is a simple human task</initialValue> </variable> <variable name=\"L1260455508986\" label=\"favorite_food\" type=\"string\" configurationVariable=\"no\"> <initialValue>a</initialValue> </variable> </variables> <roles> <role configurationVariable=\"no\" label=\"my_recipient\" name=\"L1260445287013\"> <actor userId=\"1\" /> </role> <role configurationVariable=\"yes\" label=\"my_user\" name=\"L1260445515504\" /> </roles> <faultHandler> <setProperty name=\"message\" variable=\"L1260445451575\" /> <recipient> <setProperty name=\"name\" variable=\"L1260445287013\" /> </recipient> </faultHandler> <nodes> <startNode name=\"de.decidr.modelingtoolbase.client.model.StartNodeModel\" id=\"4815162342\"> <description></description> <graphics x=\"45\" y=\"45\" width=\"52\" height=\"32\" /> <sources> <source arcId=\"1260445316022\" /> </sources> </startNode> <endNode name=\"de.decidr.modelingtoolbase.client.model.EndNodeModel\" id=\"108\"> <description></description> <graphics x=\"246\" y=\"376\" width=\"52\" height=\"32\" /> <targets> <target arcId=\"1260445316024\" /> </targets> <notificationOfSuccess> <setProperty name=\"successMessage\" variable=\"L1260445559543\" /> <setProperty name=\"recipient\" variable=\"L1260445287013\" /> </notificationOfSuccess> </endNode> <invokeNode name=\"de.decidr.modelingtoolbase.client.model.humantask.HumanTaskInvokeNodeModel\" id=\"1260445316025\" activity=\"Decidr-HumanTask\"> <description></description> <graphics x=\"170\" y=\"128\" width=\"102\" height=\"62\" /> <targets> <target arcId=\"1260445316022\" /> </targets> <sources> <source arcId=\"1260445316024\" /> </sources> <setProperty name=\"wfmID\" variable=\"L302\" /> <setProperty name=\"user\" variable=\"L1260445515504\" /> <setProperty name=\"name\" variable=\"L1260455349758\" /> <setProperty name=\"description\" variable=\"L1260455349758\" /> <setProperty name=\"userNotification\"> <propertyValue>no</propertyValue> </setProperty> <getProperty name=\"taskResult\" variable=\"L1260455377884\" /> <parameter> <humanTaskData> <taskItem name=\"ID1260455508987\" variable=\"L1260455508986\" type=\"string\"> <label>Food</label> <hint>What is your favorite food?</hint> <value>a</value> </taskItem> </humanTaskData> </parameter> </invokeNode> </nodes> <arcs> <arc name=\"de.decidr.modelingtoolbase.client.model.ConnectionModel\" id=\"1260445316022\" source=\"4815162342\" target=\"1260445316025\" /> <arc name=\"de.decidr.modelingtoolbase.client.model.ConnectionModel\" id=\"1260445316024\" source=\"1260445316025\" target=\"108\" /> </arcs> </workflow>";
        } else {
            return dwdl;
        }

    }

}