Search in sources :

Example 6 with Project

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

the class ActivityBean method getOrganizations.

/**
 * @return Organizaciones con proyectos abiertos que ademas tengan ROLES creados
 */
public List<SelectItem> getOrganizations() {
    ArrayList<SelectItem> ret = new ArrayList<SelectItem>(32);
    List<Project> projects = projectManager.getDefault().getOpenProjects(new SortCriteria("name"));
    HashMap<Integer, Organization> companies = new HashMap<Integer, Organization>(32);
    if (!CollectionUtils.isEmpty(projects)) {
        for (Project project : projects) {
            if ((!project.isFinished()) && (project.getOpen())) {
                Set<ProjectRole> roles = project.getRoles();
                if (!CollectionUtils.isEmpty(roles)) {
                    Organization company = project.getClient();
                    if (!companies.containsKey(company.getId())) {
                        companies.put(company.getId(), company);
                        ret.add(new SelectItem(company, company.getName()));
                    }
                }
            }
        }
    }
    Collections.sort(ret, new OperacionesComparator());
    if ((this.selectedOrganization == null) && (ret.size() > 0)) {
        this.setSelectedOrganization((Organization) ret.get(0).getValue());
    }
    return ret;
}
Also used : Organization(com.autentia.tnt.businessobject.Organization) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ProjectRole(com.autentia.tnt.businessobject.ProjectRole) SortCriteria(com.autentia.tnt.dao.SortCriteria) Project(com.autentia.tnt.businessobject.Project) SelectItem(javax.faces.model.SelectItem)

Example 7 with Project

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

the class ActivityEvidenceNotificationBean method groupedActivitiesByProject.

private HashMap<Project, List<Activity>> groupedActivitiesByProject(List<Activity> activities) {
    HashMap<Project, List<Activity>> map = new HashMap<>();
    activities.forEach(activity -> {
        Project project = activity.getRole().getProject();
        List<Activity> prjActivities = map.getOrDefault(project, new ArrayList<>());
        prjActivities.add(activity);
        map.put(project, prjActivities);
    });
    return map;
}
Also used : Project(com.autentia.tnt.businessobject.Project) Activity(com.autentia.tnt.businessobject.Activity)

Example 8 with Project

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

the class BillAndBillPaymentTest method insertInitialData.

/**
 * Metodo encargado de insertar datos muy generales pero que son necesarios
 * en la gestion de facturas
 */
private void insertInitialData() {
    final BillDAO billDAO = (BillDAO) SpringUtilsForTesting.getSpringBean("daoBill");
    final ProjectDAO projectDAO = (ProjectDAO) SpringUtilsForTesting.getSpringBean("daoProject");
    final Project project = new Project();
    projectDAO.insert(project);
    bill = new Bill();
    bill.setCreationDate(new Date());
    bill.setState(BillState.EMITTED);
    bill.setNumber("200901");
    bill.setName("Factura por servicios");
    bill.setProject(project);
    bill.setStartBillDate(new Date());
    bill.setEndBillDate(new Date());
    bill.setState(BillState.EMITTED);
    bill.setOrderNumber("12");
    billDAO.insert(bill);
}
Also used : Project(com.autentia.tnt.businessobject.Project) BillDAO(com.autentia.tnt.dao.hibernate.BillDAO) Bill(com.autentia.tnt.businessobject.Bill) Date(java.util.Date) ProjectDAO(com.autentia.tnt.dao.hibernate.ProjectDAO)

Example 9 with Project

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

the class BillManagerTest method insertProjectIntoContext.

private Project insertProjectIntoContext(Date date) {
    final Project project = new Project();
    project.setRoles(createRolesForContext(project, date));
    project.setClient(createOrganizationInContext());
    projectDAO.insert(project);
    return project;
}
Also used : Project(com.autentia.tnt.businessobject.Project)

Example 10 with Project

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

the class BillBeanTest method prepareReturnOpenProjects.

private List<Project> prepareReturnOpenProjects() {
    List<Project> list = new ArrayList<Project>();
    Project p1 = new Project();
    p1.setId(1);
    p1.setOpen(true);
    p1.setName("Proyecto Abierto");
    list.add(p1);
    Project p2 = new Project();
    p2.setId(2);
    p2.setOpen(false);
    p2.setName("Proyecto Cerrado");
    list.add(p2);
    return list;
}
Also used : Project(com.autentia.tnt.businessobject.Project) ArrayList(java.util.ArrayList)

Aggregations

Project (com.autentia.tnt.businessobject.Project)22 ArrayList (java.util.ArrayList)12 SelectItem (javax.faces.model.SelectItem)10 SortCriteria (com.autentia.tnt.dao.SortCriteria)9 GregorianCalendar (java.util.GregorianCalendar)5 Activity (com.autentia.tnt.businessobject.Activity)4 BillBreakDown (com.autentia.tnt.businessobject.BillBreakDown)4 ProjectCost (com.autentia.tnt.businessobject.ProjectCost)4 Test (org.junit.Test)4 ProjectRole (com.autentia.tnt.businessobject.ProjectRole)3 ActivitySearch (com.autentia.tnt.dao.search.ActivitySearch)3 Organization (com.autentia.tnt.businessobject.Organization)2 LocalDate (java.time.LocalDate)2 Calendar (java.util.Calendar)2 Date (java.util.Date)2 SettingBean (com.autentia.tnt.bean.admin.SettingBean)1 Bill (com.autentia.tnt.businessobject.Bill)1 DocumentCategory (com.autentia.tnt.businessobject.DocumentCategory)1 ExternalActivity (com.autentia.tnt.businessobject.ExternalActivity)1 GlobalHourReport (com.autentia.tnt.businessobject.GlobalHourReport)1