1 24 package org.ofbiz.minilang.method.entityops; 25 26 import java.util.*; 27 28 import org.w3c.dom.*; 29 import org.ofbiz.minilang.*; 30 import org.ofbiz.minilang.method.*; 31 32 39 public class MakeValue extends MethodOperation { 40 41 ContextAccessor valueAcsr; 42 String entityName; 43 ContextAccessor mapAcsr; 44 45 public MakeValue(Element element, SimpleMethod simpleMethod) { 46 super(element, simpleMethod); 47 valueAcsr = new ContextAccessor(element.getAttribute("value-name")); 48 entityName = element.getAttribute("entity-name"); 49 mapAcsr = new ContextAccessor(element.getAttribute("map-name")); 50 } 51 52 public boolean exec(MethodContext methodContext) { 53 String entityName = methodContext.expandString(this.entityName); 54 Map ctxMap = (Map) (mapAcsr.isEmpty() ? null : mapAcsr.get(methodContext)); 55 valueAcsr.put(methodContext, methodContext.getDelegator().makeValidValue(entityName, ctxMap)); 56 return true; 57 } 58 59 public String rawString() { 60 return "<make-value/>"; 62 } 63 public String expandedString(MethodContext methodContext) { 64 return this.rawString(); 66 } 67 } 68 | Popular Tags |