Examples of CoverageRequest


Examples of org.drools.examples.carinsurance.domain.request.CoverageRequest


        Driver realJohn = new Driver("John", "Smith", new LocalDate().minusYears(10));
        Car realMini = new Car("MINI-01", CarType.SMALL, false, new BigDecimal("10000.00"));
        PolicyRequest realJohnMiniPolicyRequest = new PolicyRequest(realJohn, realMini);
        realJohnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COLLISION));
        realJohnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COMPREHENSIVE));
        realJohnMiniPolicyRequest.setAutomaticallyRejected(true);
        realJohnMiniPolicyRequest.addRejectedMessage("Too young.");

        Driver fakeJohn = new Driver("John", "Smith", new LocalDate().minusYears(30));
        Car fakeMini = new Car("MINI-01", CarType.SMALL, false, new BigDecimal("10000.00"));
        PolicyRequest fakeJohnMiniPolicyRequest = new PolicyRequest(fakeJohn, fakeMini);
        fakeJohnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COLLISION));
        fakeJohnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COMPREHENSIVE));
        fakeJohnMiniPolicyRequest.setAutomaticallyRejected(false);


        // @formatter:off
        simulationFluent
View Full Code Here

Examples of org.drools.examples.carinsurance.domain.request.CoverageRequest


        Driver realJohn = new Driver("John", "Smith", new LocalDate().minusYears(10));
        Car realMini = new Car("MINI-01", CarType.SMALL, false, new BigDecimal("10000.00"));
        PolicyRequest realJohnMiniPolicyRequest = new PolicyRequest(realJohn, realMini);
        realJohnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COLLISION));
        realJohnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COMPREHENSIVE));
        realJohnMiniPolicyRequest.setAutomaticallyRejected(true);
        realJohnMiniPolicyRequest.addRejectedMessage("Too young.");

        Driver otherJohn = new Driver("John", "Smith", new LocalDate().minusYears(30));
        Car otherMini = new Car("MINI-01", CarType.SMALL, false, new BigDecimal("10000.00"));
        PolicyRequest otherJohnMiniPolicyRequest = new PolicyRequest(otherJohn, otherMini);
        otherJohnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COLLISION));
        otherJohnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COMPREHENSIVE));
        otherJohnMiniPolicyRequest.setAutomaticallyRejected(false);


        // @formatter:off
        simulationFluent.newPath("init")
View Full Code Here

Examples of org.drools.examples.carinsurance.domain.request.CoverageRequest

        SimulationFluent simulationFluent = new DefaultSimulationFluent();

        Driver john = new Driver("John", "Smith", new LocalDate(1970, 1, 1));
        Car mini = new Car("MINI-01", CarType.SMALL, false, new BigDecimal("10000.00"));
        PolicyRequest johnMiniPolicyRequest = new PolicyRequest(john, mini);
        johnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COLLISION));
        johnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COMPREHENSIVE));


        // @formatter:off         
        simulationFluent
        .newKnowledgeBuilder()
View Full Code Here

Examples of org.drools.examples.carinsurance.domain.request.CoverageRequest

        SimulationFluent simulationFluent = new DefaultSimulationFluent();

        Driver john = new Driver("John", "Smith", new LocalDate().minusYears(10));
        Car mini = new Car("MINI-01", CarType.SMALL, false, new BigDecimal("10000.00"));
        PolicyRequest johnMiniPolicyRequest = new PolicyRequest(john, mini);
        johnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COLLISION));
        johnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COMPREHENSIVE));


        // @formatter:off
        simulationFluent
        .newKnowledgeBuilder()
View Full Code Here

Examples of org.drools.examples.carinsurance.domain.request.CoverageRequest

        SimulationFluent simulationFluent = new DefaultSimulationFluent();

        Driver john = new Driver("John", "Smith", new LocalDate().minusYears(10));
        Car mini = new Car("MINI-01", CarType.SMALL, false, new BigDecimal("10000.00"));
        PolicyRequest johnMiniPolicyRequest = new PolicyRequest(john, mini);
        johnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COLLISION));
        johnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COMPREHENSIVE));


        // @formatter:off
        simulationFluent
        .newKnowledgeBuilder()
