Batch API - BAR file Upload - But where is it?

1
0
-1

Hi there,

Windows 8.1, Java 7 and Bonita 6.4.1

I have just a JAVA program to batch upload a BAR file to Tomcat-Bundle with the code as follows:

                        final BusinessArchive businessArchive = BusinessArchiveFactory
                                        .readBusinessArchive(new File(
                                                        "E:\\Bonita 641\\DEVL BUILDS\\processXX--1.61.bar"));
                        final ProcessDefinition processDefinition = getProcessAPI(session)
                                        .deploy(businessArchive);
                        System.out
                                        .println("Trace - Deployaprocessfromabarfile: ProcessDefinition.id "
                                                        + "\nid "+ processDefinition.getId()
                                                        + "\nname "+ processDefinition.getName()
                                                        + "\nversion "+ processDefinition.getVersion());

which successfully executes and gives me the following info on System.out

id 4764878978747018631
name processXX
version 1.61

I do not delete the process after loading.

I stop and restart my Tomcat Bundle.

When i log in as Admin - and look under Process Management->Processes there is nothing there.

So question is Where is my Process if it has loaded successfully?

Does .deploy(businessArchive) not Load the process into the Tomcat-Bundle?

Am I thinking incorrectly here, as I believe it should load and I should be able to see it in the list of processes deployed.

Many thanks in advance, regards

Seán

Comments

Submitted by julien.mege on Tue, 02/10/2015 - 16:34

hello,

Have you click on the filter "Disabled"? Because when you deploy a process, it is disable by default. you need to set an actor mapping, then enabled the process.

as is it describe here : http://documentation.bonitasoft.com/deploy-process

Hope this helps. Regards,

Julien.

Submitted by Sean McP on Wed, 02/11/2015 - 11:41

Yes I've done that,

and I've just lost my whole answer to your question with tests to ask what's happening so a little peeved, now 'll try again...

My code all of it:

/**
 * Copyright (C) 2014 BonitaSoft S.A.
 * BonitaSoft, 32 rue Gustave Eiffel - 38000 Grenoble
 * This library 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
 * version 2.1 of the License.
 * This library 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
 * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA 02110-1301, USA.
 **/

package org.bonitasoft.example;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;

import javax.annotation.Resource;

import org.bonitasoft.engine.api.IdentityAPI;
import org.bonitasoft.engine.api.LoginAPI;
import org.bonitasoft.engine.api.PlatformAPI;
import org.bonitasoft.engine.api.PlatformAPIAccessor;
import org.bonitasoft.engine.api.PlatformLoginAPI;
import org.bonitasoft.engine.api.ProcessAPI;
import org.bonitasoft.engine.api.ProcessRuntimeAPI;
import org.bonitasoft.engine.api.TenantAPIAccessor;
import org.bonitasoft.engine.bpm.actor.ActorCriterion;
import org.bonitasoft.engine.bpm.actor.ActorInstance;
import org.bonitasoft.engine.bpm.bar.BusinessArchive;
import org.bonitasoft.engine.bpm.bar.BusinessArchiveFactory;
import org.bonitasoft.engine.bpm.flownode.ActivityInstanceCriterion;
import org.bonitasoft.engine.bpm.flownode.ActivityInstanceNotFoundException;
import org.bonitasoft.engine.bpm.flownode.HumanTaskInstance;
import org.bonitasoft.engine.bpm.process.ArchivedProcessInstance;
import org.bonitasoft.engine.bpm.process.ArchivedProcessInstancesSearchDescriptor;
import org.bonitasoft.engine.bpm.process.DesignProcessDefinition;
import org.bonitasoft.engine.bpm.process.InvalidProcessDefinitionException;
import org.bonitasoft.engine.bpm.process.ProcessDefinition;
import org.bonitasoft.engine.bpm.process.ProcessDeploymentInfo;
import org.bonitasoft.engine.bpm.process.ProcessDeploymentInfoSearchDescriptor;
import org.bonitasoft.engine.bpm.process.ProcessInstance;
import org.bonitasoft.engine.bpm.process.ProcessInstanceSearchDescriptor;
import org.bonitasoft.engine.bpm.process.impl.DocumentBuilder;
import org.bonitasoft.engine.bpm.process.impl.ProcessDefinitionBuilder;
import org.bonitasoft.engine.exception.BonitaException;
import org.bonitasoft.engine.identity.User;
import org.bonitasoft.engine.search.Order;
import org.bonitasoft.engine.search.SearchOptions;
import org.bonitasoft.engine.search.SearchOptionsBuilder;
import org.bonitasoft.engine.search.SearchResult;
import org.bonitasoft.engine.session.APISession;
import org.bonitasoft.engine.session.PlatformSession;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

//import org.gubernare.Documents.Uploader;

public class App {

        /**
         * Bonita home property key
         */

        private static final String BONITA_HOME_KEY = "bonita.home";

        /**
         * Platform administrator user name
         */

        private static final String PLATFORM_ADMIN = "platformAdmin";

        /**
         * Platform administrator password
         */

        private static final String PLATFORM_PASSWORD = "platform";

        /**
         * Tenant technical user username
         */

        private static final String TECHNICAL_USER_NAME = "install";

        /**
         * Tenant technical user password
         */

        private static final String TECHNICAL_PASSWORD = "install";

        /**
         * End user Administrator
         */

        private static final String EndUser_ADMIN = "bonita.admin";

        /**
         * End user Administrator password
         */

        private static final String EndUser_ADMIN_PASSWORD = "bpm";

        /**
         * End user username
         */

        private static final String USER_NAME = "walter.bates";

        /**
         * End user password
         */

        private static final String PWD = "bpm";

        /**
         * Actor name used in the process example
         */

        private static final String ACTOR_NAME = "MyActor";

        /**
         * The maximum number of elements retrieved by paged requests
         */

        private static int PAGE_SIZE = 5;

        /**
         * Spring context used to deploy a data source
         */

        private static ConfigurableApplicationContext springContext;

        @Resource(lookup = "java:app/AppName")
        private String appName;

        @Resource(lookup = "java:module/ModuleName")
        private String moduleName;

        public static void main(String[] args) throws Exception {

                User user = null;
                try {
                        // check that Bonita Home is set
                        checkBonitaHome();

                        // deploy a data source. This step is not necessary if you already
                        // have
                        // a data source available, for instance,
                        // a data source supplied by an application server
                        deployDataSource();

                        // perform all necessary actions to create the Bonita platform
                        createPlatform();
                       
                        //wait
                        for( int i=0; i<10; i++){
                                System.out.println("Waiting "+(10-i));
                        }

                        // create a user that will deploy and execute processes
                        user = createUser();

                        // deploy a process
                        //ProcessDefinition processDefinition = deployProcess();

                        // List the deployed processes
                        Listthedeployedprocesses();

                        // Deploy and enable a process from a bar file
                        Deployaprocessfromabarfile();

                        // Deploy and enable a process from a bar file
                        // Deployandenableaprocessfromabarfile();

                        // execute actions chosen from a menu
                        // executeActions(processDefinition);

                        // --- clean all information ----
                        // undeploy the process
                        // undeployProcess(processDefinition);

                        System.out.println("Completed sucessfully!!!");

                } finally {

                        // delete the created user
                        deleteUser(user);
                        System.out.println("deleteUser Completed sucessfully!!!");

                        // perform all necessary actions to delete the platform
                        deletePlatform();
                        System.out.println("deletePlatform Completed sucessfully!!!");

                        // undeploy the data source
                        undeployDataSource();
                        System.out.println("undeployDataSource Completed sucessfully!!!");

                }
                System.out.println("Program execution Completed!!!");
        }

        /**
         * Check if the system property bonita.home is set. If not, a
         * RuntimeException is thrown.
         */

        private static void checkBonitaHome() {

                String bonitaHome = System.getProperty(BONITA_HOME_KEY);
                if (bonitaHome == null) {
                        throw new RuntimeException(
                                        "The system property bonita.home is not set. Please, set this property with the path to the bonita home folder.\n "
                                                        + "You can get a bonita home from BonitaBPMCommunity-<bonita.engine.version>-deploy.zip or use the one generated under \n"
                                                        + "the folder target/home on this project by running the command 'mvn clean install'.");
                }
                System.out.println("bonitaHome = " + bonitaHome.toString());
        }

        /**
         * Do all necessary actions to create the Bonita platform
         *
         * @throws BonitaException
         *             if an exception occurs when creating the platform
         */

        private static void createPlatform() throws BonitaException {
                // login as platform administrator
                PlatformSession session = doPlatformLogin(PLATFORM_ADMIN,
                                PLATFORM_PASSWORD);
                try {
                        System.out.println("Creating and initializing the platform ...");
                        // create and initialize the platform
                        getPlatformAPI(session).createAndInitializePlatform();
                        System.out.println("Platform created and initialized!");

                        System.out.println("Starting node ...");
                        // start the node (make scheduler service to start)
                        getPlatformAPI(session).startNode();
                        System.out.println("Node started!");
                } finally {
                        // logout
                        doPlatformLogout(session);
                }
        }

        /**
         * Perform all necessary actions to delete the platform
         *
         * @throws BonitaException
         *             if an exception occurs when deleting the platform
         */

        private static void deletePlatform() throws BonitaException {
                // login as platform administrator
                PlatformSession session = doPlatformLogin(PLATFORM_ADMIN,
                                PLATFORM_PASSWORD);
                try {
                        System.out.println("Stopping node ...");
                        // stop the node (this will stop the scheduler service)
                        getPlatformAPI(session).stopNode();
                        System.out.println("Node stopped!");

                        System.out.println("Cleaning and deleting the platform ...");
                        // clean and delete the platform
                        getPlatformAPI(session).cleanAndDeletePlaftorm();
                        System.out.println("Platform cleaned and deleted!");
                } finally {
                        // logout
                        doPlatformLogout(session);
                }
        }

        /*
         * new code for me
         */


        /*
         * List the deployed processes
         * http://documentation.bonitasoft.com/list-deployed-processes
         */

        private static void Listthedeployedprocesses() throws BonitaException {

                System.out.println("Trace - Listthedeployedprocesses: In ");
                // login
                APISession session = doTenantLogin(USER_NAME, PWD);
                try {

                        System.out.println("Trace - Listthedeployedprocesses: processAPI ");
                        final ProcessAPI processAPI = TenantAPIAccessor
                                        .getProcessAPI(session);
                        System.out
                                        .println("Trace - Listthedeployedprocesses: SearchOptions ");
                        final SearchOptions searchOptions = new SearchOptionsBuilder(0, 100)
                                        .sort(ProcessDeploymentInfoSearchDescriptor.DEPLOYMENT_DATE,
                                                        Order.DESC).done();
                        System.out
                                        .println("Trace - Listthedeployedprocesses: SearchResult ");
                        final SearchResult<ProcessDeploymentInfo> deploymentInfoResults = processAPI
                                        .searchProcessDeploymentInfos(searchOptions);
                        System.out.println("Trace - Listthedeployedprocesses: for count: "
                                        + deploymentInfoResults.getCount());
                        for (ProcessDeploymentInfo deployedProcess : deploymentInfoResults
                                        .getResult()) {
                                System.out
                                                .println("Trace - Listthedeployedprocesses: deployedProcess: "
                                                                + "\nid = "
                                                                + deployedProcess.getId()
                                                                + "\nname = "
                                                                + deployedProcess.getName()
                                                                + "\nversion = " + deployedProcess.getVersion());
                        }
                } finally {
                        // logout
                        doTenantLogout(session);
                }
                System.out.println("Trace - Listthedeployedprocesses: Out ");

        }

        /*
         * Enable a process and start an instance
         * http://documentation.bonitasoft.com/enable-process-and-start-instance
         */

        private static void Enableaprocessandstartaninstance()
                        throws BonitaException {

                /*
                 * // To enable a process, call the method enableProcess specifying the
                 * // processDefinition id: // enable the process
                 * processAPI.enableProcess(processDefinition.getId());
                 * System.out.println("A new process was enabled: " +
                 * processDefinition.getId());
                 *
                 * // The next step is to start an instance of the deployed process: //
                 * start the process final ProcessInstance processInstance = processAPI
                 * .startProcess(processDefinition.getId());
                 * System.out.println("A new process instance was started with id: " +
                 * processInstance.getId());
                 */


        }

