Examples of InvitationDTO


Examples of com.cin.dto.InvitationDTO

       invitationEJB.setCustomer((Userrecord) manager.find(Userrecord.class, ssn));
     }
     invitationEJB.setDateCreated(invitation.getDateCreated());
    
    persist(invitationEJB);
    return new InvitationDTO(invitationEJB);
  }
View Full Code Here

Examples of com.cin.dto.InvitationDTO

    query.setParameter("customer", customer);
   
    List<?> result = query.getResultList();
    List<InvitationDTO> invitations = new ArrayList<InvitationDTO>();
    for( Object o : result){
      invitations.add( new InvitationDTO((Invitation)o) );
    }
    return invitations;
  }
View Full Code Here

Examples of com.cin.dto.InvitationDTO

   * @param request
   * user DTO - with user SSN;
   * (optional) policy - sample policy
   */
  public GenericResponse inviteCostomer(GenericRequest request) throws UserNotFoundException, InvalidInputValueException {
    InvitationDTO invitationDTO = new InvitationDTO();
    if(request.getAgentSsn() != null){
      UserDTO agent = new UserDTO(request.getAgentSsn());
      invitationDTO.setAgent(agent);
    }
    invitationDTO.setCustomer(request.getUser());
   
    invitationDTO = cinService.sendInvitation(invitationDTO, request.getPolicy());
   
    GenericResponse response = new GenericResponse();
    response.setInvitation(invitationDTO);
View Full Code Here

Examples of com.cin.dto.InvitationDTO

   
    private void compensateAgentForInvite(InsurencePolicyDTO policy){
      List<InvitationDTO> userInvites = aRemote.getInvitationsByCustomer(policy.getUserSSN());
   
    userInvites = filterNoAgentInvite(userInvites);
    InvitationDTO invite = getNewestInvite(userInvites);
   
    if( invite == null){
      // nobody to compensate
      log.finer("Nobody to compensate for given purchase.");
      return;
    }
   
    UserDTO agent = invite.getAgent();
    int compensation = Math.round(policy.getQuote() * 0.1f);
   
    aRemote.addPayroll(agent, compensation);
    }
View Full Code Here

Examples of com.cin.dto.InvitationDTO

   
    private InvitationDTO getNewestInvite(List<InvitationDTO> all){
    if( all.size() == 0 ){
      return null;
    }
    InvitationDTO newest = all.get(0);
    for(InvitationDTO inv : all){
      if( inv.getDateCreated().after(newest.getDateCreated())){
        newest = inv;
      }
    }
   
    return newest;
View Full Code Here

Examples of com.cin.dto.InvitationDTO

    int agentSsn = 11;
    int customerSsn = 10;
   
    // create policy
    InsurencePolicyDTO samplePolicy = null;
    InvitationDTO invitation = new InvitationDTO();
    invitation.setAgent(new UserDTO(agentSsn));
    invitation.setCustomer(new UserDTO(customerSsn));
   
    // send invitation
    service.sendInvitation(invitation, samplePolicy);
   
    // make sure the agent was not compensate before
View Full Code Here

Examples of com.cin.dto.InvitationDTO

       
        UserDTO customer = new UserDTO();
        customer.setSsn(rs.getInt(2));
        UserDTO agent = new UserDTO();
        agent.setSsn(rs.getInt(3));
        InvitationDTO inv = new InvitationDTO(id, agent, customer, rs.getDate(4));
        return inv;
      } else {
        return null;
      }
    } finally {
View Full Code Here

Examples of com.cin.dto.InvitationDTO

          "Agent with ssn " + invitation.getAgent().getSsn() + " cannot be found.");
    }

    // record & send invitation
    // TODO: no invitation is actually mailed.
    InvitationDTO sentInvitation = null;
    sentInvitation = new InvitationDTO(0, agent, customer, new Date());
    sentInvitation = aRemote.addInvitation(sentInvitation);
    return sentInvitation;
  }
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.