Another set of internal java 1.5 markup changes.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@586854 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -99,10 +99,9 @@ public final class SOAPClientEngine extends GenericAsyncEngine {
|
||||
throw new GenericServiceException("Location not a valid URL", e);
|
||||
}
|
||||
|
||||
List inModelParamList = modelService.getInModelParamList();
|
||||
Object[] params = new Object[inModelParamList.size()];
|
||||
List<ModelParam> inModelParamList = modelService.getInModelParamList();
|
||||
|
||||
if (Debug.infoOn()) Debug.logInfo("[SOAPClientEngine.invoke] : Parameter length - " + params.length, module);
|
||||
if (Debug.infoOn()) Debug.logInfo("[SOAPClientEngine.invoke] : Parameter length - " + inModelParamList.size(), module);
|
||||
|
||||
call.setTargetEndpointAddress(endPoint);
|
||||
|
||||
@@ -115,11 +114,8 @@ public final class SOAPClientEngine extends GenericAsyncEngine {
|
||||
int i = 0;
|
||||
|
||||
call.setOperation(call.getOperationName().getLocalPart());
|
||||
List vParams = new ArrayList();
|
||||
Iterator iter = inModelParamList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ModelParam p = (ModelParam) iter.next();
|
||||
|
||||
List<Object> vParams = new ArrayList<Object>();
|
||||
for (ModelParam p: inModelParamList) {
|
||||
if (Debug.infoOn()) Debug.logInfo("[SOAPClientEngine.invoke} : Parameter: " + p.name + " (" + p.mode + ") - " + i, module);
|
||||
|
||||
//Exclude params that ModelServiceReader insert into
|
||||
@@ -128,15 +124,11 @@ public final class SOAPClientEngine extends GenericAsyncEngine {
|
||||
call.addParameter(p.name, qName, getMode(p.mode));
|
||||
vParams.add(context.get(p.name));
|
||||
}
|
||||
|
||||
// if the value is null, that's fine, it will go in null...
|
||||
params[i] = context.get(p.name);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
call.setReturnType(XMLType.XSD_ANYTYPE);
|
||||
params=vParams.toArray();
|
||||
Object[] params=vParams.toArray(new Object[vParams.size()]);
|
||||
|
||||
Object result = null;
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@ public class JmsListenerFactory implements Runnable {
|
||||
public static final String TOPIC_LISTENER_CLASS = "org.ofbiz.service.jms.JmsTopicListener";
|
||||
public static final String QUEUE_LISTENER_CLASS = "org.ofbiz.service.jms.JmsQueueListener";
|
||||
|
||||
protected static Map listeners = FastMap.newInstance();
|
||||
protected static Map servers = FastMap.newInstance();
|
||||
protected static Map<String, GenericMessageListener> listeners = FastMap.newInstance();
|
||||
protected static Map<String, Element> servers = FastMap.newInstance();
|
||||
|
||||
protected ServiceDispatcher dispatcher;
|
||||
protected boolean firstPass = true;
|
||||
@@ -134,11 +134,11 @@ public class JmsListenerFactory implements Runnable {
|
||||
className = JmsListenerFactory.QUEUE_LISTENER_CLASS;
|
||||
}
|
||||
|
||||
GenericMessageListener listener = (GenericMessageListener) listeners.get(serverKey);
|
||||
GenericMessageListener listener = listeners.get(serverKey);
|
||||
|
||||
if (listener == null) {
|
||||
synchronized (this) {
|
||||
listener = (GenericMessageListener) listeners.get(serverKey);
|
||||
listener = listeners.get(serverKey);
|
||||
if (listener == null) {
|
||||
ClassLoader cl = this.getClass().getClassLoader();
|
||||
|
||||
@@ -171,7 +171,7 @@ public class JmsListenerFactory implements Runnable {
|
||||
* @throws GenericServiceException
|
||||
*/
|
||||
public void loadListener(String serverKey) throws GenericServiceException {
|
||||
Element server = (Element) servers.get(serverKey);
|
||||
Element server = servers.get(serverKey);
|
||||
|
||||
if (server == null)
|
||||
throw new GenericServiceException("No listener found with that serverKey.");
|
||||
@@ -184,10 +184,7 @@ public class JmsListenerFactory implements Runnable {
|
||||
*/
|
||||
public void closeListeners() throws GenericServiceException {
|
||||
loadable = 0;
|
||||
Set listenerKeys = listeners.keySet();
|
||||
Iterator listenerIterator = listenerKeys.iterator();
|
||||
while (listenerIterator.hasNext()) {
|
||||
String serverKey = (String) listenerIterator.next();
|
||||
for (String serverKey: listeners.keySet()) {
|
||||
closeListener(serverKey);
|
||||
}
|
||||
}
|
||||
@@ -198,7 +195,7 @@ public class JmsListenerFactory implements Runnable {
|
||||
* @throws GenericServiceException
|
||||
*/
|
||||
public void closeListener(String serverKey) throws GenericServiceException {
|
||||
GenericMessageListener listener = (GenericMessageListener) listeners.get(serverKey);
|
||||
GenericMessageListener listener = listeners.get(serverKey);
|
||||
|
||||
if (listener == null)
|
||||
throw new GenericServiceException("No listener found with that serverKey.");
|
||||
@@ -211,7 +208,7 @@ public class JmsListenerFactory implements Runnable {
|
||||
* @throws GenericServiceException
|
||||
*/
|
||||
public void refreshListener(String serverKey) throws GenericServiceException {
|
||||
GenericMessageListener listener = (GenericMessageListener) listeners.get(serverKey);
|
||||
GenericMessageListener listener = listeners.get(serverKey);
|
||||
|
||||
if (listener == null)
|
||||
throw new GenericServiceException("No listener found with that serverKey.");
|
||||
@@ -222,7 +219,7 @@ public class JmsListenerFactory implements Runnable {
|
||||
* Gets a Map of JMS Listeners.
|
||||
* @return Map of JMS Listeners
|
||||
*/
|
||||
public Map getJMSListeners() {
|
||||
public Map<String, GenericMessageListener> getJMSListeners() {
|
||||
return UtilMisc.makeMapWritable(listeners);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ public class JmsServiceEngine extends AbstractEngine {
|
||||
|
||||
protected Message makeMessage(Session session, ModelService modelService, Map context)
|
||||
throws GenericServiceException, JMSException {
|
||||
List outParams = modelService.getParameterNames(ModelService.OUT_PARAM, false);
|
||||
List<String> outParams = modelService.getParameterNames(ModelService.OUT_PARAM, false);
|
||||
|
||||
if (outParams != null && outParams.size() > 0)
|
||||
throw new GenericServiceException("JMS service cannot have required OUT parameters; no parameters will be returned.");
|
||||
@@ -317,13 +317,10 @@ public class JmsServiceEngine extends AbstractEngine {
|
||||
|
||||
protected Map run(ModelService modelService, Map context) throws GenericServiceException {
|
||||
Element serviceElement = getServiceElement(modelService);
|
||||
List serverList = serverList(serviceElement);
|
||||
List<? extends Element> serverList = serverList(serviceElement);
|
||||
|
||||
Map result = FastMap.newInstance();
|
||||
Iterator i = serverList.iterator();
|
||||
|
||||
while (i.hasNext()) {
|
||||
Element server = (Element) i.next();
|
||||
for (Element server: serverList) {
|
||||
String serverType = server.getAttribute("type");
|
||||
|
||||
if (serverType.equals("topic"))
|
||||
|
||||
@@ -60,10 +60,10 @@ import org.ofbiz.service.config.ServiceConfigUtil;
|
||||
public class JobManager {
|
||||
|
||||
public static final String instanceId = UtilProperties.getPropertyValue("general.properties", "unique.instanceId", "ofbiz0");
|
||||
public static final Map updateFields = UtilMisc.toMap("runByInstanceId", instanceId, "statusId", "SERVICE_QUEUED");
|
||||
public static final Map<String, Object> updateFields = UtilMisc.<String, Object>toMap("runByInstanceId", instanceId, "statusId", "SERVICE_QUEUED");
|
||||
public static final String module = JobManager.class.getName();
|
||||
public static final String dispatcherName = "JobDispatcher";
|
||||
public static Map registeredManagers = FastMap.newInstance();
|
||||
public static Map<String, JobManager> registeredManagers = FastMap.newInstance();
|
||||
|
||||
protected GenericDelegator delegator;
|
||||
protected JobPoller jp;
|
||||
@@ -104,8 +104,8 @@ public class JobManager {
|
||||
return this.delegator;
|
||||
}
|
||||
|
||||
public synchronized Iterator poll() {
|
||||
List poll = FastList.newInstance();
|
||||
public synchronized Iterator<Job> poll() {
|
||||
List<Job> poll = FastList.newInstance();
|
||||
Collection<GenericValue> jobEnt = null;
|
||||
|
||||
// sort the results by time
|
||||
@@ -118,12 +118,10 @@ public class JobManager {
|
||||
new EntityExpr("runByInstanceId", EntityOperator.EQUALS, null));
|
||||
|
||||
// limit to just defined pools
|
||||
List pools = ServiceConfigUtil.getRunPools();
|
||||
List<String> pools = ServiceConfigUtil.getRunPools();
|
||||
List<EntityExpr> poolsExpr = UtilMisc.toList(new EntityExpr("poolId", EntityOperator.EQUALS, null));
|
||||
if (pools != null) {
|
||||
Iterator poolsIter = pools.iterator();
|
||||
while (poolsIter.hasNext()) {
|
||||
String poolName = (String) poolsIter.next();
|
||||
for (String poolName: pools) {
|
||||
poolsExpr.add(new EntityExpr("poolId", EntityOperator.EQUALS, poolName));
|
||||
}
|
||||
}
|
||||
@@ -146,7 +144,7 @@ public class JobManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
List localPoll = FastList.newInstance();
|
||||
List<Job> localPoll = FastList.newInstance();
|
||||
|
||||
// first update the jobs w/ this instance running information
|
||||
delegator.storeByCondition("JobSandbox", updateFields, mainCondition);
|
||||
@@ -435,7 +433,7 @@ public class JobManager {
|
||||
* Get a List of each threads current state.
|
||||
* @return List containing a Map of each thread's state.
|
||||
*/
|
||||
public List processList() {
|
||||
public List<Map<String, Object>> processList() {
|
||||
return jp.getPoolState();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ public class JobPoller implements Runnable {
|
||||
//public static final long MAX_TTL = 18000000;
|
||||
|
||||
protected Thread thread = null;
|
||||
protected LinkedList pool = null;
|
||||
protected LinkedList run = null;
|
||||
protected LinkedList<JobInvoker> pool = null;
|
||||
protected LinkedList<Job> run = null;
|
||||
protected JobManager jm = null;
|
||||
|
||||
protected volatile boolean isRunning = false;
|
||||
@@ -51,7 +51,7 @@ public class JobPoller implements Runnable {
|
||||
*/
|
||||
public JobPoller(JobManager jm, boolean enabled) {
|
||||
this.jm = jm;
|
||||
this.run = new LinkedList();
|
||||
this.run = new LinkedList<Job>();
|
||||
|
||||
// create the thread pool
|
||||
this.pool = createThreadPool();
|
||||
@@ -118,12 +118,10 @@ public class JobPoller implements Runnable {
|
||||
destroyThreadPool();
|
||||
}
|
||||
|
||||
public List getPoolState() {
|
||||
List stateList = new ArrayList();
|
||||
Iterator i = this.pool.iterator();
|
||||
while (i.hasNext()) {
|
||||
JobInvoker invoker = (JobInvoker) i.next();
|
||||
Map stateMap = FastMap.newInstance();
|
||||
public List<Map<String, Object>> getPoolState() {
|
||||
List<Map<String, Object>> stateList = new ArrayList<Map<String, Object>>();
|
||||
for (JobInvoker invoker: this.pool) {
|
||||
Map<String, Object> stateMap = FastMap.newInstance();
|
||||
stateMap.put("threadName", invoker.getName());
|
||||
stateMap.put("jobName", invoker.getJobName());
|
||||
stateMap.put("serviceName", invoker.getServiceName());
|
||||
@@ -140,9 +138,7 @@ public class JobPoller implements Runnable {
|
||||
*/
|
||||
private void destroyThreadPool() {
|
||||
Debug.logInfo("Destroying thread pool...", module);
|
||||
Iterator it = pool.iterator();
|
||||
while (it.hasNext()) {
|
||||
JobInvoker ji = (JobInvoker) it.next();
|
||||
for (JobInvoker ji: pool) {
|
||||
ji.stop();
|
||||
}
|
||||
pool.clear();
|
||||
@@ -157,9 +153,7 @@ public class JobPoller implements Runnable {
|
||||
}
|
||||
|
||||
private JobInvoker findThread(String threadName) {
|
||||
Iterator i = this.pool.iterator();
|
||||
while (i.hasNext()) {
|
||||
JobInvoker inv = (JobInvoker) i.next();
|
||||
for (JobInvoker inv: pool) {
|
||||
if (threadName.equals(inv.getName())) {
|
||||
return inv;
|
||||
}
|
||||
@@ -172,7 +166,7 @@ public class JobPoller implements Runnable {
|
||||
*/
|
||||
public synchronized Job next() {
|
||||
if (run.size() > 0)
|
||||
return (Job) run.removeFirst();
|
||||
return run.removeFirst();
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -209,8 +203,8 @@ public class JobPoller implements Runnable {
|
||||
}
|
||||
|
||||
// Creates the invoker pool
|
||||
private LinkedList createThreadPool() {
|
||||
LinkedList threadPool = new LinkedList();
|
||||
private LinkedList<JobInvoker> createThreadPool() {
|
||||
LinkedList<JobInvoker> threadPool = new LinkedList<JobInvoker>();
|
||||
|
||||
while (threadPool.size() < minThreads()) {
|
||||
JobInvoker iv = new JobInvoker(this, invokerWaitTime());
|
||||
|
||||
@@ -58,7 +58,7 @@ public class JavaMailContainer implements Container {
|
||||
protected boolean deleteMail = false; // whether to delete emails after fetching them.
|
||||
|
||||
protected String configFile = null;
|
||||
protected Map stores = null;
|
||||
protected Map<Store, Session> stores = null;
|
||||
|
||||
/**
|
||||
* Initialize the container
|
||||
@@ -70,7 +70,7 @@ public class JavaMailContainer implements Container {
|
||||
*/
|
||||
public void init(String[] args, String configFile) throws ContainerException {
|
||||
this.configFile = configFile;
|
||||
this.stores = new LinkedHashMap();
|
||||
this.stores = new LinkedHashMap<Store, Session>();
|
||||
this.pollTimer = new Timer();
|
||||
}
|
||||
|
||||
@@ -249,10 +249,9 @@ public class JavaMailContainer implements Container {
|
||||
|
||||
public void run() {
|
||||
if (stores != null && stores.size() > 0) {
|
||||
Iterator i = stores.keySet().iterator();
|
||||
while (i.hasNext()) {
|
||||
Store store = (Store) i.next();
|
||||
Session session = (Session) stores.get(store);
|
||||
for (Map.Entry<Store, Session> entry: stores.entrySet()) {
|
||||
Store store = entry.getKey();
|
||||
Session session = entry.getValue();
|
||||
try {
|
||||
checkMessages(store, session);
|
||||
} catch (GeneralException e) {
|
||||
@@ -297,22 +296,22 @@ public class JavaMailContainer implements Container {
|
||||
folder.fetch(messages, profile);
|
||||
|
||||
// process each message
|
||||
for (int i = 0; i < messages.length; i++) {
|
||||
for (Message message: messages) {
|
||||
// process each un-read message
|
||||
if (!messages[i].isSet(Flags.Flag.SEEN)) {
|
||||
long messageSize = messages[i].getSize();
|
||||
if (messages[i] instanceof MimeMessage && messageSize >= maxSize) {
|
||||
Debug.logWarning("Message from: " + messages[i].getFrom()[0] + "not received, too big, size:" + messageSize + " cannot be more than " + maxSize + " bytes", module);
|
||||
if (!message.isSet(Flags.Flag.SEEN)) {
|
||||
long messageSize = message.getSize();
|
||||
if (message instanceof MimeMessage && messageSize >= maxSize) {
|
||||
Debug.logWarning("Message from: " + message.getFrom()[0] + "not received, too big, size:" + messageSize + " cannot be more than " + maxSize + " bytes", module);
|
||||
} else {
|
||||
this.processMessage(messages[i], session);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Message from " + UtilMisc.toListArray(messages[i].getFrom()) + " with subject [" + messages[i].getSubject() + "] has been processed." , module);
|
||||
messages[i].setFlag(Flags.Flag.SEEN, true);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Message [" + messages[i].getSubject() + "] is marked seen", module);
|
||||
this.processMessage(message, session);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Message from " + UtilMisc.toListArray(message.getFrom()) + " with subject [" + message.getSubject() + "] has been processed." , module);
|
||||
message.setFlag(Flags.Flag.SEEN, true);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Message [" + message.getSubject() + "] is marked seen", module);
|
||||
}
|
||||
}
|
||||
if (deleteMail) {
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Message [" + messages[i].getSubject() + "] is being deleted", module);
|
||||
messages[i].setFlag(Flags.Flag.DELETED, true);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Message [" + message.getSubject() + "] is being deleted", module);
|
||||
message.setFlag(Flags.Flag.DELETED, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package org.ofbiz.service.mail;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.mail.Address;
|
||||
@@ -29,6 +28,8 @@ import javax.mail.Multipart;
|
||||
import javax.mail.Part;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
import javolution.util.FastList;
|
||||
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.UtilMisc;
|
||||
import org.ofbiz.service.LocalDispatcher;
|
||||
@@ -104,33 +105,33 @@ public class ServiceMcaCondition implements java.io.Serializable {
|
||||
} else if (headerName != null) {
|
||||
// compare the header field
|
||||
MimeMessage message = messageWrapper.getMessage();
|
||||
String[] headerValue = null;
|
||||
String[] headerValues = null;
|
||||
try {
|
||||
headerValue = message.getHeader(headerName);
|
||||
headerValues = message.getHeader(headerName);
|
||||
} catch (MessagingException e) {
|
||||
Debug.logError(e, module);
|
||||
}
|
||||
|
||||
if (headerValue != null) {
|
||||
for (int i = 0; i < headerValue.length; i++) {
|
||||
if (headerValues != null) {
|
||||
for (String headerValue: headerValues) {
|
||||
if ("equals".equals(operator)) {
|
||||
if (headerValue[i].equals(value)) {
|
||||
if (headerValue.equals(value)) {
|
||||
passedCondition = true;
|
||||
break;
|
||||
}
|
||||
} else if ("not-equals".equals(operator)) {
|
||||
if (!headerValue[i].equals(value)) {
|
||||
if (!headerValue.equals(value)) {
|
||||
passedCondition = true;
|
||||
} else {
|
||||
passedCondition = false;
|
||||
}
|
||||
} else if ("matches".equals(operator)) {
|
||||
if (headerValue[i].matches(value)) {
|
||||
if (headerValue.matches(value)) {
|
||||
passedCondition = true;
|
||||
break;
|
||||
}
|
||||
} else if ("not-matches".equals(operator)) {
|
||||
if (!headerValue[i].matches(value)) {
|
||||
if (!headerValue.matches(value)) {
|
||||
passedCondition = true;
|
||||
} else {
|
||||
passedCondition = false;
|
||||
@@ -145,35 +146,35 @@ public class ServiceMcaCondition implements java.io.Serializable {
|
||||
}
|
||||
} else if (fieldName != null) {
|
||||
MimeMessage message = messageWrapper.getMessage();
|
||||
String[] fieldValue = null;
|
||||
String[] fieldValues = null;
|
||||
try {
|
||||
fieldValue = this.getFieldValue(message, fieldName);
|
||||
fieldValues = this.getFieldValue(message, fieldName);
|
||||
} catch (MessagingException e) {
|
||||
Debug.logError(e, module);
|
||||
} catch (IOException e) {
|
||||
Debug.logError(e, module);
|
||||
}
|
||||
|
||||
if (fieldValue != null) {
|
||||
for (int i = 0; i < fieldValue.length; i++) {
|
||||
if (fieldValues != null) {
|
||||
for (String fieldValue: fieldValues) {
|
||||
if ("equals".equals(operator)) {
|
||||
if (fieldValue[i].equals(value)) {
|
||||
if (fieldValue.equals(value)) {
|
||||
passedCondition = true;
|
||||
break;
|
||||
}
|
||||
} else if ("not-equals".equals(operator)) {
|
||||
if (!fieldValue[i].equals(value)) {
|
||||
if (!fieldValue.equals(value)) {
|
||||
passedCondition = true;
|
||||
} else {
|
||||
passedCondition = false;
|
||||
}
|
||||
} else if ("matches".equals(operator)) {
|
||||
if (fieldValue[i].matches(value)) {
|
||||
if (fieldValue.matches(value)) {
|
||||
passedCondition = true;
|
||||
break;
|
||||
}
|
||||
} else if ("not-matches".equals(operator)) {
|
||||
if (!fieldValue[i].matches(value)) {
|
||||
if (!fieldValue.matches(value)) {
|
||||
passedCondition = true;
|
||||
} else {
|
||||
passedCondition = false;
|
||||
@@ -237,21 +238,18 @@ public class ServiceMcaCondition implements java.io.Serializable {
|
||||
values = new String[1];
|
||||
values[0] = message.getReceivedDate().toString();
|
||||
} else if ("body".equals(fieldName)) {
|
||||
List bodyParts = this.getBodyText(message);
|
||||
values = new String[bodyParts.size()];
|
||||
for (int i = 0; i < bodyParts.size(); i++) {
|
||||
values[i] = (String) bodyParts.get(i);
|
||||
}
|
||||
List<String> bodyParts = this.getBodyText(message);
|
||||
values = bodyParts.toArray(new String[bodyParts.size()]);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
private List getBodyText(Part part) throws MessagingException, IOException {
|
||||
private List<String> getBodyText(Part part) throws MessagingException, IOException {
|
||||
Object c = part.getContent();
|
||||
if (c instanceof String) {
|
||||
return UtilMisc.toList(c);
|
||||
return UtilMisc.toList((String) c);
|
||||
} else if (c instanceof Multipart) {
|
||||
List textContent = new ArrayList();
|
||||
List<String> textContent = FastList.newInstance();
|
||||
int count = ((Multipart) c).getCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
BodyPart bp = ((Multipart) c).getBodyPart(i);
|
||||
@@ -259,7 +257,7 @@ public class ServiceMcaCondition implements java.io.Serializable {
|
||||
}
|
||||
return textContent;
|
||||
} else {
|
||||
return new ArrayList();
|
||||
return FastList.newInstance();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ public class ServiceMcaRule implements java.io.Serializable {
|
||||
public static final String module = ServiceMcaRule.class.getName();
|
||||
|
||||
protected String ruleName = null;
|
||||
protected List conditions = new LinkedList();
|
||||
protected List actions = new LinkedList();
|
||||
protected List<ServiceMcaCondition> conditions = new LinkedList<ServiceMcaCondition>();
|
||||
protected List<ServiceMcaAction> actions = new LinkedList<ServiceMcaAction>();
|
||||
protected boolean enabled = true;
|
||||
|
||||
public ServiceMcaRule(Element mca) {
|
||||
@@ -60,16 +60,14 @@ public class ServiceMcaRule implements java.io.Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public void eval(LocalDispatcher dispatcher, MimeMessageWrapper messageWrapper, Set actionsRun, GenericValue userLogin) throws GenericServiceException {
|
||||
public void eval(LocalDispatcher dispatcher, MimeMessageWrapper messageWrapper, Set<String> actionsRun, GenericValue userLogin) throws GenericServiceException {
|
||||
if (!enabled) {
|
||||
Debug.logInfo("Service MCA [" + ruleName + "] is disabled; not running.", module);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean allCondTrue = true;
|
||||
Iterator i = conditions.iterator();
|
||||
while (i.hasNext()) {
|
||||
ServiceMcaCondition cond = (ServiceMcaCondition) i.next();
|
||||
for (ServiceMcaCondition cond: conditions) {
|
||||
if (!cond.eval(dispatcher, messageWrapper, userLogin)) {
|
||||
allCondTrue = false;
|
||||
break;
|
||||
@@ -77,15 +75,12 @@ public class ServiceMcaRule implements java.io.Serializable {
|
||||
}
|
||||
|
||||
if (allCondTrue) {
|
||||
Iterator a = actions.iterator();
|
||||
boolean allOkay = true;
|
||||
while (a.hasNext() && allOkay) {
|
||||
ServiceMcaAction action = (ServiceMcaAction) a.next();
|
||||
for (ServiceMcaAction action: actions) {
|
||||
if (!actionsRun.contains(action.serviceName)) {
|
||||
if (action.runAction(dispatcher, messageWrapper, userLogin)) {
|
||||
actionsRun.add(action.serviceName);
|
||||
} else {
|
||||
allOkay = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,14 +102,9 @@ public class ServiceMcaUtil {
|
||||
}
|
||||
|
||||
public static void evalRules(LocalDispatcher dispatcher, MimeMessageWrapper wrapper, GenericValue userLogin) throws GenericServiceException {
|
||||
List rules = getServiceMcaRules();
|
||||
Set actionsRun = new TreeSet();
|
||||
if (rules != null) {
|
||||
Iterator i = rules.iterator();
|
||||
while (i.hasNext()) {
|
||||
ServiceMcaRule rule = (ServiceMcaRule) i.next();
|
||||
rule.eval(dispatcher, wrapper, actionsRun, userLogin);
|
||||
}
|
||||
Set<String> actionsRun = new TreeSet<String>();
|
||||
for (ServiceMcaRule rule: getServiceMcaRules()) {
|
||||
rule.eval(dispatcher, wrapper, actionsRun, userLogin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user