        public static void getDocumentDefinition() {

                System.out.println("\nTrace - getDocumentDefinition: null ");
                DocumentBuilder docToBuild = new DocumentBuilder();

                System.out
                                .println("\nTrace - getDocumentDefinition: createNewInstance ");
                docToBuild.createNewInstance("Test Doc", true);
                System.out
                                .println("\nTrace - getDocumentDefinition: setContentMimeType ");
                docToBuild.setContentMimeType("text/docx");
                System.out.println("\nTrace - getDocumentDefinition: setDescription ");
                docToBuild.setDescription("Test Doc");
                System.out.println("\nTrace - getDocumentDefinition: setFileName ");
                docToBuild
                                .setFileName("C:\\Users\\Sean McPoland\\Desktop\\test doc.docx");
                System.out.println("\nTrace - getDocumentDefinition: done ");
                // docToBuild.setURL(String documentUrl)
                docToBuild.done();
                System.out.println("\nTrace - getDocumentDefinition: Out\n ");

        }

        /*
         * Deploy and enable a process from a bar file
         * http://documentation.bonitasoft.com/deploy-process
         */

        private static void Deployaprocessfromabarfile() throws BonitaException {

                System.out.println("Trace - Deployaprocessfromabarfile: In ");
                // login
                APISession session = doTenantLogin(USER_NAME, PWD);
                try {

                        // First create a business archive from the bar file.
                        // In this example, the bar file is /deploy/travelRequest. The
                        // process
                        // is deployed and enabled in a single step.

                        getDocumentDefinition();

                        // create a business archive
                        System.out
                                        .println("Trace - Deployaprocessfromabarfile: BusinessArchive ");
                        final BusinessArchive businessArchive = BusinessArchiveFactory
                                        .readBusinessArchive(new File(
                                                        "E:\\Bonita 641\\DEVL BUILDS for Release\\gubeSendMail--1.63.bar"));
                        // deploy and enable the process
                        System.out
                                        .println("Trace - Deployaprocessfromabarfile: ProcessDefinition ");
                        final ProcessDefinition processDefinition = getProcessAPI(session)
                                        .deploy(businessArchive);
                        System.out
                                        .println("Trace - Deployaprocessfromabarfile: ProcessDefinition.id "
                                                        + "\nid "
                                                        + processDefinition.getId()
                                                        + "\nname "
                                                        + processDefinition.getName()
                                                        + "\nversion "
                                                        + processDefinition.getVersion());

                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } finally {
                        // logout
                        doTenantLogout(session);
                }
                System.out.println("Trace - Deployaprocessfromabarfile: Out ");

        }

        /*
         * Deploy and enable a process from a bar file
         * http://documentation.bonitasoft.com/deploy-process
         */

        private static void Deployandenableaprocessfromabarfile()
                        throws BonitaException {

                System.out.println("Trace - Deployandenableaprocessfromabarfile: In ");
                // login
                APISession session = doTenantLogin(USER_NAME, PWD);
                try {

                        // First create a business archive from the bar file.
                        // In this example, the bar file is /deploy/travelRequest. The
                        // process
                        // is deployed and enabled in a single step.

                        // create a business archive
                        System.out
                                        .println("Trace - Deployandenableaprocessfromabarfile: BusinessArchive ");
                        final BusinessArchive businessArchive = BusinessArchiveFactory
                                        .readBusinessArchive(new File(
                                                        "E:\\Bonita 641\\DEVL BUILDS for Release\\gubeSendMail--1.63.bar"));
                        // deploy and enable the process
                        System.out
                                        .println("Trace - Deployandenableaprocessfromabarfile: ProcessDefinition ");
                        final ProcessDefinition processDefinition = getProcessAPI(session)
                                        .deployAndEnableProcess(businessArchive);
                        System.out
                                        .println("Trace - Deployandenableaprocessfromabarfile: ProcessDefinition.id "
                                                        + "\nid"
                                                        + processDefinition.getId()
                                                        + "\nname"
                                                        + processDefinition.getName()
                                                        + "\nversion"
                                                        + processDefinition.getVersion());

                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } finally {
                        // logout
                        doTenantLogout(session);
                }
                System.out.println("Trace - Deployandenableaprocessfromabarfile: Out ");

        }

        /*
         * Deploy and enable a process from the processDefinitionBuilder
         * http://documentation.bonitasoft.com/deploy-process
         */

/*      private static void DeployandenableaprocessfromtheprocessDefinitionBuilder()
                        throws BonitaException {

                // First deploy the process:
                // deploy the process
                final ProcessDefinition processDefinition = processAPI.deploy(processDefinitionBuilder.done());
                System.out.println("A new process was deployed with id: "
                                + processDefinition.getId());

                // Once the process is deployed, it's necessary to map the actors
                // defined in the process to existing users in the database before
                // enabling the process. In this example, the actor defined in the
                // process will be mapped to the current logged in user, whose id is
                // available in the session (attention, this user cannot be the
                // technical user):

                // map the actor "delivery" to the current logged in user final
                List<ActorInstance> actors = processAPI.getActors(
                                processDefinition.getId(), 0, 1, ActorCriterion.NAME_ASC);
                processAPI.addUserToActor(actors.get(0).getId(), session.getUserId());

                // At this point, the process is deployed but not enabled. This means
                // that no instances of this process can be started. To enable the
                // process, call the method enableProcess:

                // enable the process
                processAPI.enableProcess(processDefinition.getId());
                System.out.println("A new process was enabled: "
                                + processDefinition.getId());

        }
*/

        /*
         * end new for for me
         */

        /**
         * Deploy a process example
         *
         * @return the deployed process
         * @throws BonitaException
         *             if an exception occurs during process deployment
         */

        private static ProcessDefinition deployProcess() throws BonitaException {
                // log in with the end user previously created
                APISession session = doTenantLogin(USER_NAME, PWD);
                try {
                        System.out.println("Deploying process ... ");
                        // build the process example
                        DesignProcessDefinition designProcessDefinition = buildProcessDefinition();
                        // deploy the process
                        ProcessDefinition processDefinition = getProcessAPI(session)
                                        .deploy(designProcessDefinition);
                        System.out.println("Process deployed!");

                        System.out.println("Mapping actors ... ");
                        // map the process actor to the end user. Before enabling the
                        // process all actors must be mapped.
                        getProcessAPI(session).addUserToActor(ACTOR_NAME,
                                        processDefinition, session.getUserId());
                        System.out.println("Actors mapped!");

                        System.out.println("Enabling process ... ");
                        // enable the process. Up to now this process can be instantiated.
                        getProcessAPI(session).enableProcess(processDefinition.getId());
                        System.out.println("Process enabled!");
                        return processDefinition;

                } finally {
                        // do logout
                        doTenantLogout(session);
                }
        }

