Package org.ofbiz.entity

Examples of org.ofbiz.entity.GenericEntityException


        } catch (SQLException sqle) {
            Debug.logWarning("[SQLProcessor.execQuery]: SQL Exception while executing the following:\n" +
                sql + "\nError was:", module);
            Debug.logWarning(sqle.getMessage(), module);
            throw new GenericEntityException("SQL Exception while executing the following:" + _sql, sqle);
        } finally {
            close();
        }
    }
View Full Code Here


    }

    protected void testConnection(Connection con) throws GenericEntityException {
        if (SQLProcessor.ENABLE_TEST) {
            if (SQLProcessor.CONNECTION_TEST_LIST.contains(con.toString())) {
                throw new GenericEntityException("Connection the exact same as index " + SQLProcessor.CONNECTION_TEST_LIST.indexOf(con.toString()));
            }
            SQLProcessor.CONNECTION_TEST_LIST.add(con.toString());
            if (SQLProcessor.CONNECTION_TEST_LIST.size() > SQLProcessor.MAX_CONNECTIONS) {
                SQLProcessor.CONNECTION_TEST_LIST.remove(0);
            }
View Full Code Here

                    request.getParameter("buttonAction").equals("Cancel"))) {
                // Cancel
                action = UIScreenSection.ACTION_SHOW_INSERT;
            } else {
                // Error. Button action is required if action is ACTION_BUTTON.
                throw new GenericEntityException(
                    "The button.x or buttonAction parameter is required when action is \"button\".");
            }
        }

        return action;
View Full Code Here

        this(delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId)), dispatcher, userLogin);
    }

    protected void loadChildren(String partBomTypeId, Date inDate, List<GenericValue> productFeatures, int type) throws GenericEntityException {
        if (product == null) {
            throw new GenericEntityException("product is null");
        }
        // If the date is null, set it to today.
        if (inDate == null) inDate = new Date();
        bomTypeId = partBomTypeId;
//        Delegator delegator = product.getDelegator();
View Full Code Here

        return newNode;
    }

    protected void loadParents(String partBomTypeId, Date inDate, List<GenericValue> productFeatures) throws GenericEntityException {
        if (product == null) {
            throw new GenericEntityException("product is null");
        }
        // If the date is null, set it to today.
        if (inDate == null) inDate = new Date();

        bomTypeId = partBomTypeId;
View Full Code Here

                    ModelEntity linkEntity = modelViewEntity.getMemberModelEntity(viewLink.getEntityAlias());
                    ModelEntity relLinkEntity = modelViewEntity.getMemberModelEntity(viewLink.getRelEntityAlias());

                    if (linkEntity == null) {
                        throw new GenericEntityException("Link entity not found with alias: " + viewLink.getEntityAlias() + " for entity: " + modelViewEntity.getEntityName());
                    }

                    if (relLinkEntity == null) {
                        throw new GenericEntityException("Rel-Link entity not found with alias: " + viewLink.getRelEntityAlias() + " for entity: " + modelViewEntity.getEntityName());
                    }

                    // ModelViewEntity.ModelMemberEntity linkMemberEntity = modelViewEntity.getMemberModelMemberEntity(viewLink.getEntityAlias());
                    // ModelViewEntity.ModelMemberEntity relLinkMemberEntity = modelViewEntity.getMemberModelMemberEntity(viewLink.getRelEntityAlias());
View Full Code Here

                                while ((charsRead = valueReader.read(inCharBuffer, 0, CHAR_BUFFER_SIZE)) > 0) {
                                    strBuf.append(inCharBuffer, 0, charsRead);
                                }
                                valueReader.close();
                            } catch (IOException e) {
                                throw new GenericEntityException("Error reading long character stream for field " + curField.getName() + " of entity " + entity.getEntityName(), e);
                            }
                            entity.dangerousSetNoCheckButFast(curField, strBuf.toString());
                        } else {
                            entity.dangerousSetNoCheckButFast(curField, null);
                        }
