use of org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration in project carbon-business-process by wso2.
the class HumanTaskStore method deploy.
private void deploy(HumanTaskBaseConfiguration taskConfig) throws HumanTaskDeploymentException {
if (taskConfig != null) {
/**
* Creating AxisService for HI
*/
if (log.isDebugEnabled()) {
log.debug("Deploying task " + taskConfig.getName());
}
AxisService axisService;
Definition wsdlDef = taskConfig.getWSDL();
if (taskConfig instanceof TaskConfiguration) {
// to get the task id as response
wsdlDef.getPortType(taskConfig.getPortType()).getOperation(taskConfig.getOperation(), null, null).setStyle(OperationType.REQUEST_RESPONSE);
} else {
// ONE_WAY no feed back for NOTIFICATIONS
wsdlDef.getPortType(taskConfig.getPortType()).getOperation(taskConfig.getOperation(), null, null).setStyle(OperationType.ONE_WAY);
}
WSDL11ToAxisServiceBuilder serviceBuilder = createAxisServiceBuilder(taskConfig, wsdlDef);
try {
axisService = createAxisService(serviceBuilder, taskConfig);
ServiceConfigurationUtil.configureService(axisService, taskConfig.getEndpointConfiguration(taskConfig.getServiceName().getLocalPart(), taskConfig.getPortName()), getConfigContext());
ArrayList<AxisService> serviceList = new ArrayList<AxisService>();
serviceList.add(axisService);
DeploymentEngine.addServiceGroup(createServiceGroupForService(axisService), serviceList, null, null, getTenantAxisConfig());
if (log.isDebugEnabled()) {
log.debug(" Published axis2 service " + axisService.getName() + " for task " + taskConfig.getName());
}
} catch (AxisFault axisFault) {
String errMsg = "Error populating the service";
log.error(errMsg);
throw new HumanTaskDeploymentException(errMsg, axisFault);
}
}
}
use of org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration in project carbon-business-process by wso2.
the class TaskOperationsImpl method getRenderingTypes.
/**
* Applies to both tasks and notifications.
* Returns the rendering types available for the task or notification.
*
* @param taskIdURI : task identifier
* @return : Array of QNames
* @throws IllegalArgumentFault
*/
public QName[] getRenderingTypes(URI taskIdURI) throws IllegalArgumentFault {
try {
final Long taskId = validateTaskId(taskIdURI);
TaskDAO task = HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<TaskDAO>() {
public TaskDAO call() throws Exception {
HumanTaskEngine engine = HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine();
HumanTaskDAOConnection daoConn = engine.getDaoConnectionFactory().getConnection();
TaskDAO task = daoConn.getTask(taskId);
validateTaskTenant(task);
return task;
}
});
HumanTaskBaseConfiguration taskConfiguration = HumanTaskServiceComponent.getHumanTaskServer().getTaskStoreManager().getHumanTaskStore(task.getTenantId()).getTaskConfiguration(QName.valueOf(task.getName()));
List<QName> renderingTypes = taskConfiguration.getRenderingTypes();
QName[] types = new QName[renderingTypes.size()];
types = renderingTypes.toArray(types);
return types;
} catch (Exception ex) {
log.error(ex);
throw new IllegalArgumentFault(ex);
}
}
use of org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration in project carbon-business-process by wso2.
the class TransformerUtils method transformTask.
/**
* Transform a TaskDAO object to a TTaskAbstract object.
*
* @param task : The TaskDAO object to be transformed.
* @param callerUserName : The user name of the caller.
* @return : The transformed TTaskAbstract object.
*/
public static TTaskAbstract transformTask(final TaskDAO task, final String callerUserName) {
TTaskAbstract taskAbstract = new TTaskAbstract();
// Set the task Id
try {
taskAbstract.setId(new URI(task.getId().toString()));
} catch (URI.MalformedURIException e) {
log.warn("Invalid task Id found");
}
taskAbstract.setName(QName.valueOf(task.getDefinitionName()));
taskAbstract.setRenderingMethodExists(true);
// Set the created time
Calendar calCreatedOn = Calendar.getInstance();
calCreatedOn.setTime(task.getCreatedOn());
taskAbstract.setCreatedTime(calCreatedOn);
if (task.getUpdatedOn() != null) {
Calendar updatedTime = Calendar.getInstance();
updatedTime.setTime(task.getUpdatedOn());
taskAbstract.setUpdatedTime(updatedTime);
}
// Set the activation time if exists.
if (task.getActivationTime() != null) {
Calendar calActivationTime = Calendar.getInstance();
calActivationTime.setTime(task.getActivationTime());
taskAbstract.setActivationTime(calActivationTime);
}
// Set the expiration time if exists.
if (task.getExpirationTime() != null) {
Calendar expirationTime = Calendar.getInstance();
expirationTime.setTime(task.getExpirationTime());
taskAbstract.setExpirationTime(expirationTime);
}
if (task.getStartByTime() != null) {
taskAbstract.setStartByTimeExists(true);
} else {
taskAbstract.setStartByTimeExists(false);
}
if (task.getCompleteByTime() != null) {
taskAbstract.setCompleteByTimeExists(true);
} else {
taskAbstract.setCompleteByTimeExists(false);
}
taskAbstract.setTaskType(task.getType().toString());
taskAbstract.setHasSubTasks(CommonTaskUtil.hasSubTasks(task));
taskAbstract.setHasComments(CommonTaskUtil.hasComments(task));
taskAbstract.setHasAttachments(CommonTaskUtil.hasAttachments(task));
taskAbstract.setHasFault(CommonTaskUtil.hasFault(task));
taskAbstract.setHasOutput(CommonTaskUtil.hasOutput(task));
taskAbstract.setEscalated(task.isEscalated());
taskAbstract.setIsSkipable(task.isSkipable());
taskAbstract.setStatus(transformStatus(task.getStatus()));
taskAbstract.setPriority(transformPriority(task.getPriority()));
taskAbstract.setPreviousStatus(transformStatus(task.getStatusBeforeSuspension()));
taskAbstract.setHasPotentialOwners(CommonTaskUtil.hasPotentialOwners(task));
if (CommonTaskUtil.getUserEntityForRole(task, GenericHumanRoleDAO.GenericHumanRoleType.ACTUAL_OWNER) != null) {
taskAbstract.setActualOwner(createTUser(CommonTaskUtil.getUserEntityForRole(task, GenericHumanRoleDAO.GenericHumanRoleType.ACTUAL_OWNER)));
}
taskAbstract.setPotentialOwners(transformOrganizationalEntityList(CommonTaskUtil.getOrgEntitiesForRole(task, GenericHumanRoleDAO.GenericHumanRoleType.POTENTIAL_OWNERS)));
taskAbstract.setBusinessAdministrators(transformOrganizationalEntityList(CommonTaskUtil.getOrgEntitiesForRole(task, GenericHumanRoleDAO.GenericHumanRoleType.BUSINESS_ADMINISTRATORS)));
taskAbstract.setNotificationRecipients(transformOrganizationalEntityList(CommonTaskUtil.getOrgEntitiesForRole(task, GenericHumanRoleDAO.GenericHumanRoleType.NOTIFICATION_RECIPIENTS)));
taskAbstract.setTaskStakeholders(transformOrganizationalEntityList(CommonTaskUtil.getOrgEntitiesForRole(task, GenericHumanRoleDAO.GenericHumanRoleType.STAKEHOLDERS)));
taskAbstract.setTaskInitiator(createTUser(CommonTaskUtil.getUserEntityForRole(task, GenericHumanRoleDAO.GenericHumanRoleType.TASK_INITIATOR)));
HumanTaskBaseConfiguration baseConfiguration = CommonTaskUtil.getTaskConfiguration(task);
if (baseConfiguration == null) {
throw new HumanTaskRuntimeException("There's not matching task configuration for " + "task" + task.getName());
}
// Set the versioned package name
taskAbstract.setPackageName(baseConfiguration.getPackageName() + "-" + baseConfiguration.getVersion());
taskAbstract.setTenantId(task.getTenantId());
// If this is a task set the response operation and the port type.
if (TaskType.TASK.equals(task.getType())) {
TaskConfiguration taskConfig = (TaskConfiguration) baseConfiguration;
taskAbstract.setResponseOperationName(taskConfig.getResponseOperation());
taskAbstract.setResponseServiceName(taskConfig.getResponsePortType().toString());
}
taskAbstract.setPresentationName(transformPresentationName(CommonTaskUtil.getDefaultPresentationName(task)));
taskAbstract.setPresentationSubject(transformPresentationSubject(CommonTaskUtil.getDefaultPresentationSubject(task)));
taskAbstract.setPresentationDescription(transformPresentationDescription(CommonTaskUtil.getDefaultPresentationDescription(task)));
// Setting attachment specific information
taskAbstract.setHasAttachments(!task.getAttachments().isEmpty());
taskAbstract.setNumberOfAttachments(task.getAttachments().size());
return taskAbstract;
}
use of org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration in project carbon-business-process by wso2.
the class HumanTaskEngine method createTask.
// create task logic.
private TaskDAO createTask(WSDLAwareMessage message, HumanTaskBaseConfiguration taskConfiguration, int tenantId) throws HumanTaskException {
TaskCreationContext creationContext = new TaskCreationContext();
creationContext.setTaskConfiguration(taskConfiguration);
creationContext.setTenantId(tenantId);
creationContext.setMessageBodyParts(message.getBodyPartElements());
creationContext.setMessageHeaderParts(message.getHeaderPartElements());
creationContext.setPeopleQueryEvaluator(peopleQueryEvaluator);
TaskDAO task = getDaoConnectionFactory().getConnection().createTask(creationContext);
creationContext.injectExpressionEvaluationContext(task);
return task;
}
Aggregations