1 package org.enhydra.shark.corba; 2 3 import org.omg.TimeBase.UtcT; 4 import org.omg.WfBase.BaseException; 5 import org.omg.WfBase.NameValue; 6 import org.omg.WorkflowModel.*; 7 8 14 public class WfProcessCORBA extends _WfProcessImplBase { 15 16 org.enhydra.shark.api.client.wfmodel.WfProcess sharkProc; 17 18 private Collective __collective; 19 20 25 protected WfProcessCORBA(Collective toJoin, 26 org.enhydra.shark.api.client.wfmodel.WfProcess sharkProc) { 27 __collective = toJoin; 28 toJoin.__recruit(this); 29 this.sharkProc = sharkProc; 30 } 31 32 35 public WfRequester requester() throws BaseException { 36 try { 37 WfRequester req; 38 org.enhydra.shark.api.client.wfmodel.WfRequester requester = sharkProc.requester(); 39 if (requester instanceof org.enhydra.shark.api.client.wfmodel.WfActivity) { 40 req = new WfActivityCORBA(__collective, 41 (org.enhydra.shark.api.client.wfmodel.WfActivity) requester); 42 } else if (requester instanceof WfLinkingRequesterForCORBA) { 43 req = WfLinkingRequesterForCORBA.getCORBARequester(sharkProc.key()); 44 } else { 45 req = new WfRequesterCORBA(__collective, requester); 46 } 47 return req; 48 } catch (Exception ex) { 49 throw new BaseException(); 50 } 51 } 52 53 56 public void set_requester(WfRequester new_value) throws BaseException, 57 CannotChangeRequester { 58 if (new_value == null) throw new CannotChangeRequester("Trying to set external requester which is null!"); 59 60 if (new_value instanceof WfActivity) { throw new CannotChangeRequester("Can't change requester to activity requester"); } 61 62 try { 63 WfLinkingRequesterForCORBA lr=new WfLinkingRequesterForCORBA(); 64 WfLinkingRequesterForCORBA.setCORBARequester(sharkProc.key(),new_value); 65 sharkProc.set_requester(lr); 66 } catch (org.enhydra.shark.api.client.wfmodel.CannotChangeRequester ccr) { 67 throw new CannotChangeRequester(); 68 } catch (Exception ex) { 69 throw new BaseException(); 70 } 71 } 72 73 76 public int how_many_step() throws BaseException { 77 try { 78 return sharkProc.how_many_step(); 79 } catch (Exception ex) { 80 throw new BaseException(); 81 } 82 } 83 84 87 public WfActivityIterator get_iterator_step() throws BaseException { 88 try { 89 return new WfActivityIteratorCORBA(__collective, 90 sharkProc.get_iterator_step()); 91 } catch (Exception ex) { 92 throw new BaseException(); 93 } 94 } 95 96 102 public WfActivity[] get_sequence_step(int max_number) throws BaseException { 103 try { 104 return SharkCORBAUtilities.makeCORBAActivities(__collective, 105 sharkProc.get_sequence_step(max_number)); 106 } catch (Exception ex) { 107 throw new BaseException(); 108 } 109 } 110 111 117 public boolean is_member_of_step(WfActivity member) throws BaseException { 118 try { 119 WfActivity[] acts = get_sequence_step(0); 120 boolean ret = false; 121 if (acts != null) { 122 for (int i = 0; i < acts.length; i++) { 123 WfActivity act = acts[i]; 124 if (act.key().equals(member.key())) { 125 ret = true; 126 break; 127 } 128 } 129 } 130 return ret; 131 } catch (Exception ex) { 132 throw new BaseException(); 133 } 134 } 135 136 139 public WfProcessMgr manager() throws BaseException { 140 try { 141 return new WfProcessMgrCORBA(__collective, sharkProc.manager()); 142 } catch (Exception ex) { 143 throw new BaseException(); 144 } 145 } 146 147 150 public NameValue[] result() throws BaseException, ResultNotAvailable { 151 try { 152 return SharkCORBAUtilities.makeCORBANameValueArray(this._orb(), 153 sharkProc.result()); 154 } catch (org.enhydra.shark.api.client.wfmodel.ResultNotAvailable rna) { 155 throw new ResultNotAvailable(); 156 } catch (Exception ex) { 157 throw new BaseException(); 158 } 159 } 160 161 164 public void start() throws BaseException, CannotStart, AlreadyRunning { 165 try { 166 sharkProc.start(); 167 } catch (org.enhydra.shark.api.client.wfmodel.CannotStart cns) { 168 throw new CannotStart(); 169 } catch (org.enhydra.shark.api.client.wfmodel.AlreadyRunning ar) { 170 throw new AlreadyRunning(); 171 } catch (Exception ex) { 172 throw new BaseException(); 173 } 174 } 175 176 179 public WfActivityIterator get_activities_in_state(String state) throws BaseException, 180 InvalidState { 181 try { 182 return new WfActivityIteratorCORBA(__collective, 183 sharkProc.get_activities_in_state(state)); 184 } catch (org.enhydra.shark.api.client.wfmodel.InvalidState is) { 185 throw new InvalidState(); 186 } catch (Exception ex) { 187 throw new BaseException(); 188 } 189 } 190 191 public workflow_stateType workflow_state() throws BaseException { 192 try { 193 return workflow_stateType.from_int(sharkProc.workflow_state() 194 .value()); 195 } catch (Exception ex) { 196 throw new BaseException(); 197 } 198 } 199 200 public while_openType while_open() throws BaseException { 201 try { 202 return while_openType.from_int(sharkProc.while_open().value()); 203 } catch (Exception ex) { 204 throw new BaseException(); 205 } 206 } 207 208 public why_not_runningType why_not_running() throws BaseException { 209 try { 210 return why_not_runningType.from_int(sharkProc.why_not_running() 211 .value()); 212 } catch (Exception ex) { 213 throw new BaseException(); 214 } 215 } 216 217 public how_closedType how_closed() throws BaseException { 218 try { 219 return how_closedType.from_int(sharkProc.how_closed().value()); 220 } catch (Exception ex) { 221 throw new BaseException(); 222 } 223 } 224 225 public String [] valid_states() throws BaseException { 226 try { 227 return sharkProc.valid_states(); 228 } catch (Exception ex) { 229 throw new BaseException(); 230 } 231 } 232 233 public String state() throws BaseException { 234 try { 235 return sharkProc.state(); 236 } catch (Exception ex) { 237 throw new BaseException(); 238 } 239 } 240 241 public void change_state(String new_state) throws BaseException, 242 InvalidState, 243 TransitionNotAllowed { 244 try { 245 sharkProc.change_state(new_state); 246 } catch (org.enhydra.shark.api.client.wfmodel.InvalidState is) { 247 throw new InvalidState(); 248 } catch (org.enhydra.shark.api.client.wfmodel.TransitionNotAllowed tna) { 249 throw new TransitionNotAllowed(); 250 } catch (Exception ex) { 251 throw new BaseException(); 252 } 253 } 254 255 public String name() throws BaseException { 256 try { 257 return sharkProc.name(); 258 } catch (Exception ex) { 259 throw new BaseException(); 260 } 261 } 262 263 public void set_name(String new_value) throws BaseException { 264 try { 265 sharkProc.set_name(new_value); 266 } catch (Exception ex) { 267 throw new BaseException(); 268 } 269 } 270 271 public String key() throws BaseException { 272 try { 273 return sharkProc.key(); 274 } catch (Exception ex) { 275 throw new BaseException(); 276 } 277 } 278 279 public String description() throws BaseException { 280 try { 281 return sharkProc.description(); 282 } catch (Exception ex) { 283 throw new BaseException(); 284 } 285 } 286 287 public void set_description(String new_value) throws BaseException { 288 try { 289 sharkProc.set_description(new_value); 290 } catch (Exception ex) { 291 throw new BaseException(); 292 } 293 } 294 295 public NameValue[] process_context() throws BaseException { 296 try { 297 return SharkCORBAUtilities.makeCORBANameValueArray(this._orb(), 298 sharkProc.process_context()); 299 } catch (Exception ex) { 300 throw new BaseException(); 301 } 302 } 303 304 public void set_process_context(NameValue[] new_value) throws BaseException, 305 InvalidData, 306 UpdateNotAllowed { 307 try { 308 sharkProc.set_process_context(SharkCORBAUtilities.makeMap(new_value)); 309 } catch (org.enhydra.shark.api.client.wfmodel.InvalidData id) { 310 throw new InvalidData(); 311 } catch (org.enhydra.shark.api.client.wfmodel.UpdateNotAllowed una) { 312 throw new UpdateNotAllowed(); 313 } catch (Exception ex) { 314 throw new BaseException(); 315 } 316 } 317 318 public short priority() throws BaseException { 319 try { 320 return sharkProc.priority(); 321 } catch (Exception ex) { 322 throw new BaseException(); 323 } 324 } 325 326 public void set_priority(short new_value) throws BaseException { 327 try { 328 sharkProc.set_priority(new_value); 329 } catch (Exception ex) { 330 throw new BaseException(); 331 } 332 } 333 334 337 public void resume() throws BaseException, CannotResume, NotSuspended { 338 try { 339 sharkProc.resume(); 340 } catch (org.enhydra.shark.api.client.wfmodel.CannotResume cnr) { 341 throw new CannotResume(); 342 } catch (org.enhydra.shark.api.client.wfmodel.NotSuspended ns) { 343 throw new NotSuspended(); 344 } catch (Exception ex) { 345 throw new BaseException(); 346 } 347 } 348 349 352 public void suspend() throws BaseException, 353 CannotSuspend, 354 NotRunning, 355 AlreadySuspended { 356 try { 357 sharkProc.suspend(); 358 } catch (org.enhydra.shark.api.client.wfmodel.CannotSuspend cns) { 359 throw new CannotSuspend(); 360 } catch (org.enhydra.shark.api.client.wfmodel.NotRunning nr) { 361 throw new NotRunning(); 362 } catch (org.enhydra.shark.api.client.wfmodel.AlreadySuspended as) { 363 throw new AlreadySuspended(); 364 } catch (Exception ex) { 365 throw new BaseException(); 366 } 367 } 368 369 372 public synchronized void terminate() throws BaseException, 373 CannotStop, 374 NotRunning { 375 try { 376 sharkProc.terminate(); 377 } catch (org.enhydra.shark.api.client.wfmodel.CannotStop cns) { 378 throw new CannotStop(); 379 } catch (org.enhydra.shark.api.client.wfmodel.NotRunning nr) { 380 throw new NotRunning(); 381 } catch (Exception ex) { 382 throw new BaseException(); 383 } 384 } 385 386 389 public synchronized void abort() throws BaseException, 390 CannotStop, 391 NotRunning { 392 try { 393 sharkProc.abort(); 394 } catch (org.enhydra.shark.api.client.wfmodel.CannotStop cns) { 395 throw new CannotStop(); 396 } catch (org.enhydra.shark.api.client.wfmodel.NotRunning nr) { 397 throw new NotRunning(); 398 } catch (Exception ex) { 399 throw new BaseException(); 400 } 401 } 402 403 public int how_many_history() throws BaseException, HistoryNotAvailable { 404 try { 405 return sharkProc.how_many_history(); 406 } catch (org.enhydra.shark.api.client.wfmodel.HistoryNotAvailable hna) { 407 throw new HistoryNotAvailable(); 408 } catch (Exception ex) { 409 throw new BaseException(); 410 } 411 } 412 413 418 public WfEventAuditIterator get_iterator_history(String query, 419 NameValue[] names_in_query) throws BaseException, 420 HistoryNotAvailable { 421 try { 422 return new WfEventAuditIteratorCORBA(__collective, sharkProc.get_iterator_history(query, 423 SharkCORBAUtilities.makeMap(names_in_query))); 424 } catch (org.enhydra.shark.api.client.wfmodel.HistoryNotAvailable hna) { 425 throw new HistoryNotAvailable(); 426 } catch (Exception ex) { 427 throw new BaseException(); 428 } 429 } 430 431 436 public WfEventAudit[] get_sequence_history(int max_number) throws BaseException, 437 HistoryNotAvailable { 438 try { 439 return SharkCORBAUtilities.makeCORBAEventAudits(__collective, sharkProc.get_sequence_history(max_number)); 440 } catch (org.enhydra.shark.api.client.wfmodel.HistoryNotAvailable hna) { 441 throw new HistoryNotAvailable(); 442 } catch (Exception ex) { 443 throw new BaseException(); 444 } 445 } 446 447 452 public boolean is_member_of_history(WfExecutionObject member) throws BaseException { 453 try { 454 boolean ret = false; 455 WfEventAudit[] evs = SharkCORBAUtilities.makeCORBAEventAudits(__collective, sharkProc.get_sequence_history(0)); 456 if (evs != null) { 457 for (int i = 0; i < evs.length; i++) { 458 WfEventAudit ea = evs[i]; 459 if (member instanceof WfActivity) { 460 WfActivity act = (WfActivity) member; 461 if (act.container().key().equals(ea.process_key()) 462 && act.key().equals(ea.activity_key())) { 463 ret = true; 464 break; 465 } 466 } else { 467 if (member.key().equals(ea.process_key())) { 468 ret = true; 469 break; 470 } 471 } 472 } 473 } 474 return ret; 475 } catch (Exception ex) { 476 throw new BaseException(); 477 } 478 } 479 480 public UtcT last_state_time() throws BaseException { 481 try { 482 org.enhydra.shark.api.client.timebase.UtcT t = sharkProc.last_state_time(); 483 return new UtcT(t.time, t.inacclo, t.inacchi, t.tdf); 484 } catch (Exception ex) { 485 throw new BaseException(); 486 } 487 } 488 489 493 public boolean equals(java.lang.Object obj) { 494 if (!(obj instanceof WfProcess)) return false; 495 WfProcess proc = (WfProcess) obj; 496 try { 497 return proc.key().equals(key()); 498 } catch (Exception ex) { 499 return false; 500 } 501 } 502 503 public String toString() { 504 return sharkProc.toString(); 505 } 506 } | Popular Tags |