
org.ow2.bonita.pvm.model.OpenExecution Maven / Gradle / Ivy
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt 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.ow2.bonita.pvm.model;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import org.ow2.bonita.pvm.Execution;
import org.ow2.bonita.pvm.job.Job;
import org.ow2.bonita.util.BonitaRuntimeException;
/**
* execution that opens up access to the related objects in the execution and
* process definition model.
*
* This execution exposes the execution hierarchy, variable access and
* associated timers.
*
* This is an execution that can be used backed by an open persistence session.
* Typically inside of an environment block. Navigation over the related model
* objects will load the related objects transparantly with lazy loading.
*
* @author Tom Baeyens
*/
public interface OpenExecution extends Execution, Discussable {
/** the process definition for this execution. */
OpenProcessDefinition getProcessDefinition();
/** the current node */
Node getNode();
/** the related sub process execution. */
OpenExecution getSubProcessInstance();
// variable access //////////////////////////////////////////////////////////
/**
* retrieve the value for the given key. The value can be null. If there is no
* value for the given key, the returned value will also be null. The value
* for key null
will always be null as null keys are not allowed.
*/
Object getVariable(String key);
/**
* updates or creates a variable for the given value. Values are allowed to be
* null.
*
* @throws BonitaRuntimeException
* if key is null.
*/
void setVariable(String key, Object value);
/**
* {@link #setVariable(String, Object) sets} all given variables. Existing
* key-value pairs for which there is no key in the provided variables will
* not be removed.
*
* @throws BonitaRuntimeException
* is variables is not null and if null is present as a key in the
* provided variables map.
*/
void setVariables(Map variables);
/**
* indicates presenve of the given key. No exception will be thrown if key is
* null.
*
* @return true if the key is present and false if the key doesn't exist or if
* key is null.
*/
boolean hasVariable(String key);
/**
* remove the key-value pair for the given key from this scope. No exception
* will be thrown when the variable is not present.
*
* @returns whether a variable was actually found and removed.
*/
boolean removeVariable(String key);
/** removes all variables in this scope */
void removeVariables();
/** indicates if there are keys in this scope. */
boolean hasVariables();
/**
* a non-null set that contains all the keys present in this scope. Even if
* there are no variable keys, an empty, non-null set will be returned.
*/
Set getVariableKeys();
/**
* a non-null map containing all the key-value pairs in this scope. Even if
* there are no variable keys, an empty, non-null map will be returned.
*/
Map getVariables();
/**
* create a new variable in this execution scope and determine the type
* automagically.
*/
void createVariable(String key, Object value);
/**
* create a new variable in this execution scope with the given type name.
*/
void createVariable(String key, Object value, String typeName);
// execution hierarchy access ///////////////////////////////////////////////
/**
* the main path of execution in the execution
* structure. Null will be returned in case this execution itself is the
* main execution path.
*/
OpenExecution getProcessInstance();
/**
* the parent execution in the execution
* structure. Null will be returned in case this execution itself is the
* main execution path.
*/
OpenExecution getParent();
/**
* the child executions in the execution
* structure. Can be null and can be an empty collection.
*/
Collection getExecutions();
/**
* maps child execution names to execution objects. In case multiple
* executions have the same name, the first one is taken. Can be null or can
* be an empty map. The first execution without a name is also included with
* null as the key.
*/
Map getExecutionsMap();
/**
* the child execution for the given name or null in case such execution
* doesn't exist.
*/
OpenExecution getExecution(String name);
/**
* indicates if this execution has a child execution with the given
* executionName
*/
boolean hasExecution(String executionName);
// job access /////////////////////////////////////////////////////////////
/** timers for this execution scope */
Set getJobs();
// priority /////////////////////////////////////////////////////////////////
/**
* setter for the priority. The default priority is 0, which means NORMAL.
* Other recognized named priorities are HIGHEST (2), HIGH (1), LOW (-1) and
* LOWEST (-2). For the rest, the user can set any other priority integer
* value, but then, the UI will have to display it as an integer and not the
* named value.
*/
void setPriority(int priority);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy