Search in sources :

Example 6 with Interaction

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

the class OfferBean method editInteractions.

/**
 * Create a new empty instance of the one-to-many field
 *
 * @return forward to the same page
 */
public String editInteractions() {
    UIData table = (UIData) FacesUtils.getComponent("offer:interactions");
    InteractionBean iB = (InteractionBean) FacesUtils.getBean("interactionBean");
    Interaction interactionSelectedInOfferEdit = (Interaction) table.getRowData();
    if (interactionSelectedInOfferEdit.getId() != null) {
        Interaction interaction = InteractionManager.getDefault().getEntityById(interactionSelectedInOfferEdit.getId());
        iB.setInteractionFromOffer(interaction);
        iB.setSelectedOrganization(interaction.getProject().getClient());
    } else {
        iB.setInteractionFromOffer(interactionSelectedInOfferEdit);
    }
    return NavigationResults.OFFER_CREATE_INTERACTION;
}
Also used : Interaction(com.autentia.tnt.businessobject.Interaction) UIData(javax.faces.component.UIData)

Example 7 with Interaction

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

the class OfferBean method getInteractionss.

/**
 * Get the list of all interactionss
 *
 * @return the list of all interactionss
 */
public List<SelectItem> getInteractionss() {
    List<Interaction> refs = InteractionManager.getDefault().getAllEntities(null, new SortCriteria("creationDate"));
    ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
    for (Interaction ref : refs) {
        ret.add(new SelectItem(ref, ref.getDescription()));
    }
    return ret;
}
Also used : SortCriteria(com.autentia.tnt.dao.SortCriteria) Interaction(com.autentia.tnt.businessobject.Interaction) SelectItem(javax.faces.model.SelectItem) ArrayList(java.util.ArrayList)

Example 8 with Interaction

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

the class OfferBean method createInteractions.

/**
 * Create a new empty instance of the one-to-many field
 *
 * @return forward to the same page
 */
public String createInteractions() {
    Interaction item = new Interaction();
    item.setOffer(offer);
    if (item.getUser() == null) {
        item.setUser(SpringUtils.getPrincipal().getUser());
    }
    item.setCreationDate(new Date());
    InteractionBean iB = (InteractionBean) FacesUtils.getBean("interactionBean");
    iB.setInteractionFromOffer(item);
    iB.setSelectedOrganization(OrganizationManager.getDefault().getMyOrganization());
    if (offer.getInteractions() == null) {
        offer.setInteractions(new HashSet());
    }
    offer.getInteractions().add(item);
    return NavigationResults.OFFER_CREATE_INTERACTION;
}
Also used : Interaction(com.autentia.tnt.businessobject.Interaction) Date(java.util.Date) HashSet(java.util.HashSet)

Aggregations

Interaction (com.autentia.tnt.businessobject.Interaction)8 Date (java.util.Date)3 HashSet (java.util.HashSet)3 SortCriteria (com.autentia.tnt.dao.SortCriteria)2 LinkedHashSet (java.util.LinkedHashSet)2 InteractionType (com.autentia.tnt.businessobject.InteractionType)1 Offer (com.autentia.tnt.businessobject.Offer)1 OfferCost (com.autentia.tnt.businessobject.OfferCost)1 OfferRole (com.autentia.tnt.businessobject.OfferRole)1 InteractionTypeDAO (com.autentia.tnt.dao.hibernate.InteractionTypeDAO)1 InteractionSearch (com.autentia.tnt.dao.search.InteractionSearch)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 UIData (javax.faces.component.UIData)1 SelectItem (javax.faces.model.SelectItem)1