Search in sources :

Example 36 with User

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

the class ContactBean method sendMail.

/**
 * Send e-mail message to contact to notify him about his inclussion in our
 * archive of contacts
 *
 * @return
 */
public String sendMail() {
    User actualUser = authManager.getCurrentPrincipal().getUser();
    List<String> to = new ArrayList<String>();
    to.add(contact.getName() + " <" + contact.getEmail() + ">");
    SendMailBean sendMail = (SendMailBean) FacesUtils.getBean("sendMailBean");
    sendMail.setFrom(actualUser.getName() + " <" + actualUser.getEmail() + ">");
    sendMail.setTo(to);
    sendMail.setSubject(FacesUtils.formatMessage("editContact.sendMailSubject"));
    sendMail.setMessage(FacesUtils.formatMessage("editContact.sendMailMessage", contact.getName(), actualUser.getName()));
    sendMail.addSendMailBeanListener(this);
    return OUTCOME_NOTIFY;
}
Also used : User(com.autentia.tnt.businessobject.User) ArrayList(java.util.ArrayList) SendMailBean(com.autentia.tnt.bean.util.SendMailBean)

Example 37 with User

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

the class InteractionBean method getUsers.

/**
 * 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 38 with User

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

the class CommissioningBean method deleteReviser.

public String deleteReviser() {
    final UIData table = (UIData) FacesUtils.getComponent("commissioning:revisers");
    final User toDelete = (User) table.getRowData();
    commissioning.getRevisers().remove(toDelete);
    return NavigationResults.EDIT;
}
Also used : User(com.autentia.tnt.businessobject.User) UIData(javax.faces.component.UIData)

Example 39 with User

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

the class CommissioningBean method createObjetives.

private void createObjetives() {
    for (final User user : commissioning.getRevisers()) {
        final Objective objective = new Objective();
        objective.setUser(user);
        objective.setProject(commissioning.getProject());
        objective.setStartDate(commissioning.getRequestDate());
        objective.setEndDate(commissioning.getDeliveryDate());
        objective.setState(ObjectiveState.PENDING);
        objective.setName(FacesUtils.formatMessage("commissioning.automaticObjectiveName", commissioning.getName()));
        objectiveManager.insertEntity(objective);
    }
    FacesUtils.addInfoMessage(null, "commissioning.info.objectiveCreated");
}
Also used : Objective(com.autentia.tnt.businessobject.Objective) User(com.autentia.tnt.businessobject.User)

Example 40 with User

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

the class CommissioningBean method create.

/**
 * Go to create page
 *
 * @return forward to CREATE page
 */
public String create() {
    commissioning = new Commissioning();
    // when we create a new commissioning status is created
    // and default reviser is actual user
    commissioning.setStatus(CommissioningStatus.CREATED);
    commissioning.setRequestDate(new Date());
    final Set<User> revisers = new HashSet<User>();
    revisers.add(authManager.getCurrentPrincipal().getUser());
    commissioning.setRevisers(revisers);
    return NavigationResults.CREATE;
}
Also used : User(com.autentia.tnt.businessobject.User) Date(java.util.Date) Commissioning(com.autentia.tnt.businessobject.Commissioning) HashSet(java.util.HashSet)

Aggregations

User (com.autentia.tnt.businessobject.User)70 Test (org.junit.Test)24 ArrayList (java.util.ArrayList)17 SortCriteria (com.autentia.tnt.dao.SortCriteria)15 SelectItem (javax.faces.model.SelectItem)11 UserDAO (com.autentia.tnt.dao.hibernate.UserDAO)10 Date (java.util.Date)9 Link (com.autentia.tnt.businessobject.Link)6 UserSearch (com.autentia.tnt.dao.search.UserSearch)5 Attributes (javax.naming.directory.Attributes)5 BasicAttributes (javax.naming.directory.BasicAttributes)5 Activity (com.autentia.tnt.businessobject.Activity)4 Attribute (javax.naming.directory.Attribute)4 BasicAttribute (javax.naming.directory.BasicAttribute)4 GlobalHourReport (com.autentia.tnt.businessobject.GlobalHourReport)3 GlobalHoursReportBean (com.autentia.tnt.bean.activity.GlobalHoursReportBean)2 Commissioning (com.autentia.tnt.businessobject.Commissioning)2 Objective (com.autentia.tnt.businessobject.Objective)2 Occupation (com.autentia.tnt.businessobject.Occupation)2 DataIntegrityException (com.autentia.tnt.dao.DataIntegrityException)2