001
014
015 package com.liferay.portal.kernel.workflow;
016
017 import java.io.Serializable;
018
019 import java.util.ArrayList;
020 import java.util.Date;
021 import java.util.List;
022 import java.util.Map;
023
024
028 public class DefaultWorkflowInstance implements Serializable, WorkflowInstance {
029
030 @Override
031 public void addChildWorkflowInstance(
032 WorkflowInstance childWorkflowInstance) {
033
034 _childrenWorkflowInstances.add(childWorkflowInstance);
035 }
036
037 @Override
038 public int getChildrenWorkflowInstanceCount() {
039 return _childrenWorkflowInstances.size();
040 }
041
042 @Override
043 public List<WorkflowInstance> getChildrenWorkflowInstances() {
044 return _childrenWorkflowInstances;
045 }
046
047 @Override
048 public Date getEndDate() {
049 return _endDate;
050 }
051
052 @Override
053 public WorkflowInstance getParentWorkflowInstance() {
054 return _parentWorkflowInstance;
055 }
056
057 @Override
058 public long getParentWorkflowInstanceId() {
059 if (_parentWorkflowInstance != null) {
060 return _parentWorkflowInstance.getWorkflowInstanceId();
061 }
062 else {
063 return 0;
064 }
065 }
066
067 @Override
068 public Date getStartDate() {
069 return _startDate;
070 }
071
072 @Override
073 public String getState() {
074 return _state;
075 }
076
077 @Override
078 public Map<String, Serializable> getWorkflowContext() {
079 return _workflowContext;
080 }
081
082 @Override
083 public String getWorkflowDefinitionName() {
084 return _workflowDefinitionName;
085 }
086
087 @Override
088 public int getWorkflowDefinitionVersion() {
089 return _workflowDefinitionVersion;
090 }
091
092 @Override
093 public long getWorkflowInstanceId() {
094 return _workflowInstanceId;
095 }
096
097 @Override
098 public boolean isComplete() {
099 if (getEndDate() != null) {
100 return true;
101 }
102 else {
103 return false;
104 }
105 }
106
107 public void setChildrenWorkflowInstances(
108 List<WorkflowInstance> childrenWorkflowInstances) {
109
110 _childrenWorkflowInstances = childrenWorkflowInstances;
111 }
112
113 public void setEndDate(Date endDate) {
114 _endDate = endDate;
115 }
116
117 @Override
118 public void setParentWorkflowInstance(
119 WorkflowInstance parentWorkflowInstance) {
120
121 _parentWorkflowInstance = parentWorkflowInstance;
122 }
123
124 public void setStartDate(Date startDate) {
125 _startDate = startDate;
126 }
127
128 public void setState(String state) {
129 _state = state;
130 }
131
132 public void setWorkflowContext(Map<String, Serializable> workflowContext) {
133 _workflowContext = workflowContext;
134 }
135
136 public void setWorkflowDefinitionName(String workflowDefinitionName) {
137 _workflowDefinitionName = workflowDefinitionName;
138 }
139
140 public void setWorkflowDefinitionVersion(int workflowDefinitionVersion) {
141 _workflowDefinitionVersion = workflowDefinitionVersion;
142 }
143
144 public void setWorkflowInstanceId(long workflowInstanceId) {
145 _workflowInstanceId = workflowInstanceId;
146 }
147
148 private List<WorkflowInstance> _childrenWorkflowInstances =
149 new ArrayList<WorkflowInstance>();
150 private Date _endDate;
151 private WorkflowInstance _parentWorkflowInstance;
152 private Date _startDate;
153 private String _state;
154 private Map<String, Serializable> _workflowContext;
155 private String _workflowDefinitionName;
156 private int _workflowDefinitionVersion;
157 private long _workflowInstanceId;
158
159 }