Package org.ofbiz.base.util

Examples of org.ofbiz.base.util.GeneralException


        if (UtilValidate.isNotEmpty(amtStr)) {
            try {
                amount = new BigDecimal(amtStr);
            } catch (NumberFormatException e) {
                Debug.logError("Invalid number for amount : " + amtStr, module);
                throw new GeneralException();
            }
        } else {
            Debug.logInfo("Amount is empty; assumption is full amount : " + this.getTotalDue(), module);
            amount = this.getTotalDue();
            if (amount.compareTo(BigDecimal.ZERO) <= 0) {
                throw new GeneralException();
            }
        }
        return amount;
    }
View Full Code Here


        this.requestUri = requestUri;

        this.requestInfoMap = aif.getControllerRequestMap(controllerXmlUrl, requestUri);

        if (this.requestInfoMap == null) {
            throw new GeneralException("Controller request with name [" + requestUri + "] is not defined in controller file [" + controllerXmlUrl + "].");
        }

        if (this.requestInfoMap == null) {
            throw new GeneralException("Could not find Controller Request [" + requestUri + "] at URL [" + controllerXmlUrl.toExternalForm() + "]");
        }
    }
View Full Code Here

            try {
                screenFiles = FileUtil.findXmlFiles(rootComponentPath, null, "screens", "widget-screen.xsd");
                formFiles = FileUtil.findXmlFiles(rootComponentPath, null, "forms", "widget-form.xsd");
                controllerFiles = FileUtil.findXmlFiles(rootComponentPath, null, "site-conf", "site-conf.xsd");
            } catch (IOException ioe) {
                throw new GeneralException(ioe.getMessage());
            }
            for (File screenFile: screenFiles) {
                String screenFilePath = screenFile.getAbsolutePath();
                screenFilePath = screenFilePath.replace('\\', '/');
                String screenFileRelativePath = screenFilePath.substring(rootComponentPath.length());
                String screenLocation = "component://" + componentName + "/" + screenFileRelativePath;
                Map<String, ModelScreen> modelScreenMap = null;
                try {
                    modelScreenMap = ScreenFactory.getScreensFromLocation(screenLocation);
                } catch (Exception exc) {
                    throw new GeneralException(exc.toString(), exc);
                }
                for (String screenName : modelScreenMap.keySet()) {
                    this.getScreenWidgetArtifactInfo(screenName, screenLocation);
                }
            }
            for (File formFile: formFiles) {
                String formFilePath = formFile.getAbsolutePath();
                formFilePath = formFilePath.replace('\\', '/');
                String formFileRelativePath = formFilePath.substring(rootComponentPath.length());
                String formLocation = "component://" + componentName + "/" + formFileRelativePath;
                Map<String, ModelForm> modelFormMap = null;
                try {
                    modelFormMap = FormFactory.getFormsFromLocation(formLocation, this.getEntityModelReader(), this.getDispatchContext());
                } catch (Exception exc) {
                    throw new GeneralException(exc.toString(), exc);
                }
                for (String formName : modelFormMap.keySet()) {
                    this.getFormWidgetArtifactInfo(formName, formLocation);
                }
            }
            for (File controllerFile: controllerFiles) {
                URL controllerUrl = null;
                try {
                    controllerUrl = controllerFile.toURI().toURL();
                } catch (MalformedURLException mue) {
                    throw new GeneralException(mue.getMessage());
                }
                ControllerConfig cc = ConfigXMLReader.getControllerConfig(controllerUrl);
                for (String requestUri: cc.getRequestMapMap().keySet()) {
                    try {
                        this.getControllerRequestArtifactInfo(controllerUrl, requestUri);
View Full Code Here

        if (delegator != null && entityName != null) {
            Map<String, ModelParam> modelParamMap = new LinkedHashMap<String, ModelParam>();
            try {
                ModelEntity entity = delegator.getModelEntity(entityName);
                if (entity == null) {
                    throw new GeneralException("Could not find entity with name [" + entityName + "]");
                }
                Iterator<ModelField> fieldsIter = entity.getFieldsIterator();
                if (fieldsIter != null) {
                    while (fieldsIter.hasNext()) {
                        ModelField field = fieldsIter.next();
                        if ((!field.getIsAutoCreatedInternal()) && ((field.getIsPk() && includePk) || (!field.getIsPk() && includeNonPk))) {
                            ModelFieldType fieldType = delegator.getEntityFieldType(entity, field.getType());
                            if (fieldType == null) {
                                throw new GeneralException("Null field type from delegator for entity [" + entityName + "]");
                            }
                            ModelParam param = new ModelParam();
                            param.entityName = entityName;
                            param.fieldName = field.getName();
                            param.name = field.getName();
View Full Code Here

        else if ("application/vnd.ms-excel".equalsIgnoreCase(contentType)) {
            options.setOutputFormat("xls");
        } else if ("application/vnd.ms-powerpoint".equalsIgnoreCase(contentType)) {
            options.setOutputFormat("ppt");
        } else {
            throw new GeneralException("Unknown content type : " + contentType);
        }

        if (options.getOutputFormat().equalsIgnoreCase(RenderOption.OUTPUT_FORMAT_HTML)) {
            // set html render options
            HTMLRenderOption htmlOptions = new HTMLRenderOption(options);
View Full Code Here

                for (File controllerFile: controllerFiles) {
                    URL controllerUrl = null;
                    try {
                        controllerUrl = controllerFile.toURI().toURL();
                    } catch (MalformedURLException mue) {
                        throw new GeneralException(mue);
                    }
                    ControllerConfig cc = ConfigXMLReader.getControllerConfig(controllerUrl);
                    controllerConfigs.add(cc);
                }

                controllerSearchResultsCache.put(cacheId, controllerConfigs);
            } catch (IOException e) {
                throw new GeneralException("Error finding controller XML files to lookup request references: " + e.toString(), e);
            }
        }

        if (controllerConfigs != null) {
            for (ControllerConfig cc: controllerConfigs) {
View Full Code Here

    public static List<GenericValue> getAllPublishPoints(Delegator delegator, String parentPubPt) throws GeneralException {
        List<GenericValue> relatedPubPts = null;
        try {
            relatedPubPts = delegator.findByAndCache("ContentAssoc", UtilMisc.toMap("contentIdTo", parentPubPt, "contentAssocTypeId", "SUBSITE"));
        } catch (GenericEntityException e) {
            throw new GeneralException(e.getMessage());
        }
        List<GenericValue> allPublishPoints = FastList.newInstance();
        GenericValue webSitePublishPoint = null;
        GenericValue contentAssoc = null;
        Iterator<GenericValue> it = relatedPubPts.iterator();
View Full Code Here

    public static List<Map<String, Object>> getStaticValues(Delegator delegator,  String parentPlaceholderId, List<String []> permittedPublishPointList) throws GeneralException {
        List<GenericValue> assocValueList = null;
        try {
            assocValueList = delegator.findByAndCache("Content", UtilMisc.toMap("contentTypeId", parentPlaceholderId));
        } catch (GenericEntityException e) {
            throw new GeneralException(e.getMessage());
        }

        List<Map<String, Object>> staticValueList = FastList.newInstance();
        Iterator<GenericValue> it = assocValueList.iterator();
        int counter = 0;
View Full Code Here

        List<GenericValue> assocValueList = null;
        try {
            List<GenericValue> rawAssocValueList = delegator.findByAndCache("ContentAssoc", UtilMisc.toMap("contentId", targContentId, "contentAssocTypeId", "PUBLISH_LINK"));
            assocValueList = EntityUtil.filterByDate(rawAssocValueList);
        } catch (GenericEntityException e) {
            throw new GeneralException(e.getMessage());
        }
        Iterator<GenericValue> it4 = assocValueList.iterator();
        while (it4.hasNext()) {
            GenericValue contentAssoc = it4.next();
            String contentIdTo = contentAssoc.getString("contentIdTo");
View Full Code Here

        List<GenericValue> relatedPubPts = null;
        try {
            relatedPubPts = delegator.findByAndCache("ContentAssoc", UtilMisc.toMap("contentIdTo", parentPubPt, "contentAssocTypeId", "DEPARTMENT"));

        } catch (GenericEntityException e) {
            throw new GeneralException(e.getMessage());
        }
        List<GenericValue> allDepartmentPoints = FastList.newInstance();
        GenericValue departmentContent = null;
        GenericValue contentAssoc = null;
        Iterator<GenericValue> it = relatedPubPts.iterator();
View Full Code Here

TOP

Related Classes of org.ofbiz.base.util.GeneralException

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.