* @param matchCorrelations the match type correlation
* @return returns the resolved CorrelationKey
* @throws FaultException thrown when the correlation is not initialized and createInstance flag is not set
*/
private CorrelationKeySet resolveCorrelationKey(PartnerLinkInstance pLinkInstance, Set<OScope.CorrelationSet> matchCorrelations) throws FaultException {
CorrelationKeySet keySet = new CorrelationKeySet(); // is empty for the case of the createInstance activity
if (matchCorrelations.isEmpty() && !_opick.createInstanceFlag) {
// Adding a route for opaque correlation. In this case,
// correlation is on "out-of-band" session-id
String sessionId = getBpelRuntimeContext().fetchMySessionId(pLinkInstance);
keySet.add(new CorrelationKey("-1", new String[] { sessionId }));
} else if (!matchCorrelations.isEmpty()) {
for( OScope.CorrelationSet cset : matchCorrelations ) {
CorrelationKey key = null;
if(!getBpelRuntimeContext().isCorrelationInitialized(
_scopeFrame.resolve(cset))) {
if (!_opick.createInstanceFlag) {
throw new FaultException(_opick.getOwner().constants.qnCorrelationViolation,
"Correlation not initialized.");
}
} else {
key = getBpelRuntimeContext().readCorrelation(_scopeFrame.resolve(cset));
assert key != null;
}
if( key != null ) {
keySet.add(key);
}
}
}
return keySet;