        /**
         * Build a simple process: Start -> My Automatic Step -> My first step -> My
         * second step -> End
         *
         * @return the built process
         * @throws InvalidProcessDefinitionException
         */

        private static DesignProcessDefinition buildProcessDefinition()
                        throws InvalidProcessDefinitionException {
                String startName = "Start";
                String firstUserStepName = "My first step";
                String secondUserStepName = "My second step";
                String autoStepName = "My Automatic Step";
                String endName = "End";

                // create a new process definition with name and version
                ProcessDefinitionBuilder pdb = new ProcessDefinitionBuilder()
                                .createNewInstance("My first process", "1.0");
                // add actor defined as initiator
                pdb.addActor(ACTOR_NAME, true);
                // add a start event
                pdb.addStartEvent(startName);
                // add an automatic task
                pdb.addAutomaticTask(autoStepName);
                // add a user task having the previously defined actor
                pdb.addUserTask(firstUserStepName, ACTOR_NAME);
                // add another user task assigned to the previously defined actor
                pdb.addUserTask(secondUserStepName, ACTOR_NAME);
                // add an end event
                pdb.addEndEvent(endName);
                // defined transitions
                pdb.addTransition(startName, autoStepName);
                pdb.addTransition(autoStepName, firstUserStepName);
                pdb.addTransition(firstUserStepName, secondUserStepName);
                pdb.addTransition(secondUserStepName, endName);

                return pdb.done();
        }

        /**
         * Display a menu and prompt for a action to perform. The chosen action is
         * performed and a new action is prompted until the user decides to quit the
         * application.
         *
         * @param processDefinition
         *            the ProcesssDefinition
         * @throws IOException
         *             if an exception occurs when prompting for an action
         * @throws BonitaException
         *             if an exception occurs when executing an action
         */

        private static void executeActions(ProcessDefinition processDefinition)
                        throws IOException, BonitaException {
                String message = getMenutTextContent();
                String choice = null;
                do {
                        // show the menu and read the action chosen by the user
                        choice = readLine(message);
                        if ("1".equals(choice)) {
                                // if user chooses 1 then start a new process instance
                                startProcess(processDefinition);
                        } else if ("2".equals(choice)) {
                                // if user chooses 2 then list opened process instances
                                listOpenedProcessInstances();
                        } else if ("3".equals(choice)) {
                                // if user chooses 3 then list archived process instances
                                listArchivedProcessInstances();
                        } else if ("4".equals(choice)) {
                                // if user chooses 4 then list pending tasks
                                listPendingTasks();
                        } else if ("5".equals(choice)) {
                                // if user chooses 5 execute the task chosen by the user
                                executeATask();
                        } else if (!"0".equals(choice)) {
                                System.out.println("Invalid choice!");
                        }
                } while (!"0".equals(choice));
        }

        /**
         * Get the content of menu to be displayed
         *
         * @return the content of menu to be displayed
         */

        private static String getMenutTextContent() {
                StringBuilder stb = new StringBuilder(
                                "\nChoose the action to be executed:\n");
                stb.append("0 - exit\n");
                stb.append("1 - start a process\n");
                stb.append("2 - list open process instances\n");
                stb.append("3 - list archived process instances\n");
                stb.append("4 - list pending tasks \n");
                stb.append("5 - execute a task\n");
                stb.append("Choice:");
                String message = stb.toString();
                return message;
        }

        /**
         * Start a process
         *
         * @param processDefinition
         *            the process definition to start
         * @throws BonitaException
         *             if an exception occurs when starting the process
         */

        private static void startProcess(ProcessDefinition processDefinition)
                        throws BonitaException {
                // login
                APISession session = doTenantLogin(USER_NAME, PWD);
                try {
                        System.out.println("Instantiating process ... ");
                        // create a new process instance
                        ProcessInstance processInstance = getProcessAPI(session)
                                        .startProcess(processDefinition.getId());
                        System.out.println("Process instantiated! Id: "
                                        + processInstance.getId());
                } finally {
                        // logout
                        doTenantLogout(session);
                }
        }

        /**
         * List all opened process instances
         *
         * @throws BonitaException
         *             if an Exception occurs when listing the process instances
         */

        private static void listOpenedProcessInstances() throws BonitaException {
                // login
                APISession session = doTenantLogin(USER_NAME, PWD);
                try {
                        System.out.println("Active process instances: ");
                        // the result will be retrieved by pages of PAGE_SIZE size
                        int startIndex = 0;
                        int page = 1;
                        SearchResult<ProcessInstance> result = null;
                        do {
                                // get the current page of opened process instances
                                result = getOpenProcessInstancePage(session, startIndex);
                                // print the current page
                                printOpenedProcessIntancesPage(page, result);

                                // go to next page
                                startIndex += PAGE_SIZE;
                                page++;
                        } while (result.getResult().size() == PAGE_SIZE);
                } finally {
                        // logout
                        doTenantLogout(session);
                }
        }

        /**
         * Get the page of opened process instances based on the start index
         *
         * @param session
         *            the current session
         * @param startIndex
         *            the index of the first element of the page
         * @return the page of opened process instances based on the start index
         * @throws BonitaException
         *             if an exception occurs when getting the ProcessAPI
         */

        private static SearchResult<ProcessInstance> getOpenProcessInstancePage(
                        APISession session, int startIndex) throws BonitaException {
                // create a new SeachOptions with given start index and PAGE_SIZE as max
                // number of elements
                SearchOptionsBuilder optionsBuilder = new SearchOptionsBuilder(
                                startIndex, PAGE_SIZE);
                // sort the result by the process instance id in ascending order
                optionsBuilder.sort(ProcessInstanceSearchDescriptor.ID, Order.ASC);
                // perform the request and return the result
                return getProcessAPI(session).searchProcessInstances(
                                optionsBuilder.done());
        }

