Search in sources :

Example 46 with User

use of org.activiti.engine.identity.User in project Activiti by Activiti.

the class TaskServiceTest method testSetAssigneeUnexistingTask.

public void testSetAssigneeUnexistingTask() {
    User user = identityService.newUser("user");
    identityService.saveUser(user);
    try {
        taskService.setAssignee("unexistingTaskId", user.getId());
        fail("ActivitiException expected");
    } catch (ActivitiObjectNotFoundException ae) {
        assertTextPresent("Cannot find task with id unexistingTaskId", ae.getMessage());
        assertEquals(Task.class, ae.getObjectClass());
    }
    identityService.deleteUser(user.getId());
}
Also used : Task(org.activiti.engine.task.Task) User(org.activiti.engine.identity.User) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException)

Example 47 with User

use of org.activiti.engine.identity.User in project Activiti by Activiti.

the class GroupMembersQuery method loadItems.

public List<Item> loadItems(int start, int count) {
    UserQuery query = identityService.createUserQuery().memberOfGroup(groupId);
    if (sortby == null || "id".equals(sortby)) {
        // default
        query.orderByUserId();
    } else if ("firstName".equals(sortby)) {
        query.orderByUserFirstName();
    } else if ("lastName".equals(sortby)) {
        query.orderByUserLastName();
    } else if ("email".equals(sortby)) {
        query.orderByUserEmail();
    }
    if (sortby == null || ascending) {
        query.asc();
    } else {
        query.desc();
    }
    List<User> users = query.listPage(start, count);
    List<Item> items = new ArrayList<Item>();
    for (User user : users) {
        items.add(new GroupMemberItem(user));
    }
    return items;
}
Also used : PropertysetItem(com.vaadin.data.util.PropertysetItem) Item(com.vaadin.data.Item) User(org.activiti.engine.identity.User) UserQuery(org.activiti.engine.identity.UserQuery) ArrayList(java.util.ArrayList)

Example 48 with User

use of org.activiti.engine.identity.User in project Activiti by Activiti.

the class NewUserPopupWindow method createUser.

protected User createUser() {
    User user = identityService.newUser(form.getField("id").getValue().toString());
    user.setPassword(form.getField("password").getValue().toString());
    if (form.getField("firstName").getValue() != null) {
        user.setFirstName(form.getField("firstName").getValue().toString());
    }
    if (form.getField("lastName").getValue() != null) {
        user.setLastName(form.getField("lastName").getValue().toString());
    }
    if (form.getField("email").getValue() != null) {
        user.setEmail(form.getField("email").getValue().toString());
    }
    identityService.saveUser(user);
    return user;
}
Also used : User(org.activiti.engine.identity.User)

Example 49 with User

use of org.activiti.engine.identity.User in project Activiti by Activiti.

the class NewUserPopupWindow method handleFormSubmit.

protected void handleFormSubmit() {
    try {
        // create user
        // will throw exception in case validation is false
        form.commit();
        User user = createUser();
        // close popup and navigate to fresh user
        close();
        ExplorerApp.get().getViewManager().showUserPage(user.getId());
    } catch (InvalidValueException e) {
        // Do nothing: the Form component will render the errormsgs automatically
        setHeight(340, UNITS_PIXELS);
    }
}
Also used : InvalidValueException(com.vaadin.data.Validator.InvalidValueException) User(org.activiti.engine.identity.User)

Example 50 with User

use of org.activiti.engine.identity.User in project Activiti by Activiti.

the class UserProfileLink method initUserLink.

protected void initUserLink(final String userId) {
    User user = ProcessEngines.getDefaultProcessEngine().getIdentityService().createUserQuery().userId(userId).singleResult();
    Button userButton = new Button(user.getFirstName() + " " + user.getLastName());
    ClickListener buttonClickListener = new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            viewManager.showProfilePopup(userId);
        }
    };
    userButton.addStyleName(Reindeer.BUTTON_LINK);
    userButton.addListener(buttonClickListener);
    addComponent(userButton);
    setComponentAlignment(userButton, Alignment.MIDDLE_LEFT);
}
Also used : User(org.activiti.engine.identity.User) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener)

Aggregations

User (org.activiti.engine.identity.User)94 Group (org.activiti.engine.identity.Group)22 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)12 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)10 Task (org.activiti.engine.task.Task)10 JsonNode (com.fasterxml.jackson.databind.JsonNode)9 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)9 Picture (org.activiti.engine.identity.Picture)9 StringEntity (org.apache.http.entity.StringEntity)9 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)9 ArrayList (java.util.ArrayList)7 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)7 HttpPut (org.apache.http.client.methods.HttpPut)7 HttpGet (org.apache.http.client.methods.HttpGet)6 UserQuery (org.activiti.engine.identity.UserQuery)5 HttpDelete (org.apache.http.client.methods.HttpDelete)5 HttpPost (org.apache.http.client.methods.HttpPost)4 Item (com.vaadin.data.Item)3 ActivitiException (org.activiti.engine.ActivitiException)3 IdentityService (org.activiti.engine.IdentityService)3