1 package org.enhydra.shark.corba.poa; 2 3 import org.omg.WfBase.*; 4 import org.omg.WorkflowModel.*; 5 import org.omg.CORBA.ORB ; 6 import org.omg.PortableServer.POA ; 7 import org.omg.PortableServer.POAHelper ; 8 import org.omg.PortableServer.POAPackage.ServantAlreadyActive ; 9 import org.omg.PortableServer.POAPackage.WrongPolicy ; 10 import org.omg.PortableServer.POAPackage.ServantNotActive ; 11 import org.enhydra.shark.corba.poa.Collective; 12 import org.enhydra.shark.corba.poa.SharkCORBAUtilities; 13 import org.enhydra.shark.corba.poa.WfAssignmentIteratorCORBA; 14 15 21 public class WfResourceCORBA extends WfResourcePOA { 22 24 org.enhydra.shark.api.client.wfmodel.WfResource sharkRes; 25 private Collective __collective; 26 private ORB orb; 27 28 34 protected WfResourceCORBA(ORB orb, Collective toJoin, 35 org.enhydra.shark.api.client.wfmodel.WfResource sharkRes) { 36 __collective = toJoin; 37 this.orb = orb; 38 39 this.sharkRes = sharkRes; 41 } 42 43 46 public int how_many_work_item() throws BaseException { 47 try { 48 return sharkRes.how_many_work_item(); 49 } catch (Exception ex) { 50 throw new BaseException(); 51 } 52 } 53 54 57 public WfAssignmentIterator get_iterator_work_item() throws BaseException { 58 try { 59 WfAssignmentIterator wfAss = SharkCORBAUtilities.makeWfAssignmentIterator( new WfAssignmentIteratorCORBA(orb,__collective, 60 sharkRes.get_iterator_work_item())); 61 __collective.__recruit(wfAss); 62 return wfAss; 63 64 } catch (Exception ex) { 65 throw new BaseException(); 66 } 67 68 } 69 70 75 public WfAssignment[] get_sequence_work_item(int max_number) throws BaseException { 76 try { 77 return SharkCORBAUtilities.makeCORBAAssignments( __collective, 78 sharkRes.get_sequence_work_item(max_number)); 79 } catch (Exception ex) { 80 throw new BaseException(); 81 } 82 } 83 84 90 public boolean is_member_of_work_items(WfAssignment member) throws BaseException { 91 try { 92 WfAssignment[] ass = get_sequence_work_item(0); 93 boolean ret = false; 94 if (ass != null) { 95 for (int i = 0; i < ass.length; i++) { 96 WfAssignment as = ass[i]; 97 if (as.equals(member)) { 98 ret = true; 99 break; 100 } 101 } 102 } 103 return ret; 104 } catch (Exception ex) { 105 throw new BaseException(); 106 } 107 } 108 109 112 public String resource_key() throws BaseException { 113 try { 114 return sharkRes.resource_key(); 115 } catch (Exception ex) { 116 throw new BaseException(); 117 } 118 } 119 120 123 public String resource_name() throws BaseException { 124 try { 125 return sharkRes.resource_name(); 126 } catch (Exception ex) { 127 throw new BaseException(); 128 } 129 } 130 131 134 public void release(WfAssignment from_assigment, String release_info) throws BaseException, 135 NotAssigned { 136 try { 137 sharkRes.release(null, release_info); 138 } catch (org.enhydra.shark.api.client.wfmodel.NotAssigned na) { 139 throw new NotAssigned(); 140 } catch (Exception ex) { 141 throw new BaseException(); 142 } 143 } 144 145 149 public boolean equals(Object obj) { 150 if (!(obj instanceof WfResource)) return false; 151 WfResource res = (WfResource) obj; 152 try { 153 return res.resource_key().equals(resource_key()); 154 } catch (Exception ex) { 155 return false; 156 } 157 } 158 159 public String toString() { 160 return sharkRes.toString(); 161 } 162 163 } | Popular Tags |