        /**
         * Print a page of opened process instances
         *
         * @param page
         *            the page number
         * @param result
         *            the page content
         */

        private static void printOpenedProcessIntancesPage(int page,
                        SearchResult<ProcessInstance> result) {
                if (result.getCount() == 0) {
                        System.out.println("There are no opened process instances!");
                }
                if (!result.getResult().isEmpty()) {
                        System.out.println("----- Page " + page + "-----");
                }
                for (ProcessInstance processInstance : result.getResult()) {
                        StringBuilder stb = new StringBuilder();
                        stb.append("id: ");
                        stb.append(processInstance.getId());
                        stb.append(", name: ");
                        stb.append(processInstance.getName());
                        stb.append(", started on: ");
                        stb.append(processInstance.getStartDate());
                        System.out.println(stb.toString());
                }
        }

        /**
         * List all archived process instances
         *
         * @throws BonitaException
         *             if an Exception occurs when listing process instances
         */

        private static void listArchivedProcessInstances() throws BonitaException {
                // login
                APISession session = doTenantLogin(USER_NAME, PWD);
                try {
                        System.out.println("Archived process instances: ");
                        // the result will be retrieved by pages of PAGE_SIZE size
                        int startIndex = 0;
                        int page = 1;
                        SearchResult<ArchivedProcessInstance> result = null;
                        do {
                                // get the current page of opened process instances
                                result = getArchivedProcessInstancePage(session, startIndex);
                                // print the current page
                                printArchivedProcessInstancePage(page, result);

                                // go to the next page
                                startIndex += PAGE_SIZE;
                                page++;
                        } while (result.getResult().size() == PAGE_SIZE);
                } finally {
                        // logout
                        doTenantLogout(session);
                }

        }

        /**
         * Get the page of archived process instances based on the start index
         *
         * @param session
         *            the current session
         * @param startIndex
         *            the index of the first element of the page
         * @return the page of archived process instances based on the start index
         * @throws BonitaException
         */

        private static SearchResult<ArchivedProcessInstance> getArchivedProcessInstancePage(
                        APISession session, int startIndex) throws BonitaException {
                // create a new SeachOptions with given start index and PAGE_SIZE as max
                // number of elements
                SearchOptionsBuilder optionsBuilder = new SearchOptionsBuilder(
                                startIndex, PAGE_SIZE);
                // when process instances are archived the original process instance id
                // is supplied by SOURCE_OBJECT_ID,
                // so the result will be sort by the SOURCE_OBJECT_ID
                optionsBuilder.sort(
                                ArchivedProcessInstancesSearchDescriptor.SOURCE_OBJECT_ID,
                                Order.ASC);
                // perform the request and return the result;
                return getProcessAPI(session).searchArchivedProcessInstances(
                                optionsBuilder.done());
        }

        /**
         * Print a page of archived process instances
         *
         * @param page
         *            the page number
         * @param result
         *            the page content
         */

        private static void printArchivedProcessInstancePage(int page,
                        SearchResult<ArchivedProcessInstance> result) {
                if (result.getCount() == 0) {
                        System.out.println("There are no archived process instances!");
                }
                if (!result.getResult().isEmpty()) {
                        System.out.println("----- Page " + page + "-----");
                }
                for (ArchivedProcessInstance processInstance : result.getResult()) {
                        StringBuilder stb = new StringBuilder();
                        stb.append("id: ");
                        // remember: when you deal with archived elements the original id is
                        // supplied by the sourceObjectId
                        stb.append(processInstance.getSourceObjectId());
                        stb.append(", name: ");
                        stb.append(processInstance.getName());
                        stb.append(", started on: ");
                        stb.append(processInstance.getStartDate());
                        stb.append(", archived on: ");
                        stb.append(processInstance.getEndDate());
                        System.out.println(stb.toString());
                }
        }

        /**
         * List all pending tasks for the logged user
         *
         * @throws BonitaException
         *             if an exception occurs when listing the pending tasks
         */

        private static void listPendingTasks() throws BonitaException {
                // login
                APISession session = doTenantLogin(USER_NAME, PWD);
                try {
                        ProcessAPI processAPI = getProcessAPI(session);
                        // the result will be retrieved by pages of PAGE_SIZE size
                        int startIndex = 0;
                        int page = 1;
                        List<HumanTaskInstance> pendingTasks = null;
                        do {
                                // get the current page
                                pendingTasks = processAPI.getPendingHumanTaskInstances(
                                                session.getUserId(), startIndex, PAGE_SIZE,
                                                ActivityInstanceCriterion.LAST_UPDATE_ASC);
                                // print the current page
                                printTasksPage(page, pendingTasks);

                                // got to next page
                                startIndex += PAGE_SIZE;
                                page++;
                        } while (pendingTasks.size() == PAGE_SIZE);
                } finally {
                        // logout
                        doTenantLogout(session);
                }
        }

        /**
         * Print a tasks page
         *
         * @param page
         *            the page number
         * @param pendingTasks
         *            the page content
         */

        private static void printTasksPage(int page,
                        List<HumanTaskInstance> pendingTasks) {
                if (pendingTasks.isEmpty()) {
                        if (page == 1) {
                                System.out.println("There are no pending tasks!");
                        }
                } else {
                        System.out.println("----- Page " + page + "-----");
                }
                for (HumanTaskInstance task : pendingTasks) {
                        StringBuilder stb = new StringBuilder();
                        stb.append("id: ");
                        stb.append(task.getId());
                        stb.append(", process instance id: ");
                        stb.append(task.getRootContainerId());
                        stb.append(", task name: ");
                        stb.append(task.getName());
                        System.out.println(stb.toString());
                }

        }

        /**
         * Execute the task chosen by the user
         *
         * @throws BonitaException
         *             if an exception occurs when executing the task
         * @throws IOException
         *             if an exception occurs when reading the task id to be
         *             executed
         */

