use of org.apache.ofbiz.minilang.method.MethodOperation.DeprecatedOperation in project ofbiz-framework by apache.
the class SimpleMethod method readOperations.
public static List<MethodOperation> readOperations(Element simpleMethodElement, SimpleMethod simpleMethod) throws MiniLangException {
Assert.notNull("simpleMethodElement", simpleMethodElement, "simpleMethod", simpleMethod);
List<? extends Element> operationElements = UtilXml.childElementList(simpleMethodElement);
ArrayList<MethodOperation> methodOperations = new ArrayList<MethodOperation>(operationElements.size());
if (UtilValidate.isNotEmpty(operationElements)) {
for (Element curOperElem : operationElements) {
String nodeName = UtilXml.getNodeNameIgnorePrefix(curOperElem);
MethodOperation methodOp = null;
MethodOperation.Factory<MethodOperation> factory = methodOperationFactories.get(nodeName);
if (factory != null) {
methodOp = factory.createMethodOperation(curOperElem, simpleMethod);
} else if ("else".equals(nodeName)) {
// don't add anything, but don't complain either, this one is handled in the individual operations
} else {
MiniLangValidate.handleError("Invalid element found", simpleMethod, curOperElem);
}
if (methodOp == null) {
continue;
}
methodOperations.add(methodOp);
DeprecatedOperation depOp = methodOp.getClass().getAnnotation(DeprecatedOperation.class);
if (depOp != null) {
MiniLangValidate.handleError("The " + nodeName + " operation has been deprecated in favor of the " + depOp.value() + " operation", simpleMethod, curOperElem);
}
}
}
methodOperations.trimToSize();
return methodOperations;
}
Aggregations