1 24 package org.ofbiz.minilang.method.entityops; 25 26 import java.util.*; 27 28 import org.w3c.dom.*; 29 import org.ofbiz.base.util.*; 30 import org.ofbiz.minilang.*; 31 import org.ofbiz.minilang.method.*; 32 33 41 public class ClearCacheLine extends MethodOperation { 42 43 public static final String module = ClearCacheLine.class.getName(); 44 45 String entityName; 46 ContextAccessor mapAcsr; 47 48 public ClearCacheLine(Element element, SimpleMethod simpleMethod) { 49 super(element, simpleMethod); 50 entityName = element.getAttribute("entity-name"); 51 mapAcsr = new ContextAccessor(element.getAttribute("map-name")); 52 } 53 54 public boolean exec(MethodContext methodContext) { 55 String entityName = methodContext.expandString(this.entityName); 56 57 if (mapAcsr.isEmpty()) { 58 methodContext.getDelegator().clearCacheLine(entityName, null); 59 } else { 60 Map theMap = (Map) mapAcsr.get(methodContext); 61 if (theMap == null) { 62 Debug.logWarning("In clear-cache-line could not find map with name " + mapAcsr + ", not clearing any cache lines", module); 63 } else { 64 methodContext.getDelegator().clearCacheLine(entityName, theMap); 65 } 66 } 67 return true; 68 } 69 70 public String rawString() { 71 return "<clear-cache-line/>"; 73 } 74 public String expandedString(MethodContext methodContext) { 75 return this.rawString(); 77 } 78 } 79 | Popular Tags |