Search in sources :

Example 1 with HumanTaskBaseConfiguration

use of org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration in project carbon-business-process by wso2.

the class HTQueryBuildHelperImpl method getAllDeployedTasks.

/**
 * @param ltenantID
 * @return all the deployed tasks for the given tenant
 */
public List<HumanTaskBaseConfiguration> getAllDeployedTasks(long ltenantID) {
    int tenantID = (int) ltenantID;
    HumanTaskStore humanTaskStore = HumanTaskServiceComponent.getHumanTaskServer().getTaskStoreManager().getHumanTaskStore(tenantID);
    List<HumanTaskBaseConfiguration> humanTaskConfigurations = humanTaskStore.getTaskConfigurations();
    return humanTaskConfigurations;
}
Also used : HumanTaskStore(org.wso2.carbon.humantask.core.store.HumanTaskStore) HumanTaskBaseConfiguration(org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration)

Example 2 with HumanTaskBaseConfiguration

use of org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration in project carbon-business-process by wso2.

the class HTQueryBuildHelperImpl method getAllDeployedTasksDetails.

/**
 * @return
 * @throws IllegalAccessFault
 * @throws IllegalArgumentFault
 * @throws IllegalStateFault
 * @throws IllegalOperationFault
 */
public DeployedTaskDetail[][] getAllDeployedTasksDetails() throws Exception {
    DeployedTaskDetail[][] dtt = null;
    long[] tenantIDs = getAllTenantIDs();
    dtt = new DeployedTaskDetail[tenantIDs.length][];
    HumanTaskBaseConfiguration htc;
    int i = 0;
    for (Long tenantID : tenantIDs) {
        List<HumanTaskBaseConfiguration> htcList = getAllDeployedTasks(tenantID);
        int size = htcList.size();
        dtt[i] = new DeployedTaskDetail[size];
        for (int j = 0; j < size; j++) {
            htc = htcList.get(j);
            dtt[i][j] = new DeployedTaskDetail();
            dtt[i][j].setTenantID(tenantID.intValue());
            dtt[i][j].setTaskDefName(htc.getDefinitionName());
            dtt[i][j].setTaskName(htc.getName());
            dtt[i][j].setOperation(htc.getOperation());
            dtt[i][j].setPortName(htc.getPortName());
            dtt[i][j].setTaskCount(getTaskInstanceCountForTaskName(htc.getName().toString()));
            dtt[i][j].setConfigType(htc.getConfigurationType());
            dtt[i][j].setPackageName(htc.getPackageName());
        }
        i++;
    }
    return dtt;
}
Also used : HumanTaskBaseConfiguration(org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration)

Example 3 with HumanTaskBaseConfiguration

use of org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration in project carbon-business-process by wso2.

the class HumanTaskStore method createAxisService.

// Creates the AxisService object from the provided ServiceBuilder object.
private AxisService createAxisService(WSDL11ToAxisServiceBuilder serviceBuilder, HumanTaskBaseConfiguration config) throws AxisFault {
    AxisService axisService;
    axisService = serviceBuilder.populateService();
    axisService.setParent(getTenantAxisConfig());
    axisService.setWsdlFound(true);
    axisService.setCustomWsdl(true);
    // axisService.setFileName(new URL(taskConfig.getWsdlDefLocation()));
    axisService.setClassLoader(getTenantAxisConfig().getServiceClassLoader());
    Utils.setEndpointsToAllUsedBindings(axisService);
    axisService.addParameter(new Parameter("modifyUserWSDLPortAddress", "true"));
    /* Setting service type to use in service management*/
    axisService.addParameter(ServerConstants.SERVICE_TYPE, "humantask");
    /* Fix for losing of security configuration  when updating human-task package*/
    axisService.addParameter(new Parameter(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM, "true"));
    Iterator operations = axisService.getOperations();
    AxisHumanTaskMessageReceiver msgReceiver = new AxisHumanTaskMessageReceiver();
    msgReceiver.setHumanTaskEngine(HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine());
    // Setting the task configuration to the message receiver. Hence no need to search for task configuration, when
    // the actual task invocation happens, we will already have the task configuration attached to the message receiver
    // itself
    msgReceiver.setTaskBaseConfiguration(config);
    while (operations.hasNext()) {
        AxisOperation operation = (AxisOperation) operations.next();
        // Setting Message Receiver even if operation has a message receiver specified.
        // This is to fix the issue when build service configuration using services.xml(Always RPCMessageReceiver
        // is set to operations).
        operation.setMessageReceiver(msgReceiver);
        getTenantAxisConfig().getPhasesInfo().setOperationPhases(operation);
    }
    Set<String> exposedTransports = getTenantAxisConfig().getTransportsIn().keySet();
    // Add the transports to axis2 service by reading from the tenant transport config
    for (String transport : exposedTransports) {
        axisService.addExposedTransport(transport);
    }
    if (HumanTaskServiceComponent.getHumanTaskServer().getServerConfig().isHtCoordinationEnabled() && HumanTaskServiceComponent.getHumanTaskServer().getServerConfig().isTaskRegistrationEnabled() && config.getConfigurationType() == HumanTaskBaseConfiguration.ConfigurationType.TASK) {
        // Only Engage coordination module in-case of Tasks. Coordination module is not required for notifications
        axisService.engageModule(getConfigContext().getAxisConfiguration().getModule("htcoordination"));
    }
    return axisService;
}
Also used : AxisOperation(org.apache.axis2.description.AxisOperation) AxisService(org.apache.axis2.description.AxisService) Iterator(java.util.Iterator) Parameter(org.apache.axis2.description.Parameter) AxisHumanTaskMessageReceiver(org.wso2.carbon.humantask.core.integration.AxisHumanTaskMessageReceiver)

Example 4 with HumanTaskBaseConfiguration

use of org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration in project carbon-business-process by wso2.

the class HumanTaskStore method deploy.

/**
 * This will simply deploy the new task and will not perform removal of existing tasks, which should be done prior to
 * deploying this task
 * @param humanTaskDU
 * @return List of task configuration Qnames deployed
 * @throws HumanTaskDeploymentException
 */
public List<QName> deploy(HumanTaskDeploymentUnit humanTaskDU) throws HumanTaskDeploymentException {
    List<QName> taskConfigsInPackage = new ArrayList<QName>();
    TTask[] tasks = humanTaskDU.getTasks();
    List<HumanTaskBaseConfiguration> configurations = new ArrayList<HumanTaskBaseConfiguration>();
    if (tasks != null) {
        for (TTask task : tasks) {
            QName taskQName = new QName(humanTaskDU.getNamespace(), task.getName());
            if (log.isDebugEnabled()) {
                log.debug(" Adding task " + task.getName() + "to task configuration");
            }
            TaskConfiguration taskConf = new TaskConfiguration(task, humanTaskDU.getTaskServiceInfo(taskQName), humanTaskDU.getHumanInteractionsDefinition(), humanTaskDU.getWSDLs(), humanTaskDU.getNamespace(), humanTaskDU.getName(), getTenantAxisConfig(), humanTaskDU.getPackageName(), humanTaskDU.getVersion(), humanTaskDU.getHumanTaskDefinitionFile());
            taskConf.setPackageStatus(humanTaskDU.getTaskPackageStatus());
            configurations.add(taskConf);
            if (!taskConf.isErroneous()) {
                createCallBackService(taskConf);
                if (taskConf.getPackageStatus() == TaskPackageStatus.ACTIVE) {
                    deploy(taskConf);
                // activeTaskConfigurationQNameMap.put(taskQName, taskConf.getName());
                }
            }
        }
    }
    TNotification[] notifications = humanTaskDU.getNotifications();
    if (notifications != null) {
        for (TNotification notification : notifications) {
            QName notificationQName = new QName(humanTaskDU.getNamespace(), notification.getName());
            NotificationConfiguration notificationConf = new NotificationConfiguration(notification, humanTaskDU.getNotificationServiceInfo(notificationQName), humanTaskDU.getHumanInteractionsDefinition(), humanTaskDU.getWSDLs(), humanTaskDU.getNamespace(), humanTaskDU.getName(), getTenantAxisConfig(), humanTaskDU.getPackageName(), humanTaskDU.getVersion(), humanTaskDU.getHumanTaskDefinitionFile());
            notificationConf.setPackageStatus(humanTaskDU.getTaskPackageStatus());
            configurations.add(notificationConf);
            if (!notificationConf.isErroneous()) {
                // Deploy the axis2 service only for the active version of the task/notification
                if (notificationConf.getPackageStatus() == TaskPackageStatus.ACTIVE) {
                    deploy(notificationConf);
                // activeTaskConfigurationQNameMap.put(notificationQName, notificationConf.getName());
                }
            }
        }
    }
    // condition if a service name is deployed with same name outside of this task package
    for (HumanTaskBaseConfiguration configuration : configurations) {
        taskConfigurations.add(configuration);
        taskBaseConfigurationHashMap.put(configuration.getName(), configuration);
        taskConfigsInPackage.add(configuration.getName());
        if (configuration.getPackageStatus() == TaskPackageStatus.ACTIVE) {
            activeTaskConfigurationQNameMap.put(configuration.getDefinitionName(), configuration.getName());
        }
    }
    for (TNotification inlineNotification : humanTaskDU.getInlineNotifications()) {
        QName notificationQName = new QName(humanTaskDU.getNamespace(), inlineNotification.getName());
        NotificationConfiguration notificationConf = new NotificationConfiguration(inlineNotification, humanTaskDU.getNotificationServiceInfo(notificationQName), humanTaskDU.getHumanInteractionsDefinition(), humanTaskDU.getWSDLs(), humanTaskDU.getNamespace(), humanTaskDU.getName(), getTenantAxisConfig(), humanTaskDU.getPackageName(), humanTaskDU.getVersion(), humanTaskDU.getHumanTaskDefinitionFile());
        notificationConf.setPackageStatus(humanTaskDU.getTaskPackageStatus());
        taskConfigurations.add(notificationConf);
        taskConfigsInPackage.add(notificationConf.getName());
        taskBaseConfigurationHashMap.put(notificationConf.getName(), notificationConf);
        if (notificationConf.getPackageStatus() == TaskPackageStatus.ACTIVE) {
            activeTaskConfigurationQNameMap.put(notificationQName, notificationConf.getName());
        }
    }
    taskConfigurationsInTaskPackage.put(humanTaskDU.getName(), taskConfigsInPackage);
    return taskConfigsInPackage;
}
Also used : QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) TNotification(org.wso2.carbon.humantask.TNotification) TTask(org.wso2.carbon.humantask.TTask)