View Full Code Here

Examples of org.drools.examples.carinsurance.domain.request.CoverageRequest


        Driver realJohn = new Driver("John", "Smith", new LocalDate().minusYears(10));
        Car realMini = new Car("MINI-01", CarType.SMALL, false, new BigDecimal("10000.00"));
        PolicyRequest realJohnMiniPolicyRequest = new PolicyRequest(realJohn, realMini);
        realJohnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COLLISION));
        realJohnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COMPREHENSIVE));
        realJohnMiniPolicyRequest.setAutomaticallyRejected(true);
        realJohnMiniPolicyRequest.addRejectedMessage("Too young.");

        Driver fakeJohn = new Driver("John", "Smith", new LocalDate().minusYears(30));
        Car fakeMini = new Car("MINI-01", CarType.SMALL, false, new BigDecimal("10000.00"));
        PolicyRequest fakeJohnMiniPolicyRequest = new PolicyRequest(fakeJohn, fakeMini);
        fakeJohnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COLLISION));
        fakeJohnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COMPREHENSIVE));
        fakeJohnMiniPolicyRequest.setAutomaticallyRejected(false);

        String rules = readInputStreamReaderAsString( new InputStreamReader( getClass().getResourceAsStream( "policyRequestFraudDetectionRules.drl" ) ) );
        ReleaseId releaseId = createKJarWithMultipleResources( "org.drools.KBase1", new String[]{rules}, new ResourceType[] {ResourceType.DRL} );
View Full Code Here

Examples of org.drools.examples.carinsurance.domain.request.CoverageRequest


        Driver realJohn = new Driver("John", "Smith", new LocalDate().minusYears(10));
        Car realMini = new Car("MINI-01", CarType.SMALL, false, new BigDecimal("10000.00"));
        PolicyRequest realJohnMiniPolicyRequest = new PolicyRequest(realJohn, realMini);
        realJohnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COLLISION));
        realJohnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COMPREHENSIVE));
        realJohnMiniPolicyRequest.setAutomaticallyRejected(true);
        realJohnMiniPolicyRequest.addRejectedMessage("Too young.");

        Driver otherJohn = new Driver("John", "Smith", new LocalDate().minusYears(30));
        Car otherMini = new Car("MINI-01", CarType.SMALL, false, new BigDecimal("10000.00"));
        PolicyRequest otherJohnMiniPolicyRequest = new PolicyRequest(otherJohn, otherMini);
        otherJohnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COLLISION));
        otherJohnMiniPolicyRequest.addCoverageRequest(new CoverageRequest(CoverageType.COMPREHENSIVE));
        otherJohnMiniPolicyRequest.setAutomaticallyRejected(false);

        String rules = readInputStreamReaderAsString( new InputStreamReader( getClass().getResourceAsStream( "policyRequestFraudDetectionRules.drl" ) ) );
        ReleaseId releaseId = createKJarWithMultipleResources( "org.drools.KBase1", new String[]{rules}, new ResourceType[] {ResourceType.DRL} );
View Full Code Here

Examples of org.vfny.geoserver.wcs.requests.CoverageRequest

        return getCoverageRequest(request);
    }

    public CoverageRequest getCoverageRequest(HttpServletRequest srequest)
        throws WcsException {
        CoverageRequest currentRequest = new CoverageRequest((WCSInfo)serviceConfig);
        currentRequest.setHttpServletRequest(srequest);

        Map parameters = new HashMap();
        parameters.putAll(kvpPairs);

        // set global request parameters
        if (LOGGER.isLoggable(Level.FINEST)) {
            LOGGER.finest("setting global request parameters");
        }

        if (keyExists("SERVICE")) {
            final String service = getValue("SERVICE");

            if (service.trim().toUpperCase().startsWith("WCS")) {
                currentRequest.setService(service);
            } else {
                throw new WcsException("SERVICE parameter is wrong.");
            }

            parameters.remove("SERVICE");
        } else {
            throw new WcsException("SERVICE parameter is mandatory.");
        }

        if (keyExists("VERSION")) {
            final String version = getValue("VERSION");

            if (version.equals("1.0.0")) {
                currentRequest.setVersion(version);
            } else {
                throw new WcsException("VERSION parameter is wrong.");
            }

            parameters.remove("VERSION");
        } else {
            throw new WcsException("VERSION parameter is mandatory.");
        }

        if (keyExists("REQUEST")) {
            final String request = getValue("REQUEST");

            if (request.equalsIgnoreCase("GetCoverage")) {
                currentRequest.setRequest(request);
            } else {
                throw new WcsException("REQUEST parameter is wrong.");
            }

            parameters.remove("REQUEST");
        } else {
            throw new WcsException("REQUEST parameter is mandatory.");
        }

        if (keyExists("COVERAGE")) {
            currentRequest.setCoverage(getValue("COVERAGE"));
            parameters.remove("COVERAGE");
        } else {
            throw new WcsException("COVERAGE parameter is mandatory.");
        }

        if (keyExists("COVERAGEVERSION")) {
            currentRequest.setCoverageVersion(getValue("COVERAGEVERSION"));
            parameters.remove("COVERAGEVERSION");
        }

        if (keyExists("FORMAT")) {
            currentRequest.setOutputFormat(getValue("FORMAT"));
            parameters.remove("FORMAT");
        } else {
            throw new WcsException("FORMAT parameter is mandatory.");
        }

        if (keyExists("CRS")) {
            currentRequest.setCRS(getValue("CRS"));
            parameters.remove("CRS");
        } else {
            throw new WcsException("CRS parameter is mandatory.");
        }

        if (keyExists("RESPONSE_CRS")) {
            currentRequest.setResponseCRS(getValue("RESPONSE_CRS"));
            parameters.remove("RESPONSE_CRS");
        } else {
            currentRequest.setResponseCRS(getValue("CRS"));
        }

        if (keyExists("BBOX")) {
            currentRequest.setEnvelope(getValue("BBOX"));
            parameters.remove("BBOX");
        } else {
            throw new WcsException("BBOX parameter is mandatory.");
        }

        if (keyExists("WIDTH") && keyExists("HEIGHT")) {
            currentRequest.setGridOrigin(new Double[] { new Double(0.0), new Double(0.0) });
            currentRequest.setGridLow(new Double[] { new Double(0.0), new Double(0.0) });
            currentRequest.setGridHigh(new Double[] {
                    Double.valueOf(getValue("WIDTH")), Double.valueOf(getValue("HEIGHT"))
                });
            parameters.remove("WIDTH");
            parameters.remove("HEIGHT");
        } else if ((currentRequest.getEnvelope() != null)
                && (keyExists("RESX") && keyExists("RESY"))) {
            final Envelope envelope = currentRequest.getEnvelope();
            final double envWidth = Math.abs(envelope.getMaxX() - envelope.getMinX());
            final double envHeight = Math.abs(envelope.getMaxY() - envelope.getMinY());
            final double width = envWidth / Math.abs(Double.parseDouble(getValue("RESX")));
            final double height = envHeight / Math.abs(Double.parseDouble(getValue("RESY")));

            if ((width >= 1.0) && (height >= 1.0)) {
                currentRequest.setGridOrigin(new Double[] { new Double(0.0), new Double(0.0) });
                currentRequest.setGridLow(new Double[] { new Double(0.0), new Double(0.0) });
                currentRequest.setGridHigh(new Double[] { new Double(width), new Double(height) });
            }

            parameters.remove("RESX");
            parameters.remove("RESY");
        }

        if (keyExists("INTERPOLATION")) {
            currentRequest.setInterpolation(getValue("INTERPOLATION"));
            parameters.remove("INTERPOLATION");
        }

        currentRequest.setParameters(parameters);

        return currentRequest;
    }
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.