        private static void executeATask() throws BonitaException, IOException {
                // get the task id to be executed
                Long taskId = readTaskId();
                // login
                APISession session = doTenantLogin(USER_NAME, PWD);
                try {
                        ProcessRuntimeAPI processAPI = getProcessAPI(session);
                        // retrieve the task to be executed in order to print information
                        // such as task name and process instance id
                        // if you don't need this information you can assign and execute it
                        // directly without retrieving it
                        HumanTaskInstance taskToExecute = processAPI
                                        .getHumanTaskInstance(taskId);
                        // assign the task
                        processAPI.assignUserTask(taskToExecute.getId(),
                                        session.getUserId());
                        System.out.println("Task '" + taskToExecute.getName()
                                        + "' of process instance '"
                                        + taskToExecute.getRootContainerId() + "' assigned to '"
                                        + session.getUserName() + ".");

                        // execute the task
                        processAPI.executeFlowNode(taskToExecute.getId());
                        System.out.println("Task '" + taskToExecute.getName()
                                        + "' of process instance '"
                                        + taskToExecute.getRootContainerId() + "' executed by '"
                                        + session.getUserName() + ".");
                } catch (ActivityInstanceNotFoundException e) {
                        // catch ActivityInstanceNotFoundException to cover the case where
                        // the user enter an invalid tasks id
                        System.out.println("No task found with id " + taskId);
                } finally {
                        // logout
                        doTenantLogout(session);
                }
        }

        /**
         * Prompt for the task id to be executed
         *
         * @return the task id to be executed
         * @throws IOException
         */

        private static Long readTaskId() throws IOException {
                String message = "Enter the id of task to be executed:";
                String strId = readLine(message);
                long taskId = -1;
                try {
                        taskId = Long.parseLong(strId);
                } catch (Exception e) {
                        System.out
                                        .println(strId
                                                        + " is not a valid id. You can find all task ids using the menu 'list pending tasks'.");
                }
                return taskId;
        }

        /**
         * Undeploy the process definition
         *
         * @param processDefinition
         *            the process definition
         * @throws BonitaException
         *             if an exception occurs when undeploying the process
         */

        private static void undeployProcess(ProcessDefinition processDefinition)
                        throws BonitaException {
                // login
                APISession session = doTenantLogin(USER_NAME, PWD);
                try {
                        System.out.println("Undeploying process...");
                        // before deleting a process it is necessary to delete all its
                        // instances (opened or archived)
                        deleteOpenedProcessInstance(processDefinition, session);
                        deleteArchivedProcessInstance(processDefinition, session);

                        // disable and delete the process definition
                        getProcessAPI(session).disableAndDeleteProcessDefinition(
                                        processDefinition.getId());
                        System.out.println("Process disabled and undeployed!");
                } finally {
                        // logout
                        doTenantLogout(session);
                }
        }

        /**
         * Delete all opened process instances for the given process definition
         *
         * @param processDefinition
         *            the process definition
         * @param session
         *            the current session
         * @throws BonitaException
         *             if an exception occurs when deleting process instances
         */

        public static void deleteOpenedProcessInstance(
                        ProcessDefinition processDefinition, APISession session)
                        throws BonitaException {
                // delete opened process instances by block of PAGE_SIZE
                long nbOfDeletedProcess = 0;
                do {
                        nbOfDeletedProcess = getProcessAPI(session).deleteProcessInstances(
                                        processDefinition.getId(), 0, PAGE_SIZE);
                } while (nbOfDeletedProcess != 0);
                System.out.println("Deleted opened processs instances.");
        }

        /**
         * Delete all archived process instances for the given process definition
         *
         * @param processDefinition
         *            the process definition
         * @param session
         *            the current session
         * @throws BonitaException
         *             if an exception occurs when deleting process instances
         */

        public static void deleteArchivedProcessInstance(
                        ProcessDefinition processDefinition, APISession session)
                        throws BonitaException {
                // delete archived process instances by block of PAGE_SIZE
                long nbOfDeletedProcess = 0;
                do {
                        nbOfDeletedProcess = getProcessAPI(session)
                                        .deleteArchivedProcessInstances(processDefinition.getId(),
                                                        0, PAGE_SIZE);
                } while (nbOfDeletedProcess != 0);
                System.out.println("Deleted archived processs instances.");
        }

        /**
         * Delete the given user
         *
         * @param user
         *            the user to delete
         * @throws BonitaException
         *             if an exception occurs when deleting the user
         */

        private static void deleteUser(User user) throws BonitaException {
                // In order to delete the only end user, it's necessary to log in as the
                // technical user
                APISession session = doTenantLogin(TECHNICAL_USER_NAME,
                                TECHNICAL_USER_NAME);
                try {
                        // delete user
                        getIdentityAPI(session).deleteUser(user.getId());
                        System.out.println("Deleted user '" + user.getUserName() + "'.");
                } finally {
                        // logout
                        doTenantLogout(session);
                }
        }

        /**
         * Create an end user
         *
         * @return the created user
         * @throws BonitaException
         *             if an exception occurs during user creation
         */

        private static User createUser() throws BonitaException {
                // no end users are created during the platform initialization, so only
                // the technical user is available.
                // logged in as technical user you are able to create the end user that
                // will be able to deploy process, execute tasks, ...
                APISession session = doTenantLogin(TECHNICAL_USER_NAME,
                                TECHNICAL_PASSWORD);
                User user = null;
                try {
                        // create end user
                        user = getIdentityAPI(session).createUser(USER_NAME, PWD);
                        System.out.println("Created user '" + USER_NAME + "'.");
                } finally {
                        // technical user logs out
                        doTenantLogout(session);
                }
                return user;
        }

        /**
         * Read a line from standard input
         *
         * @param message
         *            the message to be displayed
         * @return the line read from standard input
         * @throws IOException
         *             if an exception occurs when reading a line
         */

        private static String readLine(String message) throws IOException {
                System.out.println(message);
                BufferedReader buffer = new BufferedReader(new InputStreamReader(
                                System.in));
                return buffer.readLine();
        }

        public static PlatformSession doPlatformLogin(String platformUsername,
                        String password) throws BonitaException {
                return getPlaformLoginAPI().login(platformUsername, password);
        }

        public static void doPlatformLogout(PlatformSession session)
                        throws BonitaException {
                getPlaformLoginAPI().logout(session);
        }

        public static APISession doTenantLogin(String username, String password)
                        throws BonitaException {
                APISession session = getLoginAPI().login(username, password);
                System.out.println("User '" + username + "' has logged in!");
                return session;
        }

