1 24 package org.ofbiz.minilang.method.callops; 25 26 import org.w3c.dom.*; 27 28 import org.ofbiz.minilang.*; 29 import org.ofbiz.minilang.method.*; 30 31 38 public class Return extends MethodOperation { 39 40 String responseCode; 41 42 public Return(Element element, SimpleMethod simpleMethod) { 43 super(element, simpleMethod); 44 responseCode = element.getAttribute("response-code"); 45 if (responseCode == null || responseCode.length() == 0) 46 responseCode = "success"; 47 } 48 49 public boolean exec(MethodContext methodContext) { 50 String responseCode = methodContext.expandString(this.responseCode); 51 52 if (methodContext.getMethodType() == MethodContext.EVENT) { 53 methodContext.putEnv(simpleMethod.getEventResponseCodeName(), responseCode); 54 return false; 55 } else if (methodContext.getMethodType() == MethodContext.SERVICE) { 56 methodContext.putEnv(simpleMethod.getServiceResponseMessageName(), responseCode); 57 return false; 58 } else { 59 return false; 60 } 61 } 62 63 public String rawString() { 64 return "<return/>"; 66 } 67 public String expandedString(MethodContext methodContext) { 68 return this.rawString(); 70 } 71 } 72 | Popular Tags |