use of org.wso2.carbon.humantask.core.deployment.SimpleTaskDefinitionInfo in project carbon-business-process by wso2.
the class HumanTaskPackageManagementSkeleton method listTasksInPackage.
/**
* Lists the tasks in the given package name.
*
* @param packageName : The name of the package to list task definitions.
* @return : The Task_type0 array containing the task definition information.
*/
public Task_type0[] listTasksInPackage(String packageName) throws PackageManagementException {
if (StringUtils.isEmpty(packageName)) {
throw new IllegalArgumentException("The provided package name is empty!");
}
try {
List<SimpleTaskDefinitionInfo> taskDefsInPackage = getTenantTaskStore().getTaskConfigurationInfoListForPackage(packageName);
Task_type0[] taskDefArray = new Task_type0[taskDefsInPackage.size()];
int i = 0;
for (SimpleTaskDefinitionInfo taskDefinitionInfo : taskDefsInPackage) {
taskDefArray[i] = createTaskTypeObject(taskDefinitionInfo);
i++;
}
return taskDefArray;
} catch (Exception ex) {
String errMsg = "listTasksInPackage operation failed";
log.error(errMsg, ex);
throw new PackageManagementException(errMsg, ex);
}
}
use of org.wso2.carbon.humantask.core.deployment.SimpleTaskDefinitionInfo 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);
}
}
Aggregations