Search in sources :

Example 76 with SortCriteria

use of com.autentia.tnt.dao.SortCriteria in project TNTConcept by autentia.

the class InteractionBean method getTypes.

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

Example 77 with SortCriteria

use of com.autentia.tnt.dao.SortCriteria in project TNTConcept by autentia.

the class InteractionBean 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 78 with SortCriteria

use of com.autentia.tnt.dao.SortCriteria in project TNTConcept by autentia.

the class InteractionBean method saveFromOffer.

/**
 * Save bean and stay on it
 * @return forward to list page
 */
public String saveFromOffer() {
    if (interaction.getId() == null) {
        manager.insertEntity(interaction);
    } else {
        manager.updateEntity(interaction);
    }
    // Handle uploads for file field
    if (uploadFile != null) {
        try {
            uploader.replace(Integer.toString(interaction.getId()), oldFile, uploadFile);
        } catch (IOException e) {
            log.error("save - exception uploading field file", e);
            FacesUtils.addErrorMessage("file", "error.fileTransfer", e.getMessage());
        }
    }
    final OfferBean offerBean = (OfferBean) FacesUtils.getBean("offerBean");
    final InteractionSearch search = new InteractionSearch();
    search.setOffer(interaction.getOffer());
    final List<Interaction> interactionList = InteractionManager.getDefault().getAllEntities(search, new SortCriteria("creationDate"));
    final Set<Interaction> interactions = new HashSet<Interaction>(interactionList.size());
    for (Interaction interaction : interactionList) {
        interactions.add(interaction);
    }
    offerBean.setInteractions(interactions);
    restoreOffer();
    return NavigationResults.OFFER_SAVE_INTERACTION;
}
Also used : SortCriteria(com.autentia.tnt.dao.SortCriteria) InteractionSearch(com.autentia.tnt.dao.search.InteractionSearch) Interaction(com.autentia.tnt.businessobject.Interaction) IOException(java.io.IOException) HashSet(java.util.HashSet)

Example 79 with SortCriteria

use of com.autentia.tnt.dao.SortCriteria in project TNTConcept by autentia.

the class OfferBean method getUsers.

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

Example 80 with SortCriteria

use of com.autentia.tnt.dao.SortCriteria in project TNTConcept by autentia.

the class OfferBean method getContacts.

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

Aggregations

SortCriteria (com.autentia.tnt.dao.SortCriteria)136 ArrayList (java.util.ArrayList)114 SelectItem (javax.faces.model.SelectItem)107 Organization (com.autentia.tnt.businessobject.Organization)15 User (com.autentia.tnt.businessobject.User)15 Department (com.autentia.tnt.businessobject.Department)9 Project (com.autentia.tnt.businessobject.Project)9 Position (com.autentia.tnt.businessobject.Position)7 Calendar (java.util.Calendar)7 GregorianCalendar (java.util.GregorianCalendar)7 Activity (com.autentia.tnt.businessobject.Activity)6 ProjectRole (com.autentia.tnt.businessobject.ProjectRole)6 ActivitySearch (com.autentia.tnt.dao.search.ActivitySearch)6 PositionSearch (com.autentia.tnt.dao.search.PositionSearch)6 Account (com.autentia.tnt.businessobject.Account)5 Contact (com.autentia.tnt.businessobject.Contact)5 Bill (com.autentia.tnt.businessobject.Bill)4 Inventary (com.autentia.tnt.businessobject.Inventary)4 AccountEntryType (com.autentia.tnt.businessobject.AccountEntryType)3 ExternalActivity (com.autentia.tnt.businessobject.ExternalActivity)3