use of org.activiti.engine.identity.Group in project Activiti by Activiti.
the class CreateUserAndMembershipTestDelegate method execute.
@Override
public void execute(DelegateExecution execution) throws Exception {
IdentityService identityService = execution.getEngineServices().getIdentityService();
String username = "Kermit";
User user = identityService.newUser(username);
user.setPassword("123");
user.setFirstName("Manually");
user.setLastName("created");
identityService.saveUser(user);
// Add admin group
Group group = identityService.newGroup("admin");
identityService.saveGroup(group);
identityService.createMembership(username, "admin");
}
use of org.activiti.engine.identity.Group in project Activiti by Activiti.
the class TaskTable method addTaskRow.
protected Object addTaskRow(Object previousTaskItemId, String taskName, String taskAssignee, String taskGroups, String taskDescription, Boolean startWithPrevious) {
Object newItemId = null;
if (previousTaskItemId == null) {
// add at the end of list
newItemId = addItem();
} else {
newItemId = addItemAfter(previousTaskItemId);
}
Item newItem = getItem(newItemId);
// name
newItem.getItemProperty(ID_NAME).setValue(taskName == null ? "my task" : taskName);
// assignee
ComboBox assigneeComboBox = new ComboBox();
assigneeComboBox.setNullSelectionAllowed(true);
try {
for (User user : ProcessEngines.getDefaultProcessEngine().getIdentityService().createUserQuery().orderByUserFirstName().asc().list()) {
assigneeComboBox.addItem(user.getId());
assigneeComboBox.setItemCaption(user.getId(), user.getFirstName() + " " + user.getLastName());
}
} catch (Exception e) {
// Don't do anything. Will be an empty dropdown.
}
if (taskAssignee != null) {
assigneeComboBox.select(taskAssignee);
}
newItem.getItemProperty(ID_ASSIGNEE).setValue(assigneeComboBox);
// groups
ComboBox groupComboBox = new ComboBox();
groupComboBox.setNullSelectionAllowed(true);
try {
for (Group group : ProcessEngines.getDefaultProcessEngine().getIdentityService().createGroupQuery().orderByGroupName().asc().list()) {
groupComboBox.addItem(group.getId());
groupComboBox.setItemCaption(group.getId(), group.getName());
}
} catch (Exception e) {
// Don't do anything. Will be an empty dropdown.
}
if (taskGroups != null) {
groupComboBox.select(taskGroups);
}
newItem.getItemProperty(ID_GROUPS).setValue(groupComboBox);
// description
TextField descriptionTextField = new TextField();
descriptionTextField.setColumns(16);
descriptionTextField.setRows(1);
if (taskDescription != null) {
descriptionTextField.setValue(taskDescription);
}
newItem.getItemProperty(ID_DESCRIPTION).setValue(descriptionTextField);
// concurrency
CheckBox startWithPreviousCheckBox = new CheckBox(i18nManager.getMessage(Messages.PROCESS_EDITOR_TASK_START_WITH_PREVIOUS));
startWithPreviousCheckBox.setValue(startWithPrevious == null ? false : startWithPrevious);
newItem.getItemProperty(ID_START_WITH_PREVIOUS).setValue(startWithPreviousCheckBox);
// actions
newItem.getItemProperty(ID_ACTIONS).setValue(generateActionButtons(newItemId));
return newItemId;
}
use of org.activiti.engine.identity.Group in project Activiti by Activiti.
the class DemoDataConfiguration method createGroup.
protected void createGroup(String groupId, String type) {
if (identityService.createGroupQuery().groupId(groupId).count() == 0) {
Group newGroup = identityService.newGroup(groupId);
newGroup.setName(groupId.substring(0, 1).toUpperCase() + groupId.substring(1));
newGroup.setType(type);
identityService.saveGroup(newGroup);
}
}
use of org.activiti.engine.identity.Group in project Activiti by Activiti.
the class DemoDataGenerator method createGroup.
protected void createGroup(String groupId, String type) {
if (identityService.createGroupQuery().groupId(groupId).count() == 0) {
Group newGroup = identityService.newGroup(groupId);
newGroup.setName(groupId.substring(0, 1).toUpperCase() + groupId.substring(1));
newGroup.setType(type);
identityService.saveGroup(newGroup);
}
}
use of org.activiti.engine.identity.Group in project Activiti by Activiti.
the class TaskNavigator method getGroupIds.
protected List<String> getGroupIds(String userId) {
List<String> groupIds = new ArrayList<String>();
List<Group> groups = identityService.createGroupQuery().groupMember(userId).list();
for (Group group : groups) {
groupIds.add(group.getId());
}
return groupIds;
}
Aggregations