Package aim.domain.security

Examples of aim.domain.security.Account


        policiesType.getTypeSeries().add(serie1);
        serie1.setPolicyType(policiesType);
        entityManager.persist(policiesType);

        final Passport agentId = new Passport("АВ", "468454");
        final Account agent = new Account(new Employee(agentId, "Иванов", "Иван"));
        final Set<UserRoles> firstAgentUserRoles = new TreeSet<UserRoles>();
        firstAgentUserRoles.add(UserRoles.ROLE_AGENT);
        agent.setAssociatedRoles(firstAgentUserRoles);
        userDAO.persist(agent);
        entityManager.persist(agent);

        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


    }

    @Test
    public void testCheckExistanceOfEmptyPolicies() {
        final Passport agentId = new Passport("АВ", "468454");
        final Account agent = new Account(new Employee(agentId, "Иванов", "Иван"));
        final Set<UserRoles> firstAgentUserRoles = new TreeSet<UserRoles>();
        firstAgentUserRoles.add(UserRoles.ROLE_AGENT);
        agent.setAssociatedRoles(firstAgentUserRoles);
        userDAO.persist(agent);

        final PolicyType policyTypeHouse = new PolicyType("HOUSE", "House insurance type");
        final PolicySeries houseSeriesOne = new PolicySeries("HOM");
        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);
View Full Code Here

     * Provides search agent by his passport data
     */
    public void setAgent() {
        if (agentPassportNumber != null && !agentPassportNumber.isEmpty()) {
            agentPassport = new Passport(agentPassportSerie, agentPassportNumber);
            final Account employer = userService.getAccountByPassport(agentPassport);
            agentFLP = employer.getEmployee().toString();
            agentToDisplay = new EmployeeDTO(employer.getEmployee(), employer.getAccount().getUsername(), employer.getAssociatedRoles());
        }
        showPolicies();
    }
View Full Code Here

    @Test
    public void testExistingEmptyBlankPolicyCount() {
        final Passport agentId = new Passport("АВ", "468454");
        final Employee employee = new Employee(agentId, "Иванов", "Иван");
        final Account agent = new Account(employee);
        final Set<UserRoles> firstAgentUserRoles = new TreeSet<UserRoles>();
        firstAgentUserRoles.add(UserRoles.ROLE_AGENT);
        agent.setAssociatedRoles(firstAgentUserRoles);
        userDAO.persist(agent);

        final PolicyType policyTypeHouse = new PolicyType("HOUSE", "House insurance type");
        final PolicySeries houseSeriesOne = new PolicySeries("HOM");
        houseSeriesOne.setPolicyType(policyTypeHouse);
View Full Code Here

            final BlankPolicy blankPolicy = new BlankPolicy(new PolicyId(policySeries, i));
            blankPolicyDAO.persistPolicy(blankPolicy);
        }

        final Employee firstEmployee = new Employee(new Passport("АВ", "468454"), "Иванов", "Иван");
        final Account firstAgent = new Account(firstEmployee);
        final Set<UserRoles> firstAgentUserRoles = new TreeSet<UserRoles>();
        firstAgentUserRoles.add(UserRoles.ROLE_AGENT);
        firstAgent.setAssociatedRoles(firstAgentUserRoles);
        userDAO.persist(firstAgent);

        final Employee secondEmployee = new Employee(new Passport("АУ", "468454"), "Иванов", "Иван");
        final Account secondAgent = new Account(secondEmployee);
        final Set<UserRoles> secondAgentUserRoles = new TreeSet<UserRoles>();
        secondAgentUserRoles.add(UserRoles.ROLE_AGENT);
        secondAgent.setAssociatedRoles(secondAgentUserRoles);
        userDAO.persist(secondAgent);

        final List<BlankPolicy> policiesOne = blankPolicyDAO.findBlankPolicies(policySeries, 1, 5);
        final List<BlankPolicy> policiesTwo = blankPolicyDAO.findBlankPolicies(policySeries, 6, 10);
View Full Code Here

        }


        final Passport agentId = new Passport("АВ", "468454");
        final Employee employee = new Employee(agentId, "Иванов", "Иван");
        final Account agent = new Account(employee);
        final Set<UserRoles> firstAgentUserRoles = new TreeSet<UserRoles>();
        firstAgentUserRoles.add(UserRoles.ROLE_AGENT);
        agent.setAssociatedRoles(firstAgentUserRoles);
        userDAO.persist(agent);


        final List<BlankPolicy> policiesOne = blankPolicyDAO.findBlankPolicies(policySeries, 1, 15);

        for (BlankPolicy policy : policiesOne) {
            policy.setAgent(employee);
            policy.setIssueToAgentDate(new Date());
            policy.setIssuedToAgent(true);
            blankPolicyDAO.updateBlankPolicy(policy);
        }

        final List<Long> policiesNumbers = blankPolicyDAO.findNumbersOfAgentPolicies(policySeries, beginNumber, endNumber, agent.getId().getSeries(), agent.getId().getNumber());

        assertNotNull(policiesNumbers);
        assertEquals(policyCount, policiesNumbers.size());

        long indx = 1;
View Full Code Here

        }

        /* Create Agent */
        final Passport agentId = new Passport("АВ", "884495");
        final Employee employee = new Employee(agentId, "Иванов", "Иван");
        final Account agent = new Account(employee);
        final Set<UserRoles> firstAgentUserRoles = new TreeSet<UserRoles>();
        firstAgentUserRoles.add(UserRoles.ROLE_AGENT);
        agent.setAssociatedRoles(firstAgentUserRoles);
        userDAO.persist(agent);

        /* Issue policies to Agent */
        final List<BlankPolicy> policiesOne = blankPolicyDAO.findBlankPolicies(policySeries, 11, 15);

View Full Code Here

        List<UserRoles> userRolesEnum = new ArrayList<UserRoles>(Arrays.asList(UserRoles.values()));
        userRoles = new LinkedHashMap<String, String>();
        for (UserRoles currentUserRole : userRolesEnum) {
            userRoles.put( currentUserRole.getLabel(), currentUserRole.getLabel());
        }
        user = new Account();

        allOffices = fillOfficeMap();
    }
View Full Code Here

    /**
     * Clear data after user registration.
     */
    public void reInitializePage() {
        user = new Account();
        associatedRoles = null;
        selectedOffice = null;
        acceptPopupAction = "hide";
    }
View Full Code Here

        return null;
    }
   
    public String getAgentFLP() {
        if (!(agentPassportNumber == null || agentPassportNumber.isEmpty())) {
            final Account employer = userService.getAccountByPassport(new Passport(agentPassportSerie, agentPassportNumber));
            agentFLP = employer.getEmployee().toString();
            agentToDisplay = new EmployeeDTO(employer.getEmployee(), employer.getAccount().getUsername(), employer.getAssociatedRoles());
        }
        return agentFLP;
    }
View Full Code Here

TOP

Related Classes of aim.domain.security.Account

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.