Package aim.domain.security

Examples of aim.domain.security.Employee


    /**
     * {@inheritDoc }
     */
    @Override
    public Collection<BlankPolicy> getAgentsPolicy(Passport agentId) {
        Employee agent = getAgentByID(agentId);
        return entityManager.createNamedQuery(BlankPolicy.AGENTS_BLANK_POLICIES_QUERY).
                setParameter("currentAgent", agent).setParameter("true", true).getResultList();
    }
View Full Code Here


    /**
     * {@inheritDoc }
     */
    @Override
    public List<BlankPolicy> getAgentsPolicyWithinDate(Passport passport, Date dateFrom, Date dateTo) {
        Employee agent = getAgentByID(passport);
        if (dateFrom == null) {
            DateFormat a = new SimpleDateFormat("dd.MM.yyyy");
            try {
                dateFrom = a.parse("01.07.2009");
            } catch (ParseException ex) {
View Full Code Here

        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);
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);
View Full Code Here

    @Test
    @Ignore
    public void testFindByOffice() {
        final int agentFromKievCount = 1;
        final Passport firstAgentId = new Passport("АВ", "468454");
        final Account firstAgent = new Account(new Employee(firstAgentId, "Иванов", "Иван"));
        final Set<UserRoles> firstAgentUserRoles = new TreeSet<UserRoles>();
        firstAgentUserRoles.add(UserRoles.ROLE_AGENT);
        firstAgent.setAssociatedRoles(firstAgentUserRoles);
        userDAO.persist(firstAgent);
        final Office office = new Office("Kiev");
        userDAO.persist(office);
        firstAgent.getEmployee().setOffice(office);

        final Passport secondAgentId = new Passport("АВ", "468454");
        final Account secondAgent = new Account(new Employee(secondAgentId, "Иванов", "Иван"));
        final List<UserRoles> secondAgentUserRoles = new ArrayList<UserRoles>();
        secondAgentUserRoles.add(UserRoles.ROLE_AGENT);
        secondAgent.setAssociatedRoles(firstAgentUserRoles);
        userDAO.persist(secondAgent);
View Full Code Here


    @Test
    public void testGetAgentsPolicyWithinDate() {
        final Passport agentId = new Passport("АВ", "100500");
        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);
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);
View Full Code Here

        for (long i = beginNumber; i <= endNumber; i++) {
            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);

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

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

        final List<Employee> policiesAgents = blankPolicyDAO.findAgentsOfPolicies(policySeries, 1, 10);

        assertNotNull(policiesAgents);
        assertEquals(2, policiesAgents.size());

        assertEquals(firstEmployee.getFirstName(), policiesAgents.get(0).getFirstName());
        assertEquals(secondEmployee.getFirstName(), policiesAgents.get(1).getFirstName());
    }
View Full Code Here

            blankPolicyDAO.persistPolicy(blankPolicy);
        }


        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);
View Full Code Here

            blankPolicyDAO.persistPolicy(blankPolicy);
        }

        /* 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);
View Full Code Here

TOP

Related Classes of aim.domain.security.Employee

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.