        public static void doTenantLogout(APISession session)
                        throws BonitaException {
                getLoginAPI().logout(session);
                System.out.println("User '" + session.getUserName()
                                + "' has logged out!");
        }

        private static LoginAPI getLoginAPI() throws BonitaException {
                return TenantAPIAccessor.getLoginAPI();
        }

        private static PlatformLoginAPI getPlaformLoginAPI() throws BonitaException {
                return PlatformAPIAccessor.getPlatformLoginAPI();
        }

        private static PlatformAPI getPlatformAPI(PlatformSession platformSession)
                        throws BonitaException {
                return PlatformAPIAccessor.getPlatformAPI(platformSession);
        }

        private static IdentityAPI getIdentityAPI(APISession session)
                        throws BonitaException {
                return TenantAPIAccessor.getIdentityAPI(session);
        }

        private static ProcessAPI getProcessAPI(APISession session)
                        throws BonitaException {
                return TenantAPIAccessor.getProcessAPI(session);
        }

        /**
         * Deploy a data source
         */

        private static void deployDataSource() {
                springContext = new ClassPathXmlApplicationContext("engine.cfg.xml");
        }

        /**
         * Undeploy the data source
         */

        private static void undeployDataSource() {
                springContext.close();
        }

}

Test 1: Complete with platform messages etc.

bonitaHome = E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita
Feb 11, 2015 1:10:45 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@27adc5f7: startup date [Wed Feb 11 13:10:45 AST 2015]; root of context hierarchy
Feb 11, 2015 1:10:46 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [engine.cfg.xml]
Feb 11, 2015 1:10:47 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [jdbc-h2.xml]
Feb 11, 2015 1:10:47 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [bitronix.xml]
Feb 11, 2015 1:10:47 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [datasource.xml]
Feb 11, 2015 1:10:48 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [jndi-setup.xml]
Feb 11, 2015 1:10:49 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1950ad73: defining beans [driverProperties,xaDataSourceClass,driverClass,btm1,btm2,removeBtmFiles,btmConfig,BitronixTransactionManager,bonitaDataSource,bonitaSequenceManagerDataSource,org.springframework.beans.factory.config.MethodInvokingFactoryBean#0,jndiMapping,jndiTemplate,jndiSetup,defineSysprops]; root of factory hierarchy
File 'target/bonita-bt1.tlog' has been successfully deleted
File 'target/bonita-bt2.tlog' has been successfully deleted
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
"org.slf4j.impl.StaticMDCBinder".
SLF4J: Defaulting to no-operation MDCAdapter implementation.
SLF4J: See http://www.slf4j.org/codes.html#no_static_mdc_binder for further details.
Feb 11, 2015 1:11:26 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
WARN: SQL Error: 42102, SQLState: 42S02
Feb 11, 2015 1:11:26 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: Table "PLATFORM" not found; SQL statement:
select splatformi0_.id as id1_33_, splatformi0_.created as created2_33_, splatformi0_.createdBy as createdB3_33_, splatformi0_.initialVersion as initialV4_33_, splatformi0_.previousVersion as previous5_33_, splatformi0_.version as version6_33_ from platform splatformi0_ limit ? [42102-170]
Feb 11, 2015 1:11:27 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.bonitasoft.engine.service.impl.AbsoluteFileSystemXmlApplicationContext@1fe3e55d: startup date [Wed Feb 11 13:11:27 AST 2015]; parent: org.bonitasoft.engine.service.impl.AbsoluteFileSystemXmlApplicationContext@7dcf4470
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-actor-mapping-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-archive-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-authentication-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-category-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-command-api-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-connector-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-connector-service-api-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-data-instance-api-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-data-transient.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-dependency-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-document-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-events-api-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-expression-api-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-expression-resolver.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-external-identity-mapping-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-identity-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-log-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-log-technical-slf4j.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-login.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-permission.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-process-comment-api-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-process-definition-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-process-instance-impl-ext.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-process-instance-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-profile-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-supervisor-mapping-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-tenant-configuration.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-theme-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-time-tracker.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-user-filter-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-work-factory.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bonita-work-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg-bos-operation-api-impl.xml]
Feb 11, 2015 1:11:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [E:\Bonita 641\BonitaBPMCommunity-6.4.1-Tomcat-7.0.55\bonita\server\tenants\1\conf\services\cfg.xml]
Feb 11, 2015 1:11:28 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3401287f: defining beans [actorMappingService,archiveService,authenticationService,categoryService,commandService,defaultCommandProvider,canStartProcessDefinition,isInvolvedInHumanTask,isUserProcessSupervisor,createSupervisor,getSupervisor,deleteSupervisor,searchProcessSupervisors,importProfiles,executeActionsAndTerminate,isAllowedToStartProcess,isAllowedToSeeOverviewForm,isAllowedToSeeInstanciationForm,searchAssignedTasksSupervisedBy,searchArchivedTasksSupervisedBy,getUpdatedVariableValuesForProcessDefinition,getUpdatedVariableValuesForActivityInstance,getUpdatedVariableValuesForProcessInstance,searchProcessDefinitionsSupervisedBy,searchSCommentSupervisedBy,isAllowedToStartProcesses,addEntityMemberCommand,removeEntityMemberCommand,searchEntityMembersCommand,searchEntityMembersForUserCommand,deleteEntityMembersCommand,searchWaitingEventsCommand,advancedStartProcessCommand,connectorExecutor,connectorServiceSub,connectorService,connectorInstanceService,dataInstanceService,dataExpressionExecutorStrategy,transientDataService,transientDataExpressionExecutorStrategy,dependencyService,documentService,documentURLProvider,eventService,expressionService,expressionExecutorStrategyProvider,constantExpressionExecutorStrategy,groovyScriptExpressionExecutorStrategy,inputExpressionExecutorStrategy,patternExpressionExecutorStrategy,xPathReadExpressionExecutorStrategy,engineConstantExpressionExecutorStrategy,listExpressionExecutorStrategy,conditionExpressionExecutorStrategy,javaMethodCallExpressionExecutorStrategy,expressionResolverService,externalIdentityMappingService,identityService,queriableLoggerStrategy,syncQueriableLoggerService,tenantTechnicalLoggerService,loginService,permissionService,commentService,processDefinitionManager,activityInstanceService,processInstanceService,tokenService,gatewayInstanceService,transitionService,eventInstanceService,profileService,supervisorMappingService,tenantConfiguration,timerEventTriggerJobListener,themeService,timeTracker,userFilterService,userFilterServiceSub,bonitaExecutorServiceFactory,workService,operationService,operationExecutorStrategyProvider,leftOperandHandlerProvider,assignmentOperationExecutorStrategy,dataLeftOperandHandler,transientDataLeftOperandHandler,externalDataLeftOperandHandler,javaMethodOperationExecutorStrategy,xpathUpdateQueryOperationExecutorStrategy,documentLeftOperandHandler,documentListLeftOperandHandler,queriableLogSessionProvider,tenantRecorderSync,searchEntitiesDescriptor,flowNodeExecutor,containerRegistry,bpmInstancesCreator,flowNodeStateManager,eventsHandler,processExecutor,transactionalProcessInstanceInterruptor,documentReferenceExpressionExecutorStrategy,documentListReferenceExpressionExecutorStrategy,dependencyResolver]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@19f86c05

