}
@SuppressWarnings("unchecked")
private CorrelationKey computeCorrelationKey(OScope.CorrelationSet cset, OMessageVarType messagetype,
Element msg, Map<String, Node> headerParts) {
CorrelationKey key = null;
String[] values = new String[cset.properties.size()];
int jIdx = 0;
for (Iterator j = cset.properties.iterator(); j.hasNext(); ++jIdx) {
OProcess.OProperty property = (OProcess.OProperty) j.next();
OProcess.OPropertyAlias alias = property.getAlias(messagetype);
if (alias == null) {
// TODO: Throw a real exception! And catch this at compile
// time.
throw new IllegalArgumentException("No alias matching property '" + property.name
+ "' with message type '" + messagetype + "'");
}
String value;
try {
value = _process.extractProperty(msg, headerParts, alias, msg.toString());
} catch (FaultException fe) {
String emsg = __msgs.msgPropertyAliasDerefFailedOnMessage(alias.getDescription(), fe.getMessage());
__log.error(emsg, fe);
throw new InvalidMessageException(emsg, fe);
}
values[jIdx] = value;
}
if( cset.hasJoinUseCases ) {
key = new OptionalCorrelationKey(cset.name, values);
} else {
key = new CorrelationKey(cset.name, values);
}
return key;
}