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


Java UtilXml.elementValue方法代码示例

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


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

示例1: deserializeCustom

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public static Object deserializeCustom(Element element) throws SerializeException {
    String tagName = element.getLocalName();
    if ("cus-obj".equals(tagName)) {
        String value = UtilXml.elementValue(element);
        if (value != null) {
            byte[] valueBytes = StringUtil.fromHexString(value);
            if (valueBytes != null) {
                Object obj = UtilObject.getObject(valueBytes);
                if (obj != null) {
                    return obj;
                }
            }
        }
        throw new SerializeException("Problem deserializing object from byte array + " + element.getLocalName());
    } else {
        throw new SerializeException("Cannot deserialize element named " + element.getLocalName());
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:19,代码来源:XmlSerializer.java

示例2: InlineHtmlTemplate

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public InlineHtmlTemplate(ModelScreen modelScreen, Element htmlTemplateElement) {
    super(modelScreen, htmlTemplateElement);
    String lang = htmlTemplateElement.getAttribute("lang");
    this.templateId = modelScreen.getSourceLocation() + "#" + modelScreen.getName() + "@" + this.getStartColumn() + "," + this.getStartLine();
    String templateBody = UtilXml.elementValue(htmlTemplateElement); // htmlTemplateElement.getTextContent();
    for(String tmplType : HtmlTemplate.getSupportedTypes()) {
        if (templateBody.startsWith(tmplType + ":")) {
            templateBody = templateBody.substring(tmplType.length() + 1);
            lang = tmplType;
            break;
        }
    }
    this.lang = lang;
    boolean trimLines = "true".equals(htmlTemplateElement.getAttribute("trim-lines"));
    this.templateBody = trimLines ? ScriptUtil.trimScriptLines(templateBody) : templateBody;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:17,代码来源:HtmlWidget.java

示例3: FlexibleMessage

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public FlexibleMessage(Element element, String defaultProperty) {
    if (element != null) {
        String message = UtilXml.elementValue(element);
        if (message != null) {
            messageFse = FlexibleStringExpander.getInstance(message);
            keyFse = null;
            propertykey = null;
            propertyResource = null;
        } else {
            messageFse = null;
            propertykey = MiniLangValidate.checkAttribute(element.getAttribute("property"), defaultProperty);
            int exprStart = propertykey.indexOf(FlexibleStringExpander.openBracket);
            int exprEnd = propertykey.indexOf(FlexibleStringExpander.closeBracket, exprStart);
            if (exprStart > -1 && exprStart < exprEnd) {
                keyFse = FlexibleStringExpander.getInstance(propertykey);
            } else {
                keyFse = null;
            }
            propertyResource = MiniLangValidate.checkAttribute(element.getAttribute("resource"), "DefaultMessages");
        }
    } else {
        messageFse = null;
        keyFse = null;
        propertykey = defaultProperty;
        propertyResource = "DefaultMessages";
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:28,代码来源:FlexibleMessage.java

示例4: CallScript

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public CallScript(Element element, SimpleMethod simpleMethod) throws MiniLangException {
    super(element, simpleMethod);
    if (MiniLangValidate.validationOn()) {
        MiniLangValidate.attributeNames(simpleMethod, element, "location", "script");
        MiniLangValidate.requireAnyAttribute(simpleMethod, element, "location", "script");
        MiniLangValidate.constantAttributes(simpleMethod, element, "location");
        MiniLangValidate.scriptAttributes(simpleMethod, element, "script");
        MiniLangValidate.noChildElements(simpleMethod, element);
    }
    boolean elementModified = autoCorrect(element);
    if (elementModified && MiniLangUtil.autoCorrectOn()) {
        MiniLangUtil.flagDocumentAsCorrected(element);
    }
    String scriptLocation = element.getAttribute("location");
    if (scriptLocation.isEmpty()) {
        this.location = null;
        this.method = null;
    } else {
        int pos = scriptLocation.lastIndexOf("#");
        if (pos == -1) {
            this.location = scriptLocation;
            this.method = null;
        } else {
            this.location = scriptLocation.substring(0, pos);
            this.method = scriptLocation.substring(pos + 1);
        }
    }
    String inlineScript = element.getAttribute("script");
    if (inlineScript.isEmpty()) {
        inlineScript = UtilXml.elementValue(element);
    }
    if (inlineScript != null && MiniLangUtil.containsScript(inlineScript)) {
        this.scriptlet = new Scriptlet(StringUtil.convertOperatorSubstitutions(inlineScript));
    } else {
        this.scriptlet = null;
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:38,代码来源:CallScript.java

示例5: Notify

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
Notify(Element notifyElement) throws ServiceConfigException {
    String type = notifyElement.getAttribute("type").intern();
    if (type.isEmpty()) {
        throw new ServiceConfigException("<notify> element type attribute is empty");
    }
    this.type = type;
    String content = UtilXml.elementValue(notifyElement);
    if (content == null) {
        content = "";
    }
    this.content = content;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:13,代码来源:Notify.java

示例6: Label

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public Label(ModelScreen modelScreen, Element labelElement) {
    super(modelScreen, labelElement);

    // put the text attribute first, then the pcdata under the element, if both are there of course
    String textAttr = labelElement.getAttribute("text");
    String pcdata = UtilXml.elementValue(labelElement);
    if (pcdata == null) {
        pcdata = "";
    }
    this.textExdr = FlexibleStringExpander.getInstance(textAttr + pcdata);

    this.idExdr = FlexibleStringExpander.getInstance(labelElement.getAttribute("id"));
    this.styleExdr = FlexibleStringExpander.getInstance(labelElement.getAttribute("style"));
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:15,代码来源:ModelScreenWidget.java

示例7: fromElement

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public static ModelPageScript fromElement(Element element) {
    String preprocessor = element.getAttribute("preprocessor");
    String script = UtilXml.elementValue(element);
    
    if ("ftl".equals(preprocessor)) {
        // TODO
        throw new UnsupportedOperationException("ftl preprocessor not implemented");
        //return new FtlScript(script);
    } else if ("flexible".equals(preprocessor)) {
        return new FlexibleScript(script);
    } else {
        return new PlainScript(script);
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:15,代码来源:ModelPageScript.java

示例8: janrainCheckLogin

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public static String janrainCheckLogin(HttpServletRequest request, HttpServletResponse response){
    Delegator delegator = (Delegator) request.getAttribute("delegator");
    String token =  request.getParameter("token");
    String errMsg = "";
    if (UtilValidate.isNotEmpty(token)) {
        JanrainHelper janrainHelper = new JanrainHelper(apiKey, baseUrl);
        Element authInfo = janrainHelper.authInfo(token);
        Element profileElement = UtilXml.firstChildElement(authInfo, "profile");
        Element nameElement = UtilXml.firstChildElement(profileElement, "name");
        
        // profile element
        String displayName = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "displayName"));
        String email = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "email"));
        String identifier = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "identifier"));
        String preferredUsername = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "preferredUsername"));
        String providerName = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "providerName"));
        String url = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "url"));
        
        // name element
        String givenName = UtilXml.elementValue(UtilXml.firstChildElement(nameElement, "givenName"));
        String familyName = UtilXml.elementValue(UtilXml.firstChildElement(nameElement, "familyName"));
        String formatted = UtilXml.elementValue(UtilXml.firstChildElement(nameElement, "formatted"));
        
        if (UtilValidate.isEmpty("preferredUsername")) {
            errMsg = UtilProperties.getMessage("SecurityextUiLabels", "loginevents.username_not_found_reenter", UtilHttp.getLocale(request));
            request.setAttribute("_ERROR_MESSAGE_", errMsg);
            return "error";
        }
        
        Map<String, String> result = FastMap.newInstance();
        result.put("displayName", displayName);
        result.put("email", email);
        result.put("identifier", identifier);
        result.put("preferredUsername", preferredUsername);
        result.put("providerName", providerName);
        result.put("url", url);
        result.put("givenName", givenName);
        result.put("familyName", familyName);
        result.put("formatted", formatted);
        request.setAttribute("userInfoMap", result);
        
        try {
            GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", preferredUsername).cache().queryOne();
            if (UtilValidate.isNotEmpty(userLogin)) {
                LoginWorker.doBasicLogin(userLogin, request);
                LoginWorker.autoLoginSet(request, response);
                return "success";
            } else {
                return "userLoginMissing";
            }
        } catch (GenericEntityException e) {
            Debug.logError(e, "Error finding the userLogin for distributed cache clear", module);
        }
    }
    return "success";
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:57,代码来源:JanrainHelper.java

