Search in sources :

Example 76 with Property

use of org.wso2.carbon.identity.application.common.model.Property in project carbon-business-process by wso2.

the class HistoricActivitiInstanceService method getHistoricActivityInstances.

@GET
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getHistoricActivityInstances(@Context UriInfo uriInfo) {
    Map<String, String> allRequestParams = new HashMap<>();
    for (String property : allPropertiesList) {
        String value = uriInfo.getQueryParameters().getFirst(property);
        if (value != null) {
            allRequestParams.put(property, value);
        }
    }
    HistoricActivityInstanceQueryRequest query = getHistoricActivityInstanceQueryRequest(uriInfo, allRequestParams);
    DataResponse dataResponse = getQueryResponse(query, allRequestParams, uriInfo);
    return Response.ok().entity(dataResponse).build();
}
Also used : HashMap(java.util.HashMap) HistoricActivityInstanceQueryRequest(org.wso2.carbon.bpmn.rest.model.history.HistoricActivityInstanceQueryRequest) DataResponse(org.wso2.carbon.bpmn.rest.model.common.DataResponse) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 77 with Property

use of org.wso2.carbon.identity.application.common.model.Property in project carbon-business-process by wso2.

the class ProcessDefinitionFormPropertyService method getStartFormProperties.

@GET
@Path("/{processDefinitionId}/properties")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getStartFormProperties(@PathParam("processDefinitionId") String processDefinitionId) {
    FormService formService = BPMNOSGIService.getFormService();
    StartFormData startFormData = formService.getStartFormData(processDefinitionId);
    FormPropertyResponseCollection formPropertyResponseCollection = new FormPropertyResponseCollection();
    if (startFormData != null) {
        List<FormProperty> properties = startFormData.getFormProperties();
        List<FormPropertyResponse> formPropertyResponseList = new ArrayList<>();
        for (FormProperty property : properties) {
            // ObjectNode propertyJSON = objectMapper.createObjectNode();
            FormPropertyResponse formPropertyResponse = new FormPropertyResponse();
            formPropertyResponse.setId(property.getId());
            formPropertyResponse.setName(property.getName());
            if (property.getValue() != null) {
                formPropertyResponse.setValue(property.getValue());
            } else {
                formPropertyResponse.setValue(null);
            }
            if (property.getType() != null) {
                formPropertyResponse.setType(property.getType().getName());
                if (property.getType() instanceof EnumFormType) {
                    @SuppressWarnings("unchecked") Map<String, String> valuesMap = (Map<String, String>) property.getType().getInformation("values");
                    if (valuesMap != null) {
                        List<FormPropertyEnumDataHolder> formPropertyEnumDataHoldersList = new ArrayList<>();
                        for (String key : valuesMap.keySet()) {
                            FormPropertyEnumDataHolder formPropertyEnumDataHolder = new FormPropertyEnumDataHolder();
                            formPropertyEnumDataHolder.setId(key);
                            formPropertyEnumDataHolder.setName(valuesMap.get(key));
                            formPropertyEnumDataHoldersList.add(formPropertyEnumDataHolder);
                        }
                        formPropertyResponse.setEnumValues(formPropertyEnumDataHoldersList);
                    }
                }
            } else {
                formPropertyResponse.setType("String");
            }
            formPropertyResponse.setRequired(property.isRequired());
            formPropertyResponse.setReadable(property.isReadable());
            formPropertyResponse.setWritable(property.isWritable());
            formPropertyResponseList.add(formPropertyResponse);
        }
        formPropertyResponseCollection.setData(formPropertyResponseList);
    }
    return Response.ok().entity(formPropertyResponseCollection).build();
}
Also used : FormPropertyEnumDataHolder(org.wso2.carbon.bpmn.rest.model.form.FormPropertyEnumDataHolder) FormProperty(org.activiti.engine.form.FormProperty) FormService(org.activiti.engine.FormService) FormPropertyResponse(org.wso2.carbon.bpmn.rest.model.form.FormPropertyResponse) ArrayList(java.util.ArrayList) EnumFormType(org.activiti.engine.impl.form.EnumFormType) FormPropertyResponseCollection(org.wso2.carbon.bpmn.rest.model.form.FormPropertyResponseCollection) StartFormData(org.activiti.engine.form.StartFormData) Map(java.util.Map) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 78 with Property

use of org.wso2.carbon.identity.application.common.model.Property in project carbon-business-process by wso2.

the class HistoricProcessInstanceService method getHistoricProcessInstances.

