1 24 package org.ofbiz.minilang.method.entityops; 25 26 import java.util.List ; 27 28 import org.ofbiz.entity.util.EntityUtil; 29 import org.ofbiz.minilang.SimpleMethod; 30 import org.ofbiz.minilang.method.ContextAccessor; 31 import org.ofbiz.minilang.method.MethodContext; 32 import org.ofbiz.minilang.method.MethodOperation; 33 import org.w3c.dom.Element ; 34 35 42 public class OrderValueList extends MethodOperation { 43 44 ContextAccessor listAcsr; 45 ContextAccessor toListAcsr; 46 ContextAccessor orderByListAcsr; 47 48 public OrderValueList(Element element, SimpleMethod simpleMethod) { 49 super(element, simpleMethod); 50 listAcsr = new ContextAccessor(element.getAttribute("list-name")); 51 toListAcsr = new ContextAccessor(element.getAttribute("to-list-name"), element.getAttribute("list-name")); 52 orderByListAcsr = new ContextAccessor(element.getAttribute("order-by-list-name")); 53 } 54 55 public boolean exec(MethodContext methodContext) { 56 List orderByList = null; 57 58 if (!orderByListAcsr.isEmpty()) { 59 orderByList = (List ) orderByListAcsr.get(methodContext); 60 } 61 toListAcsr.put(methodContext, EntityUtil.orderBy((List ) listAcsr.get(methodContext), orderByList)); 62 return true; 63 } 64 65 public String rawString() { 66 return "<order-value-list/>"; 68 } 69 public String expandedString(MethodContext methodContext) { 70 return this.rawString(); 72 } 73 } 74 | Popular Tags |