📄 correlations.java
字号:
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the JBPM BPEL PUBLIC LICENSE AGREEMENT as
* published by JBoss Inc.; either version 1.0 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package org.jbpm.bpel.integration.def;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.jbpm.bpel.integration.def.Correlation.Initiate;
import org.jbpm.bpel.integration.exe.CorrelationSetInstance;
import org.jbpm.bpel.variable.exe.MessageValue;
import org.jbpm.graph.exe.Token;
/**
* Groups the correlations ocurring in the message being sent or received in an
* activity.
* @see "WS-BPEL 2.0 §10.2"
* @author Alejandro Gu韟ar
* @version $Revision: 1.5 $ $Date: 2006/09/27 03:53:01 $
*/
public class Correlations implements Serializable {
private static final long serialVersionUID = 1L;
long id;
private Map correlations;
public Correlations() {
}
public void addCorrelation(Correlation correlation) {
if (correlations == null) {
correlations = new HashMap();
}
correlations.put(correlation.getSet().getName(), correlation);
}
public Correlation getCorrelation(String setName) {
return (Correlation) correlations.get(setName);
}
public Map getCorrelations() {
return correlations;
}
public void setCorrelations(Map correlations) {
this.correlations = correlations;
}
public Map getReceptionProperties(Token token) {
Map receptionProperties = new HashMap();
Iterator correlationIter = correlations.values().iterator();
while (correlationIter.hasNext()) {
Correlation correlation = (Correlation) correlationIter.next();
Initiate initiate = correlation.getInitiate();
if (initiate != Initiate.YES) {
CorrelationSetInstance setInstance = correlation.getSet().getInstance(
token);
if (initiate == Initiate.NO || setInstance.isInitialized()) {
receptionProperties.putAll(setInstance.getProperties());
}
}
}
return receptionProperties;
}
public void ensureConstraint(MessageValue messageValue, Token token) {
Iterator correlationIter = correlations.values().iterator();
while (correlationIter.hasNext()) {
Correlation correlation = (Correlation) correlationIter.next();
CorrelationSetInstance setInstance = correlation.getSet().getInstance(
token);
Initiate initiate = correlation.getInitiate();
if (initiate == Initiate.YES) {
setInstance.initialize(messageValue);
}
else if (initiate == Initiate.NO) {
setInstance.validateConstraint(messageValue);
}
else if (initiate == Initiate.JOIN) {
if (setInstance.isInitialized())
setInstance.validateConstraint(messageValue);
else
setInstance.initialize(messageValue);
}
else
throw new IllegalStateException("illegal property value: initiate="
+ initiate);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -