@Put()
public StateResponse createGroup(GroupInfo groupInfo) {
if (authenticate() == false)
return null;
IdentityService identityService = ActivitiUtil.getIdentityService();
if (groupInfo == null || groupInfo.getId() == null) {
throw new ActivitiException("No group id supplied");
}
if (groupInfo.getName() == null || groupInfo.getName().equals(""))
groupInfo.setName(groupInfo.getId());
if (identityService.createGroupQuery().groupId(groupInfo.getId()).count() == 0) {
Group group = identityService.newGroup(groupInfo.getId());
group.setName(groupInfo.getName());
if (groupInfo.getType() != null) {
group.setType(groupInfo.getType());
} else {
group.setType("assignment");
}
identityService.saveGroup(group);
} else {
throw new ActivitiException("group id must be unique");
}
return new StateResponse().setSuccess(true);
}