use of org.wso2.carbon.humantask.skeleton.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);
}
}
use of org.wso2.carbon.humantask.skeleton.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;
}
Aggregations