当前位置: 首页>>代码示例>>Java>>正文


Java UtilXml.firstChildElement方法代码示例

本文整理汇总了Java中org.ofbiz.base.util.UtilXml.firstChildElement方法的典型用法代码示例。如果您正苦于以下问题:Java UtilXml.firstChildElement方法的具体用法?Java UtilXml.firstChildElement怎么用?Java UtilXml.firstChildElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ofbiz.base.util.UtilXml的用法示例。


在下文中一共展示了UtilXml.firstChildElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: EmptyCondition

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public EmptyCondition(Element element, SimpleMethod simpleMethod) throws MiniLangException {
    super(element, simpleMethod);
    if (MiniLangValidate.validationOn()) {
        MiniLangValidate.attributeNames(simpleMethod, element, "field");
        MiniLangValidate.requiredAttributes(simpleMethod, element, "field");
        MiniLangValidate.expressionAttributes(simpleMethod, element, "field");
    }
    this.fieldFma = FlexibleMapAccessor.getInstance(element.getAttribute("field"));
    Element childElement = UtilXml.firstChildElement(element);
    if (childElement != null && !"else".equals(childElement.getTagName())) {
        this.subOps = Collections.unmodifiableList(SimpleMethod.readOperations(element, simpleMethod));
    } else {
        this.subOps = null;
    }
    Element elseElement = UtilXml.firstChildElement(element, "else");
    if (elseElement != null) {
        this.elseSubOps = Collections.unmodifiableList(SimpleMethod.readOperations(elseElement, simpleMethod));
    } else {
        this.elseSubOps = null;
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:22,代码来源:EmptyCondition.java

示例2: DisplayField

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public DisplayField(Element element, ModelFormField modelFormField) {
    super(element, modelFormField);
    this.alsoHidden = !"false".equals(element.getAttribute("also-hidden"));
    this.currency = FlexibleStringExpander.getInstance(element.getAttribute("currency"));
    this.date = FlexibleStringExpander.getInstance(element.getAttribute("date"));
    this.defaultValue = FlexibleStringExpander.getInstance(element.getAttribute("default-value"));
    this.description = FlexibleStringExpander.getInstance(element.getAttribute("description"));
    this.imageLocation = FlexibleStringExpander.getInstance(element.getAttribute("image-location"));
    Element inPlaceEditorElement = UtilXml.firstChildElement(element, "in-place-editor");
    if (inPlaceEditorElement != null) {
        this.inPlaceEditor = new InPlaceEditor(inPlaceEditorElement);
    } else {
        this.inPlaceEditor = null;
    }
    this.size = element.getAttribute("size");
    this.type = element.getAttribute("type");
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:ModelFormField.java

示例3: getFormFromWebappContext

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public static ModelForm getFormFromWebappContext(String resourceName, String formName, HttpServletRequest request)
        throws IOException, SAXException, ParserConfigurationException {
    String webappName = UtilHttp.getApplicationName(request);
    String cacheKey = webappName + "::" + resourceName + "::" + formName;
    ModelForm modelForm = formWebappCache.get(cacheKey);
    if (modelForm == null) {
        ServletContext servletContext = (ServletContext) request.getAttribute("servletContext");
        Delegator delegator = (Delegator) request.getAttribute("delegator");
        LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
        URL formFileUrl = servletContext.getResource(resourceName);
        Document formFileDoc = UtilXml.readXmlDocument(formFileUrl, true, true);
        // SCIPIO: New: Save original location as user data in Document
        if (formFileDoc != null) {
            WidgetDocumentInfo.retrieveAlways(formFileDoc).setResourceLocation(resourceName);
        }
        Element formElement = UtilXml.firstChildElement(formFileDoc.getDocumentElement(), "form", "name", formName);
        modelForm = createModelForm(formElement, delegator.getModelReader(), dispatcher.getDispatchContext(), resourceName, formName);
        modelForm = formWebappCache.putIfAbsentAndGet(cacheKey, modelForm);
    }
    if (modelForm == null) {
        throw new IllegalArgumentException("Could not find form with name [" + formName + "] in webapp resource [" + resourceName + "] in the webapp [" + webappName + "]");
    }
    return modelForm;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:25,代码来源:FormFactory.java

示例4: getGridFromWebappContext

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public static ModelGrid getGridFromWebappContext(String resourceName, String gridName, HttpServletRequest request)
        throws IOException, SAXException, ParserConfigurationException {
    String webappName = UtilHttp.getApplicationName(request);
    String cacheKey = webappName + "::" + resourceName + "::" + gridName;
    ModelGrid modelGrid = gridWebappCache.get(cacheKey);
    if (modelGrid == null) {
        ServletContext servletContext = (ServletContext) request.getAttribute("servletContext");
        Delegator delegator = (Delegator) request.getAttribute("delegator");
        LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
        URL gridFileUrl = servletContext.getResource(resourceName);
        Document gridFileDoc = UtilXml.readXmlDocument(gridFileUrl, true, true);
        // SCIPIO: New: Save original location as user data in Document
        if (gridFileDoc != null) {
            WidgetDocumentInfo.retrieveAlways(gridFileDoc).setResourceLocation(resourceName);
        }
        Element gridElement = UtilXml.firstChildElement(gridFileDoc.getDocumentElement(), "grid", "name", gridName);
        modelGrid = createModelGrid(gridElement, delegator.getModelReader(), dispatcher.getDispatchContext(), resourceName, gridName);
        modelGrid = gridWebappCache.putIfAbsentAndGet(cacheKey, modelGrid);
    }
    if (modelGrid == null) {
        throw new IllegalArgumentException("Could not find grid with name [" + gridName + "] in webapp resource [" + resourceName + "] in the webapp [" + webappName + "]");
    }
    return modelGrid;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:25,代码来源:GridFactory.java

示例5: Event

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public Event(Element eventElement) {
    this.type = eventElement.getAttribute("type");
    this.path = eventElement.getAttribute("path");
    this.invoke = eventElement.getAttribute("invoke");
    this.globalTransaction = !"false".equals(eventElement.getAttribute("global-transaction"));
    // Get metrics.
    Element metricsElement = UtilXml.firstChildElement(eventElement, "metric");
    if (metricsElement != null) {
        this.metrics = MetricsFactory.getInstance(metricsElement);
    }
    // SCIPIO: new attribs
    String transStr = eventElement.getAttribute("transaction");
    if ("true".equals(transStr)) {
        transaction = Boolean.TRUE;
    } else if ("false".equals(transStr)) {
        transaction = Boolean.FALSE;
    } else {
        transaction = null;
    }
    this.abortTransaction = eventElement.getAttribute("abort-transaction");
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:22,代码来源:ConfigXMLReader.java

示例6: addValidators

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
private void addValidators(Element attribute, ModelParam param) {
    List<? extends Element> validateElements = UtilXml.childElementList(attribute, "type-validate");
    if (UtilValidate.isNotEmpty(validateElements)) {
        // always clear out old ones; never append
        param.validators = new LinkedList<ModelParamValidator>();

        Element validate = validateElements.get(0);
        String methodName = validate.getAttribute("method").intern();
        String className = validate.getAttribute("class").intern();

        Element fail = UtilXml.firstChildElement(validate, "fail-message");
        if (fail != null) {
            String message = fail.getAttribute("message").intern();
            param.addValidator(className, methodName, message);
        } else {
            fail = UtilXml.firstChildElement(validate, "fail-property");
            if (fail != null) {
                String resource = fail.getAttribute("resource").intern();
                String property = fail.getAttribute("property").intern();
                param.addValidator(className, methodName, resource, property);
            }
        }
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:25,代码来源:ModelServiceReader.java

示例7: EntityPermissionChecker

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public EntityPermissionChecker(Element element) {
    this.entityNameExdr = FlexibleStringExpander.getInstance(element.getAttribute("entity-name"));
    this.entityIdExdr = FlexibleStringExpander.getInstance(element.getAttribute("entity-id"));
    this.displayFailCond = "true".equals(element.getAttribute("display-fail-cond"));
    Element permissionConditionElement = UtilXml.firstChildElement(element, "permission-condition-getter");
    if (permissionConditionElement == null) {
        permissionConditionGetter = new StdPermissionConditionGetter();
    } else {
        permissionConditionGetter = new StdPermissionConditionGetter(permissionConditionElement);
    }
    Element auxiliaryValueElement = UtilXml.firstChildElement(element, "auxiliary-value-getter");
    if (auxiliaryValueElement == null) {
        auxiliaryValueGetter = new StdAuxiliaryValueGetter();
    } else {
        auxiliaryValueGetter = new StdAuxiliaryValueGetter(auxiliaryValueElement);
    }
    Element relatedRoleElement = UtilXml.firstChildElement(element, "related-role-getter");
    if (relatedRoleElement == null) {
        relatedRoleGetter = new StdRelatedRoleGetter();
    } else {
        relatedRoleGetter = new StdRelatedRoleGetter(relatedRoleElement);
    }
    String targetOperationString = element.getAttribute("target-operation");
    if (UtilValidate.isNotEmpty(targetOperationString)) {
        List<String> operationsFromString = StringUtil.split(targetOperationString, "|");
        if (targetOperationList == null) {
            targetOperationList = new ArrayList<String>();
        }
        targetOperationList.addAll(operationsFromString);
    }
    permissionConditionGetter.setOperationList(targetOperationList);

}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:34,代码来源:EntityPermissionChecker.java

示例8: InPlaceEditor

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public InPlaceEditor(Element element) {
    this.cancelControl = element.getAttribute("cancel-control");
    this.cancelText = element.getAttribute("cancel-text");
    this.clickToEditText = element.getAttribute("click-to-edit-text");
    this.fieldPostCreation = element.getAttribute("field-post-creation");
    this.formClassName = element.getAttribute("form-class-name");
    this.highlightColor = element.getAttribute("highlight-color");
    this.highlightEndColor = element.getAttribute("highlight-end-color");
    this.hoverClassName = element.getAttribute("hover-class-name");
    this.htmlResponse = element.getAttribute("html-response");
    this.loadingClassName = element.getAttribute("loading-class-name");
    this.loadingText = element.getAttribute("loading-text");
    this.okControl = element.getAttribute("ok-control");
    this.okText = element.getAttribute("ok-text");
    this.paramName = element.getAttribute("param-name");
    this.savingClassName = element.getAttribute("saving-class-name");
    this.savingText = element.getAttribute("saving-text");
    this.submitOnBlur = element.getAttribute("submit-on-blur");
    this.textBeforeControls = element.getAttribute("text-before-controls");
    this.textAfterControls = element.getAttribute("text-after-controls");
    this.textBetweenControls = element.getAttribute("text-between-controls");
    this.updateAfterRequestCall = element.getAttribute("update-after-request-call");
    Element simpleElement = UtilXml.firstChildElement(element, "simple-editor");
    if (simpleElement != null) {
        this.rows = simpleElement.getAttribute("rows");
        this.cols = simpleElement.getAttribute("cols");
    } else {
        this.rows = "";
        this.cols = "";
    }
    this.fieldMap = EntityFinderUtil.makeFieldMap(element);
    this.url = FlexibleStringExpander.getInstance(element.getAttribute("url"));
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:34,代码来源:ModelFormField.java

示例9: ModelSubNode

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public ModelSubNode(Element subNodeElement, ModelNode modelNode) {
    super(subNodeElement);
    this.rootNode = modelNode;
    this.nodeNameExdr = FlexibleStringExpander.getInstance(subNodeElement.getAttribute("node-name"));
    ArrayList<ModelAction> actions = new ArrayList<ModelAction>();
    // FIXME: Validate child elements, should be only one of actions, entity-and, entity-condition, service, script.
    Element actionsElement = UtilXml.firstChildElement(subNodeElement, "actions");
    if (actionsElement != null) {
        actions.addAll(ModelTreeAction.readSubNodeActions(this, actionsElement));
    }
    Element actionElement = UtilXml.firstChildElement(subNodeElement, "entity-and");
    if (actionElement != null) {
        actions.add(new ModelTreeAction.EntityAnd(this, actionElement));
    }
    actionElement = UtilXml.firstChildElement(subNodeElement, "service");
    if (actionElement != null) {
        actions.add(new ModelTreeAction.Service(this, actionElement));
    }
    actionElement = UtilXml.firstChildElement(subNodeElement, "entity-condition");
    if (actionElement != null) {
        actions.add(new ModelTreeAction.EntityCondition(this, actionElement));
    }
    actionElement = UtilXml.firstChildElement(subNodeElement, "script");
    if (actionElement != null) {
        actions.add(new ModelTreeAction.Script(this, actionElement));
    }
    actions.trimToSize();
    this.actions = Collections.unmodifiableList(actions);
    this.iteratorKey = this.rootNode.getName().concat(".").concat(this.nodeNameExdr.getOriginal())
            .concat(".ITERATOR");
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:32,代码来源:ModelTree.java

示例10: 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;
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:34,代码来源:ModelViewEntity.java

示例11: ElseIf

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public ElseIf(Element element, SimpleMethod simpleMethod) throws MiniLangException {
    super(element, simpleMethod);
    if (MiniLangValidate.validationOn()) {
        MiniLangValidate.childElements(simpleMethod, element, "condition", "then");
        MiniLangValidate.requiredChildElements(simpleMethod, element, "condition", "then");
    }
    Element conditionElement = UtilXml.firstChildElement(element, "condition");
    Element conditionChildElement = UtilXml.firstChildElement(conditionElement);
    this.condition = ConditionalFactory.makeConditional(conditionChildElement, simpleMethod);
    Element thenElement = UtilXml.firstChildElement(element, "then");
    this.thenSubOps = Collections.unmodifiableList(SimpleMethod.readOperations(thenElement, simpleMethod));
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:13,代码来源:ElseIf.java

示例12: While

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public While(Element element, SimpleMethod simpleMethod) throws MiniLangException {
    super(element, simpleMethod);
    if (MiniLangValidate.validationOn()) {
        MiniLangValidate.childElements(simpleMethod, element, "condition", "then");
        MiniLangValidate.requiredChildElements(simpleMethod, element, "condition", "then");
    }
    Element conditionElement = UtilXml.firstChildElement(element, "condition");
    Element conditionChildElement = UtilXml.firstChildElement(conditionElement);
    this.condition = ConditionalFactory.makeConditional(conditionChildElement, simpleMethod);
    Element thenElement = UtilXml.firstChildElement(element, "then");
    this.thenSubOps = Collections.unmodifiableList(SimpleMethod.readOperations(thenElement, simpleMethod));
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:13,代码来源:While.java

示例13: SimpleMapOperation

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public SimpleMapOperation(Element element, SimpleMapProcess simpleMapProcess) {
    Element failMessage = UtilXml.firstChildElement(element, "fail-message");
    Element failProperty = UtilXml.firstChildElement(element, "fail-property");
    if (failMessage != null) {
        this.message = failMessage.getAttribute("message");
        this.isProperty = false;
    } else if (failProperty != null) {
        this.propertyResource = failProperty.getAttribute("resource");
        this.message = failProperty.getAttribute("property");
        this.isProperty = true;
    }
    this.simpleMapProcess = simpleMapProcess;
    this.fieldName = simpleMapProcess.getFieldName();
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:15,代码来源:SimpleMapOperation.java

示例14: EntityCount

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public EntityCount(Element element, SimpleMethod simpleMethod) throws MiniLangException {
    super(element, simpleMethod);
    if (MiniLangValidate.validationOn()) {
        MiniLangValidate.attributeNames(simpleMethod, element, "entity-name", "count-field", "delegator-name");
        MiniLangValidate.requiredAttributes(simpleMethod, element, "entity-name", "count-field");
        MiniLangValidate.expressionAttributes(simpleMethod, element, "count-field", "delegator-name");
        MiniLangValidate.childElements(simpleMethod, element, "condition-expr", "condition-list", "condition-object", "having-condition-list");
        MiniLangValidate.requireAnyChildElement(simpleMethod, element, "condition-expr", "condition-list", "condition-object");
    }
    this.entityNameFse = FlexibleStringExpander.getInstance(element.getAttribute("entity-name"));
    this.countFma = FlexibleMapAccessor.getInstance(element.getAttribute("count-field"));
    int conditionElementCount = 0;
    Element conditionExprElement = UtilXml.firstChildElement(element, "condition-expr");
    conditionElementCount = conditionExprElement == null ? conditionElementCount : conditionElementCount++;
    Element conditionListElement = UtilXml.firstChildElement(element, "condition-list");
    conditionElementCount = conditionListElement == null ? conditionElementCount : conditionElementCount++;
    Element conditionObjectElement = UtilXml.firstChildElement(element, "condition-object");
    conditionElementCount = conditionObjectElement == null ? conditionElementCount : conditionElementCount++;
    if (conditionElementCount > 1) {
        MiniLangValidate.handleError("Element must include only one condition child element", simpleMethod, conditionObjectElement);
    }
    if (conditionExprElement != null) {
        this.whereCondition = new ConditionExpr(conditionExprElement);
    } else if (conditionListElement != null) {
        this.whereCondition = new ConditionList(conditionListElement);
    } else if (conditionObjectElement != null) {
        this.whereCondition = new ConditionObject(conditionObjectElement);
    } else {
        this.whereCondition = null;
    }
    Element havingConditionListElement = UtilXml.firstChildElement(element, "having-condition-list");
    if (havingConditionListElement != null) {
        this.havingCondition = new ConditionList(havingConditionListElement);
    } else {
        this.havingCondition = null;
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:38,代码来源:EntityCount.java

示例15: Link

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public Link(Element linkElement) {
    this.encode = "true".equals(linkElement.getAttribute("encode")) ? Boolean.TRUE : ("false".equals(linkElement.getAttribute("encode")) ? Boolean.FALSE : null); // SCIPIO: changed from boolean to Boolean
    this.fullPath = "true".equals(linkElement.getAttribute("full-path")) ? Boolean.TRUE : ("false".equals(linkElement.getAttribute("full-path")) ? Boolean.FALSE : null); // SCIPIO: changed from boolean to Boolean
    this.idExdr = FlexibleStringExpander.getInstance(linkElement.getAttribute("id"));
    Element imageElement = UtilXml.firstChildElement(linkElement, "image");
    if (imageElement != null) {
        this.image = new Image(imageElement);
    } else {
        this.image = null;
    }
    this.linkType = linkElement.getAttribute("link-type");
    this.nameExdr = FlexibleStringExpander.getInstance(linkElement.getAttribute("name"));
    List<? extends Element> parameterElementList = UtilXml.childElementList(linkElement, "parameter");
    if (!parameterElementList.isEmpty()) {
        List<Parameter> parameterList = new ArrayList<Parameter>(parameterElementList.size());
        for (Element parameterElement : parameterElementList) {
            parameterList.add(new Parameter(parameterElement));
        }
        this.parameterList = Collections.unmodifiableList(parameterList);
    } else {
        this.parameterList = Collections.emptyList();
    }
    this.prefixExdr = FlexibleStringExpander.getInstance(linkElement.getAttribute("prefix"));
    this.secure = "true".equals(linkElement.getAttribute("secure")) ? Boolean.TRUE : ("false".equals(linkElement.getAttribute("secure")) ? Boolean.FALSE : null); // SCIPIO: changed from boolean to Boolean
    this.styleExdr = FlexibleStringExpander.getInstance(linkElement.getAttribute("style"));
    this.targetExdr = FlexibleStringExpander.getInstance(linkElement.getAttribute("target"));
    this.targetWindowExdr = FlexibleStringExpander.getInstance(linkElement.getAttribute("target-window"));
    this.textExdr = FlexibleStringExpander.getInstance(linkElement.getAttribute("text"));
    this.titleExdr = FlexibleStringExpander.getInstance(linkElement.getAttribute("title"));
    this.urlMode = UtilXml.checkEmpty(linkElement.getAttribute("link-type"), "intra-app");
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:32,代码来源:ModelTree.java


注:本文中的org.ofbiz.base.util.UtilXml.firstChildElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。