Search in sources :

Example 1 with Organization

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

the class OccupationBean method getOrganizations.

/**
 * Get the list of all organizations
 * @return the list of all organizations
 */
public List<SelectItem> getOrganizations() {
    ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
    List<Organization> refs = organizationDAO.search(new SortCriteria("name"));
    for (Organization ref : refs) {
        ret.add(new SelectItem(ref, ref.getName()));
    }
    return ret;
}
Also used : SortCriteria(com.autentia.tnt.dao.SortCriteria) Organization(com.autentia.tnt.businessobject.Organization) SelectItem(javax.faces.model.SelectItem) ArrayList(java.util.ArrayList)

Example 2 with Organization

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

the class ActivityBean method getProjectsVisiblesBySelectedOrganization.

/**
 * Get the list of all projects
 *
 * @return the list of all projects
 */
public List<SelectItem> getProjectsVisiblesBySelectedOrganization() {
    Organization companySelected = this.getSelectedOrganization();
    List<Project> openProjects = ProjectManager.getDefault().getOpenProjectsByOrganization(companySelected);
    ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
    if (selectedProject != null && selectedProject.isFinished()) {
        ret.add(new SelectItem(selectedProject, selectedProject.getName() + " (*)"));
    }
    if (openProjects == null || openProjects.size() == 0) {
        projects.clear();
        return ret;
    }
    Project proj = null;
    for (Object ref : openProjects) {
        proj = (Project) ref;
        projects.add(proj);
        if (!proj.isFinished() && !proj.getRoles().isEmpty()) {
            ret.add(new SelectItem(proj, proj.getName()));
        }
    }
    return ret;
}
Also used : Project(com.autentia.tnt.businessobject.Project) Organization(com.autentia.tnt.businessobject.Organization) SelectItem(javax.faces.model.SelectItem) ArrayList(java.util.ArrayList)

Example 3 with Organization

use of com.autentia.tnt.businessobject.Organization 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 4 with Organization

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

the class PeriodicalAccountEntryBean method getOrganizations.

/**
 * Get the list of all organizations
 * @return the list of all organizations
 */
public List<SelectItem> getOrganizations() {
    ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
    List<Organization> refs = OrganizationManager.getDefault().getAllEntities(null, new SortCriteria("name"));
    ret.add(new SelectItem(null, FacesUtils.formatMessage("organization.unknown")));
    for (Organization ref : refs) {
        ret.add(new SelectItem(ref, ref.getName()));
    }
    return ret;
}
Also used : SortCriteria(com.autentia.tnt.dao.SortCriteria) Organization(com.autentia.tnt.businessobject.Organization) SelectItem(javax.faces.model.SelectItem) ArrayList(java.util.ArrayList)

Example 5 with Organization

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

the class CreditTitleBean method getOrganizations.

// Getters to list possible values of related entities
/**
 * Get the list of all organizations
 * @return the list of all organizations
 */
public List<SelectItem> getOrganizations() {
    ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
    List<Organization> refs = OrganizationManager.getDefault().getAllEntities(null, new SortCriteria("name"));
    for (Organization ref : refs) {
        ret.add(new SelectItem(ref, ref.getName()));
    }
    return ret;
}
Also used : SortCriteria(com.autentia.tnt.dao.SortCriteria) Organization(com.autentia.tnt.businessobject.Organization) SelectItem(javax.faces.model.SelectItem) ArrayList(java.util.ArrayList)

Aggregations

Organization (com.autentia.tnt.businessobject.Organization)24 ArrayList (java.util.ArrayList)17 SelectItem (javax.faces.model.SelectItem)16 SortCriteria (com.autentia.tnt.dao.SortCriteria)15 Project (com.autentia.tnt.businessobject.Project)2 HashSet (java.util.HashSet)2 Department (com.autentia.tnt.businessobject.Department)1 OrganizationType (com.autentia.tnt.businessobject.OrganizationType)1 ProjectRole (com.autentia.tnt.businessobject.ProjectRole)1 OrganizationTypeDAO (com.autentia.tnt.dao.hibernate.OrganizationTypeDAO)1 DepartmentSearch (com.autentia.tnt.dao.search.DepartmentSearch)1 HashMap (java.util.HashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1 UIData (javax.faces.component.UIData)1