6 import mir.entity.adapter.*;
10 public abstract class EntityModifyingProducerNode implements ProducerNode {
11 String entityExpression;
13 String valueExpression;
15 public EntityModifyingProducerNode(String anEntityExpression, String anEntityField, String aValueExpression) {
16 entityExpression = anEntityExpression;
17 entityField = anEntityField;
18 valueExpression = aValueExpression;
21 public void produce(Map aValueMap, String aVerb, PrintWriter aLogger) throws ProducerFailure {
25 entity = ParameterExpander.findValueForKey( aValueMap, entityExpression );
27 if (entity instanceof EntityAdapter) {
28 ((EntityAdapter) entity).getEntity().setValueForProperty(entityField, valueExpression);
29 ((EntityAdapter) entity).getEntity().update();
32 throw new Exception( entityExpression + " does not evaluate to an entity");
35 aLogger.println("Error while performing entity modifying operation: " + t.getMessage());
37 throw new ProducerFailure(t.getMessage(), t);
41 public Set buildVerbSet() {