Search in sources :

Example 1 with Role

use of com.autentia.tnt.businessobject.Role in project TNTConcept by autentia.

the class DuplicateOfferTest method insertInitialData.

/**
 * Metodo encargado de insertar datos muy generales pero que son necesarios
 * para generar facturas en base a ofertas
 */
private void insertInitialData() {
    final OfferDAO offerDAO = (OfferDAO) SpringUtilsForTesting.getSpringBean("daoOffer");
    final ProjectDAO projectDAO = (ProjectDAO) SpringUtilsForTesting.getSpringBean("daoProject");
    final OrganizationDAO organizationDAO = (OrganizationDAO) SpringUtilsForTesting.getSpringBean("daoOrganization");
    final ContactDAO contactDAO = (ContactDAO) SpringUtilsForTesting.getSpringBean("daoContact");
    final UserDAO userDAO = (UserDAO) SpringUtilsForTesting.getSpringBean("daoUser");
    final RoleDAO roleDAO = (RoleDAO) SpringUtilsForTesting.getSpringBean("daoRole");
    final UserCategoryDAO categoryDAO = (UserCategoryDAO) SpringUtilsForTesting.getSpringBean("daoUserCategory");
    final DepartmentDAO departmentDAO = (DepartmentDAO) SpringUtilsForTesting.getSpringBean("daoDepartment");
    final WorkingAgreementDAO workingAgreementDAO = (WorkingAgreementDAO) SpringUtilsForTesting.getSpringBean("daoWorkingAgreement");
    final Role role = new Role();
    roleDAO.insert(role);
    final Department department = new Department();
    department.setName("departamento");
    departmentDAO.insert(department);
    final UserCategory category = new UserCategory();
    categoryDAO.insert(category);
    final WorkingAgreement workingAgreement = new WorkingAgreement();
    workingAgreementDAO.insert(workingAgreement);
    contact.setName("Sergio Hermida");
    contactDAO.insert(contact);
    projectDAO.insert(project);
    organizationDAO.insert(organization);
    user.setRole(role);
    user.setCategory(category);
    user.setDepartment(department);
    user.setAgreement(workingAgreement);
    userDAO.insert(user);
    offer.setNumber(OFFER_NUMBER);
    offer.setOrganization(organization);
    offer.setContact(contact);
    offer.setTitle(OFFER_TITLE);
    offer.setDescription(OFFER_DESCRIPTION);
    offer.setOfferPotential(OfferPotential.MEDIUM);
    offer.setOfferState(OfferState.OPEN);
    offer.setCreationDate(new Date());
    offer.setMaturityDate(new Date());
    offerDAO.insert(offer);
}
Also used : UserCategory(com.autentia.tnt.businessobject.UserCategory) DepartmentDAO(com.autentia.tnt.dao.hibernate.DepartmentDAO) Date(java.util.Date) WorkingAgreementDAO(com.autentia.tnt.dao.hibernate.WorkingAgreementDAO) Role(com.autentia.tnt.businessobject.Role) OfferRole(com.autentia.tnt.businessobject.OfferRole) Department(com.autentia.tnt.businessobject.Department) UserCategoryDAO(com.autentia.tnt.dao.hibernate.UserCategoryDAO) UserDAO(com.autentia.tnt.dao.hibernate.UserDAO) ContactDAO(com.autentia.tnt.dao.hibernate.ContactDAO) RoleDAO(com.autentia.tnt.dao.hibernate.RoleDAO) OfferDAO(com.autentia.tnt.dao.hibernate.OfferDAO) OrganizationDAO(com.autentia.tnt.dao.hibernate.OrganizationDAO) ProjectDAO(com.autentia.tnt.dao.hibernate.ProjectDAO) WorkingAgreement(com.autentia.tnt.businessobject.WorkingAgreement)

Example 2 with Role

use of com.autentia.tnt.businessobject.Role in project TNTConcept by autentia.

the class LdapCustomAuthenticationProviderTest method getUserForTest.

