public static CorrelationSet getCorrelationSetForActivity(Correlation correlation, String correlationSetName) {
EObject container = correlation.eContainer();
while (container != null) {
CorrelationSets correlationSets = null;
if (container instanceof Process)
correlationSets = ((Process)container).getCorrelationSets();
else if (container instanceof Scope)
correlationSets = ((Scope)container).getCorrelationSets();
else if (container instanceof OnEvent)
correlationSets = ((OnEvent)container).getCorrelationSets();
if (correlationSets != null) {
for (Iterator<?> it = correlationSets.getChildren().iterator(); it.hasNext(); ) {
CorrelationSet correlationSet = (CorrelationSet)it.next();
if (correlationSet.getName().equals(correlationSetName))
return correlationSet;
}
}