use of org.activiti.engine.identity.User in project Activiti by Activiti.
the class GroupDetailPanel method getCurrentMembers.
// Hacky - must be put in custom service
protected List<String> getCurrentMembers() {
List<User> users = identityService.createUserQuery().memberOfGroup(group.getId()).list();
List<String> userIds = new ArrayList<String>();
for (User user : users) {
userIds.add(user.getId());
}
return userIds;
}
use of org.activiti.engine.identity.User in project Activiti by Activiti.
the class UserResource method deleteUser.
@RequestMapping(value = "/identity/users/{userId}", method = RequestMethod.DELETE)
public void deleteUser(@PathVariable String userId, HttpServletResponse response) {
User user = getUserFromRequest(userId);
identityService.deleteUser(user.getId());
response.setStatus(HttpStatus.NO_CONTENT.value());
}
use of org.activiti.engine.identity.User in project Activiti by Activiti.
the class SetUserPictureCmd method execute.
public Object execute(CommandContext commandContext) {
if (userId == null) {
throw new ActivitiIllegalArgumentException("userId is null");
}
User user = commandContext.getUserIdentityManager().findUserById(userId);
if (user == null) {
throw new ActivitiObjectNotFoundException("user " + userId + " doesn't exist", User.class);
}
commandContext.getUserIdentityManager().setUserPicture(userId, picture);
return null;
}
use of org.activiti.engine.identity.User in project Activiti by Activiti.
the class GroupEventsTest method testGroupMembershipEvents.
/**
* Test create, update and delete events of Groups.
*/
public void testGroupMembershipEvents() throws Exception {
TestActivitiEventListener membershipListener = new TestActivitiEventListener();
processEngineConfiguration.getEventDispatcher().addEventListener(membershipListener);
User user = null;
Group group = null;
try {
user = identityService.newUser("kermit");
identityService.saveUser(user);
group = identityService.newGroup("sales");
identityService.saveGroup(group);
// Add membership
membershipListener.clearEventsReceived();
identityService.createMembership("kermit", "sales");
assertEquals(1, membershipListener.getEventsReceived().size());
assertTrue(membershipListener.getEventsReceived().get(0) instanceof ActivitiMembershipEvent);
ActivitiMembershipEvent event = (ActivitiMembershipEvent) membershipListener.getEventsReceived().get(0);
assertEquals(ActivitiEventType.MEMBERSHIP_CREATED, event.getType());
assertEquals("sales", event.getGroupId());
assertEquals("kermit", event.getUserId());
assertNull(event.getExecutionId());
assertNull(event.getProcessDefinitionId());
assertNull(event.getProcessInstanceId());
membershipListener.clearEventsReceived();
// Delete membership
identityService.deleteMembership("kermit", "sales");
assertEquals(1, membershipListener.getEventsReceived().size());
assertTrue(membershipListener.getEventsReceived().get(0) instanceof ActivitiMembershipEvent);
event = (ActivitiMembershipEvent) membershipListener.getEventsReceived().get(0);
assertEquals(ActivitiEventType.MEMBERSHIP_DELETED, event.getType());
assertEquals("sales", event.getGroupId());
assertEquals("kermit", event.getUserId());
assertNull(event.getExecutionId());
assertNull(event.getProcessDefinitionId());
assertNull(event.getProcessInstanceId());
membershipListener.clearEventsReceived();
// Deleting group will dispatch an event, informing ALL memberships are deleted
identityService.createMembership("kermit", "sales");
membershipListener.clearEventsReceived();
identityService.deleteGroup(group.getId());
assertEquals(2, membershipListener.getEventsReceived().size());
assertTrue(membershipListener.getEventsReceived().get(0) instanceof ActivitiMembershipEvent);
event = (ActivitiMembershipEvent) membershipListener.getEventsReceived().get(0);
assertEquals(ActivitiEventType.MEMBERSHIPS_DELETED, event.getType());
assertEquals("sales", event.getGroupId());
assertNull(event.getUserId());
assertNull(event.getExecutionId());
assertNull(event.getProcessDefinitionId());
assertNull(event.getProcessInstanceId());
membershipListener.clearEventsReceived();
} finally {
processEngineConfiguration.getEventDispatcher().removeEventListener(membershipListener);
if (user != null) {
identityService.deleteUser(user.getId());
}
if (group != null) {
identityService.deleteGroup(group.getId());
}
}
}
use of org.activiti.engine.identity.User in project Activiti by Activiti.
the class RemoveInvolvedPersonListener method buttonClick.
public void buttonClick(ClickEvent event) {
User user = identityService.createUserQuery().userId(identityLink.getUserId()).singleResult();
String name = user.getFirstName() + " " + user.getLastName();
ConfirmationDialogPopupWindow confirmationPopup = new ConfirmationDialogPopupWindow(i18nManager.getMessage(Messages.TASK_INVOLVED_REMOVE_CONFIRMATION_TITLE, name), i18nManager.getMessage(Messages.TASK_INVOLVED_REMOVE_CONFIRMATION_DESCRIPTION, name, task.getName()));
confirmationPopup.addListener(new ConfirmationEventListener() {
private static final long serialVersionUID = 1L;
protected void rejected(ConfirmationEvent event) {
}
protected void confirmed(ConfirmationEvent event) {
taskService.deleteUserIdentityLink(identityLink.getTaskId(), identityLink.getUserId(), identityLink.getType());
taskDetailPanel.notifyPeopleInvolvedChanged();
}
});
viewManager.showPopupWindow(confirmationPopup);
}
Aggregations