本文整理汇总了Java中org.ofbiz.base.util.UtilXml.childElementList方法的典型用法代码示例。如果您正苦于以下问题:Java UtilXml.childElementList方法的具体用法?Java UtilXml.childElementList怎么用?Java UtilXml.childElementList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ofbiz.base.util.UtilXml
的用法示例。
在下文中一共展示了UtilXml.childElementList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readGridDocument
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public static Map<String, ModelGrid> readGridDocument(Document gridFileDoc, ModelReader entityModelReader, DispatchContext dispatchContext, String gridLocation) {
Map<String, ModelGrid> modelGridMap = new HashMap<String, ModelGrid>();
if (gridFileDoc != null) {
// read document and construct ModelGrid for each grid element
Element rootElement = gridFileDoc.getDocumentElement();
List<? extends Element> gridElements = UtilXml.childElementList(rootElement, "grid");
for (Element gridElement : gridElements) {
String gridName = gridElement.getAttribute("name");
String cacheKey = gridLocation + "#" + gridName;
ModelGrid modelGrid = gridLocationCache.get(cacheKey);
if (modelGrid == null) {
modelGrid = createModelGrid(gridElement, entityModelReader, dispatchContext, gridLocation, gridName);
modelGrid = gridLocationCache.putIfAbsentAndGet(cacheKey, modelGrid);
}
modelGridMap.put(gridName, modelGrid);
}
}
return modelGridMap;
}
示例2: getMessageList
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
private static List<String> getMessageList(Document responseDocument) {
List<String> messageList = new ArrayList<String>();
Element engineDocElement = UtilXml.firstChildElement(responseDocument.getDocumentElement(), "EngineDoc");
Element messageListElement = UtilXml.firstChildElement(engineDocElement, "MessageList");
List<? extends Element> messageElementList = UtilXml.childElementList(messageListElement, "Message");
if (UtilValidate.isNotEmpty(messageElementList)) {
for (Iterator<? extends Element> i = messageElementList.iterator(); i.hasNext();) {
Element messageElement = i.next();
int severity = 0;
try {
severity = Integer.parseInt(UtilXml.childElementValue(messageElement, "Sev"));
} catch (NumberFormatException nfe) {
Debug.logError("Error parsing message severity: " + nfe.getMessage(), module);
severity = 9;
}
String message = "[" + UtilXml.childElementValue(messageElement, "Audience") + "] " +
UtilXml.childElementValue(messageElement, "Text") + " (" + severity + ")";
messageList.add(message);
}
}
return messageList;
}
示例3: create
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
/**
* Returns a new <code>ModelIndex</code> instance, initialized with the specified values.
*
* @param modelEntity The <code>ModelEntity</code> this index is a member of.
* @param indexElement The <code><index></code> element containing the values for this index.
*/
public static ModelIndex create(ModelEntity modelEntity, Element indexElement) {
String name = indexElement.getAttribute("name").intern();
boolean unique = "true".equals(indexElement.getAttribute("unique"));
String description = UtilXml.childElementValue(indexElement, "description");
List<Field>fields = Collections.emptyList();
List<? extends Element> elementList = UtilXml.childElementList(indexElement, "index-field");
if (!elementList.isEmpty()) {
fields = new ArrayList<Field>(elementList.size());
for (Element indexFieldElement : elementList) {
String fieldName = indexFieldElement.getAttribute("name").intern();
String function = indexFieldElement.getAttribute("function").intern();
fields.add(new Field(fieldName, UtilValidate.isNotEmpty(function) ? Function.valueOf(function.toUpperCase()) : null));
}
fields = Collections.unmodifiableList(fields);
}
return new ModelIndex(modelEntity, description, name, fields, unique);
}
示例4: ModelAliasAll
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public ModelAliasAll(Element aliasAllElement) {
this.entityAlias = UtilXml.checkEmpty(aliasAllElement.getAttribute("entity-alias")).intern();
this.prefix = UtilXml.checkEmpty(aliasAllElement.getAttribute("prefix")).intern();
this.groupBy = "true".equals(UtilXml.checkEmpty(aliasAllElement.getAttribute("group-by")));
this.function = UtilXml.checkEmpty(aliasAllElement.getAttribute("function"));
this.fieldSet = UtilXml.checkEmpty(aliasAllElement.getAttribute("field-set")).intern();
List<? extends Element> excludes = UtilXml.childElementList(aliasAllElement, "exclude");
if (UtilValidate.isNotEmpty(excludes)) {
this.fieldsToExclude = new HashSet<String>();
for (Element excludeElement: excludes) {
this.fieldsToExclude.add(excludeElement.getAttribute("field").intern());
}
} else {
this.fieldsToExclude = null;
}
}
示例5: getLabelsFromOfbizComponents
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
private void getLabelsFromOfbizComponents() throws IOException, SAXException, ParserConfigurationException {
List<File> componentsFiles = FileUtil.findXmlFiles(null, null, "ofbiz-component", "http://ofbiz.apache.org/dtds/ofbiz-component.xsd");
for (File componentFile : componentsFiles) {
String filePath = componentFile.getPath();
Document menuDocument = UtilXml.readXmlDocument(componentFile.toURI().toURL());
Element rootElem = menuDocument.getDocumentElement();
for (Element elem1 : UtilXml.childElementList(rootElem)) {
checkOfbizComponentTag(elem1, filePath);
for (Element elem2 : UtilXml.childElementList(elem1)) {
checkOfbizComponentTag(elem2, filePath);
}
}
}
}
示例6: readTreeDocument
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public static Map<String, ModelTree> readTreeDocument(Document treeFileDoc, Delegator delegator, LocalDispatcher dispatcher, String treeLocation) {
Map<String, ModelTree> modelTreeMap = new HashMap<String, ModelTree>();
if (treeFileDoc != null) {
// read document and construct ModelTree for each tree element
Element rootElement = treeFileDoc.getDocumentElement();
for (Element treeElement: UtilXml.childElementList(rootElement, "tree")) {
ModelTree modelTree = new ModelTree(treeElement, treeLocation);
modelTreeMap.put(modelTree.getName(), modelTree);
}
}
return modelTreeMap;
}
示例7: RenderInitSettings
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public RenderInitSettings(ModelScreenSettings modelScreenSettings, Element autoSettingsElement, String sourceLocation) {
List<? extends Element> childElements = UtilXml.childElementList(autoSettingsElement, "local");
if (UtilValidate.isNotEmpty(childElements)) {
this.localSettings = new LocalSettings(modelScreenSettings, childElements.get(0), sourceLocation);
} else {
this.localSettings = new LocalSettings();
}
}
示例8: ModelScreenSettings
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public ModelScreenSettings(Element settingsElement, String sourceLocation) {
super(settingsElement);
this.location = sourceLocation;
List<? extends Element> childElementList;
childElementList = UtilXml.childElementList(settingsElement, "auto-include-settings");
if (UtilValidate.isNotEmpty(childElementList)) {
this.autoIncludeSettings = new AutoIncludeSettings(childElementList.get(0), sourceLocation);
} else {
this.autoIncludeSettings = null;
}
childElementList = UtilXml.childElementList(settingsElement, "decorator-screen-settings");
if (UtilValidate.isNotEmpty(childElementList)) {
this.decoratorScreenSettings = new DecoratorScreenSettings(childElementList.get(0), sourceLocation);
} else {
this.decoratorScreenSettings = defaultDecoratorScreenSettings;
}
childElementList = UtilXml.childElementList(settingsElement, "render-init");
if (UtilValidate.isNotEmpty(childElementList)) {
this.renderInitSettings = new RenderInitSettings(this, childElementList.get(0), sourceLocation);
} else {
this.renderInitSettings = null;
}
this.active = UtilMisc.booleanValue(settingsElement.getAttribute("active"));
}
示例9: createGroupDefs
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
private void createGroupDefs(Element baseElement, ModelService service) {
List<? extends Element> group = UtilXml.childElementList(baseElement, "group");
if (UtilValidate.isNotEmpty(group)) {
Element groupElement = group.get(0);
groupElement.setAttribute("name", "_" + service.name + ".group");
service.internalGroup = new GroupModel(groupElement);
service.invoke = service.internalGroup.getGroupName();
if (Debug.verboseOn()) Debug.logVerbose("Created INTERNAL GROUP model [" + service.internalGroup + "]", module);
}
}
示例10: ColumnContainer
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public ColumnContainer(ModelScreen modelScreen, Element containerElement) {
super(modelScreen, containerElement);
this.idExdr = FlexibleStringExpander.getInstance(containerElement.getAttribute("id"));
this.styleExdr = FlexibleStringExpander.getInstance(containerElement.getAttribute("style"));
List<? extends Element> subElementList = UtilXml.childElementList(containerElement, "column");
List<Column> columns = new ArrayList<Column>(subElementList.size());
for (Element element : subElementList) {
columns.add(new Column(modelScreen, element));
}
this.columns = Collections.unmodifiableList(columns);
}
示例11: LocalSettings
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public LocalSettings(ModelScreenSettings modelScreenSettings, Element autoSettingsElement, String sourceLocation) {
ArrayList<ModelAction> actions = new ArrayList<>();
List<? extends Element> childElements = UtilXml.childElementList(autoSettingsElement, "actions");
for (Element childElement: childElements) {
actions.addAll(AbstractModelAction.readSubActions(modelScreenSettings, childElement));
}
actions.trimToSize();
this.actions = Collections.unmodifiableList(actions);
}
示例12: ViewEntityCondition
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public ViewEntityCondition(ModelViewEntity modelViewEntity, ModelViewLink modelViewLink, Element element) {
this.modelViewEntity = modelViewEntity;
this.modelViewLink = modelViewLink;
this.filterByDate = "true".equals(element.getAttribute("filter-by-date"));
this.distinct = "true".equals(element.getAttribute("distinct"));
// process order-by
List<? extends Element> orderByElementList = UtilXml.childElementList(element, "order-by");
if (orderByElementList.size() > 0) {
orderByList = new ArrayList<String>(orderByElementList.size());
for (Element orderByElement: orderByElementList) {
orderByList.add(orderByElement.getAttribute("field-name"));
}
} else {
orderByList = null;
}
Element conditionExprElement = UtilXml.firstChildElement(element, "condition-expr");
Element conditionListElement = UtilXml.firstChildElement(element, "condition-list");
if (conditionExprElement != null) {
this.whereCondition = new ViewConditionExpr(this, conditionExprElement);
} else if (conditionListElement != null) {
this.whereCondition = new ViewConditionList(this, conditionListElement);
} else {
this.whereCondition = null;
}
Element havingConditionListElement = UtilXml.firstChildElement(element, "having-condition-list");
if (havingConditionListElement != null) {
this.havingCondition = new ViewConditionList(this, havingConditionListElement);
} else {
this.havingCondition = null;
}
}
示例13: CalcOp
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
private CalcOp(Element element, SimpleMethod simpleMethod) throws MiniLangException {
super(element, simpleMethod);
if (MiniLangValidate.validationOn()) {
MiniLangValidate.attributeNames(simpleMethod, element, "field", "operator");
MiniLangValidate.requiredAttributes(simpleMethod, element, "operator");
MiniLangValidate.expressionAttributes(simpleMethod, element, "field");
MiniLangValidate.childElements(simpleMethod, element, "calcop", "number");
}
this.fieldFma = FlexibleMapAccessor.getInstance(element.getAttribute("field"));
String operatorStr = element.getAttribute("operator");
int operator = CalcOp.OPERATOR_ADD;
if ("subtract".equals(operatorStr)) {
operator = CalcOp.OPERATOR_SUBTRACT;
} else if ("multiply".equals(operatorStr)) {
operator = CalcOp.OPERATOR_MULTIPLY;
} else if ("divide".equals(operatorStr)) {
operator = CalcOp.OPERATOR_DIVIDE;
} else if ("negative".equals(operatorStr)) {
operator = CalcOp.OPERATOR_NEGATIVE;
}
this.operator = operator;
List<? extends Element> calcopElements = UtilXml.childElementList(element);
calcops = new Calculate.SubCalc[calcopElements.size()];
int i = 0;
for (Element calcopElement : calcopElements) {
if ("calcop".equals(calcopElement.getNodeName())) {
calcops[i] = new Calculate.CalcOp(calcopElement, simpleMethod);
} else if ("number".equals(calcopElement.getNodeName())) {
calcops[i] = new Calculate.NumberOp(calcopElement, simpleMethod);
} else {
MiniLangValidate.handleError("Invalid calculate sub-element.", simpleMethod, calcopElement);
calcops[i] = new InvalidOp(calcopElement, simpleMethod);
}
i++;
}
}
示例14: createImplDefs
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
private void createImplDefs(Element baseElement, ModelService service) {
for (Element implement: UtilXml.childElementList(baseElement, "implements")) {
String serviceName = UtilXml.checkEmpty(implement.getAttribute("service")).intern();
boolean optional = UtilXml.checkBoolean(implement.getAttribute("optional"), false);
if (serviceName.length() > 0)
service.implServices.add(new ModelServiceIface(serviceName, optional));
//service.implServices.add(serviceName);
}
}
示例15: CallSimpleMethod
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public CallSimpleMethod(Element element, SimpleMethod simpleMethod) throws MiniLangException {
super(element, simpleMethod);
if (MiniLangValidate.validationOn()) {
MiniLangValidate.attributeNames(simpleMethod, element, "method-name", "xml-resource", "scope");
MiniLangValidate.requiredAttributes(simpleMethod, element, "method-name");
MiniLangValidate.constantAttributes(simpleMethod, element, "method-name", "xml-resource", "scope");
MiniLangValidate.childElements(simpleMethod, element, "result-to-field");
}
this.methodName = element.getAttribute("method-name");
String xmlResourceAttribute = element.getAttribute("xml-resource");
if (xmlResourceAttribute.isEmpty()) {
xmlResourceAttribute = simpleMethod.getFromLocation();
}
this.xmlResource = xmlResourceAttribute;
URL xmlURL = null;
try {
xmlURL = FlexibleLocation.resolveLocation(this.xmlResource);
} catch (MalformedURLException e) {
MiniLangValidate.handleError("Could not find SimpleMethod XML document in resource: " + this.xmlResource + "; error was: " + e.toString(), simpleMethod, element);
}
this.xmlURL = xmlURL;
this.scope = element.getAttribute("scope");
List<? extends Element> resultToFieldElements = UtilXml.childElementList(element, "result-to-field");
if (UtilValidate.isNotEmpty(resultToFieldElements)) {
if (!"function".equals(this.scope)) {
MiniLangValidate.handleError("Inline scope cannot include <result-to-field> elements.", simpleMethod, element);
}
List<ResultToField> resultToFieldList = new ArrayList<ResultToField>(resultToFieldElements.size());
for (Element resultToFieldElement : resultToFieldElements) {
resultToFieldList.add(new ResultToField(resultToFieldElement, simpleMethod));
}
this.resultToFieldList = resultToFieldList;
} else {
this.resultToFieldList = null;
}
}