View Full Code Here

        Debug.logVerbose( "-->[UIScreenSection.UIScreenSection] screenName: " + screenName, module);
        Debug.logVerbose( "-->[UIScreenSection.UIScreenSection] sectionName: " + sectionName, module);

        if (userInfo == null) {
            throw new GenericEntityException(
                "UserInfo passed in was null for UIScreenSection.");
        } else {
            setUserInfo(userInfo);
        }

        if (delegator == null) {
            throw new GenericEntityException(
                "GenericDelegator passed in was null for UIScreenSection.");
        } else {
            setDelegator(delegator);
        }

        if (screenName == null) {
            throw new GenericEntityException(
                "ScreenName passed in was null for UIScreenSection.");
        }

        if (sectionName == null) {
            throw new GenericEntityException(
                "SectionName passed in was null for UIScreenSection.");
        }

        // Get the uiScreen object.
        if (TIMER) {
            timer.timerString(1,
                "[UIScreenSection.UIScreenSection] Looking for UIScreen in cache.");
        }

        UIScreen uiScreen = uiCache.getUiScreen(screenName);

        if (uiScreen == null) {
            if (TIMER) {
                timer.timerString(1,
                    "[UIScreenSection.UIScreenSection] UIScreen not found in cache. Creating a new one.");
            }

            uiScreen = new UIScreen(screenName, delegator);
            uiCache.putUiScreen(screenName, uiScreen);
        } else {
            if (TIMER) {
                timer.timerString(1,
                    "[UIScreenSection.UIScreenSection] Found UIScreen in cache.");
            }
        }

        setUiScreen(uiScreen);

        if (TIMER) {
            timer.timerString(1, "[UIScreenSection.UIScreenSection] Got screen");
        }

        // Get the uiScreenSection object.

        HashMap findHashMap = new HashMap();
        findHashMap.put("screenId", getUiScreen().getScreenId());
        findHashMap.put("sectionName", sectionName);

        List uiScreenSectionGVL = delegator.findByAnd("UiScreenSection",
                findHashMap, null);

        if (uiScreenSectionGVL.size() == 0) {
            throw new GenericEntityException("No screen section with name \"" +
                sectionName + "\" for screen \"" + screenName +
                "\" was found in database.");
        }

        if (uiScreenSectionGVL.size() > 1) {
            throw new GenericEntityException(
                "More than one screen section found with name \"" +
                sectionName + "\" for screen \"" + screenName + "\".");
        }

        Iterator uiScreenSectionGVI = uiScreenSectionGVL.iterator();
        GenericValue uiScreenSectionGV = (GenericValue) uiScreenSectionGVI.next();

        if (uiScreenSectionGV.get("layoutTypeId") == null) {
            throw new GenericEntityException(
                "Layout type not set for screen section \"" + sectionName +
                "\".");
        }

        setSectionId(uiScreenSectionGV.getString("sectionId"));
        setScreenId(uiScreenSectionGV.getString("screenId"));
        setSectionName(uiScreenSectionGV.getString("sectionName"));
        setSectionDescription(uiScreenSectionGV.getString("sectionDescription"));
        setLayoutTypeId(uiScreenSectionGV.getString("layoutTypeId"));
        setDisplayOrder(uiScreenSectionGV.getString("displayOrder"));
        setColumnCount(uiScreenSectionGV.getString("columnCount"));
        setRowCount(uiScreenSectionGV.getString("rowCount"));
        setButtonKeys(uiScreenSectionGV.getString("buttonKeys"));
        setTitleDef(uiScreenSectionGV.getString("titleDef"));
        setSortDef(uiScreenSectionGV.getString("sortDef"));
        setSearchAttributeId(uiScreenSectionGV.getString("searchAttributeId"));
        setButtonAction(uiScreenSectionGV.getString("buttonAction"));
        setButtonTarget(uiScreenSectionGV.getString("buttonTarget"));
        setDetailButtonAction(uiScreenSectionGV.getString("detailButtonAction"));
        setDetailButtonTarget(uiScreenSectionGV.getString("detailButtonTarget"));
        setSearchAction(uiScreenSectionGV.getString("searchAction"));
        setSearchTarget(uiScreenSectionGV.getString("searchTarget"));
        setNewButtonAction(uiScreenSectionGV.getString("newButtonAction"));
        setNewButtonTarget(uiScreenSectionGV.getString("newButtonTarget"));
        setEditButtonAction(uiScreenSectionGV.getString("editButtonAction"));
        setEditButtonTarget(uiScreenSectionGV.getString("editButtonTarget"));
        setHideButtons(uiScreenSectionGV.getString("hideButtons"));
        setSelectNameDef(uiScreenSectionGV.getString("selectNameDef"));
        setSendQueryParameterList(uiScreenSectionGV.getString("sendQueryParameterList"));
        setUseQueryParameterList(uiScreenSectionGV.getString("useQueryParameterList"));

        /* add after value added to screen settings
                        setRowsPerPage(uiScreenSectionGV.getString("rowsPerPage"));

        */
        rowsPerPage = 0;
        uiScreenSectionGVI = null;

        if (TIMER) {
            timer.timerString(1, "[UIScreenSection.UIScreenSection] Got section");
        }

        // if rowsPerPage = 0, then use the global prefernece ROWS_PER_PAGE.
        if (rowsPerPage <= 0) {
            Preference pref = Preference.getInstance(delegator);
            rowsPerPage = pref.getPreference(userInfo.getPartyId(),
                    userInfo.getAccountId(), PREFERENCE_ROWS_PER_PAGE, 20);
        }

        // Get the uiScreenSectionEntity entities.

        findHashMap = new HashMap();
        findHashMap.put("sectionId", getSectionId());

        ArrayList orderBy = new ArrayList();
        orderBy.add("retrieveOrder");

        List uiScreenSectionEntityGVL = delegator.findByAnd("UiScreenSectionEntity",
                findHashMap, orderBy);

        if ((uiScreenSectionEntityGVL == null) ||
                (uiScreenSectionEntityGVL.size() == 0)) {
            throw new GenericEntityException(
                "No screen section entities were found in database for screen section \"" +
                sectionName + "\" and screen \"" + screenName + "\".");
        }

        Iterator uiScreenSectionEntityGVI = uiScreenSectionEntityGVL.iterator();