示例9: ConstantOper

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public ConstantOper(Element element) {
    super(element);
    constant = UtilXml.elementValue(element);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:5,代码来源:ConstantOper.java

示例10: Script

import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public Script(ModelWidget modelWidget, Element scriptElement) {
    super(modelWidget, scriptElement);
    String scriptLocation = scriptElement.getAttribute("location");
    //this.location = WidgetWorker.getScriptLocation(scriptLocation);
    //this.method = WidgetWorker.getScriptMethodName(scriptLocation);
    this.locationExdr = FlexibleStringExpander.getInstance(scriptLocation);
    
    // SCIPIO: inline script preparation derived from (but no longer resembles):
    //   org.ofbiz.minilang.method.callops.CallScript.CallScript(Element, SimpleMethod)
    String lang = scriptElement.getAttribute("lang");
    if (!lang.isEmpty() && !supportedLangs.contains(lang)) {
        Debug.logError("script element: lang attribute unrecognized language: lang=\"" + lang + "\"", module);
    }
    
    String inlineScript = scriptElement.getAttribute("script");
    boolean hasScriptPrefix = startsWithLangPrefix(inlineScript);
    Scriptlet scriptlet = null;
    if (hasScriptPrefix || (!inlineScript.isEmpty() && !lang.isEmpty())) {
        // use script attribute
        if (!hasScriptPrefix) {
            inlineScript = lang + ":" + inlineScript;
        }
        inlineScript = StringUtil.convertOperatorSubstitutions(inlineScript);
        scriptlet = makeScriptlet(inlineScript);
    } else {
        if (!inlineScript.isEmpty()) {
            Debug.logError("script element: script attribute contains code of unspecified"
                    + " or unknown language: script=\"" + inlineScript + "\"", module);
        }
        inlineScript = UtilXml.elementValue(scriptElement);
        if (UtilValidate.isNotEmpty(inlineScript)) {
            hasScriptPrefix = startsWithLangPrefix(inlineScript);
            if (hasScriptPrefix || (!inlineScript.isEmpty() && !lang.isEmpty())) {
                // use script child body
                if (!hasScriptPrefix) {
                    inlineScript = lang + ":" + inlineScript;
                }
                boolean trimLines = "true".equals(scriptElement.getAttribute("trim-lines"));
                if (trimLines) {
                    inlineScript = ScriptUtil.trimScriptLines(inlineScript);
                }
                // SCIPIO: NOTE: do NOT convert keyword operators when using elem body!
                scriptlet = makeScriptlet(inlineScript);
            } else {
                if (!inlineScript.isEmpty()) {
                    Debug.logError("script element: script body/child contains code of unspecified"
                            + " or unknown language: script=\"" + inlineScript + "\"", module);
                }
            }
        }
    }
    this.scriptlet = scriptlet;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:54,代码来源:AbstractModelAction.java


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