@GET
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getHistoricProcessInstances() {
    Map<String, String> allRequestParams = new HashMap<>();
    for (String property : allPropertiesList) {
        String value = uriInfo.getQueryParameters().getFirst(property);
        if (value != null) {
            allRequestParams.put(property, value);
        }
    }
    // Populate query based on request
    HistoricProcessInstanceQueryRequest queryRequest = new HistoricProcessInstanceQueryRequest();
    if (allRequestParams.get("processInstanceId") != null) {
        queryRequest.setProcessInstanceId(allRequestParams.get("processInstanceId"));
    }
    if (allRequestParams.get("processDefinitionKey") != null) {
        queryRequest.setProcessDefinitionKey(allRequestParams.get("processDefinitionKey"));
    }
    if (allRequestParams.get("processDefinitionId") != null) {
        queryRequest.setProcessDefinitionId(allRequestParams.get("processDefinitionId"));
    }
    if (allRequestParams.get("businessKey") != null) {
        queryRequest.setProcessBusinessKey(allRequestParams.get("businessKey"));
    }
    if (allRequestParams.get("involvedUser") != null) {
        queryRequest.setInvolvedUser(allRequestParams.get("involvedUser"));
    }
    if (allRequestParams.get("finished") != null) {
        queryRequest.setFinished(Boolean.valueOf(allRequestParams.get("finished")));
    }
    if (allRequestParams.get("superProcessInstanceId") != null) {
        queryRequest.setSuperProcessInstanceId(allRequestParams.get("superProcessInstanceId"));
    }
    if (allRequestParams.get("excludeSubprocesses") != null) {
        queryRequest.setExcludeSubprocesses(Boolean.valueOf(allRequestParams.get("excludeSubprocesses")));
    }
    if (allRequestParams.get("finishedAfter") != null) {
        queryRequest.setFinishedAfter(RequestUtil.getDate(allRequestParams, "finishedAfter"));
    }
    if (allRequestParams.get("finishedBefore") != null) {
        queryRequest.setFinishedBefore(RequestUtil.getDate(allRequestParams, "finishedBefore"));
    }
    if (allRequestParams.get("startedAfter") != null) {
        queryRequest.setStartedAfter(RequestUtil.getDate(allRequestParams, "startedAfter"));
    }
    if (allRequestParams.get("startedBefore") != null) {
        queryRequest.setStartedBefore(RequestUtil.getDate(allRequestParams, "startedBefore"));
    }
    if (allRequestParams.get("startedBy") != null) {
        queryRequest.setStartedBy(allRequestParams.get("startedBy"));
    }
    if (allRequestParams.get("includeProcessVariables") != null) {
        queryRequest.setIncludeProcessVariables(Boolean.valueOf(allRequestParams.get("includeProcessVariables")));
    }
    if (allRequestParams.get("tenantId") != null) {
        queryRequest.setTenantId(allRequestParams.get("tenantId"));
    }
    if (allRequestParams.get("tenantIdLike") != null) {
        queryRequest.setTenantIdLike(allRequestParams.get("tenantIdLike"));
    }
    if (allRequestParams.get("withoutTenantId") != null) {
        queryRequest.setWithoutTenantId(Boolean.valueOf(allRequestParams.get("withoutTenantId")));
    }
    return Response.ok().entity(getQueryResponse(queryRequest, allRequestParams)).build();
}
Also used : HistoricProcessInstanceQueryRequest(org.wso2.carbon.bpmn.rest.model.common.HistoricProcessInstanceQueryRequest)

Example 79 with Property

use of org.wso2.carbon.identity.application.common.model.Property in project carbon-business-process by wso2.

the class HistoricTaskInstanceService method getHistoricProcessInstances.