View Full Code Here

        case LAYOUT_TYPE_TABULAR:
            return displayTabularSection(dataMatrix, action, titleBar, queryId);

        case LAYOUT_TYPE_CROSSTAB:
            throw new GenericEntityException(
                "Crosstab layout type not implemented yet.");

        case LAYOUT_TYPE_SELECT:
            return displaySelectSection(dataMatrix, action, titleBar, queryId);

        case LAYOUT_TYPE_COMPOSITE:

            //        return displayCompositeSection(
            //          dataMatrix,
            //          action,
            //          titleBar,
            //          queryId);
            throw new GenericEntityException(
                "Composite layout type not implemented yet.");

        default:
            throw new GenericEntityException("Invalid layout type.");
        }
    }
View Full Code Here

        // Make sure all the primary key fields of the primary entity were included.
        for (int keyFieldNbr = 0;
                keyFieldNbr < primaryPrimaryKeyFieldNameList.size();
                keyFieldNbr++) {
            if (!primaryKeyIncluded[keyFieldNbr]) {
                throw new GenericEntityException(
                    "[UIScreenSection.getDisplayFields]: All primary key fields of the primary entity must be included in the field list.");
            }
        }

        if (TIMER) {
View Full Code Here

TOP

Related Classes of org.ofbiz.entity.GenericEntityException

Copyright © 2018 www.massapicom. 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.