Package aim.domain.policy

Examples of aim.domain.policy.BlankPolicy


        final long beginNumber = 1;
        final long endNumber = 5;
        final long policyCount = endNumber - beginNumber + 1;
        for (long i = beginNumber; i <= endNumber; i++) {
            final BlankPolicy blankPolicy = new BlankPolicy(new PolicyId(serie1, i));
            entityManager.persist(blankPolicy);
        }

        policyService.issuePolicyToAgent(serie1, beginNumber, endNumber, agent.getEmployee());
        //TODO assert
View Full Code Here


        houseSeriesOne.setPolicyType(policyTypeHouse);
        policyTypeHouse.getTypeSeries().add(houseSeriesOne);
        entityManager.persist(policyTypeHouse);

        for (long i = 1; i <= 5; i++) {
            final BlankPolicy blankPolicy = new BlankPolicy(new PolicyId(houseSeriesOne, i));
            blankPolicy.setInventoryPolicyState(BlankState.FILLED);
            blankPolicy.setAgent(agent.getEmployee());
            entityManager.persist(blankPolicy);
        }
        for (long i = 6; i <= 10; i++) {
            final BlankPolicy blankPolicy = new BlankPolicy(new PolicyId(houseSeriesOne, i));
            entityManager.persist(blankPolicy);
        }

        final Long retrivedEmptyBlankPolicyCount = policyService.checkExistanceOfEmptyPolicies(houseSeriesOne, 1, 10);
        assertTrue(retrivedEmptyBlankPolicyCount == 5);
View Full Code Here

        final long beginNumber = 1;
        final long endNumber = 5;
        final Long policyCount = endNumber - beginNumber + 1;
        for (long i = beginNumber; i <= endNumber; i++) {
            final BlankPolicy blankPolicy = new BlankPolicy(new PolicyId(houseSeriesOne, i));
            entityManager.persist(blankPolicy);
        }

        final Long retrivedBlankPolicyCount = policyService.checkExistanceOfPoliciesCount(houseSeriesOne,
                beginNumber, endNumber);
View Full Code Here

        final long beginNumber = 1;
        final long endNumber = 5;
        final long policyCount = 3;
        for (long i = beginNumber; i <= endNumber; i++) {
            final BlankPolicy blankPolicy = new BlankPolicy(new PolicyId(houseSeriesOne, i));
            entityManager.persist(blankPolicy);
        }

        final Collection<BlankPolicy> retrivedBlankPolicies = policyService.getExistingBlankPolicies(houseSeriesOne, 3, 100);
        assertEquals(policyCount, retrivedBlankPolicies.size());
