提交 8f1b1f88 编写于 作者: T tijsrademakers

Merge branch 'master' of https://github.com/Activiti/Activiti

......@@ -36,6 +36,7 @@ public class JobQueryImpl extends AbstractQuery<JobQuery, Job> implements JobQue
protected String id;
protected String processInstanceId;
protected String executionId;
protected String processDefinitionId;
protected boolean retriesLeft;
protected boolean executable;
protected boolean onlyTimers;
......@@ -74,6 +75,14 @@ public class JobQueryImpl extends AbstractQuery<JobQuery, Job> implements JobQue
return this;
}
public JobQueryImpl processDefinitionId(String processDefinitionId) {
if (processDefinitionId == null) {
throw new ActivitiException("Provided process definition id is null");
}
this.processDefinitionId = processDefinitionId;
return this;
}
public JobQueryImpl executionId(String executionId) {
if (executionId == null) {
throw new ActivitiException("Provided execution id is null");
......
......@@ -284,7 +284,6 @@ public class TaskQueryImpl extends AbstractQuery<TaskQuery, Task> implements Tas
return this;
}
@Override
public TaskQuery taskVariableValueEqualsIgnoreCase(String name, String value) {
if(value == null) {
throw new ActivitiException("value is null");
......@@ -293,7 +292,6 @@ public class TaskQueryImpl extends AbstractQuery<TaskQuery, Task> implements Tas
return this;
}
@Override
public TaskQuery taskVariableValueNotEqualsIgnoreCase(String name, String value) {
if(value == null) {
throw new ActivitiException("value is null");
......@@ -322,7 +320,6 @@ public class TaskQueryImpl extends AbstractQuery<TaskQuery, Task> implements Tas
return this;
}
@Override
public TaskQuery processVariableValueEqualsIgnoreCase(String name, String value) {
if(value == null) {
throw new ActivitiException("value is null");
......@@ -331,7 +328,6 @@ public class TaskQueryImpl extends AbstractQuery<TaskQuery, Task> implements Tas
return this;
}
@Override
public TaskQuery processVariableValueNotEqualsIgnoreCase(String name, String value) {
if(value == null) {
throw new ActivitiException("value is null");
......
......@@ -118,10 +118,11 @@ public abstract class AbstractSetProcessDefinitionStateCmd implements Command<Vo
protected void createTimerForDelayedExecution(CommandContext commandContext, List<ProcessDefinitionEntity> processDefinitions) {
for (ProcessDefinitionEntity processDefinition : processDefinitions) {
TimerEntity timer = new TimerEntity();
timer.setProcessDefinitionId(processDefinition.getId());
timer.setDuedate(executionDate);
timer.setJobHandlerType(getDelayedExecutionJobHandlerType());
timer.setJobHandlerConfiguration(TimerChangeProcessDefinitionSuspensionStateJobHandler
.createJobHandlerConfiguration(processDefinition.getId(), includeProcessInstances));
.createJobHandlerConfiguration(includeProcessInstances));
commandContext.getJobManager().schedule(timer);
}
}
......
......@@ -14,6 +14,7 @@
package org.activiti.engine.impl.form;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import org.activiti.engine.impl.bpmn.parser.BpmnParse;
......@@ -42,7 +43,8 @@ public class FormTypes {
formType = new DateFormType(datePatternText);
} else if ("enum".equals(typeText)) {
Map<String, String> values = new HashMap<String, String>();
// ACT-1023: Using linked hashmap to preserve the order in which the entries are defined
Map<String, String> values = new LinkedHashMap<String, String>();
for (Element valueElement: formPropertyElement.elementsNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS,"value")) {
String valueId = valueElement.attribute("id");
String valueName = valueElement.attribute("name");
......
......@@ -23,8 +23,8 @@ import org.activiti.engine.ActivitiException;
public enum HistoryLevel {
NONE("none"),
ACTIVITY("audit"),
AUDIT("activity"),
ACTIVITY("activity"),
AUDIT("audit"),
FULL("full");
private String key;
......
......@@ -14,6 +14,7 @@ package org.activiti.engine.impl.jobexecutor;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.JobEntity;
import org.activiti.engine.impl.pvm.runtime.AtomicOperation;
/**
......@@ -27,8 +28,8 @@ public class AsyncContinuationJobHandler implements JobHandler {
public String getType() {
return TYPE;
}
public void execute(String configuration, ExecutionEntity execution, CommandContext commandContext) {
public void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext) {
// ATM only AtomicOperationTransitionCreateScope can be performed asynchronously
AtomicOperation atomicOperation = AtomicOperation.TRANSITION_CREATE_SCOPE;
......
......@@ -14,6 +14,7 @@ package org.activiti.engine.impl.jobexecutor;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.JobEntity;
/**
......@@ -22,5 +23,5 @@ import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
public interface JobHandler {
String getType();
void execute(String configuration, ExecutionEntity execution, CommandContext commandContext);
void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext);
}
......@@ -16,6 +16,7 @@ package org.activiti.engine.impl.jobexecutor;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.EventSubscriptionEntity;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.JobEntity;
/**
......@@ -29,7 +30,7 @@ public class ProcessEventJobHandler implements JobHandler {
return TYPE;
}
public void execute(String configuration, ExecutionEntity execution, CommandContext commandContext) {
public void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext) {
// lookup subscription:
EventSubscriptionEntity eventSubscription = commandContext.getEventSubscriptionManager()
.findEventSubscriptionbyId(configuration);
......
......@@ -15,6 +15,7 @@ package org.activiti.engine.impl.jobexecutor;
import org.activiti.engine.impl.cmd.ActivateProcessDefinitionCmd;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.JobEntity;
import org.activiti.engine.impl.util.json.JSONObject;
/**
......@@ -27,10 +28,10 @@ public class TimerActivateProcessDefinitionHandler extends TimerChangeProcessDef
public String getType() {
return TYPE;
}
public void execute(String configuration, ExecutionEntity execution, CommandContext commandContext) {
public void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext) {
JSONObject cfgJson = new JSONObject(configuration);
String processDefinitionId = getProcessDefinitionId(cfgJson);
String processDefinitionId = job.getProcessDefinitionId();
boolean activateProcessInstances = getIncludeProcessInstances(cfgJson);
ActivateProcessDefinitionCmd activateProcessDefinitionCmd =
......
......@@ -18,6 +18,7 @@ import java.util.logging.Logger;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.JobEntity;
import org.activiti.engine.impl.pvm.process.ActivityImpl;
......@@ -31,7 +32,7 @@ public class TimerCatchIntermediateEventJobHandler implements JobHandler {
return TYPE;
}
public void execute(String configuration, ExecutionEntity execution, CommandContext commandContext) {
public void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext) {
ActivityImpl intermediateEventActivity = execution.getProcessDefinition().findActivity(configuration);
if (intermediateEventActivity == null) {
......
......@@ -19,21 +19,14 @@ import org.activiti.engine.impl.util.json.JSONObject;
*/
public abstract class TimerChangeProcessDefinitionSuspensionStateJobHandler implements JobHandler {
private static final String JOB_HANDLER_CFG_PROCESS_DEFINITION_ID = "processDefinitionId";
private static final String JOB_HANDLER_CFG_INCLUDE_PROCESS_INSTANCES = "includeProcessInstances";
public static String createJobHandlerConfiguration(String processDefinitionId, boolean includeProcessInstances) {
public static String createJobHandlerConfiguration(boolean includeProcessInstances) {
JSONObject json = new JSONObject();
json.put(JOB_HANDLER_CFG_PROCESS_DEFINITION_ID, processDefinitionId);
json.put(JOB_HANDLER_CFG_INCLUDE_PROCESS_INSTANCES, includeProcessInstances);
return json.toString();
}
public static String getProcessDefinitionId(JSONObject jobHandlerCfgJson) {
return jobHandlerCfgJson.getString(JOB_HANDLER_CFG_PROCESS_DEFINITION_ID);
}
public static boolean getIncludeProcessInstances(JSONObject jobHandlerCfgJson) {
return jobHandlerCfgJson.getBoolean(JOB_HANDLER_CFG_INCLUDE_PROCESS_INSTANCES);
}
......
......@@ -18,6 +18,7 @@ import java.util.logging.Logger;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.JobEntity;
import org.activiti.engine.impl.pvm.process.ActivityImpl;
......@@ -34,8 +35,8 @@ public class TimerExecuteNestedActivityJobHandler implements JobHandler {
public String getType() {
return TYPE;
}
public void execute(String configuration, ExecutionEntity execution, CommandContext commandContext) {
public void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext) {
ActivityImpl borderEventActivity = execution.getProcessDefinition().findActivity(configuration);
if (borderEventActivity == null) {
......
......@@ -21,6 +21,7 @@ import org.activiti.engine.impl.context.Context;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.deploy.DeploymentCache;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.JobEntity;
import org.activiti.engine.repository.ProcessDefinition;
......@@ -33,8 +34,8 @@ public class TimerStartEventJobHandler implements JobHandler {
public String getType() {
return TYPE;
}
public void execute(String configuration, ExecutionEntity execution, CommandContext commandContext) {
public void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext) {
DeploymentCache deploymentCache = Context
.getProcessEngineConfiguration()
.getDeploymentCache();
......
......@@ -15,6 +15,7 @@ package org.activiti.engine.impl.jobexecutor;
import org.activiti.engine.impl.cmd.SuspendProcessDefinitionCmd;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.JobEntity;
import org.activiti.engine.impl.util.json.JSONObject;
/**
......@@ -27,10 +28,10 @@ public class TimerSuspendProcessDefinitionHandler extends TimerChangeProcessDefi
public String getType() {
return TYPE;
}
public void execute(String configuration, ExecutionEntity execution, CommandContext commandContext) {
public void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext) {
JSONObject cfgJson = new JSONObject(configuration);
String processDefinitionId = getProcessDefinitionId(cfgJson);
String processDefinitionId = job.getProcessDefinitionId();
boolean suspendProcessInstances = getIncludeProcessInstances(cfgJson);
SuspendProcessDefinitionCmd suspendProcessDefinitionCmd =
......
......@@ -54,6 +54,7 @@ public abstract class JobEntity implements Serializable, Job, PersistentObject,
protected String executionId = null;
protected String processInstanceId = null;
protected String processDefinitionId = null;
protected boolean isExclusive = DEFAULT_EXCLUSIVE;
......@@ -76,7 +77,7 @@ public abstract class JobEntity implements Serializable, Job, PersistentObject,
Map<String, JobHandler> jobHandlers = Context.getProcessEngineConfiguration().getJobHandlers();
JobHandler jobHandler = jobHandlers.get(jobHandlerType);
jobHandler.execute(jobHandlerConfiguration, execution, commandContext);
jobHandler.execute(this, jobHandlerConfiguration, execution, commandContext);
}
public void insert() {
......@@ -204,6 +205,14 @@ public abstract class JobEntity implements Serializable, Job, PersistentObject,
this.duedate = duedate;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public void setProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
public void setExceptionStacktrace(String exception) {
byte[] exceptionBytes = null;
if(exception == null) {
......
......@@ -45,6 +45,11 @@ public interface Job {
*/
String getExecutionId();
/**
* Returns the specific process definition on which the job was created
*/
String getProcessDefinitionId();
/**
* Returns the number of retries this job has left.
* Whenever the jobexecutor fails to execute the job, this value is decremented.
......
......@@ -34,6 +34,9 @@ public interface JobQuery extends Query<JobQuery, Job> {
/** Only select jobs which exist for the given execution */
JobQuery executionId(String executionId);
/** Only select jobs which exist for the given process definition id */
JobQuery processDefinitionId(String processDefinitionid);
/** Only select jobs which have retries left */
JobQuery withRetriesLeft();
......
......@@ -73,6 +73,7 @@ create table ACT_RU_JOB (
EXCLUSIVE_ smallint check(EXCLUSIVE_ in (1,0)),
EXECUTION_ID_ varchar(64),
PROCESS_INSTANCE_ID_ varchar(64),
PROC_DEF_ID_ varchar(64),
RETRIES_ integer,
EXCEPTION_STACK_ID_ varchar(64),
EXCEPTION_MSG_ varchar(4000),
......
......@@ -71,6 +71,7 @@ create table ACT_RU_JOB (
EXCLUSIVE_ boolean,
EXECUTION_ID_ varchar(64),
PROCESS_INSTANCE_ID_ varchar(64),
PROC_DEF_ID_ varchar(64),
RETRIES_ integer,
EXCEPTION_STACK_ID_ varchar(64),
EXCEPTION_MSG_ varchar(4000),
......
......@@ -71,6 +71,7 @@ create table ACT_RU_JOB (
EXCLUSIVE_ bit,
EXECUTION_ID_ nvarchar(64),
PROCESS_INSTANCE_ID_ nvarchar(64),
PROC_DEF_ID_ nvarchar(64),
RETRIES_ int,
EXCEPTION_STACK_ID_ nvarchar(64),
EXCEPTION_MSG_ nvarchar(4000),
......
......@@ -72,6 +72,7 @@ create table ACT_RU_JOB (
EXCLUSIVE_ boolean,
EXECUTION_ID_ varchar(64),
PROCESS_INSTANCE_ID_ varchar(64),
PROC_DEF_ID_ varchar(64),
RETRIES_ integer,
EXCEPTION_STACK_ID_ varchar(64),
EXCEPTION_MSG_ varchar(4000),
......@@ -114,6 +115,7 @@ create table ACT_RU_TASK (
PRIORITY_ integer,
CREATE_TIME_ timestamp,
DUE_DATE_ datetime,
SUSPENSION_STATE_ integer,
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
......
......@@ -71,6 +71,7 @@ create table ACT_RU_JOB (
EXCLUSIVE_ NUMBER(1,0) CHECK (EXCLUSIVE_ IN (1,0)),
EXECUTION_ID_ NVARCHAR2(64),
PROCESS_INSTANCE_ID_ NVARCHAR2(64),
PROC_DEF_ID_ NVARCHAR2(64),
RETRIES_ INTEGER,
EXCEPTION_STACK_ID_ NVARCHAR2(64),
EXCEPTION_MSG_ NVARCHAR2(2000),
......
......@@ -72,6 +72,7 @@ create table ACT_RU_JOB (
EXCLUSIVE_ boolean,
EXECUTION_ID_ varchar(64),
PROCESS_INSTANCE_ID_ varchar(64),
PROC_DEF_ID_ varchar(64),
RETRIES_ integer,
EXCEPTION_STACK_ID_ varchar(64),
EXCEPTION_MSG_ varchar(4000),
......
......@@ -5,53 +5,23 @@ drop index ACT_RU_IDENTITYLINK.ACT_IDX_IDENT_LNK_GROUP;
drop index ACT_RU_VARIABLE.ACT_IDX_VARIABLE_TASK_ID;
drop index ACT_RU_EVENT_SUBSCR.ACT_IDX_EVENT_SUBSCR_CONFIG_;
alter table ACT_GE_BYTEARRAY
drop constraint ACT_FK_BYTEARR_DEPL;
alter table ACT_RU_EXECUTION
drop constraint ACT_FK_EXE_PROCDEF;
alter table ACT_RU_EXECUTION
drop constraint ACT_FK_EXE_PARENT;
alter table ACT_RU_EXECUTION
drop constraint ACT_FK_EXE_SUPER;
alter table ACT_RU_IDENTITYLINK
drop constraint ACT_FK_TSKASS_TASK;
alter table ACT_RU_IDENTITYLINK
drop constraint ACT_FK_ATHRZ_PROCEDEF;
alter table ACT_RU_TASK
drop constraint ACT_FK_TASK_EXE;
alter table ACT_RU_TASK
drop constraint ACT_FK_TASK_PROCINST;
alter table ACT_RU_TASK
drop constraint ACT_FK_TASK_PROCDEF;
alter table ACT_RU_VARIABLE
drop constraint ACT_FK_VAR_EXE;
alter table ACT_RU_VARIABLE
drop constraint ACT_FK_VAR_PROCINST;
alter table ACT_RU_VARIABLE
drop constraint ACT_FK_VAR_BYTEARRAY;
alter table ACT_RU_JOB
drop constraint ACT_FK_JOB_EXCEPTION;
alter table ACT_RU_EVENT_SUBSCR
drop constraint ACT_FK_EVENT_EXEC;
alter table ACT_RE_MODEL
drop constraint ACT_FK_MODEL_SOURCE;
alter table ACT_RE_MODEL
drop constraint ACT_FK_MODEL_SOURCE_EXTRA;
alter table ACT_GE_BYTEARRAY drop constraint ACT_FK_BYTEARR_DEPL;
alter table ACT_RE_PROCDEF drop constraint ACT_UNIQ_PROCDEF;
alter table ACT_RU_EXECUTION drop constraint ACT_FK_EXE_PROCDEF;
alter table ACT_RU_EXECUTION drop constraint ACT_FK_EXE_PARENT;
alter table ACT_RU_EXECUTION drop constraint ACT_FK_EXE_SUPER;
alter table ACT_RU_IDENTITYLINK drop constraint ACT_FK_TSKASS_TASK;
alter table ACT_RU_IDENTITYLINK drop constraint ACT_FK_ATHRZ_PROCEDEF;
alter table ACT_RU_TASK drop constraint ACT_FK_TASK_EXE;
alter table ACT_RU_TASK drop constraint ACT_FK_TASK_PROCINST;
alter table ACT_RU_TASK drop constraint ACT_FK_TASK_PROCDEF;
alter table ACT_RU_VARIABLE drop constraint ACT_FK_VAR_EXE;
alter table ACT_RU_VARIABLE drop constraint ACT_FK_VAR_PROCINST;
alter table ACT_RU_VARIABLE drop constraint ACT_FK_VAR_BYTEARRAY;
alter table ACT_RU_JOB drop constraint ACT_FK_JOB_EXCEPTION;
alter table ACT_RU_EVENT_SUBSCR drop constraint ACT_FK_EVENT_EXEC;
alter table ACT_RE_MODEL drop constraint ACT_FK_MODEL_SOURCE;
alter table ACT_RE_MODEL drop constraint ACT_FK_MODEL_SOURCE_EXTRA;
drop index ACT_RU_IDENTITYLINK.ACT_IDX_ATHRZ_PROCEDEF;
......
drop index ACT_IDX_BYTEAR_DEPL ;
drop index ACT_IDX_EXE_PROCINST ;
drop index ACT_IDX_EXE_PARENT ;
drop index ACT_IDX_EXE_SUPER;
drop index ACT_IDX_MEMB_GROUP;
drop index ACT_IDX_MEMB_USER;
drop index ACT_IDX_TSKASS_TASK;
drop index ACT_IDX_TASK_EXEC;
drop index ACT_IDX_TASK_PROCINST;
drop index ACT_IDX_TASK_PROCDEF;
drop index ACT_IDX_VAR_EXE;
drop index ACT_IDX_VAR_PROCINST;
drop index ACT_IDX_VAR_BYTEARRAY;
drop index ACT_IDX_JOB_EXCEPTION;
drop index ACT_IDX_MODEL_SOURCE;
drop index ACT_IDX_MODEL_SOURCE_EXTRA;
drop index ACT_IDX_EXEC_BUSKEY;
drop index ACT_IDX_TASK_CREATE;
drop index ACT_IDX_IDENT_LNK_USER;
drop index ACT_IDX_IDENT_LNK_GROUP;
drop index ACT_IDX_VARIABLE_TASK_ID;
alter table ACT_GE_BYTEARRAY
drop constraint ACT_FK_BYTEARR_DEPL;
alter table ACT_RU_EXECUTION
drop constraint ACT_FK_EXE_PROCINST;
alter table ACT_RU_EXECUTION
drop constraint ACT_FK_EXE_PARENT;
alter table ACT_RU_EXECUTION
drop constraint ACT_FK_EXE_SUPER;
alter table ACT_RU_EXECUTION
drop constraint ACT_FK_EXE_PROCDEF;
alter table ACT_RU_IDENTITYLINK
drop constraint ACT_FK_TSKASS_TASK;
alter table ACT_RU_IDENTITYLINK
drop constraint ACT_FK_ATHRZ_PROCEDEF;
alter table ACT_RU_TASK
drop constraint ACT_FK_TASK_EXE;
alter table ACT_RU_TASK
drop constraint ACT_FK_TASK_PROCINST;
alter table ACT_RU_TASK
drop constraint ACT_FK_TASK_PROCDEF;
alter table ACT_RU_VARIABLE
drop constraint ACT_FK_VAR_EXE;
alter table ACT_RU_VARIABLE
drop constraint ACT_FK_VAR_PROCINST;
alter table ACT_RU_VARIABLE
drop constraint ACT_FK_VAR_BYTEARRAY;
alter table ACT_RU_JOB
drop constraint ACT_FK_JOB_EXCEPTION;
alter table ACT_RU_EVENT_SUBSCR
drop constraint ACT_FK_EVENT_EXEC;
alter table ACT_RE_PROCDEF
drop CONSTRAINT ACT_UNIQ_PROCDEF;
alter table ACT_RE_MODEL
drop CONSTRAINT ACT_FK_MODEL_SOURCE;
alter table ACT_RE_MODEL
drop CONSTRAINT ACT_FK_MODEL_SOURCE_EXTRA;
drop index ACT_IDX_EVENT_SUBSCR_CONFIG_;
drop index ACT_IDX_EVENT_SUBSCR;
drop index ACT_IDX_ATHRZ_PROCEDEF;
drop table ACT_GE_PROPERTY;
drop table ACT_GE_BYTEARRAY;
drop table ACT_RE_DEPLOYMENT;
drop table ACT_RE_MODEL;
drop table ACT_RE_PROCDEF;
drop table ACT_RU_EXECUTION;
drop table ACT_RU_JOB;
drop table ACT_RU_TASK;
drop table ACT_RU_IDENTITYLINK;
drop table ACT_RU_VARIABLE;
drop table ACT_RU_EVENT_SUBSCR;
drop table ACT_GE_PROPERTY cascade;
drop table ACT_GE_BYTEARRAY cascade;
drop table ACT_RE_DEPLOYMENT cascade;
drop table ACT_RE_MODEL cascade;
drop table ACT_RE_PROCDEF cascade;
drop table ACT_RU_EXECUTION cascade;
drop table ACT_RU_JOB cascade;
drop table ACT_RU_TASK cascade;
drop table ACT_RU_IDENTITYLINK cascade;
drop table ACT_RU_VARIABLE cascade;
drop table ACT_RU_EVENT_SUBSCR cascade;
drop index ACT_IDX_HI_PRO_INST_END;
drop index ACT_IDX_HI_PRO_I_BUSKEY;
drop index ACT_IDX_HI_ACT_INST_START;
drop index ACT_IDX_HI_ACT_INST_END;
drop index ACT_IDX_HI_DETAIL_PROC_INST;
drop index ACT_IDX_HI_DETAIL_ACT_INST;
drop index ACT_IDX_HI_DETAIL_TIME;
drop index ACT_IDX_HI_DETAIL_NAME;
drop index ACT_IDX_HI_DETAIL_TASK_ID;
drop index ACT_IDX_HI_PROCVAR_PROC_INST;
drop index ACT_IDX_HI_PROCVAR_NAME_TYPE;
drop index ACT_IDX_HI_ACT_INST_PROCINST;
drop table ACT_HI_PROCINST;
drop table ACT_HI_ACTINST;
drop table ACT_HI_VARINST;
drop table ACT_HI_TASKINST;
drop table ACT_HI_DETAIL;
drop table ACT_HI_COMMENT;
drop table ACT_HI_ATTACHMENT;
drop table ACT_HI_PROCINST cascade;
drop table ACT_HI_ACTINST cascade;
drop table ACT_HI_VARINST cascade;
drop table ACT_HI_TASKINST cascade;
drop table ACT_HI_DETAIL cascade;
drop table ACT_HI_COMMENT cascade;
drop table ACT_HI_ATTACHMENT cascade;
alter table ACT_ID_MEMBERSHIP
drop constraint ACT_FK_MEMB_GROUP;
alter table ACT_ID_MEMBERSHIP
drop constraint ACT_FK_MEMB_USER;
drop table ACT_ID_INFO;
drop table ACT_ID_GROUP;
drop table ACT_ID_MEMBERSHIP;
drop table ACT_ID_USER;
\ No newline at end of file
drop table ACT_ID_INFO cascade;
drop table ACT_ID_GROUP cascade;
drop table ACT_ID_MEMBERSHIP cascade;
drop table ACT_ID_USER cascade;
\ No newline at end of file
......@@ -28,6 +28,7 @@
<result property="exclusive" column="EXCLUSIVE_" jdbcType="BOOLEAN" />
<result property="executionId" column="EXECUTION_ID_" jdbcType="VARCHAR" />
<result property="processInstanceId" column="PROCESS_INSTANCE_ID_" jdbcType="VARCHAR" />
<result property="processDefinitionId" column="PROC_DEF_ID_" jdbcType="VARCHAR" />
<result property="retries" column="RETRIES_" jdbcType="INTEGER" />
<result property="exceptionByteArrayId" column="EXCEPTION_STACK_ID_" jdbcType="VARCHAR" />
<result property="exceptionMessage" column="EXCEPTION_MSG_" jdbcType="VARCHAR" />
......@@ -67,7 +68,24 @@
(PI.SUSPENSION_STATE_ = 1)
)
${limitAfter}
</select>
</select>
<!-- ACT-1064: MySQL-specific select's are needed to handle non-millisecond precision -->
<select id="selectNextJobsToExecute_mysql" parameterType="org.activiti.engine.impl.db.ListQueryParameterObject" resultMap="jobResultMap">
${limitBefore}
select RES.* ${limitBetween}
from ${prefix}ACT_RU_JOB RES
LEFT OUTER JOIN ${prefix}ACT_RU_EXECUTION PI ON PI.ID_ = RES.PROCESS_INSTANCE_ID_
where (RETRIES_ &gt; 0)
and (DUEDATE_ is null or DUEDATE_ &lt;= #{parameter, jdbcType=TIMESTAMP})
and (LOCK_OWNER_ is null or LOCK_EXP_TIME_ &lt;= #{parameter, jdbcType=TIMESTAMP})
and (
(RES.EXECUTION_ID_ is null)
or
(PI.SUSPENSION_STATE_ = 1)
)
${limitAfter}
</select>
<select id="selectExclusiveJobsToExecute" parameterType="org.activiti.engine.impl.db.ListQueryParameterObject" resultMap="jobResultMap">
${limitBefore}
......@@ -81,6 +99,18 @@
${limitAfter}
</select>
<select id="selectExclusiveJobsToExecute_mysql" parameterType="org.activiti.engine.impl.db.ListQueryParameterObject" resultMap="jobResultMap">
${limitBefore}
select RES.* ${limitBetween}
from ${prefix}ACT_RU_JOB RES
where (RETRIES_ &gt; 0)
and (DUEDATE_ is null or DUEDATE_ &lt;= #{parameter.now, jdbcType=TIMESTAMP})
and (LOCK_OWNER_ is null or LOCK_EXP_TIME_ &lt;= #{parameter.now, jdbcType=TIMESTAMP})
and (EXCLUSIVE_ = TRUE)
and (PROCESS_INSTANCE_ID_ = #{parameter.pid})
${limitAfter}
</select>
<select id="selectExclusiveJobsToExecute_integerBoolean" parameterType="org.activiti.engine.impl.db.ListQueryParameterObject" resultMap="jobResultMap">
${limitBefore}
select RES.* ${limitBetween}
......@@ -133,6 +163,9 @@
<if test="executionId != null">
and RES.EXECUTION_ID_ = #{executionId}
</if>
<if test="processDefinitionId != null">
and RES.PROC_DEF_ID_ = #{processDefinitionId}
</if>
<if test="retriesLeft">
and RES.RETRIES_ &gt; 0
</if>
......@@ -172,38 +205,6 @@
</where>
</sql>
<!-- SELECT DEPENDENT -->
<!-- ACT-1064: MySQL-specific select's are needed to handle non-millisecond precision -->
<select id="selectNextJobsToExecute_mysql" parameterType="org.activiti.engine.impl.db.ListQueryParameterObject" resultMap="jobResultMap">
${limitBefore}
select RES.* ${limitBetween}
from ${prefix}ACT_RU_JOB RES
LEFT OUTER JOIN ${prefix}ACT_RU_EXECUTION PI ON PI.ID_ = RES.PROCESS_INSTANCE_ID_
where (RETRIES_ &gt; 0)
and (DUEDATE_ is null or DUEDATE_ &lt;= #{parameter, jdbcType=TIMESTAMP})
and (LOCK_OWNER_ is null or LOCK_EXP_TIME_ &lt;= #{parameter, jdbcType=TIMESTAMP})
and (
(RES.EXECUTION_ID_ is null)
or
(PI.SUSPENSION_STATE_ = 1)
)
${limitAfter}
</select>
<select id="selectExclusiveJobsToExecute_mysql" parameterType="org.activiti.engine.impl.db.ListQueryParameterObject" resultMap="jobResultMap">
${limitBefore}
select RES.* ${limitBetween}
from ${prefix}ACT_RU_JOB RES
where (RETRIES_ &gt; 0)
and (DUEDATE_ is null or DUEDATE_ &lt;= #{parameter.now, jdbcType=TIMESTAMP})
and (LOCK_OWNER_ is null or LOCK_EXP_TIME_ &lt;= #{parameter.now, jdbcType=TIMESTAMP})
and (EXCLUSIVE_ = TRUE)
and (PROCESS_INSTANCE_ID_ = #{parameter.pid})
${limitAfter}
</select>
<!-- TIMER INSERT -->
<insert id="insertTimer" parameterType="org.activiti.engine.impl.persistence.entity.TimerEntity">
......@@ -216,6 +217,7 @@
EXCLUSIVE_,
EXECUTION_ID_,
PROCESS_INSTANCE_ID_,
PROC_DEF_ID_,
RETRIES_,
EXCEPTION_STACK_ID_,
EXCEPTION_MSG_,
......@@ -231,6 +233,7 @@
#{exclusive, jdbcType=BOOLEAN},
#{executionId, jdbcType=VARCHAR},
#{processInstanceId, jdbcType=VARCHAR},
#{processDefinitionId, jdbcType=VARCHAR},
#{retries, jdbcType=INTEGER},
#{exceptionByteArrayId, jdbcType=VARCHAR},
#{exceptionMessage, jdbcType=VARCHAR},
......@@ -261,13 +264,19 @@
<!-- TIMER SELECT -->
<select id="selectUnlockedTimersByDuedate" parameterType="org.activiti.engine.impl.db.ListQueryParameterObject" resultMap="jobResultMap">
select *
from ${prefix}ACT_RU_JOB
where (TYPE_ = 'timer')
and (DUEDATE_ is not null)
and (DUEDATE_ &lt; #{parameter, jdbcType=TIMESTAMP})
and (LOCK_OWNER_ is null or LOCK_EXP_TIME_ &lt; #{parameter, jdbcType=TIMESTAMP})
and (RETRIES_ &gt; 0)
select RES.*
from ${prefix}ACT_RU_JOB RES
LEFT OUTER JOIN ${prefix}ACT_RU_EXECUTION PI ON PI.ID_ = RES.PROCESS_INSTANCE_ID_
where (RES.TYPE_ = 'timer')
and (RES.DUEDATE_ is not null)
and (RES.DUEDATE_ &lt; #{parameter, jdbcType=TIMESTAMP})
and (RES.LOCK_OWNER_ is null or RES.LOCK_EXP_TIME_ &lt; #{parameter, jdbcType=TIMESTAMP})
and (RES.RETRIES_ &gt; 0)
and (
(RES.EXECUTION_ID_ is null)
or
(PI.SUSPENSION_STATE_ = 1)
)
order by DUEDATE_
</select>
......@@ -292,6 +301,7 @@
EXCLUSIVE_,
EXECUTION_ID_,
PROCESS_INSTANCE_ID_,
PROC_DEF_ID_,
RETRIES_,
EXCEPTION_STACK_ID_,
EXCEPTION_MSG_,
......@@ -305,6 +315,7 @@
#{exclusive, jdbcType=BOOLEAN},
#{executionId, jdbcType=VARCHAR},
#{processInstanceId, jdbcType=VARCHAR},
#{processDefinitionId, jdbcType=VARCHAR},
#{retries, jdbcType=INTEGER},
#{exceptionByteArrayId, jdbcType=VARCHAR},
#{exceptionMessage, jdbcType=VARCHAR},
......
alter table ACT_RE_PROCDEF
alter column KEY_ set not null;
alter table ACT_RE_PROCDEF
alter column VERSION_ set not null;
alter table ACT_RE_DEPLOYMENT
add CATEGORY_ varchar(255);
alter table ACT_RE_PROCDEF
add DESCRIPTION_ varchar(4000);
alter table ACT_RU_TASK
add SUSPENSION_STATE_ integer;
update ACT_RU_TASK set SUSPENSION_STATE= 1;
Call Sysproc.admin_cmd ('REORG TABLE ACT_RU_TASK');
update ACT_RU_TASK set SUSPENSION_STATE_ = 1;
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_PROCDEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);
create table ACT_RE_MODEL (
ID_ varchar(64) not null,
......@@ -39,4 +40,7 @@ alter table ACT_RE_MODEL
delete from ACT_GE_PROPERTY where NAME_ = 'historyLevel';
alter table ACT_RU_JOB
add PROC_DEF_ID_ varchar(64);
update ACT_GE_PROPERTY set VALUE_ = '5.11' where NAME_ = 'schema.version';
create table ACT_HI_VARINST (
ID_ varchar(64) not null,
PROC_INST_ID_ varchar(64) not null,
PROC_INST_ID_ varchar(64),
EXECUTION_ID_ varchar(64),
TASK_ID_ varchar(64),
NAME_ varchar(255) not null,
VAR_TYPE_ varchar(100),
REV_ integer,
......@@ -15,10 +17,7 @@ create table ACT_HI_VARINST (
create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_);
create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_);
update ACT_GE_PROPERTY
set VALUE_ = VALUE_ + 1,
REV_ = REV_ + 1
where NAME_ = 'historyLevel' and VALUE_ >= 2;
Call Sysproc.admin_cmd ('REORG TABLE ACT_HI_VARINST');
alter table ACT_HI_ACTINST
add TASK_ID_ varchar(64);
......@@ -27,9 +26,11 @@ alter table ACT_HI_ACTINST
add CALL_PROC_INST_ID_ varchar(64);
alter table ACT_HI_DETAIL
alter column PROC_DEF_ID_ DROP NOT NULL;
alter column PROC_INST_ID_ DROP NOT NULL;
alter table ACT_HI_DETAIL
alter column EXECUTION_ID_ DROP NOT NULL;
Call Sysproc.admin_cmd ('REORG TABLE ACT_HI_DETAIL');
create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_);
\ No newline at end of file
......@@ -13,7 +13,15 @@ alter table ACT_RU_EXECUTION
add CACHED_ENT_STATE_ integer;
update ACT_RU_EXECUTION set CACHED_ENT_STATE_ = 7;
alter table ACT_RE_PROCDEF
alter column KEY_ set not null;
alter table ACT_RE_PROCDEF
alter column VERSION_ set not null;
Call Sysproc.admin_cmd ('REORG TABLE ACT_RE_PROCDEF');
alter table ACT_RE_PROCDEF
add constraint ACT_UNIQ_PROCDEF
unique (KEY_,VERSION_);
\ No newline at end of file
......@@ -13,9 +13,14 @@ alter table ACT_RE_PROCDEF
alter table ACT_RU_TASK
add SUSPENSION_STATE_ integer;
update ACT_RU_TASK set SUSPENSION_STATE= 1;
update ACT_RU_TASK set SUSPENSION_STATE_ = 1;
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_PROCDEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);
create table ACT_RE_MODEL (
ID_ varchar(64) not null,
NAME_ varchar(255),
......@@ -40,4 +45,7 @@ alter table ACT_RE_MODEL
delete from ACT_GE_PROPERTY where NAME_ = 'historyLevel';
alter table ACT_RU_JOB
add PROC_DEF_ID_ varchar(64);
update ACT_GE_PROPERTY set VALUE_ = '5.11' where NAME_ = 'schema.version';
create table ACT_HI_VARINST (
ID_ varchar(64) not null,
PROC_INST_ID_ varchar(64) not null,
PROC_INST_ID_ varchar(64),
EXECUTION_ID_ varchar(64),
TASK_ID_ varchar(64),
NAME_ varchar(255) not null,
VAR_TYPE_ varchar(100),
REV_ integer,
......@@ -15,11 +17,6 @@ create table ACT_HI_VARINST (
create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_);
create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_);
update ACT_GE_PROPERTY
set VALUE_ = VALUE_ + 1,
REV_ = REV_ + 1
where NAME_ = 'historyLevel' and VALUE_ >= 2;
alter table ACT_HI_ACTINST
add TASK_ID_ varchar(64);
......
alter table ACT_RE_PROCDEF
alter column KEY_ nvarchar(255) not null;
alter table ACT_RE_PROCDEF drop constraint ACT_UNIQ_PROCDEF;
alter table ACT_RE_PROCDEF alter column KEY_ nvarchar(255) not null;
alter table ACT_RE_PROCDEF alter column VERSION_ int not null;
alter table ACT_RE_PROCDEF
alter column VERSION_ int not null;
alter table ACT_RE_DEPLOYMENT
add CATEGORY_ nvarchar(255);
add constraint ACT_UNIQ_PROCDEF
unique (KEY_,VERSION_);
alter table ACT_RE_DEPLOYMENT add CATEGORY_ nvarchar(255);
alter table ACT_RE_PROCDEF
add DESCRIPTION_ nvarchar(4000);
......@@ -13,7 +16,12 @@ alter table ACT_RE_PROCDEF
alter table ACT_RU_TASK
add SUSPENSION_STATE_ int;
update ACT_RU_TASK set SUSPENSION_STATE= 1;
update ACT_RU_TASK set SUSPENSION_STATE_ = 1;
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_PROCDEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);
create table ACT_RE_MODEL (
ID_ nvarchar(64) not null,
......@@ -39,4 +47,7 @@ alter table ACT_RE_MODEL
delete from ACT_GE_PROPERTY where NAME_ = 'historyLevel';
alter table ACT_RU_JOB
add PROC_DEF_ID_ nvarchar(64);
update ACT_GE_PROPERTY set VALUE_ = '5.11' where NAME_ = 'schema.version';
create table ACT_HI_VARINST (
ID_ nvarchar(64) not null,
PROC_INST_ID_ nvarchar(64) not null,
PROC_INST_ID_ nvarchar(64),
EXECUTION_ID_ nvarchar(64),
TASK_ID_ nvarchar(64),
NAME_ nvarchar(255) not null,
VAR_TYPE_ nvarchar(100),
REV_ int,
......@@ -15,16 +17,11 @@ create table ACT_HI_VARINST (
create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_);
create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_);
update ACT_GE_PROPERTY
set VALUE_ = VALUE_ + 1,
REV_ = REV_ + 1
where NAME_ = 'historyLevel' and VALUE_ >= 2;
alter table ACT_HI_ACTINST
add column TASK_ID_ nvarchar(64);
add TASK_ID_ nvarchar(64);
alter table ACT_HI_ACTINST
add column CALL_PROC_INST_ID_ nvarchar(64);
add CALL_PROC_INST_ID_ nvarchar(64);
alter table ACT_HI_DETAIL
alter column PROC_INST_ID_ nvarchar(64) null;
......
......@@ -13,6 +13,16 @@ alter table ACT_RE_DEPLOYMENT
alter table ACT_RE_PROCDEF
add DESCRIPTION_ varchar(4000);
alter table ACT_RU_TASK
add SUSPENSION_STATE_ integer;
update ACT_RU_TASK set SUSPENSION_STATE_ = 1;
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_PROCDEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);
create table ACT_RE_MODEL (
ID_ varchar(64) not null,
......@@ -38,4 +48,7 @@ alter table ACT_RE_MODEL
delete from ACT_GE_PROPERTY where NAME_ = 'historyLevel';
alter table ACT_RU_JOB
add PROC_DEF_ID_ varchar(64);
update ACT_GE_PROPERTY set VALUE_ = '5.11' where NAME_ = 'schema.version';
create table ACT_HI_VARINST (
ID_ varchar(64) not null,
PROC_INST_ID_ varchar(64) not null,
PROC_INST_ID_ varchar(64),
EXECUTION_ID_ varchar(64),
TASK_ID_ varchar(64),
NAME_ varchar(255) not null,
VAR_TYPE_ varchar(100),
REV_ integer,
......@@ -15,16 +17,11 @@ create table ACT_HI_VARINST (
create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_);
create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_);
update ACT_GE_PROPERTY
set VALUE_ = VALUE_ + 1,
REV_ = REV_ + 1
where NAME_ = 'historyLevel' and VALUE_ >= 2;
alter table ACT_HI_ACTINST
add ASK_ID_ varchar(64);
add TASK_ID_ varchar(64);
alter table ACT_HI_ACTINST
add CALL_PROC_INST_ID_ varchar(64));
add CALL_PROC_INST_ID_ varchar(64);
alter table ACT_HI_DETAIL
MODIFY PROC_INST_ID_ varchar(64) null;
......
......@@ -13,7 +13,12 @@ alter table ACT_RE_PROCDEF
alter table ACT_RU_TASK
add SUSPENSION_STATE_ INTEGER;
update ACT_RU_TASK set SUSPENSION_STATE= 1;
update ACT_RU_TASK set SUSPENSION_STATE_ = 1;
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_PROCDEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);
create table ACT_RE_MODEL (
ID_ NVARCHAR2(64) not null,
......@@ -41,4 +46,7 @@ alter table ACT_RE_MODEL
delete from ACT_GE_PROPERTY where NAME_ = 'historyLevel';
alter table ACT_RU_JOB
add PROC_DEF_ID_ NVARCHAR2(64);
update ACT_GE_PROPERTY set VALUE_ = '5.11' where NAME_ = 'schema.version';
create table ACT_HI_VARINST (
ID_ NVARCHAR2(64) not null,
PROC_INST_ID_ NVARCHAR2(64) not null,
PROC_INST_ID_ NVARCHAR2(64),
EXECUTION_ID_ NVARCHAR2(64),
TASK_ID_ NVARCHAR2(64),
NAME_ NVARCHAR2(255) not null,
VAR_TYPE_ NVARCHAR2(100),
REV_ INTEGER,
......@@ -15,11 +17,6 @@ create table ACT_HI_VARINST (
create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_);
create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_);
update ACT_GE_PROPERTY
set VALUE_ = VALUE_ + 1,
REV_ = REV_ + 1
where NAME_ = 'historyLevel' and VALUE_ >= 2;
alter table ACT_HI_ACTINST
add TASK_ID_ NVARCHAR2(64);
......
......@@ -10,10 +10,15 @@ add CATEGORY_ varchar(255);
alter table ACT_RE_PROCDEF
add DESCRIPTION_ varchar(4000);
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_PROCDEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);
alter table ACT_RU_TASK
add SUSPENSION_STATE_ integer;
update ACT_RU_TASK set SUSPENSION_STATE= 1;
update ACT_RU_TASK set SUSPENSION_STATE_ = 1;
create table ACT_RE_MODEL (
ID_ varchar(64) not null,
......@@ -41,4 +46,7 @@ alter table ACT_RE_MODEL
delete from ACT_GE_PROPERTY where NAME_ = 'historyLevel';
alter table ACT_RU_JOB
add PROC_DEF_ID_ varchar(64);
update ACT_GE_PROPERTY set VALUE_ = '5.11' where NAME_ = 'schema.version';
create table ACT_HI_VARINST (
ID_ varchar(64) not null,
PROC_INST_ID_ varchar(64) not null,
PROC_INST_ID_ varchar(64),
EXECUTION_ID_ varchar(64),
TASK_ID_ varchar(64),
NAME_ varchar(255) not null,
VAR_TYPE_ varchar(100),
REV_ integer,
......@@ -15,11 +17,6 @@ create table ACT_HI_VARINST (
create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_);
create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_);
update ACT_GE_PROPERTY
set VALUE_ = VALUE_ + 1,
REV_ = REV_ + 1
where NAME_ = 'historyLevel' and VALUE_ >= 2;
alter table ACT_HI_ACTINST
add column TASK_ID_ varchar(64);
......@@ -27,9 +24,9 @@ alter table ACT_HI_ACTINST
add column CALL_PROC_INST_ID_ varchar(64);
alter table ACT_HI_DETAIL
alter column PROC_DEF_ID_ set null;
alter column PROC_INST_ID_ drop not null;
alter table ACT_HI_DETAIL
alter column EXECUTION_ID_ set null;
alter column EXECUTION_ID_ drop not null;
create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_);
\ No newline at end of file
......@@ -15,8 +15,11 @@ package org.activiti.engine.test.api.form;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.form.FormProperty;
......@@ -267,11 +270,19 @@ public class FormServiceTest extends PluggableActivitiTestCase {
assertEquals("enum", property.getType().getName());
Map<String, String> values = (Map<String, String>) property.getType().getInformation("values");
Map<String, String> expectedValues = new HashMap<String, String>();
Map<String, String> expectedValues = new LinkedHashMap<String, String>();
expectedValues.put("left", "Go Left");
expectedValues.put("right", "Go Right");
expectedValues.put("up", "Go Up");
expectedValues.put("down", "Go Down");
// ACT-1023: check if ordering is retained
Iterator<Entry<String, String>> expectedValuesIterator = expectedValues.entrySet().iterator();
for(Entry<String, String> entry : values.entrySet()) {
Entry<String, String> expectedEntryAtLocation = expectedValuesIterator.next();
assertEquals(expectedEntryAtLocation.getKey(), entry.getKey());
assertEquals(expectedEntryAtLocation.getValue(), entry.getValue());
}
assertEquals(expectedValues, values);
}
......
......@@ -286,11 +286,17 @@ public class ProcessDefinitionSuspensionTest extends PluggableActivitiTestCase {
assertEquals(1, repositoryService.createProcessDefinitionQuery().active().count());
assertEquals(0, repositoryService.createProcessDefinitionQuery().suspended().count());
// verify there is a job created
assertEquals(1, managementService.createJobQuery().processDefinitionId(processDefinition.getId()).count());
// Move clock 8 days further and let job executor run
long eightDaysSinceStartTime = oneWeekFromStartTime + (24 * 60 * 60 * 1000);
ClockUtil.setCurrentTime(new Date(eightDaysSinceStartTime));
waitForJobExecutorToProcessAllJobs(5000L, 50L);
// verify job is now removed
assertEquals(0, managementService.createJobQuery().processDefinitionId(processDefinition.getId()).count());
// Try to start process instance. It should fail now.
try {
runtimeService.startProcessInstanceById(processDefinition.getId());
......@@ -475,6 +481,12 @@ public class ProcessDefinitionSuspensionTest extends PluggableActivitiTestCase {
assertEquals(0, repositoryService.createProcessDefinitionQuery().suspended().count());
assertEquals(1, runtimeService.createProcessInstanceQuery().active().count());
// Verify a job is created for each process definition
assertEquals(nrOfProcessDefinitions, managementService.createJobQuery().count());
for (ProcessDefinition processDefinition : repositoryService.createProcessDefinitionQuery().list()) {
assertEquals(1, managementService.createJobQuery().processDefinitionId(processDefinition.getId()).count());
}
// Move time 3 hours and run job executor
ClockUtil.setCurrentTime(new Date(startTime.getTime() + (3 * hourInMs)));
waitForJobExecutorToProcessAllJobs(5000L, 50L);
......
......@@ -12,15 +12,23 @@
*/
package org.activiti.engine.test.jobexecutor;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import org.activiti.engine.impl.Page;
import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.interceptor.CommandExecutor;
import org.activiti.engine.impl.jobexecutor.GetUnlockedTimersByDuedateCmd;
import org.activiti.engine.impl.persistence.entity.JobManager;
import org.activiti.engine.impl.persistence.entity.TimerEntity;
import org.activiti.engine.impl.util.ClockUtil;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.test.Deployment;
......@@ -39,6 +47,7 @@ public class JobExecutorTest extends JobExecutorTestCase {
jobManager.send(createTweetMessage("message-three"));
jobManager.send(createTweetMessage("message-four"));
jobManager.schedule(createTweetTimer("timer-one", new Date()));
jobManager.schedule(createTweetTimer("timer-one", new Date()));
jobManager.schedule(createTweetTimer("timer-two", new Date()));
return null;
......@@ -58,4 +67,35 @@ public class JobExecutorTest extends JobExecutorTestCase {
assertEquals(new TreeSet<String>(expectedMessages), new TreeSet<String>(messages));
}
@Deployment
public void testSuspendedProcessTimerExecution() throws Exception {
// Process with boundary timer-event that fires in 1 hour
ProcessInstance procInst = runtimeService.startProcessInstanceByKey("suspendProcess");
assertNotNull(procInst);
assertEquals(1, managementService.createJobQuery().processInstanceId(procInst.getId()).count());
// Shutdown the job-executor so timer's won't be executed
processEngineConfiguration.getJobExecutor().shutdown();
// Roll time ahead to be sure timer is due to fire
Calendar tomorrow = Calendar.getInstance();
tomorrow.add(Calendar.DAY_OF_YEAR, 1);
ClockUtil.setCurrentTime(tomorrow.getTime());
// Check if timer is eligable to be executed, when process in not yet suspended
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
List<TimerEntity> jobs = commandExecutor.execute(new GetUnlockedTimersByDuedateCmd(ClockUtil.getCurrentTime(), new Page(0, 1)));
assertEquals(1, jobs.size());
// Suspend process instancd
runtimeService.suspendProcessInstanceById(procInst.getId());
// Check if the timer is NOT aquired, even though the duedate is reached
jobs = commandExecutor.execute(new GetUnlockedTimersByDuedateCmd(ClockUtil.getCurrentTime(), new Page(0, 1)));
assertEquals(0, jobs.size());
// Start job-executor again
processEngineConfiguration.getJobExecutor().start();
}
}
......@@ -17,6 +17,7 @@ import java.util.logging.Logger;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.jobexecutor.JobHandler;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.JobEntity;
/**
......@@ -32,7 +33,7 @@ public class TweetExceptionHandler implements JobHandler {
return "tweet-exception";
}
public void execute(String configuration, ExecutionEntity execution, CommandContext commandContext) {
public void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext) {
if (exceptionsRemaining>0) {
exceptionsRemaining--;
throw new RuntimeException("exception remaining: "+exceptionsRemaining);
......
......@@ -18,6 +18,7 @@ import java.util.List;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.jobexecutor.JobHandler;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.JobEntity;
import org.junit.Assert;
public class TweetHandler implements JobHandler {
......@@ -27,8 +28,8 @@ public class TweetHandler implements JobHandler {
public String getType() {
return "tweet";
}
public void execute(String configuration, ExecutionEntity execution, CommandContext commandContext) {
public void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext) {
messages.add(configuration);
Assert.assertNotNull(commandContext);
}
......
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="Examples">
<process id="suspendProcess" name="The One Task Process">
<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="theTask" />
<userTask id="theTask" name="my task" />
<boundaryEvent id="escalationTimer" cancelActivity="true" attachedToRef="theTask">
<timerEventDefinition>
<timeDuration>PT1H</timeDuration>
</timerEventDefinition>
</boundaryEvent>
<sequenceFlow id="flow2" sourceRef="theTask" targetRef="theEnd" />
<sequenceFlow id="flow3" sourceRef="escalationTimer" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
......@@ -12,6 +12,8 @@
*/
package org.activiti.explorer;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
......@@ -36,6 +38,9 @@ public class Constants {
public static final String DEFAULT_DATE_FORMAT = "dd-MM-yyyy";
public static final String DEFAULT_TIME_FORMAT = "dd-MM-yyyy hh:mm:ss";
public static final DateFormat DEFAULT_DATE_FORMATTER = new SimpleDateFormat(DEFAULT_DATE_FORMAT);
public static final DateFormat DEFAULT_TIME_FORMATTER = new SimpleDateFormat(DEFAULT_TIME_FORMAT);
// Default diagram image extension, when name cannot be deducted from resource name
public static final String DEFAULT_DIAGRAM_IMAGE_EXTENSION = "png";
......
......@@ -34,6 +34,8 @@ import org.activiti.explorer.ui.management.deployment.DeploymentPage;
import org.activiti.explorer.ui.management.identity.GroupPage;
import org.activiti.explorer.ui.management.identity.UserPage;
import org.activiti.explorer.ui.management.job.JobPage;
import org.activiti.explorer.ui.management.processdefinition.ActiveProcessDefinitionPage;
import org.activiti.explorer.ui.management.processdefinition.SuspendedProcessDefinitionPage;
import org.activiti.explorer.ui.process.MyProcessInstancesPage;
import org.activiti.explorer.ui.process.ProcessDefinitionPage;
import org.activiti.explorer.ui.process.ProcessMenuBar;
......@@ -236,6 +238,22 @@ public class DefaultViewManager implements ViewManager {
switchView(new DeploymentPage(deploymentId), ViewManager.MAIN_NAVIGATION_MANAGE, ManagementMenuBar.ENTRY_DEPLOYMENTS);
}
public void showActiveProcessDefinitionsPage() {
switchView(new ActiveProcessDefinitionPage(), ViewManager.MAIN_NAVIGATION_MANAGE, ManagementMenuBar.ENTRY_ACTIVE_PROCESS_DEFINITIONS);
}
public void showActiveProcessDefinitionsPage(String processDefinitionId) {
switchView(new ActiveProcessDefinitionPage(processDefinitionId), ViewManager.MAIN_NAVIGATION_MANAGE, ManagementMenuBar.ENTRY_ACTIVE_PROCESS_DEFINITIONS);
}
public void showSuspendedProcessDefinitionsPage() {
switchView(new SuspendedProcessDefinitionPage(), ViewManager.MAIN_NAVIGATION_MANAGE, ManagementMenuBar.ENTRY_SUSPENDED_PROCESS_DEFINITIONS);
}
public void showSuspendedProcessDefinitionsPage(String processDefinitionId) {
switchView(new SuspendedProcessDefinitionPage(processDefinitionId), ViewManager.MAIN_NAVIGATION_MANAGE, ManagementMenuBar.ENTRY_SUSPENDED_PROCESS_DEFINITIONS);
}
public void showJobPage() {
switchView(new JobPage(), ViewManager.MAIN_NAVIGATION_MANAGE, ManagementMenuBar.ENTRY_JOBS);
}
......
......@@ -216,6 +216,15 @@ public class ExplorerApp extends Application implements HttpServletRequestListen
}
}
// Error handling ---------------------------------------------------------------------------------
@Override
public void terminalError(com.vaadin.terminal.Terminal.ErrorEvent event) {
super.terminalError(event);
notificationManager.showErrorNotification(Messages.UNCAUGHT_EXCEPTION, event.getThrowable().getCause().getMessage());
}
// URL Handling ---------------------------------------------------------------------------------
public void setCurrentUriFragment(UriFragment fragment) {
......
......@@ -28,6 +28,7 @@ public interface Messages {
static final String BUTTON_OK = "button.ok";
static final String BUTTON_CREATE = "button.create";
static final String BUTTON_CANCEL = "button.cancel";
static final String UNCAUGHT_EXCEPTION = "uncaught.exception";
// Navigation
static final String NAVIGATION_ERROR_NOT_INVOLVED_TITLE = "navigation.error.not.involved.title";
......@@ -193,12 +194,25 @@ public interface Messages {
static final String PROCESS_DEPLOY_TIME = "process.deploy.time";
static final String PROCESS_HEADER_DIAGRAM = "process.header.diagram";
static final String PROCESS_NO_DIAGRAM = "process.no.diagram";
static final String PROCESS_HEADER_SUSPENSION_STATE = "process.header.suspension.state";
static final String PROCESS_SCHEDULED_SUSPEND = "process.scheduled.suspend";
static final String PROCESS_SCHEDULED_ACTIVATE = "process.scheduled.activate";
static final String PROCESS_START = "process.start";
static final String PROCESS_EDIT = "process.edit";
static final String PROCESS_COPY = "process.copy";
static final String PROCESS_NEW = "process.new";
static final String PROCESS_DELETE = "process.delete";
static final String PROCESS_DEPLOY = "process.deploy";
static final String PROCESS_ACTIVATE = "process.activate";
static final String PROCESS_ACTIVATE_POPUP = "process.activate.popup";
static final String PROCESS_ACTIVATE_POPUP_TIME_DESCRIPTION = "process.activate.popup.time.description";
static final String PROCESS_ACTIVATE_POPUP_INCLUDE_PROCESS_INSTANCES_DESCRIPTION = "process.activate.popup.process.instances.description";
static final String PROCESS_SUSPEND = "process.suspend";
static final String PROCESS_SUSPEND_POPUP = "process.suspend.popup";
static final String PROCESS_SUSPEND_POPUP_TIME_DESCRIPTION = "process.suspend.popup.time.description";
static final String PROCESS_SUSPEND_POPUP_TIME_NOW = "process.suspend.popup.time.now";
static final String PROCESS_SUSPEND_POPUP_TIME_DATE = "process.suspend.popup.time.date";
static final String PROCESS_SUSPEND_POPUP_INCLUDE_PROCESS_INSTANCES_DESCRIPTION = "process.suspend.popup.process.instances.description";
static final String PROCESS_TOXML_FAILED = "process.toxml.failed";
static final String PROCESS_CONVERT = "process.convert";
static final String PROCESS_EXPORT = "process.export";
......@@ -235,6 +249,8 @@ public interface Messages {
// Management menu
static final String MGMT_MENU_DATABASE = "management.menu.database";
static final String MGMT_MENU_DEPLOYMENTS = "management.menu.deployments";
static final String MGMT_MENU_ACTIVE_PROCESS_DEFINITIONS = "management.menu.active.processdefinitions";
static final String MGMT_MENU_SUSPENDED_PROCESS_DEFINITIONS = "management.menu.suspended.processdefinitions";
static final String MGMT_MENU_JOBS = "management.menu.jobs";
static final String MGMT_MENU_DEPLOYMENTS_SHOW_ALL = "management.menu.deployments.show.all";
static final String MGMT_MENU_DEPLOYMENTS_UPLOAD = "management.menu.deployments.upload";
......@@ -244,6 +260,8 @@ public interface Messages {
// Job page
static final String JOB_EXECUTE = "job.execute";
static final String JOB_DELETE = "job.delete";
static final String JOB_DELETED = "job.deleted";
static final String JOB_HEADER_EXECUTION = "job.header.execution";
static final String JOB_RETRIES = "job.retries";
static final String JOB_NO_RETRIES = "job.no.retries";
......@@ -254,6 +272,8 @@ public interface Messages {
static final String JOB_NO_DUEDATE = "job.no.dudedate";
static final String JOB_ERROR = "job.error";
static final String JOB_NOT_EXECUTED = "job.not.executed";
static final String JOB_SUSPEND_PROCESSDEFINITION = "job.suspend.processdefinition";
static final String JOB_ACTIVATE_PROCESSDEFINITION = "job.activate.processdefinition";
// Deployment page
static final String DEPLOYMENT_DELETE = "deployment.delete";
......
......@@ -89,6 +89,14 @@ public interface ViewManager {
void showDeploymentPage(String deploymentId);
void showActiveProcessDefinitionsPage();
void showActiveProcessDefinitionsPage(String processDefinitionId);
void showSuspendedProcessDefinitionsPage();
void showSuspendedProcessDefinitionsPage(String processDefinitionId);
void showJobPage();
void showJobPage(String jobId);
......
/* Licensed 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 org.activiti.explorer.navigation;
import org.activiti.explorer.ExplorerApp;
/**
* @author Joram Barrez
*/
public class ActiveProcessDefinitionNavigator extends ManagementNavigator {
public static final String ACTIVE_PROC_DEF_URI_PART = "activeProcessDefinition";
public String getTrigger() {
return ACTIVE_PROC_DEF_URI_PART;
}
public void handleManagementNavigation(UriFragment uriFragment) {
String processDefinitionId = uriFragment.getUriPart(1);
if(processDefinitionId != null) {
ExplorerApp.get().getViewManager().showActiveProcessDefinitionsPage(processDefinitionId);
} else {
ExplorerApp.get().getViewManager().showActiveProcessDefinitionsPage();
}
}
}
/* Licensed 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 org.activiti.explorer.navigation;
import org.activiti.explorer.ExplorerApp;
/**
* @author Joram Barrez
*/
public class SuspendedProcessDefinitionNavigator extends ManagementNavigator {
public static final String SUSPENDED_PROC_DEF_URI_PART = "suspendedProcessDefinition";
public String getTrigger() {
return SUSPENDED_PROC_DEF_URI_PART;
}
public void handleManagementNavigation(UriFragment uriFragment) {
String processDefinitionId = uriFragment.getUriPart(1);
if(processDefinitionId != null) {
ExplorerApp.get().getViewManager().showActiveProcessDefinitionsPage(processDefinitionId);
} else {
ExplorerApp.get().getViewManager().showActiveProcessDefinitionsPage();
}
}
}
......@@ -15,7 +15,7 @@ package org.activiti.explorer.ui.alfresco;
import org.activiti.explorer.DefaultViewManager;
import org.activiti.explorer.ViewManager;
import org.activiti.explorer.ui.management.process.ProcessInstancePage;
import org.activiti.explorer.ui.management.processinstance.ProcessInstancePage;
/**
......
......@@ -13,7 +13,6 @@
package org.activiti.explorer.ui.custom;
import com.vaadin.event.ShortcutAction;
import com.vaadin.ui.Component;
import com.vaadin.ui.Window;
......
......@@ -72,7 +72,6 @@ public interface ExplorerLayout {
static final String STYLE_ADD = "add";
static final String STYLE_NO_LINE = "no-line";
static final String STYLE_APPLICATION_LOGO = "logo";
static final String STYLE_WORKFLOW_CONSOLE_LOGO = "workflow-console-logo";
static final String STYLE_MAIN_MENU_BUTTON = "main-menu-button";
......@@ -129,6 +128,10 @@ public interface ExplorerLayout {
static final String STYLE_JOB_EXCEPTION_MESSAGE = "job-exception-message";
static final String STYLE_JOB_EXCEPTION_TRACE = "job-exception-trace";
static final String STYLE_JOB_HEADER_DUE_DATE = "job-duedate";
// Process definitions page
static final String STYLE_PROCESS_DEFINITION_SUSPEND_CHOICE = "process-definition-suspend-choice";
// Related content
static final String STYLE_RELATED_CONTENT_LIST = "related-content-list";
......
......@@ -30,6 +30,8 @@ public class ManagementMenuBar extends ToolBar {
public static final String ENTRY_DATABASE = "database";
public static final String ENTRY_DEPLOYMENTS = "deployments";
public static final String ENTRY_ACTIVE_PROCESS_DEFINITIONS = "activeProcessDefinitions";
public static final String ENTRY_SUSPENDED_PROCESS_DEFINITIONS = "suspendedProcessDefinitions";
public static final String ENTRY_JOBS = "jobs";
public static final String ENTRY_USERS = "users";
public static final String ENTRY_GROUPS = "groups";
......@@ -49,6 +51,8 @@ public class ManagementMenuBar extends ToolBar {
protected void initToolbarEntries() {
addDatabaseToolbarEntry();
addDeploymentsToolbarEntry();
addActiveProcessDefinitionsEntry();
addSuspendedProcessDefinitionsEntry();
addJobsToolbarEntry();
addUsersToolbarEntry();
addGroupToolbarEntry();
......@@ -72,6 +76,24 @@ public class ManagementMenuBar extends ToolBar {
});
deploymentEntry.addMenuItem(i18nManager.getMessage(Messages.MGMT_MENU_DEPLOYMENTS_UPLOAD), new NewDeploymentListener());
}
protected void addActiveProcessDefinitionsEntry() {
addToolbarEntry(ENTRY_ACTIVE_PROCESS_DEFINITIONS,
i18nManager.getMessage(Messages.MGMT_MENU_ACTIVE_PROCESS_DEFINITIONS), new ToolbarCommand() {
public void toolBarItemSelected() {
viewManager.showActiveProcessDefinitionsPage();
}
});
}
protected void addSuspendedProcessDefinitionsEntry() {
addToolbarEntry(ENTRY_SUSPENDED_PROCESS_DEFINITIONS,
i18nManager.getMessage(Messages.MGMT_MENU_SUSPENDED_PROCESS_DEFINITIONS), new ToolbarCommand() {
public void toolBarItemSelected() {
viewManager.showSuspendedProcessDefinitionsPage();
}
});
}
protected void addJobsToolbarEntry() {
addToolbarEntry(ENTRY_JOBS, i18nManager.getMessage(Messages.MGMT_MENU_JOBS), new ToolbarCommand() {
......
......@@ -25,7 +25,6 @@ import org.activiti.explorer.ui.util.ThemeImageColumnGenerator;
import com.vaadin.data.Item;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.ui.Component;
import com.vaadin.ui.Table;
......
......@@ -15,6 +15,9 @@ package org.activiti.explorer.ui.management.job;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.ManagementService;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.impl.jobexecutor.TimerActivateProcessDefinitionHandler;
import org.activiti.engine.impl.jobexecutor.TimerSuspendProcessDefinitionHandler;
import org.activiti.engine.impl.persistence.entity.JobEntity;
import org.activiti.engine.impl.persistence.entity.MessageEntity;
import org.activiti.engine.impl.persistence.entity.TimerEntity;
import org.activiti.engine.runtime.Job;
......@@ -32,6 +35,7 @@ import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;
......@@ -71,6 +75,18 @@ public class JobDetailPanel extends DetailPanel {
}
protected void addActions() {
Button deleteButton = new Button(i18nManager.getMessage(Messages.JOB_DELETE));
deleteButton.setIcon(Images.DELETE);
deleteButton.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
managementService.deleteJob(job.getId());
notificationManager.showInformationNotification(Messages.JOB_DELETED);
jobPage.refreshSelectNext();
}
});
Button executeButton = new Button(i18nManager.getMessage(Messages.JOB_EXECUTE));
executeButton.setIcon(Images.EXECUTE);
executeButton.addListener(new ClickListener() {
......@@ -88,37 +104,38 @@ public class JobDetailPanel extends DetailPanel {
}
}
});
jobPage.getToolBar().removeAllButtons();
jobPage.getToolBar().addButton(executeButton);
jobPage.getToolBar().addButton(deleteButton);
}
protected void addHeader() {
GridLayout taskDetails = new GridLayout(3, 2);
taskDetails.setWidth(100, UNITS_PERCENTAGE);
taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
taskDetails.setSpacing(true);
taskDetails.setMargin(false, false, true, false);
GridLayout jobDetails = new GridLayout(3, 2);
jobDetails.setWidth(100, UNITS_PERCENTAGE);
jobDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
jobDetails.setSpacing(true);
jobDetails.setMargin(false, false, true, false);
// Add image
Embedded image = new Embedded(null, Images.JOB_50);
taskDetails.addComponent(image, 0, 0, 0, 1);
jobDetails.addComponent(image, 0, 0, 0, 1);
// Add job name
Label nameLabel = new Label(getJobLabel(job));
nameLabel.addStyleName(Reindeer.LABEL_H2);
taskDetails.addComponent(nameLabel, 1, 0, 2, 0);
jobDetails.addComponent(nameLabel, 1, 0, 2, 0);
// Add due date
PrettyTimeLabel dueDateLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.JOB_DUEDATE),
job.getDuedate(), i18nManager.getMessage(Messages.JOB_NO_DUEDATE), false);
dueDateLabel.addStyleName(ExplorerLayout.STYLE_JOB_HEADER_DUE_DATE);
taskDetails.addComponent(dueDateLabel, 1, 1);
jobDetails.addComponent(dueDateLabel, 1, 1);
taskDetails.setColumnExpandRatio(1, 1.0f);
taskDetails.setColumnExpandRatio(2, 1.0f);
jobDetails.setColumnExpandRatio(1, 1.0f);
jobDetails.setColumnExpandRatio(2, 1.0f);
addDetailComponent(taskDetails);
addDetailComponent(jobDetails);
}
protected String getJobLabel(Job theJob) {
......@@ -177,11 +194,57 @@ public class JobDetailPanel extends DetailPanel {
layout.addComponent(stackPanel);
layout.setExpandRatio(stackPanel, 1.0f);
} else {
Label noException = new Label(i18nManager.getMessage(Messages.JOB_NOT_EXECUTED));
layout.addComponent(noException);
layout.setExpandRatio(noException, 1.0f);
if (job.getProcessDefinitionId() != null) {
// This is a hack .. need to cleanify this in the engine
JobEntity jobEntity = (JobEntity) job;
if (jobEntity.getJobHandlerType().equals(TimerSuspendProcessDefinitionHandler.TYPE)) {
addLinkToProcessDefinition(layout, i18nManager.getMessage(Messages.JOB_SUSPEND_PROCESSDEFINITION), false);
} else if (jobEntity.getJobHandlerType().equals(TimerActivateProcessDefinitionHandler.TYPE)) {
addLinkToProcessDefinition(layout, i18nManager.getMessage(Messages.JOB_ACTIVATE_PROCESSDEFINITION), true);
} else {
addNotYetExecutedLabel(layout);
}
} else {
addNotYetExecutedLabel(layout);
}
}
}
protected void addLinkToProcessDefinition(final VerticalLayout verticalLayout, final String labelText, final boolean isSuspendedProcessDefinition) {
HorizontalLayout layout = new HorizontalLayout();
verticalLayout.addComponent(layout);
Label processDefinitionLabel = new Label(labelText);
processDefinitionLabel.setSizeUndefined();
layout.addComponent(processDefinitionLabel);
layout.addComponent(new Label("&nbsp;", Label.CONTENT_XHTML));
Button showProcessDefinitionLink = new Button(job.getProcessDefinitionId());
showProcessDefinitionLink.addStyleName(Reindeer.BUTTON_LINK);
showProcessDefinitionLink.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
if (isSuspendedProcessDefinition) {
ExplorerApp.get().getViewManager().showSuspendedProcessDefinitionsPage(job.getProcessDefinitionId());
} else {
ExplorerApp.get().getViewManager().showActiveProcessDefinitionsPage(job.getProcessDefinitionId());
}
}
});
layout.addComponent(showProcessDefinitionLink);
}
private void addNotYetExecutedLabel(VerticalLayout layout) {
Label noException = new Label(i18nManager.getMessage(Messages.JOB_NOT_EXECUTED));
layout.addComponent(noException);
layout.setExpandRatio(noException, 1.0f);
}
protected String getRetriesLabel(Job theJob) {
String retriesString;
......
/* Licensed 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 org.activiti.explorer.ui.management.processdefinition;
import java.util.List;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.impl.jobexecutor.TimerSuspendProcessDefinitionHandler;
import org.activiti.engine.impl.persistence.entity.JobEntity;
import org.activiti.engine.runtime.Job;
import org.activiti.explorer.ExplorerApp;
import org.activiti.explorer.Messages;
import org.activiti.explorer.ui.AbstractPage;
import org.activiti.explorer.ui.process.AbstractProcessDefinitionDetailPanel;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
/**
* @author Joram Barrez
*/
public class ActiveProcessDefinitionDetailPanel extends AbstractProcessDefinitionDetailPanel {
private static final long serialVersionUID = 1L;
public ActiveProcessDefinitionDetailPanel(String processDefinitionId, ActiveProcessDefinitionPage activeProcessDefinitionPage) {
super(processDefinitionId, activeProcessDefinitionPage);
}
protected void initActions(final AbstractPage parentPage) {
ActiveProcessDefinitionPage processDefinitionPage = (ActiveProcessDefinitionPage) parentPage;
Button suspendButton = new Button(i18nManager.getMessage(Messages.PROCESS_SUSPEND));
suspendButton.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
ChangeProcessSuspensionStatePopupWindow popupWindow =
new ChangeProcessSuspensionStatePopupWindow(processDefinition.getId(), parentPage, true);
ExplorerApp.get().getViewManager().showPopupWindow(popupWindow);
}
});
// Check if button must be disabled
boolean suspendJobPending = false;
List<Job> jobs = ProcessEngines.getDefaultProcessEngine().getManagementService()
.createJobQuery().processDefinitionId(processDefinition.getId()).list();
for (Job job : jobs) {
// TODO: this is a hack. Needs to be cleaner in engine!
if ( ((JobEntity) job).getJobHandlerType().equals(TimerSuspendProcessDefinitionHandler.TYPE) ) {
suspendJobPending = true;
break;
}
}
suspendButton.setEnabled(!suspendJobPending);
// Clear toolbar and add 'start' button
processDefinitionPage.getToolBar().removeAllButtons();
processDefinitionPage.getToolBar().addButton(suspendButton);
}
}
/* Licensed 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 org.activiti.explorer.ui.management.processdefinition;
import java.util.ArrayList;
import java.util.List;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.explorer.data.AbstractLazyLoadingQuery;
import com.vaadin.data.Item;
/**
* @author Joram Barrez
*/
public class ActiveProcessDefinitionListQuery extends AbstractLazyLoadingQuery {
protected RepositoryService repositoryService;
public ActiveProcessDefinitionListQuery() {
this.repositoryService = ProcessEngines.getDefaultProcessEngine().getRepositoryService();
}
public int size() {
return (int) repositoryService.createProcessDefinitionQuery().active().count();
}
public List<Item> loadItems(int start, int count) {
List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
.active()
.orderByProcessDefinitionName().asc()
.orderByProcessDefinitionVersion().asc()
.listPage(start, count);
List<Item> processDefinitionItems = new ArrayList<Item>();
for (ProcessDefinition processDefinition : processDefinitions) {
processDefinitionItems.add(new ProcessDefinitionListItem(processDefinition));
}
return processDefinitionItems;
}
public Item loadSingleResult(String id) {
return new ProcessDefinitionListItem(repositoryService.createProcessDefinitionQuery()
.processDefinitionId(id).singleResult());
}
public void setSorting(Object[] propertyIds, boolean[] ascending) {
throw new UnsupportedOperationException();
}
}
/* Licensed 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 org.activiti.explorer.ui.management.processdefinition;
import org.activiti.explorer.ExplorerApp;
import org.activiti.explorer.data.LazyLoadingContainer;
import org.activiti.explorer.data.LazyLoadingQuery;
import org.activiti.explorer.navigation.ActiveProcessDefinitionNavigator;
import org.activiti.explorer.navigation.UriFragment;
import org.activiti.explorer.ui.management.ManagementPage;
import com.vaadin.data.Item;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.ui.Table;
/**
* @author Joram Barrez
*/
public class ActiveProcessDefinitionPage extends ManagementPage {
private static final long serialVersionUID = 1L;
protected String processDefinitionId;
protected Table processDefinitionTable;
protected LazyLoadingQuery processDefinitionListQuery;
protected LazyLoadingContainer processDefinitionListContainer;
public ActiveProcessDefinitionPage() {
ExplorerApp.get().setCurrentUriFragment(
new UriFragment(ActiveProcessDefinitionNavigator.ACTIVE_PROC_DEF_URI_PART));
}
public ActiveProcessDefinitionPage(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
@Override
protected void initUi() {
super.initUi();
if (processDefinitionId == null) {
selectElement(0);
} else {
selectElement(processDefinitionListContainer.getIndexForObjectId(processDefinitionId));
}
}
protected Table createList() {
processDefinitionTable = new Table();
processDefinitionListQuery = new ActiveProcessDefinitionListQuery();
processDefinitionListContainer = new LazyLoadingContainer(processDefinitionListQuery);
processDefinitionTable.setContainerDataSource(processDefinitionListContainer);
// Column headers
processDefinitionTable.addContainerProperty("name", String.class, null);
processDefinitionTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
// Listener to change right panel when clicked on a user
processDefinitionTable.addListener(new Property.ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
Item item = processDefinitionTable.getItem(event.getProperty().getValue()); // the value of the property is the itemId of the table entry
if (item != null) {
String processDefinitionId = (String) item.getItemProperty("id").getValue();
setDetailComponent(new ActiveProcessDefinitionDetailPanel(processDefinitionId, ActiveProcessDefinitionPage.this));
// Update URL
ExplorerApp.get().setCurrentUriFragment(
new UriFragment(ActiveProcessDefinitionNavigator.ACTIVE_PROC_DEF_URI_PART, processDefinitionId));
} else {
// Nothing selected
setDetailComponent(null);
ExplorerApp.get().setCurrentUriFragment(new UriFragment(ActiveProcessDefinitionNavigator.ACTIVE_PROC_DEF_URI_PART));
}
}
});
return processDefinitionTable;
}
}
/* Licensed 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 org.activiti.explorer.ui.management.processdefinition;
import java.util.Date;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.explorer.ExplorerApp;
import org.activiti.explorer.I18nManager;
import org.activiti.explorer.Messages;
import org.activiti.explorer.ui.AbstractPage;
import org.activiti.explorer.ui.custom.PopupWindow;
import org.activiti.explorer.ui.mainlayout.ExplorerLayout;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.DateField;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.Reindeer;
/**
* @author Joram Barrez
*/
public class ChangeProcessSuspensionStatePopupWindow extends PopupWindow {
private static final long serialVersionUID = 1L;
protected I18nManager i18nManager;
protected String processDefinitionId;
protected AbstractPage parentPage;
protected VerticalLayout verticalLayout;
protected CheckBox nowCheckBox;
protected CheckBox dateCheckBox;
protected DateField dateField;
protected CheckBox includeProcessInstancesCheckBox;
public ChangeProcessSuspensionStatePopupWindow(String processDefinitionId, AbstractPage parentPage, boolean suspend) {
this.processDefinitionId = processDefinitionId;
this.parentPage = parentPage;
this.i18nManager = ExplorerApp.get().getI18nManager();
setCaption(suspend ? i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP) :
i18nManager.getMessage(Messages.PROCESS_ACTIVATE_POPUP));
setModal(true);
center();
setResizable(false);
setWidth(400, UNITS_PIXELS);
setHeight(300, UNITS_PIXELS);
addStyleName(Reindeer.WINDOW_LIGHT);
verticalLayout = new VerticalLayout();
addComponent(verticalLayout);
addTimeSection(suspend);
addIncludeProcessInstancesSection(suspend);
addOkButton(suspend);
}
protected void addTimeSection(boolean suspend) {
Label timeLabel = new Label(suspend ? i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_DESCRIPTION)
: i18nManager.getMessage(Messages.PROCESS_ACTIVATE_POPUP_TIME_DESCRIPTION));
verticalLayout.addComponent(timeLabel);
verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));
nowCheckBox = new CheckBox(i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_NOW), true);
nowCheckBox.addStyleName(ExplorerLayout.STYLE_PROCESS_DEFINITION_SUSPEND_CHOICE);
nowCheckBox.setImmediate(true);
nowCheckBox.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
if (nowCheckBox.booleanValue() == true) {
dateField.setValue(null);
dateCheckBox.setValue(false);
} else {
dateCheckBox.setValue(true);
dateField.setValue(new Date());
}
}
});
verticalLayout.addComponent(nowCheckBox);
HorizontalLayout dateLayout = new HorizontalLayout();
verticalLayout.addComponent(dateLayout);
dateCheckBox = new CheckBox(i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_DATE));
dateCheckBox.addStyleName(ExplorerLayout.STYLE_PROCESS_DEFINITION_SUSPEND_CHOICE);
dateCheckBox.setImmediate(true);
dateCheckBox.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
if (dateCheckBox.booleanValue() == true) {
dateField.setValue(new Date());
nowCheckBox.setValue(false);
} else {
dateField.setValue(null);
nowCheckBox.setValue(true);
}
}
});
dateLayout.addComponent(dateCheckBox);
dateField = new DateField();
dateField.setImmediate(true);
dateField.addListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
if (dateField.getValue() != null) {
nowCheckBox.setValue(false);
dateCheckBox.setValue(true);
}
}
});
dateLayout.addComponent(dateField);
}
protected void addIncludeProcessInstancesSection(boolean suspend) {
verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));
verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));
includeProcessInstancesCheckBox = new CheckBox(suspend ?
i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_INCLUDE_PROCESS_INSTANCES_DESCRIPTION) :
i18nManager.getMessage(Messages.PROCESS_ACTIVATE_POPUP_INCLUDE_PROCESS_INSTANCES_DESCRIPTION), true);
verticalLayout.addComponent(includeProcessInstancesCheckBox);
}
protected void addOkButton(final boolean suspend) {
verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));
verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));
Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK));
verticalLayout.addComponent(okButton);
verticalLayout.setComponentAlignment(okButton, Alignment.BOTTOM_CENTER);
okButton.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
RepositoryService repositoryService = ProcessEngines.getDefaultProcessEngine().getRepositoryService();
boolean includeProcessInstances = (Boolean) includeProcessInstancesCheckBox.getValue();
if (suspend) {
repositoryService.suspendProcessDefinitionById(processDefinitionId,
includeProcessInstances, (Date) dateField.getValue());
} else {
repositoryService.activateProcessDefinitionById(processDefinitionId,
includeProcessInstances, (Date) dateField.getValue());
}
close();
parentPage.refreshSelectNext(); // select next item in list on the left
}
});
}
}
/* Licensed 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 org.activiti.explorer.ui.management.processdefinition;
import org.activiti.engine.repository.ProcessDefinition;
import com.vaadin.data.util.ObjectProperty;
import com.vaadin.data.util.PropertysetItem;
/**
* @author Joram Barrez
*/
public class ProcessDefinitionListItem extends PropertysetItem implements Comparable<ProcessDefinitionListItem> {
private static final long serialVersionUID = 1L;
public ProcessDefinitionListItem(ProcessDefinition processDefinition) {
addItemProperty("id", new ObjectProperty<String>(processDefinition.getId(), String.class));
addItemProperty("key", new ObjectProperty<String>(processDefinition.getKey(), String.class));
addItemProperty("name", new ObjectProperty<String>(processDefinition.getName() ,String.class));
addItemProperty("version", new ObjectProperty<Integer>(processDefinition.getVersion() ,Integer.class));
}
public int compareTo(ProcessDefinitionListItem other) {
String name = (String) getItemProperty("name").getValue();
String otherName = (String) other.getItemProperty("name").getValue();
int comparison = name.compareTo(otherName);
if (comparison != 0) {
return comparison;
} else {
String key = (String) getItemProperty("key").getValue();
String otherKey = (String) other.getItemProperty("key").getValue();
comparison = key.compareTo(otherKey);
if (comparison != 0) {
return comparison;
} else {
Integer version = (Integer) getItemProperty("version").getValue();
Integer otherVersion = (Integer) other.getItemProperty("version").getValue();
return version.compareTo(otherVersion);
}
}
}
}
\ No newline at end of file
/* Licensed 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 org.activiti.explorer.ui.management.processdefinition;
import java.util.List;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.impl.jobexecutor.TimerActivateProcessDefinitionHandler;
import org.activiti.engine.impl.persistence.entity.JobEntity;
import org.activiti.engine.runtime.Job;
import org.activiti.explorer.ExplorerApp;
import org.activiti.explorer.Messages;
import org.activiti.explorer.ui.AbstractPage;
import org.activiti.explorer.ui.process.AbstractProcessDefinitionDetailPanel;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
/**
* @author Joram Barrez
*/
public class SuspendedProcessDefinitionDetailPanel extends AbstractProcessDefinitionDetailPanel {
private static final long serialVersionUID = 1L;
public SuspendedProcessDefinitionDetailPanel(String processDefinitionId, SuspendedProcessDefinitionPage suspendedProcessDefinitionPage) {
super(processDefinitionId, suspendedProcessDefinitionPage);
}
protected void initActions(final AbstractPage parentPage) {
SuspendedProcessDefinitionPage processDefinitionPage = (SuspendedProcessDefinitionPage) parentPage;
Button activateButton = new Button(i18nManager.getMessage(Messages.PROCESS_ACTIVATE));
activateButton.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
ChangeProcessSuspensionStatePopupWindow popupWindow =
new ChangeProcessSuspensionStatePopupWindow(processDefinition.getId(), parentPage, false);
ExplorerApp.get().getViewManager().showPopupWindow(popupWindow);
}
});
// Check if already activation job pending
boolean activateJobPending = false;
List<Job> jobs = ProcessEngines.getDefaultProcessEngine().getManagementService()
.createJobQuery().processDefinitionId(processDefinition.getId()).list();
for (Job job : jobs) {
// TODO: this is a hack. Needs to be cleaner in engine!
if ( ((JobEntity) job).getJobHandlerType().equals(TimerActivateProcessDefinitionHandler.TYPE) ) {
activateJobPending = true;
break;
}
}
activateButton.setEnabled(!activateJobPending);
// Clear toolbar and add 'start' button
processDefinitionPage.getToolBar().removeAllButtons();
processDefinitionPage.getToolBar().addButton(activateButton);
}
}
/* Licensed 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 org.activiti.explorer.ui.management.processdefinition;
import java.util.ArrayList;
import java.util.List;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.explorer.data.AbstractLazyLoadingQuery;
import com.vaadin.data.Item;
/**
* @author Joram Barrez
*/
public class SuspendedProcessDefinitionListQuery extends AbstractLazyLoadingQuery {
protected RepositoryService repositoryService;
public SuspendedProcessDefinitionListQuery() {
this.repositoryService = ProcessEngines.getDefaultProcessEngine().getRepositoryService();
}
public int size() {
return (int) repositoryService.createProcessDefinitionQuery().suspended().count();
}
public List<Item> loadItems(int start, int count) {
List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
.suspended()
.orderByProcessDefinitionName().asc()
.orderByProcessDefinitionVersion().asc()
.listPage(start, count);
List<Item> processDefinitionItems = new ArrayList<Item>();
for (ProcessDefinition processDefinition : processDefinitions) {
processDefinitionItems.add(new ProcessDefinitionListItem(processDefinition));
}
return processDefinitionItems;
}
public Item loadSingleResult(String id) {
return new ProcessDefinitionListItem(repositoryService.createProcessDefinitionQuery()
.processDefinitionId(id).singleResult());
}
public void setSorting(Object[] propertyIds, boolean[] ascending) {
throw new UnsupportedOperationException();
}
}
/* Licensed 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 org.activiti.explorer.ui.management.processdefinition;
import org.activiti.explorer.ExplorerApp;
import org.activiti.explorer.data.LazyLoadingContainer;
import org.activiti.explorer.data.LazyLoadingQuery;
import org.activiti.explorer.navigation.ActiveProcessDefinitionNavigator;
import org.activiti.explorer.navigation.SuspendedProcessDefinitionNavigator;
import org.activiti.explorer.navigation.UriFragment;
import org.activiti.explorer.ui.management.ManagementPage;
import com.vaadin.data.Item;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.ui.Table;
/**
* @author Joram Barrez
*/
public class SuspendedProcessDefinitionPage extends ManagementPage {
private static final long serialVersionUID = 1L;
protected String processDefinitionId;
protected Table processDefinitionTable;
protected LazyLoadingQuery processDefinitionListQuery;
protected LazyLoadingContainer processDefinitionListContainer;
public SuspendedProcessDefinitionPage() {
ExplorerApp.get().setCurrentUriFragment(
new UriFragment(SuspendedProcessDefinitionNavigator.SUSPENDED_PROC_DEF_URI_PART));
}
public SuspendedProcessDefinitionPage(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
@Override
protected void initUi() {
super.initUi();
if (processDefinitionId == null) {
selectElement(0);
} else {
selectElement(processDefinitionListContainer.getIndexForObjectId(processDefinitionId));
}
}
protected Table createList() {
processDefinitionTable = new Table();
processDefinitionListQuery = new SuspendedProcessDefinitionListQuery();
processDefinitionListContainer = new LazyLoadingContainer(processDefinitionListQuery);
processDefinitionTable.setContainerDataSource(processDefinitionListContainer);
// Column headers
processDefinitionTable.addContainerProperty("name", String.class, null);
processDefinitionTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
// Listener to change right panel when clicked on a user
processDefinitionTable.addListener(new Property.ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
Item item = processDefinitionTable.getItem(event.getProperty().getValue()); // the value of the property is the itemId of the table entry
if (item != null) {
String processDefinitionId = (String) item.getItemProperty("id").getValue();
setDetailComponent(new SuspendedProcessDefinitionDetailPanel(processDefinitionId, SuspendedProcessDefinitionPage.this));
// Update URL
ExplorerApp.get().setCurrentUriFragment(
new UriFragment(ActiveProcessDefinitionNavigator.ACTIVE_PROC_DEF_URI_PART, processDefinitionId));
} else {
// Nothing selected
setDetailComponent(null);
ExplorerApp.get().setCurrentUriFragment(new UriFragment(ActiveProcessDefinitionNavigator.ACTIVE_PROC_DEF_URI_PART));
}
}
});
return processDefinitionTable;
}
}
......@@ -11,7 +11,7 @@
* limitations under the License.
*/
package org.activiti.explorer.ui.management.process;
package org.activiti.explorer.ui.management.processinstance;
import org.activiti.explorer.ui.AbstractTablePage;
......
......@@ -11,7 +11,7 @@
* limitations under the License.
*/
package org.activiti.explorer.ui.management.process;
package org.activiti.explorer.ui.management.processinstance;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;
......
......@@ -11,7 +11,7 @@
* limitations under the License.
*/
package org.activiti.explorer.ui.management.process;
package org.activiti.explorer.ui.management.processinstance;
import java.util.List;
import java.util.Map;
......
......@@ -10,7 +10,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.explorer.ui.management.process;
package org.activiti.explorer.ui.management.processinstance;
import org.activiti.engine.runtime.ProcessInstance;
......
......@@ -11,7 +11,7 @@
* limitations under the License.
*/
package org.activiti.explorer.ui.management.process;
package org.activiti.explorer.ui.management.processinstance;
import java.util.ArrayList;
import java.util.HashMap;
......
......@@ -11,7 +11,7 @@
* limitations under the License.
*/
package org.activiti.explorer.ui.management.process;
package org.activiti.explorer.ui.management.processinstance;
import org.activiti.explorer.ExplorerApp;
import org.activiti.explorer.data.LazyLoadingContainer;
......
/* Licensed 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 org.activiti.explorer.ui.process;
import org.activiti.engine.FormService;
import org.activiti.engine.ManagementService;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.explorer.ExplorerApp;
import org.activiti.explorer.I18nManager;
import org.activiti.explorer.Messages;
import org.activiti.explorer.ui.AbstractPage;
import org.activiti.explorer.ui.Images;
import org.activiti.explorer.ui.custom.DetailPanel;
import org.activiti.explorer.ui.custom.PrettyTimeLabel;
import org.activiti.explorer.ui.form.FormPropertiesForm;
import org.activiti.explorer.ui.mainlayout.ExplorerLayout;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.Reindeer;
/**
* Panel showing process definition detail.
*
* @author Frederik Heremans
* @author Joram Barrez
*/
public abstract class AbstractProcessDefinitionDetailPanel extends DetailPanel {
private static final long serialVersionUID = 1L;
// Members
protected ProcessDefinition processDefinition;
protected Deployment deployment;
protected AbstractPage parentPage;
// Services
protected RepositoryService repositoryService;
protected ManagementService managementService;
protected FormService formService;
protected I18nManager i18nManager;
// UI
protected VerticalLayout detailPanelLayout;
protected HorizontalLayout detailContainer;
protected HorizontalLayout actionsContainer;
protected Label nameLabel;
protected FormPropertiesForm processDefinitionStartForm;
protected ProcessDefinitionInfoComponent definitionInfoComponent;
public AbstractProcessDefinitionDetailPanel(String processDefinitionId, AbstractPage parentPage) {
this.repositoryService = ProcessEngines.getDefaultProcessEngine().getRepositoryService();
this.managementService = ProcessEngines.getDefaultProcessEngine().getManagementService();
this.formService = ProcessEngines.getDefaultProcessEngine().getFormService();
this.i18nManager = ExplorerApp.get().getI18nManager();
this.parentPage = parentPage;
this.processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
if(processDefinition != null) {
deployment = repositoryService.createDeploymentQuery().deploymentId(processDefinition.getDeploymentId()).singleResult();
}
initUi();
}
protected void initUi() {
setSizeFull();
addStyleName(Reindeer.LAYOUT_WHITE);
detailPanelLayout = new VerticalLayout();
detailPanelLayout.setWidth(100, UNITS_PERCENTAGE);
detailPanelLayout.setMargin(true);
setDetailContainer(detailPanelLayout);
// All details about the process definition
initHeader();
detailContainer = new HorizontalLayout();
detailContainer.addStyleName(Reindeer.PANEL_LIGHT);
detailPanelLayout.addComponent(detailContainer);
detailContainer.setSizeFull();
initActions(parentPage);
initProcessDefinitionInfo();
}
/**
* Custom toolbar buttons are added here
*/
protected abstract void initActions(AbstractPage parentPage);
public void initProcessDefinitionInfo() {
if(definitionInfoComponent == null) {
definitionInfoComponent = new ProcessDefinitionInfoComponent(processDefinition, deployment);
}
detailContainer.removeAllComponents();
detailContainer.addComponent(definitionInfoComponent);
}
protected void initHeader() {
GridLayout details = new GridLayout(2, 2);
details.setWidth(100, UNITS_PERCENTAGE);
details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
details.setSpacing(true);
details.setMargin(false, false, true, false);
details.setColumnExpandRatio(1, 1.0f);
detailPanelLayout.addComponent(details);
// Image
Embedded image = new Embedded(null, Images.PROCESS_50);
details.addComponent(image, 0, 0, 0, 1);
// Name
Label nameLabel = new Label(getProcessDisplayName(processDefinition));
nameLabel.addStyleName(Reindeer.LABEL_H2);
details.addComponent(nameLabel, 1, 0);
// Properties
HorizontalLayout propertiesLayout = new HorizontalLayout();
propertiesLayout.setSpacing(true);
details.addComponent(propertiesLayout);
// Version
String versionString = i18nManager.getMessage(Messages.PROCESS_VERSION, processDefinition.getVersion());
Label versionLabel = new Label(versionString);
versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_VERSION);
propertiesLayout.addComponent(versionLabel);
// Add deploy time
PrettyTimeLabel deployTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.PROCESS_DEPLOY_TIME),
deployment.getDeploymentTime(), null, true);
deployTimeLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_DEPLOY_TIME);
propertiesLayout.addComponent(deployTimeLabel);
}
protected String getProcessDisplayName(ProcessDefinition processDefinition) {
if(processDefinition.getName() != null) {
return processDefinition.getName();
} else {
return processDefinition.getKey();
}
}
protected void addEmptySpace(ComponentContainer container) {
Label emptySpace = new Label("&nbsp;", Label.CONTENT_XHTML);
emptySpace.setSizeUndefined();
container.addComponent(emptySpace);
}
}
......@@ -31,17 +31,20 @@ public class DefaultProcessDefinitionFilter implements ProcessDefinitionFilter {
public ProcessDefinitionQuery getQuery(RepositoryService repositoryService) {
return repositoryService
.createProcessDefinitionQuery()
.latestVersion()
.orderByProcessDefinitionName().asc()
.orderByProcessDefinitionKey().asc(); // name is not unique, so we add the order on key (so we can use it in the comparsion of ProcessDefinitionListItem)
return getBaseQuery(repositoryService)
.orderByProcessDefinitionName().asc()
.orderByProcessDefinitionKey().asc(); // name is not unique, so we add the order on key (so we can use it in the comparsion of ProcessDefinitionListItem)
}
public ProcessDefinitionQuery getCountQuery(RepositoryService repositoryService) {
return getBaseQuery(repositoryService);
}
protected ProcessDefinitionQuery getBaseQuery(RepositoryService repositoryService) {
return repositoryService
.createProcessDefinitionQuery()
.latestVersion();
.latestVersion()
.active();
}
public ProcessDefinitionListItem createItem(ProcessDefinition processDefinition) {
......
......@@ -12,102 +12,40 @@
*/
package org.activiti.explorer.ui.process;
import org.activiti.engine.FormService;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.form.StartFormData;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.explorer.ExplorerApp;
import org.activiti.explorer.I18nManager;
import org.activiti.explorer.Messages;
import org.activiti.explorer.ui.Images;
import org.activiti.explorer.ui.custom.DetailPanel;
import org.activiti.explorer.ui.custom.PrettyTimeLabel;
import org.activiti.explorer.ui.AbstractPage;
import org.activiti.explorer.ui.form.FormPropertiesEventListener;
import org.activiti.explorer.ui.form.FormPropertiesForm;
import org.activiti.explorer.ui.form.FormPropertiesForm.FormPropertiesEvent;
import org.activiti.explorer.ui.mainlayout.ExplorerLayout;
import org.activiti.explorer.ui.process.listener.ConvertProcessDefinitionToModelClickListener;
import org.activiti.explorer.ui.process.listener.StartProcessInstanceClickListener;
import com.vaadin.ui.Button;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.Reindeer;
/**
* Panel showing process definition detail.
*
* @author Frederik Heremans
* @author Joram Barrez
*/
public class ProcessDefinitionDetailPanel extends DetailPanel {
public class ProcessDefinitionDetailPanel extends AbstractProcessDefinitionDetailPanel {
private static final long serialVersionUID = 1L;
// Members
protected ProcessDefinition processDefinition;
protected Deployment deployment;
protected ProcessDefinitionPage processDefinitionPage;
// Services
protected RepositoryService repositoryService;
protected FormService formService;
protected I18nManager i18nManager;
// UI
protected VerticalLayout detailPanelLayout;
protected HorizontalLayout detailContainer;
protected HorizontalLayout actionsContainer;
protected Label nameLabel;
protected Button startProcessInstanceButton;
protected Button editProcessDefinitionButton;
protected FormPropertiesForm processDefinitionStartForm;
protected ProcessDefinitionInfoComponent definitionInfoComponent;
public ProcessDefinitionDetailPanel(String processDefinitionId, ProcessDefinitionPage processDefinitionPage) {
this.repositoryService = ProcessEngines.getDefaultProcessEngine().getRepositoryService();
this.formService = ProcessEngines.getDefaultProcessEngine().getFormService();
this.i18nManager = ExplorerApp.get().getI18nManager();
this.processDefinitionPage = processDefinitionPage;
this.processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
if(processDefinition != null) {
deployment = repositoryService.createDeploymentQuery().deploymentId(processDefinition.getDeploymentId()).singleResult();
}
initUi();
}
protected void initUi() {
setSizeFull();
addStyleName(Reindeer.LAYOUT_WHITE);
detailPanelLayout = new VerticalLayout();
detailPanelLayout.setWidth(100, UNITS_PERCENTAGE);
detailPanelLayout.setMargin(true);
setDetailContainer(detailPanelLayout);
// All details about the process definition
initHeader();
detailContainer = new HorizontalLayout();
detailContainer.addStyleName(Reindeer.PANEL_LIGHT);
detailPanelLayout.addComponent(detailContainer);
detailContainer.setSizeFull();
initActions();
initProcessDefinitionInfo();
super(processDefinitionId, processDefinitionPage);
}
protected void initActions() {
protected void initActions(AbstractPage parentPage) {
ProcessDefinitionPage processDefinitionPage = (ProcessDefinitionPage) parentPage;
startProcessInstanceButton = new Button(i18nManager.getMessage(Messages.PROCESS_START));
startProcessInstanceButton.addListener(new StartProcessInstanceClickListener(processDefinition, processDefinitionPage));
......@@ -124,20 +62,6 @@ public class ProcessDefinitionDetailPanel extends DetailPanel {
processDefinitionPage.getToolBar().addButton(editProcessDefinitionButton);
}
public void initProcessDefinitionInfo() {
if(definitionInfoComponent == null) {
definitionInfoComponent = new ProcessDefinitionInfoComponent(processDefinition, deployment);
}
if (startProcessInstanceButton != null) {
startProcessInstanceButton.setEnabled(true);
}
detailContainer.removeAllComponents();
detailContainer.addComponent(definitionInfoComponent);
}
public void showProcessStartForm(StartFormData startFormData) {
if(processDefinitionStartForm == null) {
processDefinitionStartForm = new FormPropertiesForm();
......@@ -167,53 +91,13 @@ public class ProcessDefinitionDetailPanel extends DetailPanel {
detailContainer.addComponent(processDefinitionStartForm);
}
protected void initHeader() {
GridLayout details = new GridLayout(2, 2);
details.setWidth(100, UNITS_PERCENTAGE);
details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
details.setSpacing(true);
details.setMargin(false, false, true, false);
details.setColumnExpandRatio(1, 1.0f);
detailPanelLayout.addComponent(details);
// Image
Embedded image = new Embedded(null, Images.PROCESS_50);
details.addComponent(image, 0, 0, 0, 1);
// Name
Label nameLabel = new Label(getProcessDisplayName(processDefinition));
nameLabel.addStyleName(Reindeer.LABEL_H2);
details.addComponent(nameLabel, 1, 0);
// Properties
HorizontalLayout propertiesLayout = new HorizontalLayout();
propertiesLayout.setSpacing(true);
details.addComponent(propertiesLayout);
// Version
String versionString = i18nManager.getMessage(Messages.PROCESS_VERSION, processDefinition.getVersion());
Label versionLabel = new Label(versionString);
versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_VERSION);
propertiesLayout.addComponent(versionLabel);
@Override
public void initProcessDefinitionInfo() {
super.initProcessDefinitionInfo();
// Add deploy time
PrettyTimeLabel deployTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.PROCESS_DEPLOY_TIME),
deployment.getDeploymentTime(), null, true);
deployTimeLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_DEPLOY_TIME);
propertiesLayout.addComponent(deployTimeLabel);
}
protected String getProcessDisplayName(ProcessDefinition processDefinition) {
if(processDefinition.getName() != null) {
return processDefinition.getName();
} else {
return processDefinition.getKey();
if (startProcessInstanceButton != null) {
startProcessInstanceButton.setEnabled(true);
}
}
protected void addEmptySpace(ComponentContainer container) {
Label emptySpace = new Label("&nbsp;", Label.CONTENT_XHTML);
emptySpace.setSizeUndefined();
container.addComponent(emptySpace);
}
}
......@@ -13,10 +13,19 @@
package org.activiti.explorer.ui.process;
import java.util.ArrayList;
import java.util.List;
import org.activiti.engine.ManagementService;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.impl.jobexecutor.TimerActivateProcessDefinitionHandler;
import org.activiti.engine.impl.jobexecutor.TimerSuspendProcessDefinitionHandler;
import org.activiti.engine.impl.persistence.entity.JobEntity;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.Job;
import org.activiti.explorer.Constants;
import org.activiti.explorer.ExplorerApp;
import org.activiti.explorer.I18nManager;
import org.activiti.explorer.Messages;
......@@ -34,6 +43,7 @@ import com.vaadin.ui.themes.Reindeer;
/**
* @author Frederik Heremans
* @author Joram Barrez
*/
public class ProcessDefinitionInfoComponent extends VerticalLayout {
......@@ -41,6 +51,7 @@ public class ProcessDefinitionInfoComponent extends VerticalLayout {
// Services
protected RepositoryService repositoryService;
protected ManagementService managementService;
protected I18nManager i18nManager;
// Members
......@@ -55,6 +66,7 @@ public class ProcessDefinitionInfoComponent extends VerticalLayout {
public ProcessDefinitionInfoComponent(ProcessDefinition processDefinition, Deployment deployment) {
super();
this.repositoryService = ProcessEngines.getDefaultProcessEngine().getRepositoryService();
this.managementService = ProcessEngines.getDefaultProcessEngine().getManagementService();
this.i18nManager = ExplorerApp.get().getI18nManager();
this.processDefinition = processDefinition;
......@@ -62,9 +74,49 @@ public class ProcessDefinitionInfoComponent extends VerticalLayout {
addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
initSuspensionStateInformation();
initImage();
}
protected void initSuspensionStateInformation() {
List<Job> jobs = managementService.createJobQuery()
.processDefinitionId(processDefinition.getId()).orderByJobDuedate().asc().list();
List<JobEntity> suspensionStateJobs = new ArrayList<JobEntity>();
// TODO: this is a hack (ie the cast to JobEntity)... we must clean this in the engine!
for (Job job : jobs) {
JobEntity jobEntity = (JobEntity) job;
if (jobEntity.getJobHandlerType().equals(TimerSuspendProcessDefinitionHandler.TYPE)
|| jobEntity.getJobHandlerType().equals(TimerActivateProcessDefinitionHandler.TYPE)) {
suspensionStateJobs.add(jobEntity);
}
}
if (suspensionStateJobs.size() > 0) {
// Header
Label suspensionStateTitle = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_SUSPENSION_STATE));
suspensionStateTitle.addStyleName(ExplorerLayout.STYLE_H3);
addComponent(suspensionStateTitle);
addEmptySpace(this);
// Actual suspend/activation jobs
for (JobEntity jobEntity : suspensionStateJobs) {
if (jobEntity.getJobHandlerType().equals(TimerSuspendProcessDefinitionHandler.TYPE)) {
Label suspendLabel = new Label(i18nManager.getMessage(Messages.PROCESS_SCHEDULED_SUSPEND,
Constants.DEFAULT_TIME_FORMATTER.format(jobEntity.getDuedate())), Label.CONTENT_XHTML);
addComponent(suspendLabel);
} else if (jobEntity.getJobHandlerType().equals(TimerActivateProcessDefinitionHandler.TYPE)) {
Label suspendLabel = new Label(i18nManager.getMessage(Messages.PROCESS_SCHEDULED_ACTIVATE,
Constants.DEFAULT_TIME_FORMATTER.format(jobEntity.getDuedate())), Label.CONTENT_XHTML);
addComponent(suspendLabel);
}
}
}
addEmptySpace(this);
}
protected void initImage() {
processImageContainer = new VerticalLayout();
......
......@@ -21,7 +21,7 @@ import org.activiti.explorer.ui.AbstractTablePage;
import org.activiti.explorer.ui.Images;
import org.activiti.explorer.ui.custom.ToolBar;
import org.activiti.explorer.ui.mainlayout.ExplorerLayout;
import org.activiti.explorer.ui.management.process.ProcessInstanceDetailPanel;
import org.activiti.explorer.ui.management.processinstance.ProcessInstanceDetailPanel;
import org.activiti.explorer.ui.util.ThemeImageColumnGenerator;
import com.vaadin.data.Item;
......
......@@ -7,6 +7,7 @@ confirmation.dialog.no= No
button.ok = Ok
button.create = Create
button.cancel = Cancel
uncaught.exception = Warning!
# Navigation
navigation.error.not.involved.title = Cannot view task
......@@ -175,12 +176,25 @@ process.version = Version {0}
process.deploy.time = Deployed {0}
process.header.diagram = Process Diagram
process.no.diagram = No image available for this process.
process.header.suspension.state = Suspension state changes
process.scheduled.suspend = This process definition is scheduled to be <b>suspended on {0}</b>
process.scheduled.activate = This process definition is scheduled to be <b>activated on {0}</b>
process.start = Start process
process.edit = Edit model
process.copy = Copy model
process.delete = Delete model
process.new = New model
process.deploy = Deploy
process.activate = Activate
process.activate.popup = Activate process definition
process.activate.popup.time.description = When do you want to activate this process definition?
process.activate.popup.process.instances.description = Also activate all process instances for this process definitions
process.suspend = Suspend
process.suspend.popup = Suspend process definition
process.suspend.popup.time.description = When do you want to suspend this process definition?
process.suspend.popup.time.now = now
process.suspend.popup.time.date = on
process.suspend.popup.process.instances.description = Also suspend all process instances for this process definition
process.convert = Convert to editable model
process.export = Export to BPMN 2.0
process.toxml.failed = Create of BPMN XML failed
......@@ -219,6 +233,8 @@ management.menu.database = Database
management.menu.deployments = Deployments
management.menu.deployments.show.all = Show all
management.menu.deployments.upload = Upload new
management.menu.active.processdefinitions = Active Processes
management.menu.suspended.processdefinitions = Suspended Processes
management.menu.jobs = Jobs
management.menu.users = Users
management.menu.groups = Groups
......@@ -226,6 +242,8 @@ management.menu.admin = Administration
# Job page
job.execute = Execute
job.delete = Delete
job.deleted = Job deleted
job.header.execution = Job execution
job.retries = Retries : {0}
job.no.retries = No more retries left
......@@ -236,6 +254,8 @@ job.duedate = Due {0}
job.no.dudedate = No duedate
job.error = Error occurred while executing job
job.not.executed = Job hasn't been executed yet.
job.suspend.processdefinition = This job will suspend process definition
job.activate.processdefinition = This job will activate process definition
# Deployment page
deployment.delete = Delete
......
......@@ -13,6 +13,7 @@
package org.activiti.spring;
import org.activiti.engine.impl.cfg.TransactionContext;
import org.activiti.engine.impl.cfg.TransactionListener;
import org.activiti.engine.impl.cfg.TransactionState;
......@@ -79,7 +80,9 @@ public class SpringTransactionContext implements TransactionContext {
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
@Override
public void afterCompletion(int status) {
transactionListener.execute(commandContext);
if(TransactionSynchronization.STATUS_ROLLED_BACK == status) {
transactionListener.execute(commandContext);
}
}
});
......
......@@ -10,13 +10,15 @@
<properties>
<skipTests>true</skipTests>
<dependencyVersion>5.11-SNAPSHOT</dependencyVersion>
<postgresVersion>8.4-701.jdbc4</postgresVersion>
</properties>
<dependencies>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>5.11-SNAPSHOT</version>
<version>${dependencyVersion}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
......@@ -37,7 +39,7 @@
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>8.4-701.jdbc4</version>
<version>${postgresVersion}</version>
</dependency>
<dependency>
<groupId>com.oracle.jdbc</groupId>
......@@ -49,6 +51,18 @@
<artifactId>jtds</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc4</artifactId>
<version>10.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
......@@ -105,25 +119,102 @@
</build>
<profiles>
<profile>
<id>drop</id>
<properties>
<skipTests>false</skipTests>
</properties>
</profile>
<profile>
<id>create</id>
<properties>
<skipTests>false</skipTests>
<skipTests>true</skipTests>
</properties>
</profile>
<profile>
<id>generate</id>
<activation>
<property>
<name>releaseVersion</name>
</property>
</activation>
<properties>
<skipTests>false</skipTests>
<skipTests>true</skipTests>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>generate.data.file</id>
<phase>process-test-classes</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="Property database: ${database}" />
<echo message="Property dependencyVersion: ${dependencyVersion}" />
<echo message="Property releaseVersion: ${releaseVersion}" />
<condition property="mandatoryPropertiesAvailable">
<and>
<isset property="database"/>
<isset property="releaseVersion"/>
</and>
</condition>
<fail unless="mandatoryPropertiesAvailable" message="please specify values for all the properties" />
<!-- mkdir dir="src/test/resources/org/activiti/db/${releaseVersion}/create" />
<copy todir="src/test/resources/org/activiti/db/${releaseVersion}/create">
<fileset dir="../activiti-engine/src/main/resources/org/activiti/db/create" />
</copy>
<mkdir dir="src/test/resources/org/activiti/db/${releaseVersion}/drop" />
<copy todir="src/test/resources/org/activiti/db/${releaseVersion}/drop">
<fileset dir="../activiti-engine/src/main/resources/org/activiti/db/drop" />
</copy -->
<mkdir dir="src/test/resources/org/activiti/db/${releaseVersion}/data" />
<property file="${user.home}/.activiti/upgrade/build.${database}.properties" />
<echo message="generating data files" />
<property name="test_classpath" refid="maven.test.classpath" />
<echo message="cleaning schema" />
<echo message=" jdbc driver.. ${jdbc.driver}" />
<echo message=" jdbc url..... ${jdbc.url}" />
<echo message=" jdbc username ${jdbc.username}" />
<sql driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" password="${jdbc.password}"
classpath="${test_classpath}"
onerror="continue">
<path>
<fileset dir="src/test/resources/org/activiti/db/clean">
<include name="clean.${database}.sql"/>
</fileset>
</path>
</sql>
<java classname="org.activiti.upgrade.CleanPostgres" fork="true">
<arg line="${database}"/>
<classpath>
<path path="${test_classpath}"/>
</classpath>
</java>
<sql driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" password="${jdbc.password}"
classpath="${test_classpath}">
<path>
<fileset dir="src/test/resources/org/activiti/db/${dependencyVersion}/create">
<include name="activiti.${database}.create.*.sql"/>
</fileset>
</path>
</sql>
<echo message="generating data in ${releaseVersion}" />
<java classname="org.activiti.upgrade.UpgradeDataGenerator" fork="true">
<arg line="${database} ${releaseVersion}"/>
<classpath>
<path path="${test_classpath}"/>
</classpath>
</java>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
......@@ -133,55 +224,164 @@
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<failIfNoTests>false</failIfNoTests>
<trimStackTrace>false</trimStackTrace>
<!-- redirectTestOutputToFile>true</redirectTestOutputToFile -->
<includes>
<include>**/*AfterTest.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<!--
only worked with this version, there might be a bug with antrun
see http://jira.codehaus.org/browse/MANTRUN-109
-->
<version>1.4</version>
<executions>
<execution>
<id>customized.config.for.db</id>
<id>create.old.schema</id>
<phase>process-test-classes</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="updating activiti configuration for ${database}" />
<copy file="../../qa/upgrade/activiti.cfg.xml" todir="target/test-classes" overwrite="true">
<filterset filtersfile="${user.home}/.activiti/upgrade/build.${database}.properties" />
</copy>
</tasks>
<echo message="Property database: ${database}" />
<echo message="Property oldVersion: ${oldVersion}" />
<echo message="Property newVersion: ${newVersion}" />
<condition property="mandatoryPropertiesAvailable">
<and>
<isset property="database"/>
<isset property="oldVersion"/>
<isset property="newVersion"/>
</and>
</condition>
<fail unless="mandatoryPropertiesAvailable" message="please specify values for all the properties" />
<echo message="reading properties from ${user.home}/.activiti/upgrade/build.${database}.properties" />
<property file="${user.home}/.activiti/upgrade/build.${database}.properties" />
<echo message="creating old schema ${oldVersion}" />
<echo message=" jdbc driver.. ${jdbc.driver}" />
<echo message=" jdbc url..... ${jdbc.url}" />
<echo message=" jdbc username ${jdbc.username}" />
<property name="test_classpath" refid="maven.test.classpath" />
<sql driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" password="${jdbc.password}"
classpath="${test_classpath}"
onerror="continue">
<path>
<fileset dir="src/test/resources/org/activiti/db/clean">
<include name="clean.${database}.sql"/>
</fileset>
</path>
</sql>
<java classname="org.activiti.upgrade.CleanPostgres" fork="true">
<arg line="${database}"/>
<classpath>
<path path="${test_classpath}"/>
</classpath>
</java>
<sql driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" password="${jdbc.password}"
classpath="${test_classpath}">
<path>
<fileset dir="src/test/resources/org/activiti/db/${oldVersion}/create">
<include name="activiti.${database}.create.*.sql"/>
</fileset>
</path>
</sql>
<sql driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" password="${jdbc.password}"
classpath="${test_classpath}">
<path>
<fileset dir="src/test/resources/org/activiti/db/${oldVersion}/data">
<include name="${database}.data.sql"/>
</fileset>
</path>
</sql>
</tasks>
</configuration>
</execution>
<execution>
<id>database-test-drop-schema</id>
<id>drop.schema</id>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="dropping schema in ${database}" />
<echo message="reading properties from ${user.home}/.activiti/upgrade/build.${database}.properties" />
<property file="${user.home}/.activiti/upgrade/build.${database}.properties" />
<echo message="dropping new schema ${newVersion}" />
<echo message=" jdbc driver.. ${jdbc.driver}" />
<echo message=" jdbc url..... ${jdbc.url}" />
<echo message=" jdbc username ${jdbc.username}" />
<property name="test_classpath" refid="maven.test.classpath" />
<java classname="org.activiti.engine.impl.db.DbSchemaDrop" fork="true">
<classpath>
<path path="${test_classpath}"/>
</classpath>
</java>
<sql driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" password="${jdbc.password}"
classpath="${test_classpath}"
onerror="continue">
<path>
<fileset dir="src/test/resources/org/activiti/db/${newVersion}/drop">
<include name="activiti.${database}.drop.*.sql"/>
</fileset>
</path>
</sql>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<failIfNoTests>false</failIfNoTests>
<trimStackTrace>false</trimStackTrace>
<!-- redirectTestOutputToFile>true</redirectTestOutputToFile -->
<systemProperties>
<property>
<name>database</name>
<value>${database}</value>
</property>
</systemProperties>
<excludes>
<exclude>**/*TestCase.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>drop</id>
<properties>
<skipTests>true</skipTests>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>drop.schema</id>
<phase>process-test-classes</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="Property database: ${database}" />
<echo message="Property activitiVersion: ${activitiVersion}" />
<condition property="mandatoryPropertiesAvailable">
<and>
<isset property="database"/>
<isset property="activitiVersion"/>
</and>
</condition>
<fail unless="mandatoryPropertiesAvailable" message="please specify values for all the properties" />
<echo message="reading properties from ${user.home}/.activiti/upgrade/build.${database}.properties" />
<property file="${user.home}/.activiti/upgrade/build.${database}.properties" />
<echo message="dropping schema ${activitiVersion}" />
<echo message=" jdbc driver.. ${jdbc.driver}" />
<echo message=" jdbc url..... ${jdbc.url}" />
<echo message=" jdbc username ${jdbc.username}" />
<property name="test_classpath" refid="maven.test.classpath" />
<sql driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" password="${jdbc.password}"
classpath="${test_classpath}"
onerror="continue">
<path>
<fileset dir="src/test/resources/org/activiti/db/${activitiVersion}/create">
<include name="activiti.${database}.*.sql"/>
</fileset>
</path>
</sql>
</tasks>
</configuration>
</execution>
......
/* Licensed 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 org.activiti.upgrade;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.logging.Logger;
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.activiti.engine.impl.db.DbSqlSession;
import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.interceptor.CommandExecutor;
public class CleanPostgres {
private static Logger log = Logger.getLogger(CleanPostgres.class.getName());
static String[] cleanStatements = new String[] {
"drop table ACT_GE_PROPERTY cascade;",
"drop table ACT_GE_BYTEARRAY cascade;",
"drop table ACT_RE_MODEL cascade;",
"drop table ACT_RE_DEPLOYMENT cascade;",
"drop table ACT_RE_PROCDEF cascade;",
"drop table ACT_RU_IDENTITYLINK cascade;",
"drop table ACT_RU_VARIABLE cascade;",
"drop table ACT_RU_TASK cascade;",
"drop table ACT_RU_EXECUTION cascade;",
"drop table ACT_RU_JOB cascade;",
"drop table ACT_RU_EVENT_SUBSCR cascade;",
"drop table ACT_HI_PROCINST cascade;",
"drop table ACT_HI_ACTINST cascade;",
"drop table ACT_HI_VARINST cascade;",
"drop table ACT_HI_TASKINST cascade;",
"drop table ACT_HI_DETAIL cascade;",
"drop table ACT_HI_COMMENT cascade;",
"drop table ACT_HI_ATTACHMENT cascade;",
"drop table ACT_ID_INFO cascade;",
"drop table ACT_ID_MEMBERSHIP cascade;",
"drop table ACT_ID_GROUP cascade;",
"drop table ACT_ID_USER cascade;"};
public static void main(String[] args) {
try {
if ("postgres".equals(args[0])) {
ProcessEngineConfigurationImpl processEngineConfiguration = UpgradeTestCase.createProcessEngineConfiguration("postgres");
processEngineConfiguration.buildProcessEngine();
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
commandExecutor.execute(new Command<Object>() {
public Object execute(CommandContext commandContext) {
try {
Connection connection = commandContext.getSession(DbSqlSession.class).getSqlSession().getConnection();
connection.setAutoCommit(false);
for (String cleanStatement : cleanStatements) {
try {
PreparedStatement preparedStatement = connection.prepareStatement(cleanStatement);
preparedStatement.execute();
connection.commit();
log.info("executed ["+cleanStatement+"] successfully");
} catch (Exception e) {
log.info("ERROR WHILE EXECUTING ["+cleanStatement+"]:");
e.printStackTrace();
connection.rollback();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
});
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
/* Licensed 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 org.activiti.upgrade;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DatabaseFormatter {
static SimpleDateFormat defaultDateFormat = new SimpleDateFormat("''yyyy-MM-dd HH:mm:ss''");
public String formatDate(Date date) {
return defaultDateFormat.format(date);
}
public String formatBoolean(boolean b) {
return Boolean.toString(b);
}
public String formatBinary(byte[] bytes) {
StringBuffer sb = new StringBuffer();
sb.append("X'");
appendBytesInHex(sb, bytes);
sb.append("'");
return sb.toString();
}
protected void appendBytesInHex(StringBuffer sb, byte[] bytes) {
for (byte b : bytes) {
sb.append(String.format("%02X", b));
}
}
}
/* Licensed 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 org.activiti.upgrade;
import java.util.Date;
public class DatabaseFormatterDb2 extends DatabaseFormatter {
@Override
public String formatBinary(byte[] bytes) {
StringBuffer sb = new StringBuffer();
sb.append("blob(X'");
appendBytesInHex(sb, bytes);
sb.append("')");
return sb.toString();
}
@Override
public String formatBoolean(boolean b) {
return (b ? "1" : "0");
}
@Override
public String formatDate(Date date) {
StringBuffer sb = new StringBuffer();
sb.append("TIMESTAMP (");
sb.append(defaultDateFormat.format(date));
sb.append(")");
return sb.toString();
}
}
/* Licensed 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 org.activiti.upgrade;
public class DatabaseFormatterMsSqlServer extends DatabaseFormatter {
@Override
public String formatBinary(byte[] bytes) {
StringBuffer sb = new StringBuffer();
sb.append("0x");
appendBytesInHex(sb, bytes);
return sb.toString();
}
@Override
public String formatBoolean(boolean b) {
return (b ? "1" : "0");
}
}
/* Licensed 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 org.activiti.upgrade;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DatabaseFormatterOracle extends DatabaseFormatter {
static SimpleDateFormat oracleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SS");
public String formatDate(Date date) {
StringBuffer sb = new StringBuffer();
sb.append("to_timestamp('");
sb.append(oracleDateFormat.format(date));
sb.append("', 'YYYY-MM-DD HH:MI:SS.FF')");
return sb.toString();
}
@Override
public String formatBoolean(boolean b) {
return (b ? "1" : "0");
}
@Override
public String formatBinary(byte[] bytes) {
StringBuffer sb = new StringBuffer();
sb.append("hextoraw('");
appendBytesInHex(sb, bytes);
sb.append("')");
return sb.toString();
}
}
/* Licensed 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 org.activiti.upgrade;
public class DatabaseFormatterPostgres extends DatabaseFormatter {
@Override
public String formatBinary(byte[] bytes) {
StringBuffer sb = new StringBuffer();
sb.append("decode('");
appendBytesInHex(sb, bytes);
sb.append("', 'hex')");
return sb.toString();
}
}
/* Licensed 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 org.activiti.upgrade;
import java.sql.Array;
......@@ -17,6 +29,7 @@ import java.sql.Statement;
import java.sql.Struct;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Executor;
public class ProxyConnection implements Connection {
......@@ -229,4 +242,24 @@ public class ProxyConnection implements Connection {
public void setTypeMap(Map<String, Class< ? >> map) throws SQLException {
connection.setTypeMap(map);
}
public void setSchema(String schema) throws SQLException {
throw new RuntimeException("buzz");
}
public String getSchema() throws SQLException {
throw new RuntimeException("buzz");
}
public void abort(Executor executor) throws SQLException {
throw new RuntimeException("buzz");
}
public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
throw new RuntimeException("buzz");
}
public int getNetworkTimeout() throws SQLException {
throw new RuntimeException("buzz");
}
}
/* Licensed 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 org.activiti.upgrade;
import java.sql.Connection;
......@@ -5,16 +17,20 @@ import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.logging.Logger;
public class ProxyDriver implements Driver {
private static Logger log = Logger.getLogger(ProxyDriver.class.getName());
static String url;
static DatabaseFormatter databaseFormatter = new DatabaseFormatter();
static DateFormat dateFormat;
public static List<String> statements = new ArrayList<String>();
......@@ -29,9 +45,15 @@ public class ProxyDriver implements Driver {
public static void setUrl(String url) {
ProxyDriver.url = url;
if (url.startsWith("jdbc:mysql")) {
dateFormat = new SimpleDateFormat("''yyyy-MM-dd HH:mm:ss''");
}
if (url.startsWith("jdbc:oracle")) {
databaseFormatter = new DatabaseFormatterOracle();
} else if (url.startsWith("jdbc:sqlserver")) {
databaseFormatter = new DatabaseFormatterMsSqlServer();
} else if (url.startsWith("jdbc:db2")) {
databaseFormatter = new DatabaseFormatterDb2();
} else if (url.startsWith("jdbc:postgresql")) {
databaseFormatter = new DatabaseFormatterPostgres();
}
}
public boolean acceptsURL(String url) throws SQLException {
......@@ -39,7 +61,17 @@ public class ProxyDriver implements Driver {
}
public Connection connect(String url, Properties properties) throws SQLException {
Connection connection = DriverManager.getConnection(ProxyDriver.url, properties);
if (!"proxy".equals(url)) {
return null;
}
Connection connection;
try {
log.info("creating proxy connection to "+ProxyDriver.url);
connection = DriverManager.getConnection(ProxyDriver.url, properties);
} catch (SQLException e) {
e.printStackTrace();
throw e;
}
return new ProxyConnection(connection, this);
}
......@@ -59,4 +91,7 @@ public class ProxyDriver implements Driver {
throw new RuntimeException("buzz");
}
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
throw new RuntimeException("buzz");
}
}
/* Licensed 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 org.activiti.upgrade;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
......@@ -101,56 +114,64 @@ public class ProxyStatement implements PreparedStatement {
//////////////////////////////////////////////////////////////////////
public void setString(int parameterIndex, String x) throws SQLException {
parameters.put(parameterIndex, "'"+x+"'");
preparedStatement.setString(parameterIndex, x);
}
public void setBoolean(int parameterIndex, boolean x) throws SQLException {
parameters.put(parameterIndex, Boolean.toString(x));
preparedStatement.setBoolean(parameterIndex, x);
}
public void setNull(int parameterIndex, int sqlType) throws SQLException {
parameters.put(parameterIndex, "null");
preparedStatement.setNull(parameterIndex, sqlType);
}
public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException {
parameters.put(parameterIndex, "null");
preparedStatement.setNull(parameterIndex, sqlType, typeName);
}
public void setTime(int parameterIndex, Time x) throws SQLException {
parameters.put(parameterIndex, ProxyDriver.dateFormat.format(x));
preparedStatement.setTime(parameterIndex, x);
InputStream setInputStreamParameter(int parameterIndex, InputStream x) {
byte[] bytes = IoUtil.readInputStream(x, "jdbc variable bytes");
parameters.put(parameterIndex, ProxyDriver.databaseFormatter.formatBinary(bytes));
return new ByteArrayInputStream(bytes);
}
public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {
parameters.put(parameterIndex, ProxyDriver.dateFormat.format(x));
parameters.put(parameterIndex, ProxyDriver.databaseFormatter.formatDate(x));
preparedStatement.setTime(parameterIndex, x, cal);
}
public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException {
parameters.put(parameterIndex, ProxyDriver.dateFormat.format(x));
parameters.put(parameterIndex, ProxyDriver.databaseFormatter.formatDate(x));
preparedStatement.setTimestamp(parameterIndex, x);
}
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException {
parameters.put(parameterIndex, ProxyDriver.dateFormat.format(x));
parameters.put(parameterIndex, ProxyDriver.databaseFormatter.formatDate(x));
preparedStatement.setTimestamp(parameterIndex, x, cal);
}
public void setDate(int parameterIndex, Date x) throws SQLException {
parameters.put(parameterIndex, ProxyDriver.dateFormat.format(x));
parameters.put(parameterIndex, ProxyDriver.databaseFormatter.formatDate(x));
preparedStatement.setDate(parameterIndex, x);
}
public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
parameters.put(parameterIndex, ProxyDriver.dateFormat.format(x));
parameters.put(parameterIndex, ProxyDriver.databaseFormatter.formatDate(x));
preparedStatement.setDate(parameterIndex, x, cal);
}
public void setBoolean(int parameterIndex, boolean x) throws SQLException {
parameters.put(parameterIndex, ProxyDriver.databaseFormatter.formatBoolean(x));
preparedStatement.setBoolean(parameterIndex, x);
}
//////////////////////////////////////////////////////////////////////
public void setString(int parameterIndex, String x) throws SQLException {
parameters.put(parameterIndex, "'"+x+"'");
preparedStatement.setString(parameterIndex, x);
}
public void setNull(int parameterIndex, int sqlType) throws SQLException {
parameters.put(parameterIndex, "null");
preparedStatement.setNull(parameterIndex, sqlType);
}
public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException {
parameters.put(parameterIndex, "null");
preparedStatement.setNull(parameterIndex, sqlType, typeName);
}
public void setTime(int parameterIndex, Time x) throws SQLException {
parameters.put(parameterIndex, ProxyDriver.dateFormat.format(x));
preparedStatement.setTime(parameterIndex, x);
}
public void setInt(int parameterIndex, int x) throws SQLException {
parameters.put(parameterIndex, Integer.toString(x));
preparedStatement.setInt(parameterIndex, x);
......@@ -162,29 +183,20 @@ public class ProxyStatement implements PreparedStatement {
}
public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException {
setInputStreamParameter(parameterIndex, x);
x = setInputStreamParameter(parameterIndex, x);
preparedStatement.setBinaryStream(parameterIndex, x);
}
public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException {
setInputStreamParameter(parameterIndex, x);
x = setInputStreamParameter(parameterIndex, x);
preparedStatement.setBinaryStream(parameterIndex, x, length);
}
public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException {
setInputStreamParameter(parameterIndex, x);
x = setInputStreamParameter(parameterIndex, x);
preparedStatement.setBinaryStream(parameterIndex, x, length);
}
void setInputStreamParameter(int parameterIndex, InputStream x) {
byte[] bytes = IoUtil.readInputStream(x, "jdbc variable bytes");
StringBuffer sb = new StringBuffer();
for (byte b : bytes) {
sb.append(Integer.toHexString((int) (b & 0xff)));
}
parameters.put(parameterIndex, "0x"+sb.toString());
}
//////////////////////////////////////////////////////////////////////
public void setArray(int parameterIndex, Array x) throws SQLException {
......@@ -527,4 +539,11 @@ public class ProxyStatement implements PreparedStatement {
return preparedStatement.getParameterMetaData();
}
public void closeOnCompletion() throws SQLException {
throw new RuntimeException("buzz");
}
public boolean isCloseOnCompletion() throws SQLException {
throw new RuntimeException("buzz");
}
}
......@@ -12,18 +12,16 @@
*/
package org.activiti.upgrade;
import java.io.FileInputStream;
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.logging.Logger;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.activiti.engine.impl.db.DbSqlSession;
import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.interceptor.CommandExecutor;
import org.activiti.engine.impl.util.ClassNameUtil;
import org.activiti.engine.impl.util.LogUtil;
import org.activiti.upgrade.test.UpgradeTaskOneTest;
......@@ -34,7 +32,7 @@ import org.activiti.upgrade.test.UpgradeTaskTwoTest;
*/
public class UpgradeDataGenerator {
private static Logger log = Logger.getLogger(UpgradeTestCase.class.getName());
static Logger log = Logger.getLogger(UpgradeTestCase.class.getName());
static UpgradeTestCase[] upgradeTestCases = new UpgradeTestCase[]{
new UpgradeTaskOneTest(),
......@@ -42,44 +40,33 @@ public class UpgradeDataGenerator {
};
public static void main(String[] args) {
ProcessEngineConfigurationImpl processEngineConfiguration = null;
try {
LogUtil.readJavaUtilLoggingConfigFromClasspath();
if (args==null || args.length!=1) {
throw new RuntimeException("exactly argument expected: database");
if (args==null || args.length!=2) {
throw new RuntimeException("exactly 2 arguments expected: database and releaseVersion");
}
String database = args[0];
String releaseVersion = args[1];
log.fine("database: "+database);
log.fine("releaseVersion: "+releaseVersion);
ProcessEngineConfiguration processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
.createStandaloneProcessEngineConfiguration()
.setHistory("full")
.setJobExecutorActivate(false);
processEngineConfiguration = UpgradeTestCase.createProcessEngineConfiguration(database);
// loading properties
log.fine("loading properties...");
String propertiesFileName = System.getProperty("user.home")+System.getProperty("file.separator")+".activiti"+System.getProperty("file.separator")+"jdbc"+System.getProperty("file.separator")+"build."+database+".properties";
Properties properties = new Properties();
properties.load(new FileInputStream(propertiesFileName));
log.fine("jdbc url.....: "+processEngineConfiguration.getJdbcUrl());
log.fine("jdbc username: "+processEngineConfiguration.getJdbcUsername());
// install the jdbc proxy driver
log.fine("installing jdbc proxy driver...");
ProxyDriver.setUrl(properties.getProperty("jdbc.url"));
DriverManager.registerDriver(new ProxyDriver());
// configure the jdbc parameters in the process engine configuration
processEngineConfiguration.setJdbcDriver(properties.getProperty("jdbc.driver"));
log.fine("installing jdbc proxy driver delegating to "+processEngineConfiguration.getJdbcUrl());
ProxyDriver.setUrl(processEngineConfiguration.getJdbcUrl());
processEngineConfiguration.setJdbcUrl("proxy");
processEngineConfiguration.setJdbcUsername(properties.getProperty("jdbc.username"));
processEngineConfiguration.setJdbcPassword(properties.getProperty("jdbc.password"));
DriverManager.registerDriver(new ProxyDriver());
log.fine("building the process engine...");
ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
log.fine("deploy processes and start process instances");
UpgradeTestCase.setProcessEngine(processEngine);
......@@ -89,15 +76,33 @@ public class UpgradeDataGenerator {
}
log.fine("### Captured SQL");
PrintWriter file = new PrintWriter("src/test/resources/org/activiti/db/"+releaseVersion+"/data/"+database+".data.sql");
System.err.println();
System.err.println();
for (String statement: ProxyDriver.statements) {
System.err.println(statement);
System.err.println();
file.println(statement);
file.println();
}
file.close();
} catch (Exception e) {
e.printStackTrace();
}
dbSchemaDrop(processEngineConfiguration);
}
private static void dbSchemaDrop(ProcessEngineConfigurationImpl processEngineConfiguration) {
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
commandExecutor.execute(new Command<Object> (){
public Object execute(CommandContext commandContext) {
commandContext
.getSession(DbSqlSession.class)
.dbSchemaDrop();
return null;
}
});
}
}
/* Licensed 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 org.activiti.upgrade;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import junit.framework.TestCase;
import org.activiti.engine.HistoryService;
......@@ -8,12 +25,15 @@ import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.activiti.engine.impl.util.LogUtil;
import org.junit.Ignore;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
@Ignore
public abstract class UpgradeTestCase extends TestCase {
static {
......@@ -43,6 +63,19 @@ public abstract class UpgradeTestCase extends TestCase {
}
}
}
@Override
protected void setUp() throws Exception {
super.setUp();
if (processEngine==null) {
String database = System.getProperty("database");
UpgradeDataGenerator.log.fine("Configuration properties...");
UpgradeDataGenerator.log.fine("database.....:"+database);
setProcessEngine(createProcessEngineConfiguration(database).buildProcessEngine());
}
}
public static void setProcessEngine(ProcessEngine processEngine) {
UpgradeTestCase.processEngine = processEngine;
......@@ -53,4 +86,29 @@ public abstract class UpgradeTestCase extends TestCase {
}
public abstract void runInTheOldVersion();
public static ProcessEngineConfigurationImpl createProcessEngineConfiguration(String database) throws Exception {
ProcessEngineConfigurationImpl processEngineConfiguration;
processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
.createStandaloneProcessEngineConfiguration()
.setDatabaseSchemaUpdate("true")
.setHistory("full")
.setJobExecutorActivate(false);
// loading properties
String propertiesFileName = System.getProperty("user.home")+System.getProperty("file.separator")+".activiti"+System.getProperty("file.separator")+"upgrade"+System.getProperty("file.separator")+"build."+database+".properties";
Properties properties = new Properties();
properties.load(new FileInputStream(propertiesFileName));
// configure the jdbc parameters in the process engine configuration
processEngineConfiguration.setJdbcDriver(properties.getProperty("jdbc.driver"));
processEngineConfiguration.setJdbcUrl(properties.getProperty("jdbc.url"));
processEngineConfiguration.setJdbcUsername(properties.getProperty("jdbc.username"));
processEngineConfiguration.setJdbcPassword(properties.getProperty("jdbc.password"));
UpgradeDataGenerator.log.fine("jdbc url.....: "+processEngineConfiguration.getJdbcUrl());
UpgradeDataGenerator.log.fine("jdbc username: "+processEngineConfiguration.getJdbcUsername());
return processEngineConfiguration;
}
}
/* Licensed 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 org.activiti.upgrade.test;
import org.activiti.engine.HistoryService;
......
/* Licensed 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 org.activiti.upgrade.test;
import java.util.HashMap;
......
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<property name="jdbcDriver" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/activiti?autoReconnect=true" />
<property name="jdbcUsername" value="activiti" />
<property name="jdbcPassword" value="activiti" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jobExecutorActivate" value="false" />
<property name="history" value="full" />
</bean>
</beans>
handlers = java.util.logging.ConsoleHandler
.level = FINE
.level = FINE
java.util.logging.ConsoleHandler.level=FINEST
java.util.logging.ConsoleHandler.formatter=org.activiti.engine.impl.util.LogUtil$LogFormatter
create table ACT_GE_PROPERTY (
NAME_ varchar(64),
VALUE_ varchar(300),
REV_ integer,
primary key (NAME_)
);
insert into ACT_GE_PROPERTY
values ('schema.version', '5.0', 1);
insert into ACT_GE_PROPERTY
values ('next.dbid', '1', 1);
create table ACT_GE_BYTEARRAY (
ID_ varchar(64),
REV_ integer,
NAME_ varchar(255),
DEPLOYMENT_ID_ varchar(64),
BYTES_ longvarbinary,
primary key (ID_)
);
create table ACT_RE_DEPLOYMENT (
ID_ varchar(64),
NAME_ varchar(255),
DEPLOY_TIME_ timestamp,
primary key (ID_)
);
create table ACT_RU_EXECUTION (
ID_ varchar(64),
REV_ integer,
PROC_INST_ID_ varchar(64),
BUSINESS_KEY_ varchar(255),
PARENT_ID_ varchar(64),
PROC_DEF_ID_ varchar(64),
SUPER_EXEC_ varchar(64),
ACT_ID_ varchar(255),
IS_ACTIVE_ bit,
IS_CONCURRENT_ bit,
IS_SCOPE_ bit,
primary key (ID_)
);
create table ACT_RU_JOB (
ID_ varchar(64) NOT NULL,
REV_ integer,
TYPE_ varchar(255) NOT NULL,
LOCK_EXP_TIME_ timestamp,
LOCK_OWNER_ varchar(255),
EXCLUSIVE_ boolean,
EXECUTION_ID_ varchar(64),
PROCESS_INSTANCE_ID_ varchar(64),
RETRIES_ integer,
EXCEPTION_STACK_ID_ varchar(64),
EXCEPTION_MSG_ varchar(255),
DUEDATE_ timestamp,
REPEAT_ varchar(255),
HANDLER_TYPE_ varchar(255),
HANDLER_CFG_ varchar(255),
primary key (ID_)
);
create table ACT_ID_GROUP (
ID_ varchar(64),
REV_ integer,
NAME_ varchar(255),
TYPE_ varchar(255),
primary key (ID_)
);
create table ACT_ID_MEMBERSHIP (
USER_ID_ varchar(64),
GROUP_ID_ varchar(64),
primary key (USER_ID_, GROUP_ID_)
);
create table ACT_ID_USER (
ID_ varchar(64),
REV_ integer,
FIRST_ varchar(255),
LAST_ varchar(255),
EMAIL_ varchar(255),
PWD_ varchar(255),
primary key (ID_)
);
create table ACT_RE_PROCDEF (
ID_ varchar(64),
CATEGORY_ varchar(255),
NAME_ varchar(255),
KEY_ varchar(255),
VERSION_ integer,
DEPLOYMENT_ID_ varchar(64),
RESOURCE_NAME_ varchar(255),
DGRM_RESOURCE_NAME_ varchar(255),
HAS_START_FORM_KEY_ bit,
primary key (ID_)
);
create table ACT_RU_TASK (
ID_ varchar(64),
REV_ integer,
EXECUTION_ID_ varchar(64),
PROC_INST_ID_ varchar(64),
PROC_DEF_ID_ varchar(64),
NAME_ varchar(255),
DESCRIPTION_ varchar(255),
TASK_DEF_KEY_ varchar(255),
ASSIGNEE_ varchar(64),
PRIORITY_ integer,
CREATE_TIME_ timestamp,
primary key (ID_)
);
create table ACT_RU_IDENTITYLINK (
ID_ varchar(64),
REV_ integer,
GROUP_ID_ varchar(64),
TYPE_ varchar(255),
USER_ID_ varchar(64),
TASK_ID_ varchar(64),
primary key (ID_)
);
create table ACT_RU_VARIABLE (
ID_ varchar(64) not null,
REV_ integer,
TYPE_ varchar(255) not null,
NAME_ varchar(255) not null,
EXECUTION_ID_ varchar(64),
PROC_INST_ID_ varchar(64),
BYTEARRAY_ID_ varchar(64),
DOUBLE_ double,
LONG_ bigint,
TEXT_ varchar(255),
TEXT2_ varchar(255),
primary key (ID_)
);
create table ACT_HI_PROCINST (
ID_ varchar(64) not null,
PROC_INST_ID_ varchar(64) not null,
BUSINESS_KEY_ varchar(255),
PROC_DEF_ID_ varchar(64) not null,
START_TIME_ timestamp not null,
END_TIME_ timestamp,
DURATION_ bigint,
START_USER_ID_ varchar(255),
START_ACT_ID_ varchar(255),
END_ACT_ID_ varchar(255),
primary key (ID_),
unique (PROC_INST_ID_)
);
create table ACT_HI_ACTINST (
ID_ varchar(64) not null,
PROC_DEF_ID_ varchar(64) not null,
PROC_INST_ID_ varchar(64) not null,
EXECUTION_ID_ varchar(64) not null,
ACT_ID_ varchar(255) not null,
ACT_NAME_ varchar(255),
ACT_TYPE_ varchar(255) not null,
ASSIGNEE_ varchar(64),
START_TIME_ timestamp not null,
END_TIME_ timestamp,
DURATION_ bigint,
primary key (ID_)
);
create table ACT_HI_DETAIL (
ID_ varchar(64) not null,
TYPE_ varchar(255) not null,
PROC_INST_ID_ varchar(64) not null,
EXECUTION_ID_ varchar(64) not null,
ACT_INST_ID_ varchar(64),
NAME_ varchar(255) not null,
VAR_TYPE_ varchar(255),
REV_ integer,
TIME_ timestamp not null,
BYTEARRAY_ID_ varchar(64),
DOUBLE_ double,
LONG_ bigint,
TEXT_ varchar(255),
TEXT2_ varchar(255),
primary key (ID_)
);
create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_);
create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_);
create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_);
create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_);
create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_);
create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_);
create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_);
create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_);
create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_);
create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_);
create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_);
create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_);
alter table ACT_GE_BYTEARRAY
add constraint ACT_FK_BYTEARR_DEPL
foreign key (DEPLOYMENT_ID_)
references ACT_RE_DEPLOYMENT;
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_PROCINST
foreign key (PROC_INST_ID_)
references ACT_RU_EXECUTION;
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_PARENT
foreign key (PARENT_ID_)
references ACT_RU_EXECUTION;
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_SUPER
foreign key (SUPER_EXEC_)
references ACT_RU_EXECUTION;
alter table ACT_RU_EXECUTION
add constraint ACT_UNIQ_RU_BUS_KEY
unique(PROC_DEF_ID_, BUSINESS_KEY_);
alter table ACT_HI_PROCINST
add constraint ACT_UNIQ_HI_BUS_KEY
unique(PROC_DEF_ID_, BUSINESS_KEY_);
alter table ACT_ID_MEMBERSHIP
add constraint ACT_FK_MEMB_GROUP
foreign key (GROUP_ID_)
references ACT_ID_GROUP;
alter table ACT_ID_MEMBERSHIP
add constraint ACT_FK_MEMB_USER
foreign key (USER_ID_)
references ACT_ID_USER;
alter table ACT_RU_IDENTITYLINK
add constraint ACT_FK_TSKASS_TASK
foreign key (TASK_ID_)
references ACT_RU_TASK;
alter table ACT_RU_TASK
add constraint ACT_FK_TASK_EXE
foreign key (EXECUTION_ID_)
references ACT_RU_EXECUTION;
alter table ACT_RU_TASK
add constraint ACT_FK_TASK_PROCINST
foreign key (PROC_INST_ID_)
references ACT_RU_EXECUTION;
alter table ACT_RU_TASK
add constraint ACT_FK_TASK_PROCDEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF;
alter table ACT_RU_VARIABLE
add constraint ACT_FK_VAR_EXE
foreign key (EXECUTION_ID_)
references ACT_RU_EXECUTION;
alter table ACT_RU_VARIABLE
add constraint ACT_FK_VAR_PROCINST
foreign key (PROC_INST_ID_)
references ACT_RU_EXECUTION;
alter table ACT_RU_VARIABLE
add constraint ACT_FK_VAR_BYTEARRAY
foreign key (BYTEARRAY_ID_)
references ACT_GE_BYTEARRAY;
alter table ACT_RU_JOB
add constraint ACT_FK_JOB_EXCEPTION
foreign key (EXCEPTION_STACK_ID_)
references ACT_GE_BYTEARRAY;
create table ACT_GE_PROPERTY (
NAME_ varchar(64),
VALUE_ varchar(300),
REV_ integer,
primary key (NAME_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
insert into ACT_GE_PROPERTY
values ('schema.version', '5.0', 1);
insert into ACT_GE_PROPERTY
values ('next.dbid', '1', 1);
create table ACT_GE_BYTEARRAY (
ID_ varchar(64),
REV_ integer,
NAME_ varchar(255),
DEPLOYMENT_ID_ varchar(64),
BYTES_ LONGBLOB,
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
create table ACT_RE_DEPLOYMENT (
ID_ varchar(64),
NAME_ varchar(255),
DEPLOY_TIME_ timestamp,
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
create table ACT_RU_EXECUTION (
ID_ varchar(64),
REV_ integer,
PROC_INST_ID_ varchar(64),
BUSINESS_KEY_ varchar(255),
PARENT_ID_ varchar(64),
PROC_DEF_ID_ varchar(64),
SUPER_EXEC_ varchar(64),
ACT_ID_ varchar(255),
IS_ACTIVE_ TINYINT,
IS_CONCURRENT_ TINYINT,
IS_SCOPE_ TINYINT,
primary key (ID_),
unique ACT_UNIQ_RU_BUS_KEY (PROC_DEF_ID_, BUSINESS_KEY_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
create table ACT_RU_JOB (
ID_ varchar(64) NOT NULL,
REV_ integer,
TYPE_ varchar(255) NOT NULL,
LOCK_EXP_TIME_ timestamp,
LOCK_OWNER_ varchar(255),
EXCLUSIVE_ boolean,
EXECUTION_ID_ varchar(64),
PROCESS_INSTANCE_ID_ varchar(64),
RETRIES_ integer,
EXCEPTION_STACK_ID_ varchar(64),
EXCEPTION_MSG_ varchar(255),
DUEDATE_ timestamp NULL,
REPEAT_ varchar(255),
HANDLER_TYPE_ varchar(255),
HANDLER_CFG_ varchar(255),
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
create table ACT_ID_GROUP (
ID_ varchar(64),
REV_ integer,
NAME_ varchar(255),
TYPE_ varchar(255),
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
create table ACT_ID_MEMBERSHIP (
USER_ID_ varchar(64),
GROUP_ID_ varchar(64),
primary key (USER_ID_, GROUP_ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
create table ACT_ID_USER (
ID_ varchar(64),
REV_ integer,
FIRST_ varchar(255),
LAST_ varchar(255),
EMAIL_ varchar(255),
PWD_ varchar(255),
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
create table ACT_RE_PROCDEF (
ID_ varchar(64),
CATEGORY_ varchar(255),
NAME_ varchar(255),
KEY_ varchar(255),
VERSION_ integer,
DEPLOYMENT_ID_ varchar(64),
RESOURCE_NAME_ varchar(255),
DGRM_RESOURCE_NAME_ varchar(255),
HAS_START_FORM_KEY_ TINYINT,
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
create table ACT_RU_TASK (
ID_ varchar(64),
REV_ integer,
EXECUTION_ID_ varchar(64),
PROC_INST_ID_ varchar(64),
PROC_DEF_ID_ varchar(64),
NAME_ varchar(255),
DESCRIPTION_ varchar(255),
TASK_DEF_KEY_ varchar(255),
ASSIGNEE_ varchar(64),
PRIORITY_ integer,
CREATE_TIME_ timestamp,
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
create table ACT_RU_IDENTITYLINK (
ID_ varchar(64),
REV_ integer,
GROUP_ID_ varchar(64),
TYPE_ varchar(255),
USER_ID_ varchar(64),
TASK_ID_ varchar(64),
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
create table ACT_RU_VARIABLE (
ID_ varchar(64) not null,
REV_ integer,
TYPE_ varchar(255) not null,
NAME_ varchar(255) not null,
EXECUTION_ID_ varchar(64),
PROC_INST_ID_ varchar(64),
TASK_ID_ varchar(64),
BYTEARRAY_ID_ varchar(64),
DOUBLE_ double,
LONG_ bigint,
TEXT_ varchar(255),
TEXT2_ varchar(255),
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
create table ACT_HI_PROCINST (
ID_ varchar(64) not null,
PROC_INST_ID_ varchar(64) not null,
BUSINESS_KEY_ varchar(255),
PROC_DEF_ID_ varchar(64) not null,
START_TIME_ datetime not null,
END_TIME_ datetime,
DURATION_ bigint,
START_USER_ID_ varchar(255),
START_ACT_ID_ varchar(255),
END_ACT_ID_ varchar(255),
primary key (ID_),
unique (PROC_INST_ID_),
unique ACT_UNIQ_HI_BUS_KEY (PROC_DEF_ID_, BUSINESS_KEY_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
create table ACT_HI_ACTINST (
ID_ varchar(64) not null,
PROC_DEF_ID_ varchar(64) not null,
PROC_INST_ID_ varchar(64) not null,
EXECUTION_ID_ varchar(64) not null,
ACT_ID_ varchar(255) not null,
ACT_NAME_ varchar(255),
ACT_TYPE_ varchar(255) not null,
ASSIGNEE_ varchar(64),
START_TIME_ datetime not null,
END_TIME_ datetime,
DURATION_ bigint,
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
create table ACT_HI_DETAIL (
ID_ varchar(64) not null,
TYPE_ varchar(255) not null,
PROC_INST_ID_ varchar(64) not null,
EXECUTION_ID_ varchar(64) not null,
ACT_INST_ID_ varchar(64),
NAME_ varchar(255) not null,
VAR_TYPE_ varchar(255),
REV_ integer,
TIME_ datetime not null,
BYTEARRAY_ID_ varchar(64),
DOUBLE_ double,
LONG_ bigint,
TEXT_ varchar(255),
TEXT2_ varchar(255),
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_);
create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_);
create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_);
create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_);
create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_);
create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_);
create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_);
create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_);
create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_);
create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_);
create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_);
create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_);
alter table ACT_GE_BYTEARRAY
add constraint ACT_FK_BYTEARR_DEPL
foreign key (DEPLOYMENT_ID_)
references ACT_RE_DEPLOYMENT (ID_);
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_PROCINST
foreign key (PROC_INST_ID_)
references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade;
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_PARENT
foreign key (PARENT_ID_)
references ACT_RU_EXECUTION (ID_);
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_SUPER
foreign key (SUPER_EXEC_)
references ACT_RU_EXECUTION (ID_);
alter table ACT_ID_MEMBERSHIP
add constraint ACT_FK_MEMB_GROUP
foreign key (GROUP_ID_)
references ACT_ID_GROUP (ID_);
alter table ACT_ID_MEMBERSHIP
add constraint ACT_FK_MEMB_USER
foreign key (USER_ID_)
references ACT_ID_USER (ID_);
alter table ACT_RU_IDENTITYLINK
add constraint ACT_FK_TSKASS_TASK
foreign key (TASK_ID_)
references ACT_RU_TASK (ID_);
alter table ACT_RU_TASK
add constraint ACT_FK_TASK_EXE
foreign key (EXECUTION_ID_)
references ACT_RU_EXECUTION (ID_);
alter table ACT_RU_TASK
add constraint ACT_FK_TASK_PROCINST
foreign key (PROC_INST_ID_)
references ACT_RU_EXECUTION (ID_);
alter table ACT_RU_TASK
add constraint ACT_FK_TASK_PROCDEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);
alter table ACT_RU_VARIABLE
add constraint ACT_FK_VAR_EXE
foreign key (EXECUTION_ID_)
references ACT_RU_EXECUTION (ID_);
alter table ACT_RU_VARIABLE
add constraint ACT_FK_VAR_PROCINST
foreign key (PROC_INST_ID_)
references ACT_RU_EXECUTION(ID_);
alter table ACT_RU_VARIABLE
add constraint ACT_FK_VAR_BYTEARRAY
foreign key (BYTEARRAY_ID_)
references ACT_GE_BYTEARRAY (ID_);
alter table ACT_RU_JOB
add constraint ACT_FK_JOB_EXCEPTION
foreign key (EXCEPTION_STACK_ID_)
references ACT_GE_BYTEARRAY (ID_);
\ No newline at end of file
create table ACT_GE_PROPERTY (
NAME_ NVARCHAR2(64),
VALUE_ NVARCHAR2(300),
REV_ INTEGER,
primary key (NAME_)
);
insert into ACT_GE_PROPERTY
values ('schema.version', '5.0', 1);
insert into ACT_GE_PROPERTY
values ('next.dbid', '1', 1);
create table ACT_GE_BYTEARRAY (
ID_ NVARCHAR2(64),
REV_ INTEGER,
NAME_ NVARCHAR2(255),
DEPLOYMENT_ID_ NVARCHAR2(64),
BYTES_ BLOB,
primary key (ID_)
);
create table ACT_RE_DEPLOYMENT (
ID_ NVARCHAR2(64),
NAME_ NVARCHAR2(255),
DEPLOY_TIME_ TIMESTAMP(6),
primary key (ID_)
);
create table ACT_RU_EXECUTION (
ID_ NVARCHAR2(64),
REV_ INTEGER,
PROC_INST_ID_ NVARCHAR2(64),
BUSINESS_KEY_ NVARCHAR2(255),
PARENT_ID_ NVARCHAR2(64),
PROC_DEF_ID_ NVARCHAR2(64),
SUPER_EXEC_ NVARCHAR2(64),
ACT_ID_ NVARCHAR2(255),
IS_ACTIVE_ NUMBER(1,0) CHECK (IS_ACTIVE_ IN (1,0)),
IS_CONCURRENT_ NUMBER(1,0) CHECK (IS_CONCURRENT_ IN (1,0)),
IS_SCOPE_ NUMBER(1,0) CHECK (IS_SCOPE_ IN (1,0)),
primary key (ID_)
);
create table ACT_RU_JOB (
ID_ NVARCHAR2(64) NOT NULL,
REV_ INTEGER,
TYPE_ NVARCHAR2(255) NOT NULL,
LOCK_EXP_TIME_ TIMESTAMP(6),
LOCK_OWNER_ NVARCHAR2(255),
EXCLUSIVE_ NUMBER(1,0) CHECK (EXCLUSIVE_ IN (1,0)),
EXECUTION_ID_ NVARCHAR2(64),
PROCESS_INSTANCE_ID_ NVARCHAR2(64),
RETRIES_ INTEGER,
EXCEPTION_STACK_ID_ NVARCHAR2(64),
EXCEPTION_MSG_ NVARCHAR2(255),
DUEDATE_ TIMESTAMP(6),
REPEAT_ NVARCHAR2(255),
HANDLER_TYPE_ NVARCHAR2(255),
HANDLER_CFG_ NVARCHAR2(255),
primary key (ID_)
);
create table ACT_ID_GROUP (
ID_ NVARCHAR2(64),
REV_ INTEGER,
NAME_ NVARCHAR2(255),
TYPE_ NVARCHAR2(255),
primary key (ID_)
);
create table ACT_ID_MEMBERSHIP (
USER_ID_ NVARCHAR2(64),
GROUP_ID_ NVARCHAR2(64),
primary key (USER_ID_, GROUP_ID_)
);
create table ACT_ID_USER (
ID_ NVARCHAR2(64),
REV_ INTEGER,
FIRST_ NVARCHAR2(255),
LAST_ NVARCHAR2(255),
EMAIL_ NVARCHAR2(255),
PWD_ NVARCHAR2(255),
primary key (ID_)
);
create table ACT_RE_PROCDEF (
ID_ NVARCHAR2(64),
CATEGORY_ NVARCHAR2(255),
NAME_ NVARCHAR2(255),
KEY_ NVARCHAR2(255),
VERSION_ INTEGER,
DEPLOYMENT_ID_ NVARCHAR2(64),
RESOURCE_NAME_ NVARCHAR2(255),
DGRM_RESOURCE_NAME_ varchar(255),
HAS_START_FORM_KEY_ NUMBER(1,0) CHECK (HAS_START_FORM_KEY_ IN (1,0)),
primary key (ID_)
);
create table ACT_RU_TASK (
ID_ NVARCHAR2(64),
REV_ INTEGER,
EXECUTION_ID_ NVARCHAR2(64),
PROC_INST_ID_ NVARCHAR2(64),
PROC_DEF_ID_ NVARCHAR2(64),
NAME_ NVARCHAR2(255),
DESCRIPTION_ NVARCHAR2(255),
TASK_DEF_KEY_ NVARCHAR2(255),
ASSIGNEE_ NVARCHAR2(64),
PRIORITY_ INTEGER,
CREATE_TIME_ TIMESTAMP(6),
primary key (ID_)
);
create table ACT_RU_IDENTITYLINK (
ID_ NVARCHAR2(64),
REV_ INTEGER,
GROUP_ID_ NVARCHAR2(64),
TYPE_ NVARCHAR2(255),
USER_ID_ NVARCHAR2(64),
TASK_ID_ NVARCHAR2(64),
primary key (ID_)
);
create table ACT_RU_VARIABLE (
ID_ NVARCHAR2(64) not null,
REV_ INTEGER,
TYPE_ NVARCHAR2(255) not null,
NAME_ NVARCHAR2(255) not null,
EXECUTION_ID_ NVARCHAR2(64),
PROC_INST_ID_ NVARCHAR2(64),
TASK_ID_ NVARCHAR2(64),
BYTEARRAY_ID_ NVARCHAR2(64),
DOUBLE_ NUMBER(*,10),
LONG_ NUMBER(19,0),
TEXT_ NVARCHAR2(255),
TEXT2_ NVARCHAR2(255),
primary key (ID_)
);
create table ACT_HI_PROCINST (
ID_ NVARCHAR2(64) not null,
PROC_INST_ID_ NVARCHAR2(64) not null,
BUSINESS_KEY_ NVARCHAR2(255),
PROC_DEF_ID_ NVARCHAR2(64) not null,
START_TIME_ TIMESTAMP(6) not null,
END_TIME_ TIMESTAMP(6),
DURATION_ NUMBER(19,0),
START_USER_ID_ NVARCHAR2(255),
START_ACT_ID_ NVARCHAR2(255),
END_ACT_ID_ NVARCHAR2(255),
primary key (ID_),
unique (PROC_INST_ID_)
);
create table ACT_HI_ACTINST (
ID_ NVARCHAR2(64) not null,
PROC_DEF_ID_ NVARCHAR2(64) not null,
PROC_INST_ID_ NVARCHAR2(64) not null,
EXECUTION_ID_ NVARCHAR2(64) not null,
ACT_ID_ NVARCHAR2(255) not null,
ACT_NAME_ NVARCHAR2(255),
ACT_TYPE_ NVARCHAR2(255) not null,
ASSIGNEE_ NVARCHAR2(64),
START_TIME_ TIMESTAMP(6) not null,
END_TIME_ TIMESTAMP(6),
DURATION_ NUMBER(19,0),
primary key (ID_)
);
create table ACT_HI_DETAIL (
ID_ varchar(64) not null,
TYPE_ NVARCHAR2(255) not null,
PROC_INST_ID_ NVARCHAR2(64) not null,
EXECUTION_ID_ NVARCHAR2(64) not null,
ACT_INST_ID_ NVARCHAR2(64),
NAME_ NVARCHAR2(255) not null,
VAR_TYPE_ NVARCHAR2(64),
REV_ INTEGER,
TIME_ TIMESTAMP(6) not null,
BYTEARRAY_ID_ NVARCHAR2(64),
DOUBLE_ NUMBER(*,10),
LONG_ NUMBER(19,0),
TEXT_ NVARCHAR2(255),
TEXT2_ NVARCHAR2(255),
primary key (ID_)
);
create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_);
create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_);
create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_);
create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_);
create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_);
create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_);
create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_);
create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_);
create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_);
create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_);
create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_);
create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_);
create index ACT_IDX_BYTEAR_DEPL on ACT_GE_BYTEARRAY(DEPLOYMENT_ID_);
alter table ACT_GE_BYTEARRAY
add constraint ACT_FK_BYTEARR_DEPL
foreign key (DEPLOYMENT_ID_)
references ACT_RE_DEPLOYMENT (ID_);
create index ACT_IDX_EXE_PROCINST on ACT_RU_EXECUTION(PROC_INST_ID_);
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_PROCINST
foreign key (PROC_INST_ID_)
references ACT_RU_EXECUTION (ID_);
create index ACT_IDX_EXE_PARENT on ACT_RU_EXECUTION(PARENT_ID_);
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_PARENT
foreign key (PARENT_ID_)
references ACT_RU_EXECUTION (ID_);
create index ACT_IDX_EXE_SUPER on ACT_RU_EXECUTION(SUPER_EXEC_);
alter table ACT_RU_EXECUTION
add constraint ACT_FK_EXE_SUPER
foreign key (SUPER_EXEC_)
references ACT_RU_EXECUTION (ID_);
create index ACT_IDX_MEMB_GROUP on ACT_ID_MEMBERSHIP(GROUP_ID_);
alter table ACT_ID_MEMBERSHIP
add constraint ACT_FK_MEMB_GROUP
foreign key (GROUP_ID_)
references ACT_ID_GROUP (ID_);
create index ACT_IDX_MEMB_USER on ACT_ID_MEMBERSHIP(USER_ID_);
alter table ACT_ID_MEMBERSHIP
add constraint ACT_FK_MEMB_USER
foreign key (USER_ID_)
references ACT_ID_USER (ID_);
create index ACT_IDX_TSKASS_TASK on ACT_RU_IDENTITYLINK(TASK_ID_);
alter table ACT_RU_IDENTITYLINK
add constraint ACT_FK_TSKASS_TASK
foreign key (TASK_ID_)
references ACT_RU_TASK (ID_);
create index ACT_IDX_TASK_EXEC on ACT_RU_TASK(EXECUTION_ID_);
alter table ACT_RU_TASK
add constraint ACT_FK_TASK_EXE
foreign key (EXECUTION_ID_)
references ACT_RU_EXECUTION (ID_);
create index ACT_IDX_TASK_PROCINST on ACT_RU_TASK(PROC_INST_ID_);
alter table ACT_RU_TASK
add constraint ACT_FK_TASK_PROCINST
foreign key (PROC_INST_ID_)
references ACT_RU_EXECUTION (ID_);
create index ACT_IDX_TASK_PROCDEF on ACT_RU_TASK(PROC_DEF_ID_);
alter table ACT_RU_TASK
add constraint ACT_FK_TASK_PROCDEF
foreign key (PROC_DEF_ID_)
references ACT_RE_PROCDEF (ID_);
create index ACT_IDX_VAR_EXE on ACT_RU_VARIABLE(EXECUTION_ID_);
alter table ACT_RU_VARIABLE
add constraint ACT_FK_VAR_EXE
foreign key (EXECUTION_ID_)
references ACT_RU_EXECUTION (ID_);
create index ACT_IDX_VAR_PROCINST on ACT_RU_VARIABLE(PROC_INST_ID_);
alter table ACT_RU_VARIABLE
add constraint ACT_FK_VAR_PROCINST
foreign key (PROC_INST_ID_)
references ACT_RU_EXECUTION(ID_);
create index ACT_IDX_VAR_BYTEARRAY on ACT_RU_VARIABLE(BYTEARRAY_ID_);
alter table ACT_RU_VARIABLE
add constraint ACT_FK_VAR_BYTEARRAY
foreign key (BYTEARRAY_ID_)
references ACT_GE_BYTEARRAY (ID_);
create index ACT_IDX_JOB_EXCEPTION on ACT_RU_JOB(EXCEPTION_STACK_ID_);
alter table ACT_RU_JOB
add constraint ACT_FK_JOB_EXCEPTION
foreign key (EXCEPTION_STACK_ID_)
references ACT_GE_BYTEARRAY (ID_);
-- see http://stackoverflow.com/questions/675398/how-can-i-constrain-multiple-columns-to-prevent-duplicates-but-ignore-null-value
create unique index ACT_UNIQ_RU_BUS_KEY on ACT_RU_EXECUTION
(case when BUSINESS_KEY_ is null then null else PROC_DEF_ID_ end,
case when BUSINESS_KEY_ is null then null else BUSINESS_KEY_ end);
-- see http://stackoverflow.com/questions/675398/how-can-i-constrain-multiple-columns-to-prevent-duplicates-but-ignore-null-value
create unique index ACT_UNIQ_HI_BUS_KEY on ACT_HI_PROCINST
(case when BUSINESS_KEY_ is null then null else PROC_DEF_ID_ end,
case when BUSINESS_KEY_ is null then null else BUSINESS_KEY_ end);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册