001: package org.emforge.jbpm;
002:
003: import java.util.Collection;
004: import java.util.Iterator;
005: import java.util.List;
006: import java.util.ListIterator;
007:
008: import org.emforge.xfer.StepTO;
009: import org.jbpm.taskmgmt.exe.TaskInstance;
010:
011: /** His collection is required for lazy initialization of Steps
012: *
013: * Since converting of TaskInstance to StepTO not so fast operation
014: * but we sometimes need to have collection of steps, but - not whole tasks are really used
015: * we implementing this lazy-conversion List - TaskInstance converted into step only then it is required
016: *
017: */
018: public class StepCollection implements List<StepTO> {
019: private List<TaskInstance> tasks;
020: private TaskTransformer transformer;
021:
022: public StepCollection(List<TaskInstance> tasks,
023: TaskTransformer transformer) {
024: this .tasks = tasks;
025: this .transformer = transformer;
026: }
027:
028: public boolean add(StepTO i_e) {
029: // TODO Auto-generated method stub
030: return false;
031: }
032:
033: public void add(int i_index, StepTO i_element) {
034: // TODO Auto-generated method stub
035:
036: }
037:
038: public boolean addAll(Collection<? extends StepTO> i_c) {
039: // TODO Auto-generated method stub
040: return false;
041: }
042:
043: public boolean addAll(int i_index, Collection<? extends StepTO> i_c) {
044: // TODO Auto-generated method stub
045: return false;
046: }
047:
048: public void clear() {
049: // TODO Auto-generated method stub
050:
051: }
052:
053: public boolean contains(Object i_o) {
054: // TODO Auto-generated method stub
055: return false;
056: }
057:
058: public boolean containsAll(Collection<?> i_c) {
059: // TODO Auto-generated method stub
060: return false;
061: }
062:
063: public StepTO get(int i_index) {
064: TaskInstance process = tasks.get(i_index);
065:
066: return transformer.transform(process);
067: }
068:
069: public int indexOf(Object i_o) {
070: // TODO Auto-generated method stub
071: return 0;
072: }
073:
074: public boolean isEmpty() {
075: return tasks.isEmpty();
076: }
077:
078: public Iterator<StepTO> iterator() {
079: // TODO Auto-generated method stub
080: return null;
081: }
082:
083: public int lastIndexOf(Object i_o) {
084: // TODO Auto-generated method stub
085: return 0;
086: }
087:
088: public ListIterator<StepTO> listIterator() {
089: // TODO Auto-generated method stub
090: return null;
091: }
092:
093: public ListIterator<StepTO> listIterator(int i_index) {
094: // TODO Auto-generated method stub
095: return null;
096: }
097:
098: public boolean remove(Object i_o) {
099: // TODO Auto-generated method stub
100: return false;
101: }
102:
103: public StepTO remove(int i_index) {
104: // TODO Auto-generated method stub
105: return null;
106: }
107:
108: public boolean removeAll(Collection<?> i_c) {
109: // TODO Auto-generated method stub
110: return false;
111: }
112:
113: public boolean retainAll(Collection<?> i_c) {
114: // TODO Auto-generated method stub
115: return false;
116: }
117:
118: public StepTO set(int i_index, StepTO i_element) {
119: // TODO Auto-generated method stub
120: return null;
121: }
122:
123: public int size() {
124: return tasks.size();
125: }
126:
127: public List<StepTO> subList(int i_fromIndex, int i_toIndex) {
128: // TODO Auto-generated method stub
129: return null;
130: }
131:
132: public Object[] toArray() {
133: Object[] result = new Object[tasks.size()];
134:
135: int i = 0;
136: for (TaskInstance task : tasks) {
137: result[i++] = transformer.transform(task);
138: }
139:
140: return result;
141: }
142:
143: @SuppressWarnings("unchecked")
144: public <T> T[] toArray(T[] i_a) {
145: int i = 0;
146: for (TaskInstance task : tasks) {
147: i_a[i++] = (T) transformer.transform(task);
148: }
149:
150: return i_a;
151: }
152:
153: }
|