View Full Code Here

        if (!iterator.hasNext()) {
            return lightPolicies;
        }

        BlankPolicy someBlankPolicy = iterator.next();
        String lastType = someBlankPolicy.getPolicyType().getTitle();
        String lastSeries = someBlankPolicy.getRealId().getSeries().getSeries();
        BlankState lastState = someBlankPolicy.getInventoryPolicyState();
        long numberFrom = someBlankPolicy.getRealId().getNumber();
        long numberTo = numberFrom;
        boolean wasIssuedToAgent = someBlankPolicy.getIssuedToAgent();

        while (iterator.hasNext()) {
            someBlankPolicy = iterator.next();

            if (someBlankPolicy.getRealId().getNumber() == numberTo+1 &&
                    wasIssuedToAgent == someBlankPolicy.getIssuedToAgent() &&
                    someBlankPolicy.getPolicyType().getTitle().equals(lastType) &&
                    someBlankPolicy.getRealId().getSeries().getSeries().equals(lastSeries) &&
                    someBlankPolicy.getInventoryPolicyState().equals(lastState)
                    ) {
                numberTo++;
            } else {
                if (numberFrom == numberTo) {
                    lightPolicies.add(new LightPolicySet(lastSeries, lastType, lastState.toString(), Long.toString(numberTo),
                            wasIssuedToAgent));
                } else {
                    lightPolicies.add(new LightPolicySet(lastSeries, lastType, lastState.toString(), numberFrom+"..."+numberTo,
                            wasIssuedToAgent));
                }
                lastType = someBlankPolicy.getPolicyType().getTitle();
                lastSeries = someBlankPolicy.getRealId().getSeries().getSeries();
                lastState = someBlankPolicy.getInventoryPolicyState();
                numberFrom = someBlankPolicy.getRealId().getNumber();
                numberTo = numberFrom;
                wasIssuedToAgent = someBlankPolicy.getIssuedToAgent();
            }
        }

        if (numberFrom == numberTo) {
            lightPolicies.add(new LightPolicySet(lastSeries, lastType, lastState.toString(), Long.toString(numberTo),
View Full Code Here

        }

        lightPolicies = new ArrayList<LightPolicySet>();
        boolean notOne = false;

        BlankPolicy blankPolicy = iterator.next();
        LightPolicySet lightPolicy = new LightPolicySet(blankPolicy.getRealId().getSeries().getSeries(),
                blankPolicy.getPolicyType().getTitle(),
                blankPolicy.getIssueToAgentDate(),
                blankPolicy.getInventoryPolicyState().toString());

        if (blankPolicy.getWriteOffReason() != null) {
            lightPolicy.setReason(blankPolicy.getWriteOffReason().toString());
        }
        long lastValue = blankPolicy.getRealId().getNumber();
        Date lastDate = blankPolicy.getInventoryDate();

        while (iterator.hasNext()) {
            blankPolicy = iterator.next();
            final long currentValue = blankPolicy.getRealId().getNumber();
            final Date currentDate = blankPolicy.getInventoryDate();

            if (EMPTY_STRING.equals(lightPolicy.getNumber())) {
                lightPolicy.setNumber(Long.toString(lastValue));
                notOne = false;
            }
            /* Check if prev policy vs current, if they have diff number or diff PolicyType
            or diff PolicySerie or diff Invent Date or diff State*/
            if ((lastValue + 1) != currentValue ||
                    !lastDate.equals(currentDate) ||
                    !blankPolicy.getPolicyType().getTitle().equals(lightPolicy.getType()) ||
                    !blankPolicy.getRealId().getSeries().getSeries().equals(lightPolicy.getSerie()) ||
                    !blankPolicy.getInventoryPolicyState().toString().equals(lightPolicy.getState()) ||
                    (blankPolicy.getWriteOffReason() != null && !blankPolicy.getWriteOffReason().toString().equals(lightPolicy.getReason()))) {
                if (notOne) {
                    lightPolicy.setNumber(lightPolicy.getNumber() + NUMBERS_SEPARATOR + lastValue);
                }
                /*IF write-off , then set reason */
                if (WRITE_OFF.equals(lightPolicy.getState())) {
                    lightPolicy.setReason(MessageBundle.getMessage(lightPolicy.getReason()));
                    lightPolicy.setState(MessageBundle.getMessage(lightPolicy.getState()) + REASON_SEPARATOR_LEFT + lightPolicy.getReason() + REASON_SEPARATOR_RIGHT);
                } else {
                    lightPolicy.setState(MessageBundle.getMessage(lightPolicy.getState()));
                }


                lightPolicies.add(lightPolicy);
                lightPolicy = new LightPolicySet(blankPolicy.getRealId().getSeries().getSeries(),
                        blankPolicy.getPolicyType().getTitle(),
                        blankPolicy.getIssueToAgentDate(),
                        blankPolicy.getInventoryPolicyState().toString());
                if (blankPolicy.getWriteOffReason() != null) {
                    lightPolicy.setReason(blankPolicy.getWriteOffReason().toString());
                }
                lastDate = currentDate;
            } else {
                notOne = true;
            }
View Full Code Here

        final long beginNumber = 1;
        final long endNumber = 5;
        final Long policyCount = endNumber - beginNumber + 1;
        for (long i = beginNumber; i <= endNumber; i++) {
            final BlankPolicy blankPolicy = new BlankPolicy(new PolicyId(houseSeriesOne, i));
            blankPolicyDAO.persistPolicy(blankPolicy);
        }

        final Long retrivedBlankPolicyCount = blankPolicyDAO.existingBlankPolicyCount(houseSeriesOne,
                beginNumber, endNumber);
View Full Code Here

        final PolicySeries serie2 = new PolicySeries("ABB");
        serie2.setPolicyType(type);
        type.getTypeSeries().add(serie2);
        policyTypeDAO.persistPolicyType(type);

        blankPolicyDAO.persistPolicy(new BlankPolicy(new PolicyId(serie1, 1)));
        blankPolicyDAO.persistPolicy(new BlankPolicy(new PolicyId(serie1, 2)));

        final List<BlankPolicy> policies = blankPolicyDAO.findBlankPolicies(serie1, 3, 4);

        assertTrue(policies.isEmpty());
    }
View Full Code Here

        policyTypeDAO.persistPolicyType(type);

        final long beginNumber = 1;
        final long endNumber = 5;
        for (long i = beginNumber; i <= endNumber; i++) {
            final BlankPolicy blankPolicy = new BlankPolicy(new PolicyId(series, i));
            blankPolicyDAO.persistPolicy(blankPolicy);
        }

        final long serchingPolcyCount = 3;
        final List<BlankPolicy> policies = blankPolicyDAO.findBlankPolicies(series, beginNumber, 3);
View Full Code Here

        final long beginNumber = 1;
        final long endNumber = 5;
        final long policyCount = endNumber - beginNumber + 1;
        for (long i = beginNumber; i <= endNumber; i++) {
            final BlankPolicy blankPolicy = new BlankPolicy(new PolicyId(series, i));
            blankPolicyDAO.persistPolicy(blankPolicy);
        }

        final List<BlankPolicy> policies = blankPolicyDAO.findBlankPolicies(series, 1, 5);
View Full Code Here

TOP

Related Classes of aim.domain.policy.BlankPolicy

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.