use of org.kie.internal.task.api.UserInfo in project jbpm by kiegroup.
the class ExecuteReminderCommand method executedeadLine.
private Void executedeadLine(TaskContext ctx, TaskPersistenceContext persistenceContext, Task task, DeadlineSummary deadlineSummary, TaskData taskData) {
Deadline deadline = persistenceContext.findDeadline(deadlineSummary.getDeadlineId());
if (task == null || deadline == null) {
return null;
}
if (taskData != null) {
UserInfo userInfo = (UserInfo) ctx.get(EnvironmentName.TASK_USER_INFO);
// check if task is still in valid status
if (DeadlineType.START.isValidStatus(taskData.getStatus()) || DeadlineType.END.isValidStatus(taskData.getStatus())) {
Map<String, Object> variables = getVariables(ctx, persistenceContext, task, taskData);
if (deadline == null || deadline.getEscalations() == null) {
return null;
}
TaskEventSupport taskEventSupport = ctx.getTaskEventSupport();
taskEventSupport.fireBeforeTaskNotified(task, ctx);
for (Escalation escalation : deadline.getEscalations()) {
for (Notification notification : escalation.getNotifications()) {
if (notification.getNotificationType() == NotificationType.Email) {
logger.debug("Sending an Email");
NotificationListenerManager.get().broadcast(new NotificationEvent(notification, task, variables), userInfo);
}
}
}
taskEventSupport.fireAfterTaskNotified(task, ctx);
}
}
return null;
}
use of org.kie.internal.task.api.UserInfo in project jbpm by kiegroup.
the class LDAPUserInfoImplTest method testGroupsSubtreeScopeBaseDnContext.
@Test
public void testGroupsSubtreeScopeBaseDnContext() {
UserInfo ldapUserInfo = createLdapUserInfoWithGroupCtx(SUBTREE_SCOPE, "dc=jbpm,dc=org");
assertGroups(ldapUserInfo, true, true, true, true);
}
use of org.kie.internal.task.api.UserInfo in project jbpm by kiegroup.
the class LDAPUserInfoImplTest method testGetLanguageForEntity.
private void testGetLanguageForEntity(OrganizationalEntity entity, String language, boolean customAttribute) {
Properties properties = createUserInfoProperties();
if (customAttribute) {
properties.setProperty(LDAPUserInfoImpl.LANG_ATTR_ID, "language");
}
if (entity.getId().startsWith("uid=") || entity.getId().startsWith("cn=")) {
properties.setProperty(LDAPUserInfoImpl.IS_ENTITY_ID_DN, "true");
}
UserInfo ldapUserInfo = new LDAPUserInfoImpl(properties);
Assertions.assertThat(ldapUserInfo.getLanguageForEntity(entity)).isEqualTo(language);
}
use of org.kie.internal.task.api.UserInfo in project jbpm by kiegroup.
the class LDAPUserInfoImplTest method testUsersOneLevelScopeBaseDnContext.
@Test
public void testUsersOneLevelScopeBaseDnContext() {
UserInfo ldapUserInfo = createLdapUserInfoWithUserCtx(ONELEVEL_SCOPE, "dc=jbpm,dc=org");
assertUsers(ldapUserInfo, false, false, false, false);
}
use of org.kie.internal.task.api.UserInfo in project jbpm by kiegroup.
the class LDAPUserInfoImplTest method testGetMembersForGroup.
private void testGetMembersForGroup(boolean emptyGroup, boolean customAttribute, boolean distinguishedName) {
Properties properties = createUserInfoProperties();
if (customAttribute) {
properties.setProperty(LDAPUserInfoImpl.MEMBER_ATTR_ID, "representative");
}
if (distinguishedName) {
properties.setProperty(LDAPUserInfoImpl.IS_ENTITY_ID_DN, "true");
}
UserInfo ldapUserInfo = new LDAPUserInfoImpl(properties);
Group group;
if (distinguishedName) {
group = emptyGroup ? USER_DN : MANAGER_DN;
} else {
group = emptyGroup ? USER : MANAGER;
}
Iterator<OrganizationalEntity> iterator = ldapUserInfo.getMembersForGroup(group);
if (emptyGroup) {
Assertions.assertThat(iterator.hasNext()).isFalse();
return;
}
Assertions.assertThat(iterator.hasNext()).isTrue();
User user = (User) iterator.next();
if (customAttribute) {
Assertions.assertThat(user.getId()).isEqualTo(MARY_DN.getId());
} else {
Assertions.assertThat(user.getId()).isEqualTo(JOHN_DN.getId());
}
Assertions.assertThat(iterator.hasNext()).isFalse();
}
Aggregations