Search in sources :

Example 11 with PackageManagementException

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.PackageManagementException in project carbon-business-process by wso2.

the class HumanTaskPackageManagementSkeleton method listDeployedTaskDefinitionsPaginated.

public DeployedTaskDefinitionsPaginated listDeployedTaskDefinitionsPaginated(int page) throws PackageManagementException {
    int tPage = page;
    try {
        DeployedTaskDefinitionsPaginated paginatedTaskDefs = new DeployedTaskDefinitionsPaginated();
        if (tPage < 0 || tPage == Integer.MAX_VALUE) {
            tPage = 0;
        }
        int itemsPerPage = 10;
        int startIndexForCurrentPage = tPage * itemsPerPage;
        int endIndexForCurrentPage = (tPage + 1) * itemsPerPage;
        List<SimpleTaskDefinitionInfo> taskConfigs = getTenantTaskStore().getTaskConfigurationInfoList();
        int taskDefListSize = taskConfigs.size();
        int pages = (int) Math.ceil((double) taskDefListSize / itemsPerPage);
        paginatedTaskDefs.setPages(pages);
        SimpleTaskDefinitionInfo[] taskDefinitionInfoArray = taskConfigs.toArray(new SimpleTaskDefinitionInfo[taskDefListSize]);
        for (int i = startIndexForCurrentPage; (i < endIndexForCurrentPage && i < taskDefListSize); i++) {
            paginatedTaskDefs.addTaskDefinition(createTaskDefObject(taskDefinitionInfoArray[i]));
        }
        return paginatedTaskDefs;
    } catch (Exception ex) {
        String errMsg = "listDeployedTaskDefinitionsPaginated operation failed";
        log.error(errMsg, ex);
        throw new PackageManagementException(errMsg, ex);
    }
}
Also used : SimpleTaskDefinitionInfo(org.wso2.carbon.humantask.core.deployment.SimpleTaskDefinitionInfo) PackageManagementException(org.wso2.carbon.humantask.skeleton.mgt.services.PackageManagementException) XMLStreamException(javax.xml.stream.XMLStreamException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) PackageManagementException(org.wso2.carbon.humantask.skeleton.mgt.services.PackageManagementException)

Example 12 with PackageManagementException

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.PackageManagementException in project carbon-business-process by wso2.

the class HumanTaskPackageManagementSkeleton method getTaskInfo.

public TaskInfoType getTaskInfo(QName taskId) throws PackageManagementException {
    int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    TaskInfoType taskInfo = null;
    HumanTaskBaseConfiguration taskConf = HumanTaskServiceComponent.getHumanTaskServer().getTaskStoreManager().getHumanTaskStore(tenantId).getTaskConfiguration(taskId);
    if (taskConf != null) {
        taskInfo = new TaskInfoType();
        taskInfo.setTaskId(taskConf.getName());
        taskInfo.setPackageName(taskConf.getPackageName());
        if (TaskPackageStatus.ACTIVE.equals(taskConf.getPackageStatus())) {
            taskInfo.setStatus(TaskStatusType.ACTIVE);
        } else if (TaskPackageStatus.RETIRED.equals(taskConf.getPackageStatus())) {
            taskInfo.setStatus(TaskStatusType.INACTIVE);
        } else if (TaskPackageStatus.UNDEPLOYING.equals(taskConf.getPackageStatus())) {
            taskInfo.setStatus(TaskStatusType.UNDEPLOYING);
        }
        taskInfo.setDeploymentError(taskConf.getDeploymentError());
        taskInfo.setErroneous(taskConf.isErroneous());
        if (taskConf instanceof TaskConfiguration) {
            taskInfo.setTaskType(TaskType.TASK);
        } else if (taskConf instanceof NotificationConfiguration) {
            taskInfo.setTaskType(TaskType.NOTIFICATION);
        }
        taskInfo.setDefinitionInfo(fillTaskDefinitionInfo(taskConf));
    }
    return taskInfo;
}
Also used : NotificationConfiguration(org.wso2.carbon.humantask.core.store.NotificationConfiguration) TaskConfiguration(org.wso2.carbon.humantask.core.store.TaskConfiguration) HumanTaskBaseConfiguration(org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration)

Aggregations

BPELUIException (org.wso2.carbon.bpel.core.ode.integration.store.BPELUIException)4 TenantProcessStoreImpl (org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl)4 BPELPackageRepository (org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageRepository)4 PackageManagementException (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.PackageManagementException)4 FileNotFoundException (java.io.FileNotFoundException)3 IOException (java.io.IOException)3 XMLStreamException (javax.xml.stream.XMLStreamException)3 PackageType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.PackageType)3 SimpleTaskDefinitionInfo (org.wso2.carbon.humantask.core.deployment.SimpleTaskDefinitionInfo)3 PackageManagementException (org.wso2.carbon.humantask.skeleton.mgt.services.PackageManagementException)3 BPELPackageInfo (org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageInfo)2 DeployedPackagesPaginated (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.DeployedPackagesPaginated)2 HumanTaskBaseConfiguration (org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration)2 NotificationConfiguration (org.wso2.carbon.humantask.core.store.NotificationConfiguration)2 FileInputStream (java.io.FileInputStream)1 XMLInputFactory (javax.xml.stream.XMLInputFactory)1 XMLStreamReader (javax.xml.stream.XMLStreamReader)1 OMElement (org.apache.axiom.om.OMElement)1 StAXOMBuilder (org.apache.axiom.om.impl.builder.StAXOMBuilder)1 Version_type0 (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Version_type0)1