protected AbstractActivity(String activityName, JoinType joinType, SplitType splitType, ActivityType activityType, Performer performer) { Misc.checkArgsNotNull(activityType); this.activityId = activityName; this.joinType = joinType; this.splitType = splitType; this.activityType = activityType; this.performer = performer; if (performer != null) { if (!ActivityType.task.equals(activityType)) { throw new BonitaRuntimeException("Activity is automatic and a performer is specified: incorrect."); } } else { if (ActivityType.task.equals(activityType)) { throw new BonitaRuntimeException("startMode or finishMode is Manual and no performer is specified: incorrect."); } } }
@Override public ActivityBody getBody(XpdlExecution xpdlExecution, ActivityInstance<ActivityBody> activityInstance) { if (activityType.equals(ActivityType.task)) { return getTask(xpdlExecution, activityInstance); } else if (activityType.equals(ActivityType.no)) { return new AutomaticBodyImpl(new AutomaticBodyUUID(activityInstance.getUUID())); } throw new BonitaRuntimeException("Ouch! NoImplementation does not support type: " + activityType); }
@Override protected boolean bodyStartAutomatically() { if (activityType.equals(ActivityType.task)) { return false; } return true; }
@Override protected boolean executeBusinessLogic(Execution execution) { XpdlExecution xpdlExecution = (XpdlExecution) execution; if (activityType.equals(ActivityType.task)) { addTaskToRepository(taskRuntime); return false; } //noImpl must have a hook if it is not a task HookExecutor.executeHooks(javaHooks, xpdlExecution, activityId, JavaHook.Type.automaticOnEnter); return true; }