use of org.wso2.carbon.humantask.client.api.types in project carbon-business-process by wso2.
the class BPELMessageReceiver method createAttachmentDTO.
private TAttachment createAttachmentDTO(DataHandler attachmentHandler) {
TAttachment attachment = new TAttachment();
String attachmentName = attachmentHandler.getName();
attachment.setName(attachmentName);
log.warn("Couldn't determine the name of BPEL client. So the owner of the attachment:" + attachmentName + " " + "will be the default bpel client" + org.wso2.carbon.bpel.core.BPELConstants.DAFAULT_BPEL_CLIENT);
attachment.setCreatedBy(org.wso2.carbon.bpel.core.BPELConstants.DAFAULT_BPEL_CLIENT);
attachment.setContentType(attachmentHandler.getContentType());
// As well there are some other parameters to be set.
attachment.setContent(attachmentHandler);
return attachment;
}
use of org.wso2.carbon.humantask.client.api.types in project carbon-business-process by wso2.
the class RestResponseFactory method createGroupResponse.
public GroupResponse createGroupResponse(Group group, String baseUrl) {
RestUrlBuilder urlBuilder = createUrlBuilder(baseUrl);
GroupResponse response = new GroupResponse();
response.setId(group.getId());
response.setName(group.getName());
response.setType(group.getType());
response.setUrl(urlBuilder.buildUrl(org.wso2.carbon.bpmn.rest.common.RestUrls.URL_GROUP, group.getId()));
return response;
}
use of org.wso2.carbon.humantask.client.api.types in project carbon-business-process by wso2.
the class TransformerUtils method generateAttachmentDAOFromID.
/**
* Generate an {@code AttachmentDAO} for a given attachment-id
*
* @param task task to be associated with the particular attachment
* @param attachmentID id of the attachment, so this will be used to extract attachment information from the
* attachment-mgt OSGi service
*
* @return reference to the created {@code AttachmentDAO}
* @throws HumanTaskException If if was failed to retrieve data from the attachment-mgt OSGi service
*/
public static AttachmentDAO generateAttachmentDAOFromID(TaskDAO task, String attachmentID) throws HumanTaskException {
try {
org.wso2.carbon.attachment.mgt.skeleton.types.TAttachment attachment = HumanTaskServerHolder.getInstance().getAttachmentService().getAttachmentService().getAttachmentInfo(attachmentID);
AttachmentDAO dao = HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getDaoConnectionFactory().getConnection().createAttachment();
// Constructing the attachment DAO from the DTO
dao.setName(attachment.getName());
dao.setContentType(attachment.getContentType());
dao.setTask((Task) task);
String attachmentURL = attachment.getUrl().toString();
// Extracting the attachment uri
String attachmentUniqueID = attachmentURL.substring(attachmentURL.lastIndexOf("/") + 1);
dao.setValue(attachmentUniqueID);
dao.setAttachedAt(attachment.getCreatedTime().getTime());
OrganizationalEntityDAO orgEntityDAO = HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getDaoConnectionFactory().getConnection().createNewOrgEntityObject(attachment.getCreatedBy(), OrganizationalEntityDAO.OrganizationalEntityType.USER);
dao.setAttachedBy((OrganizationalEntity) orgEntityDAO);
// TODO : "AccessType is not supported by Attachment-Mgt DTOs. So using a dummy value: " + HumanTaskConstants.DEFAULT_ATTACHMENT_ACCESS_TYPE);
dao.setAccessType(HumanTaskConstants.DEFAULT_ATTACHMENT_ACCESS_TYPE);
return dao;
} catch (AttachmentMgtException e) {
String errorMsg = "Attachment Data retrieval operation failed for attachment id:" + attachmentID + ". " + "Reason:";
log.error(e.getLocalizedMessage(), e);
throw new HumanTaskException(errorMsg + e.getLocalizedMessage(), e);
}
}
use of org.wso2.carbon.humantask.client.api.types in project carbon-business-process by wso2.
the class HumanTaskJPQLQueryBuilder method buildAllTasksCountQuery.
private Query buildAllTasksCountQuery() {
boolean hasStatus = false;
List<TaskStatus> statuses = queryCriteria.getStatuses();
if (statuses != null && !statuses.isEmpty()) {
hasStatus = true;
}
boolean hasTaskName = false;
if (!StringUtils.isEmpty(queryCriteria.getTaskName())) {
hasTaskName = true;
}
Query allTasksQuery = em.createQuery(" SELECT COUNT(DISTINCT t) FROM org.wso2.carbon.humantask.core.dao.jpa" + ".openjpa.model.Task t " + JOIN_HUMAN_ROLES_JOIN_ORG_ENTITIES + OE_NAME_IN_NAMES + AND + (hasStatus ? T_STATUS_IN_TASK_STATUSES + AND : "") + T_TYPE_TASK_TYPE + (hasTaskName ? AND + FILTER_BY_TASKNAME : "") + AND + T_TENANT_ID_TENANT_ID);
List<String> rolesAndNamesList = getNameListForUser(queryCriteria.getCaller(), true);
allTasksQuery.setParameter(NAMES, rolesAndNamesList);
allTasksQuery.setParameter(TENANT_ID, queryCriteria.getCallerTenantId());
allTasksQuery.setParameter(TASK_TYPE, TaskType.TASK);
if (hasStatus) {
allTasksQuery.setParameter(TASK_STATUSES, statuses);
}
if (hasTaskName) {
allTasksQuery.setParameter(TASK_NAME, queryCriteria.getTaskName());
}
return allTasksQuery;
}
use of org.wso2.carbon.humantask.client.api.types in project carbon-business-process by wso2.
the class HumanTaskJPQLQueryBuilder method buildAllTasksQuery.
private Query buildAllTasksQuery() {
boolean hasStatus = false;
List<TaskStatus> statuses = queryCriteria.getStatuses();
if (statuses != null && !statuses.isEmpty()) {
hasStatus = true;
}
boolean hasTaskName = false;
if (!StringUtils.isEmpty(queryCriteria.getTaskName())) {
hasTaskName = true;
}
Query allTasksQuery = em.createQuery(" SELECT DISTINCT t FROM org.wso2.carbon.humantask.core.dao.jpa.openjpa.model.Task t " + JOIN_HUMAN_ROLES_JOIN_ORG_ENTITIES + OE_NAME_IN_NAMES + AND + (hasStatus ? T_STATUS_IN_TASK_STATUSES + AND : "") + T_TYPE_TASK_TYPE + (hasTaskName ? AND + FILTER_BY_TASKNAME : "") + AND + T_TENANT_ID_TENANT_ID + generateOrderedByQuery()).setMaxResults(queryCriteria.getPageSize()).setFirstResult(queryCriteria.getPageSize() * queryCriteria.getPageNumber());
List<String> rolesAndNamesList = getNameListForUser(queryCriteria.getCaller(), true);
allTasksQuery.setParameter(NAMES, rolesAndNamesList);
allTasksQuery.setParameter(TENANT_ID, queryCriteria.getCallerTenantId());
allTasksQuery.setParameter(TASK_TYPE, TaskType.TASK);
if (hasStatus) {
allTasksQuery.setParameter(TASK_STATUSES, statuses);
}
if (hasTaskName) {
allTasksQuery.setParameter(TASK_NAME, queryCriteria.getTaskName());
}
return allTasksQuery;
}
Aggregations