public void ready() { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Ready task : " + taskUUID + " on activity " + activityId); } this.state = TaskState.READY; // get performer (aka participant/swimlane) Performer performer = activityDef.getPerformer(); Set<String> ar = new HashSet<String>(); //if human set userId and candidates if (performer.getParticipantType().equals(ParticipantType.HUMAN)) { this.userId = performer.getParticipantId(); ar.add(performer.getParticipantId()); this.candidates = ar; } //Only ROLE and ORGANIZATIONAL_UNIT can have Role mapper (ParticipantBinding) if (performer.getRoleMapper() != null) { mapRole(performer); } else { // no role mapper: set an empty candidates list this.candidates = ar; } // performer assignment associated to this task assign(performer); EnvTool.getRecorder().recordTaskReady(this); HookExecutor.executeHooks(activityDef.getJavaHooks(), xpdlExecution, activityId, JavaHook.Type.taskOnReady); }
this.userId = performer.getParticipantId(); ar.add(performer.getParticipantId()); this.candidates = ar;
protected void mapRole(Performer performer) { ClassInfo rolemapperInfo = performer.getRoleMapper(); if (rolemapperInfo != null) { RoleMapper roleMapper = ClassDataLoader.getRoleMapperInstance(packageUUID, rolemapperInfo); try { this.candidates = roleMapper.searchMembers( AccessorUtil.getQueryAPIAccessor(), instanceUUID, performer.getParticipantId()); } catch (Exception e) { throw new BonitaWrapperException( new RoleMapperInvocationException(rolemapperInfo.toString(), e) ); } } }
protected void executeRoleMapper(final Performer performer) { final ClassInfo rolemapperInfo = performer.getRoleMapper(); if (rolemapperInfo != null) { final RoleMapper roleMapper = ClassDataLoader.getInstance(RoleMapper.class, this.packageUUID, rolemapperInfo); try { this.candidates = EngineEnvTool.getHookExecutor().executeRoleMapper( roleMapper, this.instanceUUID, performer.getParticipantId()); } catch (final Exception e) { throw new BonitaWrapperException( new RoleMapperInvocationException(rolemapperInfo.toString(), e) ); } } }