1 24 package org.ofbiz.minilang.method; 25 26 import org.w3c.dom.*; 27 import org.ofbiz.base.util.*; 28 import org.ofbiz.minilang.*; 29 30 37 public class StringString extends MethodString { 38 39 String value; 40 String cdataValue; 41 42 public StringString(Element element, SimpleMethod simpleMethod) { 43 super(element, simpleMethod); 44 value = element.getAttribute("value"); 45 cdataValue = UtilXml.elementValue(element); 46 } 47 48 public String getString(MethodContext methodContext) { 49 String value = methodContext.expandString(this.value); 50 String cdataValue = methodContext.expandString(this.cdataValue); 51 52 boolean valueExists = UtilValidate.isNotEmpty(value); 53 boolean cdataValueExists = UtilValidate.isNotEmpty(cdataValue); 54 55 if (valueExists && cdataValueExists) { 56 return value + cdataValue; 57 } else { 58 if (valueExists) { 59 return value; 60 } else { 61 return cdataValue; 62 } 63 } 64 } 65 } 66 | Popular Tags |