Platform created and initialized!
Starting node ...
Node started!
Waiting 10
Waiting 9
Waiting 8
Waiting 7
Waiting 6
Waiting 5
Waiting 4
Waiting 3
Waiting 2
Waiting 1
User 'install' has logged in!
Created user 'walter.bates'.
User 'install' has logged out!
Trace - Listthedeployedprocesses: In
User 'walter.bates' has logged in!
Trace - Listthedeployedprocesses: processAPI
Trace - Listthedeployedprocesses: SearchOptions
Trace - Listthedeployedprocesses: SearchResult
Trace - Listthedeployedprocesses: for count: 0
User 'walter.bates' has logged out!
Trace - Listthedeployedprocesses: Out
Trace - Deployaprocessfromabarfile: In
User 'walter.bates' has logged in!

Trace - getDocumentDefinition: null

Trace - getDocumentDefinition: createNewInstance

Trace - getDocumentDefinition: setContentMimeType

Trace - getDocumentDefinition: setDescription

Trace - getDocumentDefinition: setFileName

Trace - getDocumentDefinition: done

Trace - getDocumentDefinition: Out
 
Trace - Deployaprocessfromabarfile: BusinessArchive
Trace - Deployaprocessfromabarfile: ProcessDefinition
Trace - Deployaprocessfromabarfile: ProcessDefinition.id

id 9658452154845623153
name gubeSendMail
version 1.63

User 'walter.bates' has logged out!
Trace - Deployaprocessfromabarfile: Out
Completed sucessfully!!!
User 'install' has logged in!
Deleted user 'walter.bates'.
User 'install' has logged out!
deleteUser Completed sucessfully!!!
Stopping node ...
Node stopped!
Cleaning and deleting the platform ...
Platform cleaned and deleted!
deletePlatform Completed sucessfully!!!

Feb 11, 2015 1:11:32 PM org.springframework.context.support.AbstractApplicationContext doClose
INFO: Closing org.springframework.context.support.ClassPathXmlApplicationContext@27adc5f7: startup date [Wed Feb 11 13:10:45 AST 2015]; root of context hierarchy
Unbinding java:comp/env/bonitaDS
Feb 11, 2015 1:11:32 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1950ad73: defining beans [driverProperties,xaDataSourceClass,driverClass,btm1,btm2,removeBtmFiles,btmConfig,BitronixTransactionManager,bonitaDataSource,bonitaSequenceManagerDataSource,org.springframework.beans.factory.config.MethodInvokingFactoryBean#0,jndiMapping,jndiTemplate,jndiSetup,defineSysprops]; root of factory hierarchy
Unbinding java:comp/env/bonitaSequenceManagerDS
Unbinding java:comp/UserTransaction
undeployDataSource Completed sucessfully!!!
Program execution Completed!!!
Unable to delete the directory: C:\Users\SEANMC~1\AppData\Local\Temp\tempBarFolder_27408@Mainframe_1423649490450

Test 2: Reduced - no platform messages

Platform created and initialized!
Starting node ...
Node started!
Waiting 10
Waiting 9
Waiting 8
Waiting 7
Waiting 6
Waiting 5
Waiting 4
Waiting 3
Waiting 2
Waiting 1
User 'install' has logged in!
Created user 'walter.bates'.
User 'install' has logged out!
Trace - Listthedeployedprocesses: In
User 'walter.bates' has logged in!
Trace - Listthedeployedprocesses: processAPI
Trace - Listthedeployedprocesses: SearchOptions
Trace - Listthedeployedprocesses: SearchResult
Trace - Listthedeployedprocesses: for count: 0
User 'walter.bates' has logged out!
Trace - Listthedeployedprocesses: Out
Trace - Deployaprocessfromabarfile: In
User 'walter.bates' has logged in!

Trace - getDocumentDefinition: null

Trace - getDocumentDefinition: createNewInstance

Trace - getDocumentDefinition: setContentMimeType

Trace - getDocumentDefinition: setDescription

Trace - getDocumentDefinition: setFileName

Trace - getDocumentDefinition: done

Trace - getDocumentDefinition: Out
 
Trace - Deployaprocessfromabarfile: BusinessArchive
Trace - Deployaprocessfromabarfile: ProcessDefinition
Trace - Deployaprocessfromabarfile: ProcessDefinition.id

id 5436495187650375902
name gubeSendMail
version 1.63

User 'walter.bates' has logged out!
Trace - Deployaprocessfromabarfile: Out
Completed sucessfully!!!
User 'install' has logged in!
Deleted user 'walter.bates'.
User 'install' has logged out!
deleteUser Completed sucessfully!!!
Stopping node ...
Node stopped!
Cleaning and deleting the platform ...
Platform cleaned and deleted!
deletePlatform Completed sucessfully!!!

Problem 1)

In test 1 we deployed the process but in Test 2 at the start it does NOT list the process from the previous run...it seems when the platform died, it killed off the process. Which it should not do even if it is not Actored or Enabled - it should Stay there as Disabled.

Problem 2)

In Test 2, consequent of Test 1 results, the program should NOT have been able to deploy the process the second time. What happened to the process, it's not deleted by the code, so, where is it?

Thanks and regards Seán

No answers yet.
Notifications