Example 5 with HumanTaskBaseConfiguration

use of org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration in project carbon-business-process by wso2.

the class HumanTaskStore method createAxisServiceBuilder.

// Creates the AxisServiceBuilder object.
private WSDL11ToAxisServiceBuilder createAxisServiceBuilder(HumanTaskBaseConfiguration taskConfig, Definition wsdlDef) {
    WSDL11ToAxisServiceBuilder serviceBuilder = new WSDL11ToAxisServiceBuilder(wsdlDef, taskConfig.getServiceName(), taskConfig.getPortName());
    String wsdlBaseURI = wsdlDef.getDocumentBaseURI();
    serviceBuilder.setBaseUri(wsdlBaseURI);
    /*we don't need custom resolvers since registry takes care of it*/
    serviceBuilder.setCustomResolver(new DefaultURIResolver());
    URI wsdlBase = null;
    try {
        wsdlBase = new URI(convertToVaildURI(wsdlBaseURI));
    } catch (Exception e) {
        String error = "Error occurred while creating AxisServiceBuilder.";
        log.error(error);
    }
    serviceBuilder.setCustomWSDLResolver(new HumanTaskWSDLLocator(wsdlBase));
    serviceBuilder.setServerSide(true);
    return serviceBuilder;
}
Also used : HumanTaskWSDLLocator(org.wso2.carbon.humantask.core.integration.HumanTaskWSDLLocator) DefaultURIResolver(org.apache.ws.commons.schema.resolver.DefaultURIResolver) WSDL11ToAxisServiceBuilder(org.apache.axis2.description.WSDL11ToAxisServiceBuilder) URI(java.net.URI) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) HumanTaskDeploymentException(org.wso2.carbon.humantask.core.deployment.HumanTaskDeploymentException) HumanTaskRuntimeException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)

Aggregations

HumanTaskBaseConfiguration (org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration)10 HumanTaskRuntimeException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)7 QName (javax.xml.namespace.QName)6 TaskConfiguration (org.wso2.carbon.humantask.core.store.TaskConfiguration)5 Element (org.w3c.dom.Element)4 TaskDAO (org.wso2.carbon.humantask.core.dao.TaskDAO)4 HumanTaskDeploymentException (org.wso2.carbon.humantask.core.deployment.HumanTaskDeploymentException)4 ArrayList (java.util.ArrayList)3 AxisFault (org.apache.axis2.AxisFault)3 AxisService (org.apache.axis2.description.AxisService)3 WSDL11ToAxisServiceBuilder (org.apache.axis2.description.WSDL11ToAxisServiceBuilder)3 NotificationConfiguration (org.wso2.carbon.humantask.core.store.NotificationConfiguration)3 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)3 HashMap (java.util.HashMap)2 NodeList (org.w3c.dom.NodeList)2 OutputEventAdapterConfiguration (org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration)2 OutputEventAdapterException (org.wso2.carbon.event.output.adapter.core.exception.OutputEventAdapterException)2 HumanTaskEngine (org.wso2.carbon.humantask.core.engine.HumanTaskEngine)2 HumanTaskException (org.wso2.carbon.humantask.core.engine.HumanTaskException)2 ExpressionEvaluationContext (org.wso2.carbon.humantask.core.engine.runtime.ExpressionEvaluationContext)2