Search in sources :

Example 1 with Collaborator

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

the class CommissioningBean method getAllCollaborators.

public List<SelectItem> getAllCollaborators() {
    final List<Collaborator> refs = CollaboratorManager.getDefault().getAllEntities(null, new SortCriteria("insertDate"));
    final List<SelectItem> ret = new ArrayList<SelectItem>();
    for (Collaborator ref : refs) {
        ret.add(new SelectItem(ref, ref.getName()));
    }
    return ret;
}
Also used : SortCriteria(com.autentia.tnt.dao.SortCriteria) Collaborator(com.autentia.tnt.businessobject.Collaborator) SelectItem(javax.faces.model.SelectItem) ArrayList(java.util.ArrayList)

Example 2 with Collaborator

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

the class CommissioningBean method addCollaborator.

public String addCollaborator() {
    final Collaborator collab = getSelectedCollaborator();
    try {
        if (!commissioning.getCollaboratorsPaymentData().contains(collab)) {
            CommissioningPaymentData newCollab = new CommissioningPaymentData();
            newCollab.setCollaborator(collab);
            newCollab.setCommissioning(commissioning);
            newCollab.setPaymentMode(BillPaymentMode.UNKNOWN);
            newCollab.setBillNumber("");
            newCollab.setBankAccount("");
            commissioning.getCollaboratorsPaymentData().add(newCollab);
            // Add to history if commissioning is in a valid STATUS
            if (commissioning.getStatus() == CommissioningStatus.CONFIRMED || commissioning.getStatus() == CommissioningStatus.VALIDATED) {
                commissioning.getHistory().add(manager.getChange("commissioning.collaborator.add", "", newCollab.getCollaborator().getName(), commissioning));
            }
        }
    } catch (Exception e) {
        log.info(e.getCause());
    }
    return NavigationResults.EDIT;
}
Also used : Collaborator(com.autentia.tnt.businessobject.Collaborator) CommissioningPaymentData(com.autentia.tnt.businessobject.CommissioningPaymentData) IOException(java.io.IOException)

Aggregations

Collaborator (com.autentia.tnt.businessobject.Collaborator)2 CommissioningPaymentData (com.autentia.tnt.businessobject.CommissioningPaymentData)1 SortCriteria (com.autentia.tnt.dao.SortCriteria)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 SelectItem (javax.faces.model.SelectItem)1