Package org.ofbiz.entity

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


            }

            GenericValue productAssoc = null;

            try {
                productAssoc = delegator.findOne(tempProductAssoc.getEntityName(), tempProductAssoc.getPrimaryKey(), false);
            } catch (GenericEntityException e) {
                Debug.logWarning(e.getMessage(), module);
                productAssoc = null;
            }
            if (productAssoc != null) {
View Full Code Here


       
        try {
            if (fieldsToSelectList != null) {
                valueAcsr.put(methodContext, delegator.findByPrimaryKeyPartial(delegator.makePK(entityName, inMap), new HashSet(fieldsToSelectList)));
            } else {
                valueAcsr.put(methodContext, delegator.findOne(entityName, inMap, useCache));
            }
        } catch (GenericEntityException e) {
            Debug.logError(e, module);
            String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [problem finding the " + entityName + " entity: " + e.getMessage() + "]";
            methodContext.setErrorReturn(errMsg, simpleMethod);
View Full Code Here

                valueToCreate.setIsFromEntitySync(true);

                // check to make sure all foreign keys are created; if not create dummy values as place holders
                valueToCreate.checkFks(true);

                GenericValue existingValue = delegator.findOne(valueToCreate.getEntityName(), valueToCreate.getPrimaryKey(), false);
                if (existingValue == null) {
                    delegator.create(valueToCreate);
                    toCreateInserted++;
                } else {
                    // if the existing value has a stamp field that is AFTER the stamp on the valueToCreate, don't update it
View Full Code Here

                valueToStore.setIsFromEntitySync(true);

                // check to make sure all foreign keys are created; if not create dummy values as place holders
                valueToStore.checkFks(true);

                GenericValue existingValue = delegator.findOne(valueToStore.getEntityName(), valueToStore.getPrimaryKey(), false);
                if (existingValue == null) {
                    delegator.create(valueToStore);
                    toStoreInserted++;
                } else {
                    // if the existing value has a stamp field that is AFTER the stamp on the valueToStore, don't update it
View Full Code Here

                fieldKey = this.modelFormField.fieldName;
            }
            GenericDelegator delegator = this.modelFormField.modelForm.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

                } else {
                    id = (String) context.get(pkName);
                }
                 try {
                   if (id != null && modelEntity.getPksSize() == 1) {
                     GenericValue entity = delegator.findOne(entName, UtilMisc.toMap(pkName, id), false);
                         if (modelEntity.isField("childBranchCount")) {
                         entity.put("childBranchCount", nodeCount);
                         }
                     entity.store();
                   }
View Full Code Here

                GenericValue userLogin = null;

                try {
                    // only get userLogin from cache for service calls; for web and other manual logins there is less time sensitivity
                    userLogin = delegator.findOne("UserLogin", isServiceAuth, "userLoginId", username);
                } catch (GenericEntityException e) {
                    Debug.logWarning(e, "", module);
                }

                if (userLogin != null) {
View Full Code Here

        // unless the logged in user has permission to do so (same partyId or PARTYMGR_CREATE)
        if (partyId != null && partyId.length() > 0) {
            GenericValue party = null;

            try {
                party = delegator.findOne("Party", false, "partyId", partyId);
            } catch (GenericEntityException e) {
                Debug.logWarning(e, "", module);
            }

            if (party != null) {
View Full Code Here

        }

        GenericValue userLoginToUpdate = null;

        try {
            userLoginToUpdate = delegator.findOne("UserLogin", false, "userLoginId", userLoginId);
        } catch (GenericEntityException e) {
            Map messageMap = UtilMisc.toMap("errorMessage", e.getMessage());
            errMsg = UtilProperties.getMessage(resource,"loginservices.could_not_change_password_read_failure", messageMap, locale);
            return ServiceUtil.returnError(errMsg);
        }
View Full Code Here

        GenericValue newUserLogin = null;
        boolean doCreate = true;

        // check to see if there's a matching login and use it if it's for the same party
        try {
            newUserLogin = delegator.findOne("UserLogin", false, "userLoginId", userLoginId);
        } catch (GenericEntityException e) {
            Debug.logWarning(e, "", module);
            Map messageMap = UtilMisc.toMap("errorMessage", e.getMessage());
            errMsg = UtilProperties.getMessage(resource,"loginservices.could_not_create_login_user_read_failure", messageMap, locale);
            errorMessageList.add(errMsg);
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.