Examples of expandString()


Examples of org.ofbiz.base.util.string.FlexibleStringExpander.expandString()

    public void renderFieldGroupOpen(Appendable writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) throws IOException {
        String style = fieldGroup.getStyle();
        String id = fieldGroup.getId();
        FlexibleStringExpander titleNotExpanded = FlexibleStringExpander.getInstance(fieldGroup.getTitle());
        String title = titleNotExpanded.expandString(context);
        Boolean collapsed = fieldGroup.initiallyCollapsed();
        String collapsibleAreaId = fieldGroup.getId() + "_body";

        if (UtilValidate.isNotEmpty(style) || UtilValidate.isNotEmpty(id) || UtilValidate.isNotEmpty(title)) {
View Full Code Here

Examples of org.ofbiz.base.util.string.FlexibleStringExpander.expandString()

     */
    public void renderHyperlinkTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, String titleText) throws IOException {
        if (UtilValidate.isNotEmpty(modelFormField.getHeaderLink())) {
            StringBuilder targetBuffer = new StringBuilder();
            FlexibleStringExpander target = FlexibleStringExpander.getInstance(modelFormField.getHeaderLink());
            String fullTarget = target.expandString(context);
            targetBuffer.append(fullTarget);
            String targetType = HyperlinkField.DEFAULT_TARGET_TYPE;
            if (UtilValidate.isNotEmpty(targetBuffer.toString()) && targetBuffer.toString().toLowerCase().startsWith("javascript:")) {
                targetType="plain";
            }
View Full Code Here

Examples of org.ofbiz.base.util.string.FlexibleStringExpander.expandString()

        if (locale == null) {
            assertNull(label + ":get-initial", fmaGet.get(testMap));
            fmaPut.put(testMap, var);
            assertFalse(label + ":testMap-not-empty", testMap.isEmpty());
            assertEquals(label + ":get", var, fmaGet.get(testMap));
            assertEquals(label, value, fse.expandString(testMap));
            assertEquals(label + ":remove", var, fmaGet.remove(testMap));
            assertNull(label + ":remove-not-exist", fmaGet.remove(testMap));
        } else {
            fmaPut.put(testMap, var);
            assertFalse(label + ":testMap-not-empty", testMap.isEmpty());
View Full Code Here

Examples of org.ofbiz.base.util.string.FlexibleStringExpander.expandString()

            fmaPut.put(testMap, var);
            assertFalse(label + ":testMap-not-empty", testMap.isEmpty());
            assertEquals(label + ":get", value, fmaGet.get(testMap, locale));
            // BUG: fmaGet modifies testMap, even tho it shouldn't
            assertEquals(label + ":get", value, fmaGet.get(testMap, null));
            assertEquals(label, value, fse.expandString(testMap, locale));
        }

        testMap.clear();
        fmaPut.put(testMap, null);
        assertFalse(label + ":testMap-not-empty-put-null", testMap.isEmpty());
View Full Code Here

Examples of org.ofbiz.base.util.string.FlexibleStringExpander.expandString()

    public static boolean checkWhen(Map<String, Object> context, String whenStr) {
        boolean isWhen = true; //opposite default from checkReturnWhen
        if (UtilValidate.isNotEmpty(whenStr)) {
            FlexibleStringExpander fse = FlexibleStringExpander.getInstance(whenStr);
            String newWhen = fse.expandString(context);
            //if (Debug.infoOn()) Debug.logInfo("newWhen:" + newWhen,null);
            //if (Debug.infoOn()) Debug.logInfo("context:" + context,null);
            try {
                Boolean isWhenObj = (Boolean) BshUtil.eval(newWhen, context);
                isWhen = isWhenObj.booleanValue();
View Full Code Here

Examples of org.ofbiz.base.util.string.FlexibleStringExpander.expandString()

    public static boolean checkReturnWhen(Map<String, Object> context, String whenStr) {
        boolean isWhen = false; //opposite default from checkWhen
        if (UtilValidate.isNotEmpty(whenStr)) {
            FlexibleStringExpander fse = FlexibleStringExpander.getInstance(whenStr);
            String newWhen = fse.expandString(context);
            try {
                Boolean isWhenObj = (Boolean) BshUtil.eval(newWhen, context);
                isWhen = isWhenObj.booleanValue();
            } catch (EvalError e) {
                Debug.logError("Error in evaluating :" + whenStr + " : " + e.getMessage(), null);
View Full Code Here

Examples of org.ofbiz.base.util.string.FlexibleStringExpander.expandString()

            result.put("contentId", (String) context.get("contentId"));
            result.put("dataResourceId", (String) context.get("dataResourceId"));
           
            // File to use for original image
            FlexibleStringExpander filenameExpander = FlexibleStringExpander.getInstance(imageFilenameFormat);
            String fileLocation = filenameExpander.expandString(UtilMisc.toMap("location", "products", "type", sizeType, "id", contentId));
            String filenameToUse = fileLocation;
            if (fileLocation.lastIndexOf("/") != -1) {
                filenameToUse = fileLocation.substring(fileLocation.lastIndexOf("/") + 1);
            }
           
View Full Code Here

Examples of org.ofbiz.base.util.string.FlexibleStringExpander.expandString()

        expContext.put("person", person);
        expContext.put("partyGroup", partyGroup);

        // expand the name field to dynamically add information
        FlexibleStringExpander exp = FlexibleStringExpander.getInstance(finAccountName);
        finAccountName = exp.expandString(expContext);

        // price/amount/quantity to create initial deposit amount
        BigDecimal quantity = orderItem.getBigDecimal("quantity");
        BigDecimal price = orderItem.getBigDecimal("unitPrice");
        BigDecimal deposit = price.multiply(quantity).setScale(FinAccountHelper.decimals, FinAccountHelper.rounding);
View Full Code Here

Examples of org.ofbiz.base.util.string.FlexibleStringExpander.expandString()

        String id = null;
        if (viewType.toLowerCase().contains("main")) {
            String filenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format");
            filenameExpander = FlexibleStringExpander.getInstance(filenameFormat);
            id = (String) context.get("productId");
            fileLocation = filenameExpander.expandString(UtilMisc.toMap("location", "products", "id", id, "type", "original"));
        } else if (viewType.toLowerCase().contains("additional") && viewNumber != null && !viewNumber.equals("0")) {
            String filenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.additionalviewsize.format");
            filenameExpander = FlexibleStringExpander.getInstance(filenameFormat);
            id = (String) context.get("productId");
            if (filenameFormat.endsWith("${id}")) {
View Full Code Here

Examples of org.ofbiz.base.util.string.FlexibleStringExpander.expandString()

            if (filenameFormat.endsWith("${id}")) {
                id = id + "_View_" + viewNumber;
            } else {
                viewType = "additional" + viewNumber;
            }   
            fileLocation = filenameExpander.expandString(UtilMisc.toMap("location", "products", "id", id, "viewtype", viewType, "sizetype", "original"));
        } else {
            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ProductImageViewType", UtilMisc.toMap("viewType", type), locale));
        }

        if (fileLocation.lastIndexOf("/") != -1) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.