1 package org.enhydra.shark.corba.poa; 2 3 import org.omg.WfBase.BaseException; 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.WfActivityCORBA; 14 15 21 public class WfAssignmentCORBA extends WfAssignmentPOA { 22 24 org.enhydra.shark.api.client.wfmodel.WfAssignment sharkAss; 25 26 private Collective __collective; 27 private ORB orb; 28 29 35 protected WfAssignmentCORBA(ORB orb, Collective toJoin, 36 org.enhydra.shark.api.client.wfmodel.WfAssignment sharkAss) { 37 __collective = toJoin; 38 this.orb = orb; 39 this.sharkAss = sharkAss; 41 } 42 43 48 public WfActivity activity() throws BaseException { 49 try { 50 WfActivity activity = SharkCORBAUtilities.makeWfActivity(new WfActivityCORBA(orb, __collective, sharkAss.activity())); 51 __collective.__recruit(activity); 52 return activity; 53 } catch (Exception ex) { 54 throw new BaseException(); 55 } 56 57 } 58 59 64 public WfResource assignee() throws BaseException { 65 try { 66 WfResource wfRes = SharkCORBAUtilities.makeWfResource( new WfResourceCORBA(orb, __collective, sharkAss.assignee())); 67 __collective.__recruit(wfRes); 68 return wfRes; 69 } catch (Exception ex) { 70 throw new BaseException(); 71 } 72 73 } 74 75 78 public void set_assignee(WfResource new_value) throws BaseException, 79 InvalidResource { 80 try { 81 sharkAss.set_assignee(new WfResourceHelper(new_value.resource_key())); 82 } catch (Exception ex) { 83 throw new BaseException(); 84 } 85 } 86 87 public synchronized void set_accepted_status(boolean accept) throws BaseException, 88 CannotAcceptSuspended { 89 try { 90 sharkAss.set_accepted_status(accept); 91 } catch (Exception ex) { 92 throw new BaseException(); 93 } 94 } 95 96 public boolean get_accepted_status() throws BaseException { 97 try { 98 return sharkAss.get_accepted_status(); 99 } catch (Exception ex) { 100 throw new BaseException(); 101 } 102 } 103 104 public boolean equals(Object obj) { 105 if (!(obj instanceof WfAssignment)) return false; 106 WfAssignment ass = (WfAssignment) obj; 107 try { 108 return (ass.activity().key().equals(activity().key()) && ass.assignee() 109 .resource_key() 110 .equals(assignee().resource_key())); 111 } catch (Exception ex) { 112 return false; 113 } 114 } 115 116 public String toString() { 117 return sharkAss.toString(); 118 } 119 120 } 121 122 | Popular Tags |