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());
}
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;
}
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;
}
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);
}
}
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);
}
Aggregations