@GET
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getHistoricProcessInstances() {
    Map<String, String> allRequestParams = new HashMap<>();
    for (String property : allPropertiesList) {
        String value = uriInfo.getQueryParameters().getFirst(property);
        if (value != null) {
            allRequestParams.put(property, value);
        }
    }
    // Populate query based on request
    HistoricTaskInstanceQueryRequest queryRequest = new HistoricTaskInstanceQueryRequest();
    if (allRequestParams.get("taskId") != null) {
        queryRequest.setTaskId(allRequestParams.get("taskId"));
    }
    if (allRequestParams.get("processInstanceId") != null) {
        queryRequest.setProcessInstanceId(allRequestParams.get("processInstanceId"));
    }
    if (allRequestParams.get("processBusinessKey") != null) {
        queryRequest.setProcessBusinessKey(allRequestParams.get("processBusinessKey"));
    }
    if (allRequestParams.get("processDefinitionKey") != null) {
        queryRequest.setProcessDefinitionKey(allRequestParams.get("processDefinitionKey"));
    }
    if (allRequestParams.get("processDefinitionId") != null) {
        queryRequest.setProcessDefinitionId(allRequestParams.get("processDefinitionId"));
    }
    if (allRequestParams.get("processDefinitionName") != null) {
        queryRequest.setProcessDefinitionName(allRequestParams.get("processDefinitionName"));
    }
    if (allRequestParams.get("executionId") != null) {
        queryRequest.setExecutionId(allRequestParams.get("executionId"));
    }
    if (allRequestParams.get("taskName") != null) {
        queryRequest.setTaskName(allRequestParams.get("taskName"));
    }
    if (allRequestParams.get("taskNameLike") != null) {
        queryRequest.setTaskNameLike(allRequestParams.get("taskNameLike"));
    }
    if (allRequestParams.get("taskDescription") != null) {
        queryRequest.setTaskDescription(allRequestParams.get("taskDescription"));
    }
    if (allRequestParams.get("taskDescriptionLike") != null) {
        queryRequest.setTaskDescriptionLike(allRequestParams.get("taskDescriptionLike"));
    }
    if (allRequestParams.get("taskDefinitionKey") != null) {
        queryRequest.setTaskDefinitionKey(allRequestParams.get("taskDefinitionKey"));
    }
    if (allRequestParams.get("taskDeleteReason") != null) {
        queryRequest.setTaskDeleteReason(allRequestParams.get("taskDeleteReason"));
    }
    if (allRequestParams.get("taskDeleteReasonLike") != null) {
        queryRequest.setTaskDeleteReasonLike(allRequestParams.get("taskDeleteReasonLike"));
    }
    if (allRequestParams.get("taskAssignee") != null) {
        queryRequest.setTaskAssignee(allRequestParams.get("taskAssignee"));
    }
    if (allRequestParams.get("taskAssigneeLike") != null) {
        queryRequest.setTaskAssigneeLike(allRequestParams.get("taskAssigneeLike"));
    }
    if (allRequestParams.get("taskOwner") != null) {
        queryRequest.setTaskOwner(allRequestParams.get("taskOwner"));
    }
    if (allRequestParams.get("taskOwnerLike") != null) {
        queryRequest.setTaskOwnerLike(allRequestParams.get("taskOwnerLike"));
    }
    if (allRequestParams.get("taskInvolvedUser") != null) {
        queryRequest.setTaskInvolvedUser(allRequestParams.get("taskInvolvedUser"));
    }
    if (allRequestParams.get("taskPriority") != null) {
        queryRequest.setTaskPriority(Integer.valueOf(allRequestParams.get("taskPriority")));
    }
    if (allRequestParams.get("finished") != null) {
        queryRequest.setFinished(Boolean.valueOf(allRequestParams.get("finished")));
    }
    if (allRequestParams.get("processFinished") != null) {
        queryRequest.setProcessFinished(Boolean.valueOf(allRequestParams.get("processFinished")));
    }
    if (allRequestParams.get("parentTaskId") != null) {
        queryRequest.setParentTaskId(allRequestParams.get("parentTaskId"));
    }
    if (allRequestParams.get("dueDate") != null) {
        queryRequest.setDueDate(RequestUtil.getDate(allRequestParams, "dueDate"));
    }
    if (allRequestParams.get("dueDateAfter") != null) {
        queryRequest.setDueDateAfter(RequestUtil.getDate(allRequestParams, "dueDateAfter"));
    }
    if (allRequestParams.get("dueDateBefore") != null) {
        queryRequest.setDueDateBefore(RequestUtil.getDate(allRequestParams, "dueDateBefore"));
    }
    if (allRequestParams.get("taskCreatedOn") != null) {
        queryRequest.setTaskCreatedOn(RequestUtil.getDate(allRequestParams, "taskCreatedOn"));
    }
    if (allRequestParams.get("taskCreatedBefore") != null) {
        queryRequest.setTaskCreatedBefore(RequestUtil.getDate(allRequestParams, "taskCreatedBefore"));
    }
    if (allRequestParams.get("taskCreatedAfter") != null) {
        queryRequest.setTaskCreatedAfter(RequestUtil.getDate(allRequestParams, "taskCreatedAfter"));
    }
    if (allRequestParams.get("taskCompletedOn") != null) {
        queryRequest.setTaskCompletedOn(RequestUtil.getDate(allRequestParams, "taskCompletedOn"));
    }
    if (allRequestParams.get("taskCompletedBefore") != null) {
        queryRequest.setTaskCompletedBefore(RequestUtil.getDate(allRequestParams, "taskCompletedBefore"));
    }
    if (allRequestParams.get("taskCompletedAfter") != null) {
        queryRequest.setTaskCompletedAfter(RequestUtil.getDate(allRequestParams, "taskCompletedAfter"));
    }
    if (allRequestParams.get("includeTaskLocalVariables") != null) {
        queryRequest.setIncludeTaskLocalVariables(Boolean.valueOf(allRequestParams.get("includeTaskLocalVariables")));
    }
    if (allRequestParams.get("includeProcessVariables") != null) {
        queryRequest.setIncludeProcessVariables(Boolean.valueOf(allRequestParams.get("includeProcessVariables")));
    }
    if (allRequestParams.get("tenantId") != null) {
        queryRequest.setTenantId(allRequestParams.get("tenantId"));
    }
    if (allRequestParams.get("tenantIdLike") != null) {
        queryRequest.setTenantIdLike(allRequestParams.get("tenantIdLike"));
    }
    if (allRequestParams.get("withoutTenantId") != null) {
        queryRequest.setWithoutTenantId(Boolean.valueOf(allRequestParams.get("withoutTenantId")));
    }
    if (allRequestParams.get("taskCandidateGroup") != null) {
        queryRequest.setTaskCandidateGroup(allRequestParams.get("taskCandidateGroup"));
    }
    String serverRootUrl = uriInfo.getBaseUri().toString().replace("/history/historic-task-instances", "");
    DataResponse dataResponse = getQueryResponse(queryRequest, allRequestParams, serverRootUrl);
    return Response.ok().entity(dataResponse).build();
}
Also used : HistoricTaskInstanceQueryRequest(org.wso2.carbon.bpmn.rest.model.history.HistoricTaskInstanceQueryRequest) HashMap(java.util.HashMap) DataResponse(org.wso2.carbon.bpmn.rest.model.common.DataResponse)