private User getUserForTest() {
    Role role = mock(Role.class);
    when(role.getId()).thenReturn(1);
    User user = mock(User.class);
    when(user.getId()).thenReturn(1);
    when(user.getDepartmentId()).thenReturn(1);
    when(user.getLogin()).thenReturn("login");
    when(user.getLdapPassword()).thenReturn("ldapPassword");
    when(user.isActive()).thenReturn(true);
    when(user.getName()).thenReturn("name");
    when(user.getRole()).thenReturn(role);
    return user;
}
Also used : Role(com.autentia.tnt.businessobject.Role) User(com.autentia.tnt.businessobject.User)

Example 3 with Role

use of com.autentia.tnt.businessobject.Role in project TNTConcept by autentia.

the class SpringUtilsForTesting method createRoleInContext.

private static Role createRoleInContext() {
    final Role role = new Role();
    final RoleDAO roleDao = (RoleDAO) appCtx.getBean("daoRole");
    roleDao.insert(role);
    return role;
}
Also used : Role(com.autentia.tnt.businessobject.Role) RoleDAO(com.autentia.tnt.dao.hibernate.RoleDAO)

Example 4 with Role

use of com.autentia.tnt.businessobject.Role in project TNTConcept by autentia.

the class ReportUtil method getRoles.

public static ArrayList<SelectItem> getRoles(ArrayList<SelectItem> projs) {
    final RoleDAO roleDAO = new RoleDAO();
    ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
    List<Role> roles = roleDAO.search(new SortCriteria("name"));
    for (Role role : roles) {
        ret.add(new SelectItem(role.getId().toString(), role.getName()));
    }
    return ret;
}
Also used : Role(com.autentia.tnt.businessobject.Role) ProjectRole(com.autentia.tnt.businessobject.ProjectRole) SortCriteria(com.autentia.tnt.dao.SortCriteria) RoleDAO(com.autentia.tnt.dao.hibernate.RoleDAO) SelectItem(javax.faces.model.SelectItem) ArrayList(java.util.ArrayList)

Example 5 with Role

use of com.autentia.tnt.businessobject.Role in project TNTConcept by autentia.

the class SpringUtilsForTesting method createRoleInContext.

private static Role createRoleInContext() {
    final Role role = new Role();
    role.setName("Test Role");
    final RoleDAO roleDao = (RoleDAO) appCtx.getBean("daoRole");
    roleDao.insert(role);
    return role;
}
Also used : Role(com.autentia.tnt.businessobject.Role) RoleDAO(com.autentia.tnt.dao.hibernate.RoleDAO)

Aggregations

Role (com.autentia.tnt.businessobject.Role)6 RoleDAO (com.autentia.tnt.dao.hibernate.RoleDAO)4 SortCriteria (com.autentia.tnt.dao.SortCriteria)2 ArrayList (java.util.ArrayList)2 SelectItem (javax.faces.model.SelectItem)2 Department (com.autentia.tnt.businessobject.Department)1 OfferRole (com.autentia.tnt.businessobject.OfferRole)1 ProjectRole (com.autentia.tnt.businessobject.ProjectRole)1 User (com.autentia.tnt.businessobject.User)1 UserCategory (com.autentia.tnt.businessobject.UserCategory)1 WorkingAgreement (com.autentia.tnt.businessobject.WorkingAgreement)1 ContactDAO (com.autentia.tnt.dao.hibernate.ContactDAO)1 DepartmentDAO (com.autentia.tnt.dao.hibernate.DepartmentDAO)1 OfferDAO (com.autentia.tnt.dao.hibernate.OfferDAO)1 OrganizationDAO (com.autentia.tnt.dao.hibernate.OrganizationDAO)1 ProjectDAO (com.autentia.tnt.dao.hibernate.ProjectDAO)1 UserCategoryDAO (com.autentia.tnt.dao.hibernate.UserCategoryDAO)1 UserDAO (com.autentia.tnt.dao.hibernate.UserDAO)1 WorkingAgreementDAO (com.autentia.tnt.dao.hibernate.WorkingAgreementDAO)1 Date (java.util.Date)1