Examples of findOne()


Examples of org.ofbiz.entity.Delegator.findOne()

                fieldKey = this.modelFormField.fieldName;
            }
            Delegator delegator = WidgetWorker.getDelegator(context);
            String fieldValue = modelFormField.getEntry(context);
            try {
                value = delegator.findOne(this.entityName, this.cache, fieldKey, fieldValue);
            } catch (GenericEntityException e) {
                String errMsg = "Error getting value from the database for display of field [" + this.modelFormField.getName() + "] on form [" + this.modelFormField.modelForm.getName() + "]: " + e.toString();
                Debug.logError(e, errMsg, module);
                throw new IllegalArgumentException(errMsg);
            }
View Full Code Here

Examples of org.ofbiz.entity.Delegator.findOne()

            // get web site and default locale string
            String localeString = null;
            String webSiteId = WebSiteWorker.getWebSiteId(request);
            GenericValue webSite;
            try {
                webSite = delegator.findOne("WebSite", UtilMisc.toMap("webSiteId", webSiteId), true);
                if (UtilValidate.isNotEmpty(webSite)) {
                    GenericValue productStore = webSite.getRelatedOne("ProductStore");
                    if (UtilValidate.isNotEmpty(productStore)) {
                        localeString = productStore.getString("defaultLocaleString");
                    }
View Full Code Here

Examples of org.ofbiz.entity.Delegator.findOne()

    }
   
    public static String makeCategoryUrl(HttpServletRequest request, String previousCategoryId, String productCategoryId, String productId, String viewSize, String viewIndex, String viewSort, String searchString) {
        Delegator delegator = (Delegator) request.getAttribute("delegator");
        try {
            GenericValue productCategory = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryId), true);
            CategoryContentWrapper wrapper = new CategoryContentWrapper(productCategory, request);
            StringWrapper alternativeUrl = wrapper.get("ALTERNATIVE_URL");
           
            if (UtilValidate.isNotEmpty(alternativeUrl) && UtilValidate.isNotEmpty(alternativeUrl.toString())) {
                StringBuilder urlBuilder = new StringBuilder();
View Full Code Here

Examples of org.ofbiz.entity.Delegator.findOne()

    }
   
    public static String makeProductUrl(HttpServletRequest request, String previousCategoryId, String productCategoryId, String productId) {
        Delegator delegator = (Delegator) request.getAttribute("delegator");
        try {
            GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true);
            ProductContentWrapper wrapper = new ProductContentWrapper(product, request);
            StringWrapper alternativeUrl = wrapper.get("ALTERNATIVE_URL");
            if (UtilValidate.isNotEmpty(alternativeUrl) && UtilValidate.isNotEmpty(alternativeUrl.toString())) {
                StringBuilder urlBuilder = new StringBuilder();
                urlBuilder.append(request.getSession().getServletContext().getContextPath());
View Full Code Here

Examples of org.ofbiz.entity.Delegator.findOne()

                Authorization authz = (Authorization) context.get("authz");

                Boolean hasPortalAdminPermission = authz.hasPermission(userLoginId, "PORTALPAGE_ADMIN", context);
                try {
                    Delegator delegator = WidgetWorker.getDelegator(context);
                    GenericValue portalPage = delegator.findOne("PortalPage", UtilMisc.toMap("portalPageId", portalPageId),false);

                    if (UtilValidate.isNotEmpty(portalPage)) {
                        String ownerUserLoginId = (String) portalPage.get("ownerUserLoginId");
                        // Users with PORTALPAGE_ADMIN permission can configure every Portal Page
                        userIsAllowed = (ownerUserLoginId.equals(userLoginId) || hasPortalAdminPermission);
View Full Code Here

Examples of org.ofbiz.entity.Delegator.findOne()

            throw new GeneralException("Method writeText() only supports rendering text content : " + targetMimeTypeId + " is not supported");
        }

        if ("text/html".equals(targetMimeTypeId)) {
            // get the default mime type template
            GenericValue mimeTypeTemplate = delegator.findOne("MimeTypeHtmlTemplate", UtilMisc.toMap("mimeTypeId", dataResourceMimeTypeId), true);

            if (mimeTypeTemplate != null && mimeTypeTemplate.get("templateLocation") != null) {
                // prepare the context
                Map<String, Object> mimeContext = FastMap.newInstance();
                mimeContext.putAll(context);
View Full Code Here

Examples of org.ofbiz.entity.Delegator.findOne()

            String text = "";

            if ("SHORT_TEXT".equals(dataResourceTypeId) || "LINK".equals(dataResourceTypeId)) {
                text = dataResource.getString("objectInfo");
            } else if ("ELECTRONIC_TEXT".equals(dataResourceTypeId)) {
                GenericValue electronicText = delegator.findOne("ElectronicText", UtilMisc.toMap("dataResourceId", dataResourceId), cache);
                if (electronicText != null) {
                    text = electronicText.getString("textData");
                }
            } else {
                throw new GeneralException("Unsupported TEXT type; cannot stream");
View Full Code Here

Examples of org.ofbiz.entity.Delegator.findOne()

        } else if (dataResourceTypeId.endsWith("_OBJECT")) {
            byte[] bytes = new byte[0];
            GenericValue valObj;

            if ("IMAGE_OBJECT".equals(dataResourceTypeId)) {
                valObj = delegator.findOne("ImageDataResource", UtilMisc.toMap("dataResourceId", dataResourceId), cache);
                if (valObj != null) {
                    bytes = valObj.getBytes("imageData");
                }
            } else if ("VIDEO_OBJECT".equals(dataResourceTypeId)) {
                valObj = delegator.findOne("VideoDataResource", UtilMisc.toMap("dataResourceId", dataResourceId), cache);
View Full Code Here

Examples of org.ofbiz.entity.Delegator.findOne()

                valObj = delegator.findOne("ImageDataResource", UtilMisc.toMap("dataResourceId", dataResourceId), cache);
                if (valObj != null) {
                    bytes = valObj.getBytes("imageData");
                }
            } else if ("VIDEO_OBJECT".equals(dataResourceTypeId)) {
                valObj = delegator.findOne("VideoDataResource", UtilMisc.toMap("dataResourceId", dataResourceId), cache);
                if (valObj != null) {
                    bytes = valObj.getBytes("videoData");
                }
            } else if ("AUDIO_OBJECT".equals(dataResourceTypeId)) {
                valObj = delegator.findOne("AudioDataResource", UtilMisc.toMap("dataResourceId", dataResourceId), cache);
View Full Code Here

Examples of org.ofbiz.entity.GenericDelegator.findOne()

            }
            if (isProductId) {
                for (String orderItemSeqId : orderItemSeqIds) {
                    counter++;
                    if (quantity.compareTo(ZERO) > 0) {
                        GenericValue orderItem = delegator.findOne("OrderItem", UtilMisc.toMap("orderId", orderId , "orderItemSeqId", orderItemSeqId), false);
                        BigDecimal orderedQuantity = orderItem.getBigDecimal("quantity");
                        List<GenericValue> shipments = delegator.findByAnd("Shipment", UtilMisc.toMap("primaryOrderId", orderId , "statusId", "SHIPMENT_PICKED"));
                        for(GenericValue shipment : shipments) {
                            List<GenericValue> orderShipments = shipment.getRelatedByAnd("OrderShipment" , UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId));
                            for(GenericValue orderShipment : orderShipments) {
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.