Example 80 with Property

use of org.wso2.carbon.identity.application.common.model.Property in project carbon-business-process by wso2.

the class HistoricVariableInstanceService method getHistoricActivityInstances.

@GET
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getHistoricActivityInstances() {
    HistoricVariableInstanceQueryRequest query = new HistoricVariableInstanceQueryRequest();
    // Populate query based on request
    Map<String, String> allRequestParams = new HashMap<>();
    for (String property : allPropertiesList) {
        String value = uriInfo.getQueryParameters().getFirst(property);
        if (value != null) {
            allRequestParams.put(property, value);
        }
    }
    if (allRequestParams.get("excludeTaskVariables") != null) {
        query.setExcludeTaskVariables(Boolean.valueOf(allRequestParams.get("excludeTaskVariables")));
    }
    if (allRequestParams.get("taskId") != null) {
        query.setTaskId(allRequestParams.get("taskId"));
    }
    if (allRequestParams.get("executionId") != null) {
        query.setExecutionId(allRequestParams.get("executionId"));
    }
    if (allRequestParams.get("processInstanceId") != null) {
        query.setProcessInstanceId(allRequestParams.get("processInstanceId"));
    }
    if (allRequestParams.get("variableName") != null) {
        query.setVariableName(allRequestParams.get("variableName"));
    }
    if (allRequestParams.get("variableNameLike") != null) {
        query.setVariableNameLike(allRequestParams.get("variableNameLike"));
    }
    DataResponse dataResponse = getQueryResponse(query, allRequestParams);
    return Response.ok().entity(dataResponse).build();
}
Also used : HistoricVariableInstanceQueryRequest(org.wso2.carbon.bpmn.rest.model.history.HistoricVariableInstanceQueryRequest) HashMap(java.util.HashMap) DataResponse(org.wso2.carbon.bpmn.rest.model.common.DataResponse) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

HashMap (java.util.HashMap)42 ArrayList (java.util.ArrayList)32 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)32 Resource (org.wso2.carbon.registry.core.Resource)23 Map (java.util.Map)21 Test (org.junit.Test)21 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)21 DataResponse (org.wso2.carbon.bpmn.rest.model.common.DataResponse)17 API (org.wso2.carbon.apimgt.api.model.API)16 UserStoreException (org.wso2.carbon.user.api.UserStoreException)16 Path (javax.ws.rs.Path)14 Produces (javax.ws.rs.Produces)14 JSONObject (org.json.simple.JSONObject)14 APIIdentifier (org.wso2.carbon.apimgt.api.model.APIIdentifier)14 List (java.util.List)13 IOException (java.io.IOException)11 QName (javax.xml.namespace.QName)11 APIProductResource (org.wso2.carbon.apimgt.api.model.APIProductResource)11 Properties (java.util.Properties)10 GovernanceException (org.wso2.carbon.governance.api.exception.GovernanceException)10