/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001-2006 The Mir-coders group
*
* This file is part of Mir.
*
*
* In addition, as a special exception, The Mir-coders gives permission to link
* the code of this program with any library licensed under the Apache Software License,
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
- * (or with modified versions of the above that use the same license as the above),
* and distribute linked combinations including the two. You must obey the
* GNU General Public License in all respects for all of the code used other than
* the above mentioned libraries. If you modify this file, you may extend this
*/
package mir.producer;
-import java.util.Collections;
-import java.util.Map;
-
import mir.entity.adapter.EntityAdapterModel;
import mir.entity.adapter.EntityIteratorAdapter;
-import mir.log.LoggerWrapper;
import mir.util.CachingRewindableIterator;
import mir.util.ParameterExpander;
import mir.util.StringRoutines;
+import java.util.Collections;
+
public class EntityListProducerNode extends ProducerNodeDecorator {
private String keyExpression;
private String whereClause;
skipExpression = aSkipExpression;
}
- public void produce(Map aValueMap, String aVerb, LoggerWrapper aLogger) throws ProducerFailure, ProducerExc {
+ public void produce(ProductionContext aProductionContext) throws ProducerFailure, ProducerExc {
try {
- int limit = ParameterExpander.evaluateIntegerExpressionWithDefault(aValueMap, limitExpression, -1);
- int skip = ParameterExpander.evaluateIntegerExpressionWithDefault(aValueMap, skipExpression, 0);
+ int limit = ParameterExpander.evaluateIntegerExpressionWithDefault(aProductionContext.getValueSet(), limitExpression, -1);
+ int skip = ParameterExpander.evaluateIntegerExpressionWithDefault(aProductionContext.getValueSet(), skipExpression, 0);
if (skipExpression != null && !skipExpression.trim().equals(""))
- skip = ParameterExpander.evaluateIntegerExpression(aValueMap, skipExpression);
- String key = ParameterExpander.expandExpression(aValueMap, keyExpression);
+ skip = ParameterExpander.evaluateIntegerExpression(aProductionContext.getValueSet(), skipExpression);
+ String key = ParameterExpander.expandExpression(aProductionContext.getValueSet(), keyExpression);
try {
ParameterExpander.setValueForKey(
- aValueMap,
+ aProductionContext.getValueSet(),
key,
new CachingRewindableIterator(
new EntityIteratorAdapter( mainTablePrefix,
- StringRoutines.splitString(ParameterExpander.expandExpression( aValueMap, extraTables).trim(), ","),
- ParameterExpander.expandExpression( aValueMap, whereClause ),
- ParameterExpander.expandExpression( aValueMap, orderByClause ),
+ StringRoutines.splitString(ParameterExpander.expandExpression(aProductionContext.getValueSet(), extraTables).trim(), ","),
+ ParameterExpander.expandExpression(aProductionContext.getValueSet(), whereClause ),
+ ParameterExpander.expandExpression(aProductionContext.getValueSet(), orderByClause ),
Math.min(50, limit),
model,
definition,
);
}
catch (Throwable t) {
- aLogger.error("cannot retrieve list into keyExpression " + key + ": " + t.getMessage());
+ aProductionContext.getLogger().warn("cannot retrieve list into keyExpression " + key, t);
+
try {
ParameterExpander.setValueForKey(
- aValueMap,
+ aProductionContext.getValueSet(),
key,
new CachingRewindableIterator(Collections.EMPTY_LIST.iterator())
);
}
}
catch (Throwable t) {
- aLogger.error("cannot process entity list producer node: : " + t.getMessage());
+ aProductionContext.getLogger().error("cannot process entity list producer node: : ", t);
}
- super.produce(aValueMap, aVerb, aLogger);
+ super.produce(aProductionContext);
}
}
\ No newline at end of file