* @return the limit, or Integer.MAX_VALUE if there is no limit
*/
public int getTransitionConstraint(Scope<?> scope, StateModelDefId stateModelDefId,
Transition transition) {
// set up attributes to match based on the scope
ClusterConstraints transitionConstraints =
getConstraintMap().get(ConstraintType.MESSAGE_CONSTRAINT);
Map<ConstraintAttribute, String> matchAttributes = Maps.newHashMap();
matchAttributes.put(ConstraintAttribute.STATE_MODEL, stateModelDefId.toString());
matchAttributes.put(ConstraintAttribute.MESSAGE_TYPE, MessageType.STATE_TRANSITION.toString());
matchAttributes.put(ConstraintAttribute.TRANSITION, transition.toString());
switch (scope.getType()) {
case CLUSTER:
// cluster is implicit
break;
case RESOURCE:
matchAttributes.put(ConstraintAttribute.RESOURCE, scope.getScopedId().stringify());
break;
case PARTICIPANT:
matchAttributes.put(ConstraintAttribute.INSTANCE, scope.getScopedId().stringify());
break;
default:
LOG.error("Unsupported scope for transition constraints: " + scope);
return Integer.MAX_VALUE;
}
Set<ConstraintItem> matches = transitionConstraints.match(matchAttributes);
int value = Integer.MAX_VALUE;
for (ConstraintItem item : matches) {
String constraintValue = item.getConstraintValue();
if (constraintValue != null) {
try {