/** * checks, for the set of initial ChoreographyActivities, that they are initiated by the * ChoreographySubProcess´ initiator */ private Collection<EnforceabilityProblem> checkInitiatorsInSubprocess( Collection<ProcessNode> firstChoreographyActivities, ChoreographySubProcess subProcess) { Collection<EnforceabilityProblem> problems = new HashSet<EnforceabilityProblem>(); for (ProcessNode node : firstChoreographyActivities) { if (!Utils.initiatorOf(node).equals(Utils.initiatorOf(subProcess))) { problems.add(new EnforceabilityProblem(DESC_Initiators, node, subProcess)); } } return problems; }
/** * checks, for a ChoreographySubProcess, that only those participants take part in it, who are * mentioned in one of the participant bands. */ private Collection<EnforceabilityProblem> checkParticipants(ChoreographySubProcess subProcess) { Set<String> participants = Utils.participantsOf(subProcess.getProcessNodes()); participants.removeAll(Utils.participantsOf(subProcess)); Collection<EnforceabilityProblem> problems = new HashSet<EnforceabilityProblem>(); if (!participants.isEmpty()) { problems.add( new EnforceabilityProblem( DESC_AllowedParticipants, subProcess, activitiesEngagingOneOf(subProcess.getProcessNodes(), participants))); } return problems; }
/** * collects all ChoreographyActivities out of a set of ProcessNodes, that do engage one of the * supplied participants. */ private Collection<ProcessNode> activitiesEngagingOneOf( Collection<ProcessNode> nodes, Collection<String> participants) { Collection<ProcessNode> activities = new HashSet<ProcessNode>(); for (ProcessNode node : nodes) { for (String participant : Utils.participantsOf(node)) { if (participants.contains(participant)) { activities.add(node); break; } } } return activities; }