1 package org.enhydra.shark.corba.poa; 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 import org.omg.CORBA.ORB ; 8 import org.enhydra.shark.corba.poa.Collective; 9 import org.enhydra.shark.corba.poa.SharkCORBAUtilities; 10 11 17 public class WfActivityCORBA extends WfActivityPOA { 18 19 org.enhydra.shark.api.client.wfmodel.WfActivity sharkAct; 20 21 private Collective __collective; 22 private ORB orb; 23 24 27 protected WfActivityCORBA(ORB orb, Collective toJoin, 28 org.enhydra.shark.api.client.wfmodel.WfActivity sharkAct) { 29 __collective = toJoin; 30 this.orb = orb; 31 this.sharkAct = sharkAct; 33 } 34 35 41 public int how_many_assignment() throws BaseException { 42 try { 43 return sharkAct.how_many_assignment(); 44 } catch (Exception ex) { 45 throw new BaseException(); 46 } 47 } 48 49 52 public WfAssignmentIterator get_iterator_assignment() throws BaseException { 53 try { 54 WfAssignmentIterator iter = SharkCORBAUtilities.makeWfAssignmentIterator(new WfAssignmentIteratorCORBA(orb, __collective, 55 sharkAct.get_iterator_assignment())); 56 __collective.__recruit(iter); 57 return iter; 58 } catch (Exception ex) { 59 throw new BaseException(); 60 } 61 } 62 63 68 public WfAssignment[] get_sequence_assignment(int max_number) throws BaseException { 69 try { 70 return SharkCORBAUtilities.makeCORBAAssignments( __collective, 71 sharkAct.get_sequence_assignment(max_number)); 72 } catch (Exception ex) { 73 throw new BaseException(); 74 } 75 } 76 77 82 public boolean is_member_of_assignment(WfAssignment member) throws BaseException { 83 try { 84 String actId = member.activity().key(); 85 return actId.equals(sharkAct.key()); 86 } catch (Exception ex) { 87 throw new BaseException(); 88 } 89 } 90 91 94 public WfProcess container() throws BaseException { 95 try { 96 WfProcess proc = SharkCORBAUtilities.makeWfProcess(new WfProcessCORBA(orb, __collective, sharkAct.container())); 97 __collective.__recruit(proc); 98 return proc; 99 } catch (Exception ex) { 100 throw new BaseException(); 101 } 102 } 103 104 109 public NameValue[] result() throws BaseException, ResultNotAvailable { 110 try { 111 return SharkCORBAUtilities.makeCORBANameValueArray(orb, 112 sharkAct.result()); 113 } catch (org.enhydra.shark.api.client.wfmodel.ResultNotAvailable rna) { 114 throw new ResultNotAvailable(); 115 } catch (Exception ex) { 116 throw new BaseException(); 117 } 118 } 119 120 123 public void set_result(NameValue[] results) throws BaseException, 124 InvalidData { 125 try { 126 sharkAct.set_result(SharkCORBAUtilities.makeMap(results)); 127 } catch (org.enhydra.shark.api.client.wfmodel.InvalidData id) { 128 throw new InvalidData(); 129 } catch (Exception ex) { 130 throw new BaseException(); 131 } 132 } 133 134 137 public void complete() throws BaseException, CannotComplete { 138 try { 139 sharkAct.complete(); 140 } catch (org.enhydra.shark.api.client.wfmodel.CannotComplete cnc) { 141 throw new CannotComplete(); 142 } catch (Exception ex) { 143 throw new BaseException(); 144 } 145 } 146 147 public workflow_stateType workflow_state() throws BaseException { 148 try { 149 return workflow_stateType.from_int(sharkAct.workflow_state().value()); 150 } catch (Exception ex) { 151 throw new BaseException(); 152 } 153 } 154 155 public while_openType while_open() throws BaseException { 156 try { 157 return while_openType.from_int(sharkAct.while_open().value()); 158 } catch (Exception ex) { 159 throw new BaseException(); 160 } 161 } 162 163 public why_not_runningType why_not_running() throws BaseException { 164 try { 165 return why_not_runningType.from_int(sharkAct.why_not_running() 166 .value()); 167 } catch (Exception ex) { 168 throw new BaseException(); 169 } 170 } 171 172 public how_closedType how_closed() throws BaseException { 173 try { 174 return how_closedType.from_int(sharkAct.how_closed().value()); 175 } catch (Exception ex) { 176 throw new BaseException(); 177 } 178 } 179 180 public String [] valid_states() throws BaseException { 181 try { 182 return sharkAct.valid_states(); 183 } catch (Exception ex) { 184 throw new BaseException(); 185 } 186 } 187 188 public String state() throws BaseException { 189 try { 190 return sharkAct.state(); 191 } catch (Exception ex) { 192 throw new BaseException(); 193 } 194 } 195 196 public void change_state(String new_state) throws BaseException, 197 InvalidState, 198 TransitionNotAllowed { 199 try { 200 sharkAct.change_state(new_state); 201 } catch (org.enhydra.shark.api.client.wfmodel.InvalidState is) { 202 throw new InvalidState(); 203 } catch (org.enhydra.shark.api.client.wfmodel.TransitionNotAllowed tna) { 204 throw new TransitionNotAllowed(); 205 } catch (Exception ex) { 206 throw new BaseException(); 207 } 208 } 209 210 public String name() throws BaseException { 211 try { 212 return sharkAct.name(); 213 } catch (Exception ex) { 214 throw new BaseException(); 215 } 216 } 217 218 public void set_name(String new_value) throws BaseException { 219 try { 220 sharkAct.set_name(new_value); 221 } catch (Exception ex) { 222 throw new BaseException(); 223 } 224 } 225 226 public String key() throws BaseException { 227 try { 228 return sharkAct.key(); 229 } catch (Exception ex) { 230 throw new BaseException(); 231 } 232 } 233 234 public String description() throws BaseException { 235 try { 236 return sharkAct.description(); 237 } catch (Exception ex) { 238 throw new BaseException(); 239 } 240 } 241 242 public void set_description(String new_value) throws BaseException { 243 try { 244 sharkAct.set_description(new_value); 245 } catch (Exception ex) { 246 throw new BaseException(); 247 } 248 } 249 250 public NameValue[] process_context() throws BaseException { 251 try { 252 return SharkCORBAUtilities.makeCORBANameValueArray(orb, 253 sharkAct.process_context()); 254 } catch (Exception ex) { 255 throw new BaseException(); 256 } 257 } 258 259 public void set_process_context(NameValue[] new_value) throws BaseException, 260 InvalidData, 261 UpdateNotAllowed { 262 try { 263 sharkAct.set_process_context(SharkCORBAUtilities.makeMap(new_value)); 264 } catch (org.enhydra.shark.api.client.wfmodel.InvalidData id) { 265 throw new InvalidData(); 266 } catch (org.enhydra.shark.api.client.wfmodel.UpdateNotAllowed una) { 267 throw new UpdateNotAllowed(); 268 } catch (Exception ex) { 269 throw new BaseException(); 270 } 271 } 272 273 public short priority() throws BaseException { 274 try { 275 return sharkAct.priority(); 276 } catch (Exception ex) { 277 throw new BaseException(); 278 } 279 } 280 281 public void set_priority(short new_value) throws BaseException { 282 try { 283 sharkAct.set_priority(new_value); 284 } catch (Exception ex) { 285 throw new BaseException(); 286 } 287 } 288 289 292 public void resume() throws BaseException, CannotResume, NotSuspended { 293 try { 294 sharkAct.resume(); 295 } catch (org.enhydra.shark.api.client.wfmodel.CannotResume cnr) { 296 throw new CannotResume(); 297 } catch (org.enhydra.shark.api.client.wfmodel.NotSuspended ns) { 298 throw new NotSuspended(); 299 } catch (Exception ex) { 300 throw new BaseException(); 301 } 302 } 303 304 307 public void suspend() throws BaseException, 308 CannotSuspend, 309 NotRunning, 310 AlreadySuspended { 311 try { 312 sharkAct.suspend(); 313 } catch (org.enhydra.shark.api.client.wfmodel.CannotSuspend cns) { 314 throw new CannotSuspend(); 315 } catch (org.enhydra.shark.api.client.wfmodel.NotRunning nr) { 316 throw new NotRunning(); 317 } catch (org.enhydra.shark.api.client.wfmodel.AlreadySuspended as) { 318 throw new AlreadySuspended(); 319 } catch (Exception ex) { 320 throw new BaseException(); 321 } 322 } 323 324 327 public void terminate() throws BaseException, CannotStop, NotRunning { 328 try { 329 sharkAct.terminate(); 330 } catch (org.enhydra.shark.api.client.wfmodel.CannotStop cns) { 331 throw new CannotStop(); 332 } catch (org.enhydra.shark.api.client.wfmodel.NotRunning nr) { 333 throw new NotRunning(); 334 } catch (Exception ex) { 335 throw new BaseException(); 336 } 337 } 338 339 342 public void abort() throws BaseException, CannotStop, NotRunning { 343 try { 344 sharkAct.abort(); 345 } catch (org.enhydra.shark.api.client.wfmodel.CannotStop cns) { 346 throw new CannotStop(); 347 } catch (org.enhydra.shark.api.client.wfmodel.NotRunning nr) { 348 throw new NotRunning(); 349 } catch (Exception ex) { 350 throw new BaseException(); 351 } 352 } 353 354 public int how_many_history() throws BaseException, HistoryNotAvailable { 355 try { 356 return sharkAct.how_many_history(); 357 } catch (org.enhydra.shark.api.client.wfmodel.HistoryNotAvailable hna) { 358 throw new HistoryNotAvailable(); 359 } catch (Exception ex) { 360 throw new BaseException(); 361 } 362 } 363 364 371 public WfEventAuditIterator get_iterator_history(String query, 372 NameValue[] names_in_query) throws BaseException, 373 HistoryNotAvailable { 374 try { 375 WfEventAuditIterator iter = SharkCORBAUtilities.makeWfEventAuditIterator(new WfEventAuditIteratorCORBA(orb, __collective, 376 sharkAct.get_iterator_history(query, 377 SharkCORBAUtilities.makeMap(names_in_query)))); 378 __collective.__recruit(iter); 379 return iter; 380 } catch (org.enhydra.shark.api.client.wfmodel.HistoryNotAvailable hna) { 381 throw new HistoryNotAvailable(); 382 } catch (Exception ex) { 383 throw new BaseException(); 384 } 385 } 386 387 393 public WfEventAudit[] get_sequence_history(int max_number) throws BaseException, 394 HistoryNotAvailable { 395 try { 396 return SharkCORBAUtilities.makeCORBAEventAudits(__collective, 397 sharkAct.get_sequence_history(max_number)); 398 } catch (org.enhydra.shark.api.client.wfmodel.HistoryNotAvailable hna) { 399 throw new HistoryNotAvailable(); 400 } catch (Exception ex) { 401 throw new BaseException(); 402 } 403 } 404 405 410 public boolean is_member_of_history(WfExecutionObject member) throws BaseException { 411 try { 412 boolean ret = false; 413 WfEventAudit[] evs = SharkCORBAUtilities.makeCORBAEventAudits(__collective, 414 sharkAct.get_sequence_history(0)); 415 if (evs != null) { 416 for (int i = 0; i < evs.length; i++) { 417 WfEventAudit ea = evs[i]; 418 if (member instanceof WfActivity) { 419 WfActivity act = (WfActivity) member; 420 if (act.container().key().equals(ea.process_key()) 421 && act.key().equals(ea.activity_key())) { 422 ret = true; 423 break; 424 } 425 } else { 426 if (member.key().equals(ea.process_key())) { 427 ret = true; 428 break; 429 } 430 } 431 } 432 } 433 return ret; 434 } catch (Exception ex) { 435 throw new BaseException(); 436 } 437 } 438 439 public UtcT last_state_time() throws BaseException { 440 try { 441 org.enhydra.shark.api.client.timebase.UtcT t = sharkAct.last_state_time(); 442 return new UtcT(t.time, t.inacclo, t.inacchi, t.tdf); 443 } catch (Exception ex) { 444 throw new BaseException(); 445 } 446 } 447 448 451 public int how_many_performer() throws BaseException { 452 try { 453 return sharkAct.how_many_performer(); 454 } catch (Exception ex) { 455 throw new BaseException(); 456 } 457 } 458 459 462 public WfProcessIterator get_iterator_performer() throws BaseException { 463 try { 464 WfProcessIterator iter = SharkCORBAUtilities.makeWfProcessIterator(new WfProcessIteratorCORBA(orb, __collective, 465 sharkAct.get_iterator_performer())); 466 __collective.__recruit(iter); 467 return iter; 468 469 } catch (Exception ex) { 470 throw new BaseException(); 471 } 472 } 473 474 479 public WfProcess[] get_sequence_performer(int max_number) throws BaseException { 480 try { 481 return SharkCORBAUtilities.makeCORBAProcesses(__collective, 482 sharkAct.get_sequence_performer(max_number)); 483 } catch (Exception ex) { 484 throw new BaseException(); 485 } 486 } 487 488 493 public boolean is_member_of_performer(WfProcess member) throws BaseException { 494 try { 495 boolean ret = false; 496 WfProcess[] perfs = SharkCORBAUtilities.makeCORBAProcesses(__collective, 497 sharkAct.get_sequence_performer(0)); 498 if (perfs != null) { 499 for (int i = 0; i < perfs.length; i++) { 500 WfProcess perf = perfs[i]; 501 if (perf.key().equals(member.key())) { 502 ret = true; 503 break; 504 } 505 } 506 } 507 return ret; 508 } catch (Exception ex) { 509 throw new BaseException(); 510 } 511 } 512 513 public void receive_event(WfEventAudit event) throws BaseException, 514 InvalidPerformer {} 515 516 520 public boolean equals(java.lang.Object obj) { 521 if (!(obj instanceof WfActivity)) return false; 522 WfActivity act = (WfActivity) obj; 523 try { 524 return act.key().equals(key()); 525 } catch (Exception ex) { 526 return false; 527 } 528 } 529 530 public String toString() { 531 return sharkAct.toString(); 532 } 533 534 } | Popular Tags |