/** * Checks if the gateway is a join gateway and if this gateway type is allowed in a generalized * flow pattern. * * @param gateway The gateway to check * @return True, if the gateway is an inclusive or parallel join gateway. False, otherwise. */ private boolean isJoinGateway(Gateway gateway) { if (gateway.getGatewayType().equals(Gateway.TYPE_AND) || gateway.getGatewayType().equals(Gateway.TYPE_OR)) { if (gateway.getTargetFor().size() > 1) { return true; } } return false; }
/** @return The first join gateway found, that has another join gateway as successor. */ private Gateway getSequentialJoinGateways() { List<Gateway> joinGateways = getJoinGateways(false); for (Iterator<Gateway> it = joinGateways.iterator(); it.hasNext(); ) { Gateway gateway = it.next(); Activity successor = gateway.getSuccessor(); if ((successor instanceof Gateway) && (isJoinGateway((Gateway) gateway.getSuccessor()))) { return gateway; } } return null; }
/** @return All join gateways that have an incoming transition from a fork gateway. */ private List<Gateway> getDirectJoinGateways() { List<Gateway> result = new ArrayList<Gateway>(); List<Gateway> joinGateways = getJoinGateways(true); for (Iterator<Gateway> it = joinGateways.iterator(); it.hasNext(); ) { Gateway gateway = it.next(); for (Iterator<Transition> itTrans = gateway.getTargetFor().iterator(); itTrans.hasNext(); ) { // check if source of one of the incoming transitions // is a fork gateway Transition trans = itTrans.next(); if ((trans.getSource() instanceof Gateway) && (isForkGateway((Gateway) trans.getSource()))) { result.add(gateway); } } } return result; }
/** * Checks if the gateway is a fork gateway and if this gateway type is allowed in a generalized * flow pattern. * * @param gateway The gateway to check * @return True, if the gateway is a parallel fork gateway. False, otherwise. */ private boolean isForkGateway(Gateway gateway) { if (gateway.getGatewayType().equals(Gateway.TYPE_AND) && gateway.getSourceFor().size() > 1) { return true; } return false; }