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.TaskTO;
009: import org.jbpm.graph.exe.ProcessInstance;
010:
011: /** His collection is required for lazy initialization of Tasks
012: *
013: * Since converting of ProcessInstance to TaskTO not so fast operation
014: * but we sometimes need to have collection of Tasks, but - not whole tasks are really used
015: * we implementing this lazy-conversion List - ProcessInstance converted into task only then it is required
016: *
017: */
018: public class TaskCollection implements List<TaskTO> {
019: private List<ProcessInstance> processes;
020: private ProcessTransformer transformer;
021:
022: public TaskCollection(List<ProcessInstance> processes,
023: ProcessTransformer transformer) {
024: this .processes = processes;
025: this .transformer = transformer;
026: }
027:
028: public boolean add(TaskTO i_e) {
029: // TODO Auto-generated method stub
030: return false;
031: }
032:
033: public void add(int i_index, TaskTO i_element) {
034: // TODO Auto-generated method stub
035:
036: }
037:
038: public boolean addAll(Collection<? extends TaskTO> i_c) {
039: // TODO Auto-generated method stub
040: return false;
041: }
042:
043: public boolean addAll(int i_index, Collection<? extends TaskTO> 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 TaskTO get(int i_index) {
064: ProcessInstance process = processes.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 processes.isEmpty();
076: }
077:
078: public Iterator<TaskTO> 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<TaskTO> listIterator() {
089: // TODO Auto-generated method stub
090: return null;
091: }
092:
093: public ListIterator<TaskTO> 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 TaskTO 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 TaskTO set(int i_index, TaskTO i_element) {
119: // TODO Auto-generated method stub
120: return null;
121: }
122:
123: public int size() {
124: return processes.size();
125: }
126:
127: public List<TaskTO> 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[processes.size()];
134:
135: int i = 0;
136: for (ProcessInstance process : processes) {
137: result[i++] = transformer.transform(process);
138: }
139:
140: return result;
141: }
142:
143: @SuppressWarnings("unchecked")
144: public <T> T[] toArray(T[] i_a) {
145: int i = 0;
146: for (ProcessInstance process : processes) {
147: i_a[i++] = (T) transformer.transform(process);
148: }
149:
150: return i_a;
151: }
152:
153: }
|