use of org.wso2.carbon.humantask.core.dao.TaskDAO in project carbon-business-process by wso2.
the class JPATaskUtil method processGenericHumanRoles.
public static void processGenericHumanRoles(TaskDAO task, HumanTaskBaseConfiguration taskConfiguration, PeopleQueryEvaluator peopleQueryEvaluator, EvaluationContext evaluationContext) throws HumanTaskException {
if (taskConfiguration.isTask()) {
// Task
TTask tTask = ((TaskConfiguration) taskConfiguration).getTask();
// TODO move the reading of configuration file in to the TaskConfiguration class
// Reading Excluded users
TGenericHumanRoleAssignment[] tExcludedOwners = tTask.getPeopleAssignments().getExcludedOwnersArray();
if (tExcludedOwners != null && tExcludedOwners.length > 0) {
assignHumanRoles(task, peopleQueryEvaluator, tExcludedOwners[0], GenericHumanRoleDAO.GenericHumanRoleType.EXCLUDED_OWNERS, evaluationContext);
}
// Reading potential owners
TPotentialOwnerAssignment[] tPotentialOwners = tTask.getPeopleAssignments().getPotentialOwnersArray();
if (tPotentialOwners != null && tPotentialOwners.length > 0) {
TPotentialOwnerAssignment tPotentialOwner = tPotentialOwners[0];
OrganizationalEntityProvider provider = OrganizationalEntityProviderFactory.getOrganizationalEntityProvider(tPotentialOwner.getFrom());
List<OrganizationalEntityDAO> orgEntities = provider.getOrganizationalEntities(peopleQueryEvaluator, tPotentialOwner.getFrom(), evaluationContext);
if (tExcludedOwners != null && tExcludedOwners.length > 0) {
GenericHumanRoleDAO excludedOwners = task.getGenericHumanRole(GenericHumanRoleDAO.GenericHumanRoleType.EXCLUDED_OWNERS);
for (OrganizationalEntityDAO excludedEntity : excludedOwners.getOrgEntities()) {
for (OrganizationalEntityDAO ownerEntity : orgEntities) {
if (excludedEntity.getOrgEntityType() == ownerEntity.getOrgEntityType() && excludedEntity.getName().equals(ownerEntity.getName())) {
orgEntities.remove(ownerEntity);
break;
}
}
}
}
GenericHumanRole potentialOwnersGHRole = new GenericHumanRole();
potentialOwnersGHRole.setType(GenericHumanRole.GenericHumanRoleType.POTENTIAL_OWNERS);
potentialOwnersGHRole.setOrgEntities(orgEntities);
potentialOwnersGHRole.setTask(task);
for (OrganizationalEntityDAO oe : orgEntities) {
oe.addGenericHumanRole(potentialOwnersGHRole);
}
task.addHumanRole(potentialOwnersGHRole);
}
// Reading Stake holders
TGenericHumanRoleAssignment[] tStakeHolders = tTask.getPeopleAssignments().getTaskStakeholdersArray();
if (tStakeHolders != null && tStakeHolders.length > 0) {
assignHumanRoles(task, peopleQueryEvaluator, tStakeHolders[0], GenericHumanRoleDAO.GenericHumanRoleType.STAKEHOLDERS, evaluationContext);
}
// Reading Business administrators
TGenericHumanRoleAssignment[] tBusinessAdministrators = tTask.getPeopleAssignments().getBusinessAdministratorsArray();
if (tBusinessAdministrators != null && tBusinessAdministrators.length > 0) {
assignHumanRoles(task, peopleQueryEvaluator, tBusinessAdministrators[0], GenericHumanRoleDAO.GenericHumanRoleType.BUSINESS_ADMINISTRATORS, evaluationContext);
}
} else {
// Notification
TNotification tNotification = ((NotificationConfiguration) taskConfiguration).getNotificationDefinition();
// Reading Notification recipients
TGenericHumanRoleAssignment[] tRecipients = tNotification.getPeopleAssignments().getRecipientsArray();
if (tRecipients != null && tRecipients.length > 0) {
assignHumanRoles(task, peopleQueryEvaluator, tRecipients[0], GenericHumanRoleDAO.GenericHumanRoleType.NOTIFICATION_RECIPIENTS, evaluationContext);
}
}
}
use of org.wso2.carbon.humantask.core.dao.TaskDAO in project carbon-business-process by wso2.
the class Complete method execute.
/**
* The method to execute the business logic for the specific command.
*/
public void execute() {
authorise();
TaskDAO task = getTask();
checkPreConditions();
checkState();
task.complete(createMessage());
TaskConfiguration taskConf = (TaskConfiguration) HumanTaskServiceComponent.getHumanTaskServer().getTaskStoreManager().getHumanTaskStore(task.getTenantId()).getTaskConfiguration(QName.valueOf(task.getName()));
try {
taskConf.getCallBackService().invoke(XMLUtils.toOM(taskOutput), task.getId());
} catch (Exception e) {
throw new HumanTaskRuntimeException("Error occurred while invoking callback service", e);
}
processTaskEvent();
checkPostConditions();
}
use of org.wso2.carbon.humantask.core.dao.TaskDAO in project carbon-business-process by wso2.
the class DeleteFault method execute.
@Override
public void execute() {
TaskDAO task = getTask();
authorise();
checkPreConditions();
checkState();
task.deleteFault();
processTaskEvent();
checkPostConditions();
}
use of org.wso2.carbon.humantask.core.dao.TaskDAO in project carbon-business-process by wso2.
the class Exit method execute.
@Override
public void execute() {
authorise();
TaskDAO task = getTask();
checkPreConditions();
checkState();
task.exit();
processTaskEvent();
checkPostConditions();
}
use of org.wso2.carbon.humantask.core.dao.TaskDAO in project carbon-business-process by wso2.
the class Forward method createTaskEvent.
@Override
protected EventDAO createTaskEvent() {
TaskDAO task = getTask();
EventDAO taskEvent = super.createTaskEvent();
taskEvent.setDetails("");
processTaskEvent();
return taskEvent;
}
Aggregations