Package org.ofbiz.entity

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


                            Debug.logError(e, module);
                            return ServiceUtil.returnError(e.getMessage());
                        }
                        GenericValue contentAssocUp = null;
                        try {
                            contentAssocUp = delegator.findOne("Content", UtilMisc.toMap("contentId", contentAssoc.get("contentIdTo")), false);
                        } catch (GenericEntityException e) {
                            Debug.logError(e, module);
                            return ServiceUtil.returnError(e.getMessage());
                        }
                        if (contentAssocUp != null) {
View Full Code Here


            sizeTagElement = tagElements.get(tagElements.size() - 2);
        }
       
        GenericValue content = null;
        try {
            GenericValue contentResult = delegator.findOne("Content", UtilMisc.toMap("contentId", contentId), false);
            if (contentResult == null) {
                content = delegator.findOne("Content", UtilMisc.toMap("contentId", sizeTagElement), false);
            } else {
                content = delegator.findOne("Content", UtilMisc.toMap("contentId", contentId), false);
            }
View Full Code Here

       
        GenericValue content = null;
        try {
            GenericValue contentResult = delegator.findOne("Content", UtilMisc.toMap("contentId", contentId), false);
            if (contentResult == null) {
                content = delegator.findOne("Content", UtilMisc.toMap("contentId", sizeTagElement), false);
            } else {
                content = delegator.findOne("Content", UtilMisc.toMap("contentId", contentId), false);
            }
        } catch (GenericEntityException e) {
            Debug.logError(e, module);
View Full Code Here

        try {
            GenericValue contentResult = delegator.findOne("Content", UtilMisc.toMap("contentId", contentId), false);
            if (contentResult == null) {
                content = delegator.findOne("Content", UtilMisc.toMap("contentId", sizeTagElement), false);
            } else {
                content = delegator.findOne("Content", UtilMisc.toMap("contentId", contentId), false);
            }
        } catch (GenericEntityException e) {
            Debug.logError(e, module);
        }
   
View Full Code Here

                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

            // 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

    }
   
    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

    }
   
    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

                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

            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

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.