001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.bpmscript;
018:
019: import java.io.Serializable;
020: import java.sql.Timestamp;
021: import java.util.List;
022:
023: public class ProcessInstance extends TimeStampedIdentity implements
024: IProcessInstance, Serializable {
025:
026: private static final long serialVersionUID = -8978746266899605900L;
027:
028: private IProcess process = null;
029:
030: private String operation = null;
031:
032: private byte[] continuation = null;
033:
034: private ProcessState processState = ProcessState.CREATED;
035:
036: private String parentProcessInstanceId;
037:
038: private StackTraceElement[] stackTraceElements;
039:
040: private Throwable throwable;
041:
042: public ProcessInstance(String id, Timestamp lastModified,
043: Timestamp creationDate, IProcess process, String operation,
044: byte[] continuation, ProcessState processState,
045: String parentProcessInstanceId,
046: StackTraceElement[] stackTraceElements, Throwable throwable) {
047: super (id, lastModified, creationDate);
048: this .process = process;
049: this .operation = operation;
050: this .continuation = continuation;
051: this .processState = processState;
052: this .parentProcessInstanceId = parentProcessInstanceId;
053: this .stackTraceElements = stackTraceElements;
054: this .throwable = throwable;
055: }
056:
057: public ProcessInstance(String processInstanceId,
058: String parentProcessInstanceId, String operation,
059: IProcess process) {
060: setId(processInstanceId);
061: this .parentProcessInstanceId = parentProcessInstanceId;
062: this .operation = operation;
063: this .process = process;
064: }
065:
066: public ProcessInstance() {
067:
068: }
069:
070: public ProcessInstance(IProcessInstance processInstance) {
071: this (processInstance.getId(),
072: processInstance.getLastModified(), processInstance
073: .getCreationDate(), new Process(processInstance
074: .getProcess()), processInstance.getOperation(),
075: processInstance.getContinuation(), ProcessState
076: .valueOf(processInstance.getState()),
077: processInstance.getParentProcessInstanceId(),
078: processInstance.getStackTraceElements(),
079: processInstance.getThrowable());
080: }
081:
082: /*
083: * (non-Javadoc)
084: *
085: * @see org.bpmscript.IProcessInstance#getContinuation()
086: */
087: public byte[] getContinuation() {
088: return continuation;
089: }
090:
091: /*
092: * (non-Javadoc)
093: *
094: * @see org.bpmscript.IProcessInstance#getProcess()
095: */
096: public IProcess getProcess() {
097: return process;
098: }
099:
100: /*
101: * (non-Javadoc)
102: *
103: * @see org.bpmscript.IProcessInstance#setContinuation(byte[])
104: */
105: public void setContinuation(byte[] continuation) {
106: this .continuation = continuation;
107: }
108:
109: public String getState() {
110: return processState.name();
111: }
112:
113: public void setState(String state) {
114: this .processState = ProcessState.valueOf(state);
115: }
116:
117: public ProcessState getProcessState() {
118: return processState;
119: }
120:
121: public void setProcessState(ProcessState processState) {
122: this .processState = processState;
123: }
124:
125: public String getOperation() {
126: return operation;
127: }
128:
129: public void setOperation(String operation) {
130: this .operation = operation;
131: }
132:
133: public String getParentProcessInstanceId() {
134: return parentProcessInstanceId;
135: }
136:
137: public void setParentProcessInstanceId(
138: String parentProcessInstanceId) {
139: this .parentProcessInstanceId = parentProcessInstanceId;
140: }
141:
142: public StackTraceElement[] getStackTraceElements() {
143: return stackTraceElements;
144: }
145:
146: public void setStackTraceElements(
147: StackTraceElement[] stackTraceElements) {
148: this .stackTraceElements = stackTraceElements;
149: }
150:
151: public Throwable getThrowable() {
152: return throwable;
153: }
154:
155: public void setThrowable(Throwable throwable) {
156: this .throwable = throwable;
157: }
158:
159: public void setProcess(IProcess process) {
160: this.process = process;
161: }
162:
163: }
|