1 24 package org.ofbiz.minilang.method.envops; 25 26 import java.util.*; 27 28 import org.w3c.dom.*; 29 30 import org.ofbiz.base.util.*; 31 import org.ofbiz.minilang.*; 32 import org.ofbiz.minilang.method.*; 33 34 41 public class ClearField extends MethodOperation { 42 43 public static final String module = ClearField.class.getName(); 44 45 ContextAccessor mapAcsr; 46 ContextAccessor fieldAcsr; 47 48 public ClearField(Element element, SimpleMethod simpleMethod) { 49 super(element, simpleMethod); 50 mapAcsr = new ContextAccessor(element.getAttribute("map-name")); 51 fieldAcsr = new ContextAccessor(element.getAttribute("field-name")); 52 } 53 54 public boolean exec(MethodContext methodContext) { 55 if (!mapAcsr.isEmpty()) { 56 Map toMap = (Map) mapAcsr.get(methodContext); 57 58 if (toMap == null) { 59 if (Debug.verboseOn()) Debug.logVerbose("Map not found with name " + mapAcsr + ", creating new map", module); 62 toMap = new HashMap(); 63 mapAcsr.put(methodContext, toMap); 64 } 65 66 fieldAcsr.put(toMap, null, methodContext); 67 } else { 68 fieldAcsr.put(methodContext, null); 69 } 70 71 return true; 72 } 73 74 public String rawString() { 75 return "<clear-field field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\"/>"; 76 } 77 public String expandedString(MethodContext methodContext) { 78 return this.rawString(); 80 } 81 } 82 | Popular Tags |