Search in sources :

Example 6 with ByCaseIdContainerLocator

use of org.kie.server.services.casemgmt.locator.ByCaseIdContainerLocator in project droolsjbpm-integration by kiegroup.

the class CaseManagementServiceBase method addDynamicSubprocess.

public void addDynamicSubprocess(String containerId, String caseId, String stageId, String processId, String payload, String marshallingType) {
    verifyContainerId(containerId, caseId);
    logger.debug("About to unmarshal process data from payload: '{}'", payload);
    Map<String, Object> subProcessParameters = marshallerHelper.unmarshal(containerId, payload, marshallingType, Map.class, new ByCaseIdContainerLocator(caseId));
    logger.debug("SubProcess data '{}'", subProcessParameters);
    if (stageId != null && !stageId.isEmpty()) {
        logger.debug("Adding dynamic subprocess to stage {} within case {}", stageId, caseId);
        caseService.addDynamicSubprocessToStage(caseId, stageId, processId, subProcessParameters);
    } else {
        logger.debug("Adding dynamic subprocess to case {}", caseId);
        caseService.addDynamicSubprocess(caseId, processId, subProcessParameters);
    }
}
Also used : ByCaseIdContainerLocator(org.kie.server.services.casemgmt.locator.ByCaseIdContainerLocator)

Example 7 with ByCaseIdContainerLocator

use of org.kie.server.services.casemgmt.locator.ByCaseIdContainerLocator in project droolsjbpm-integration by kiegroup.

the class CaseManagementServiceBase method addCommentToCase.

public String addCommentToCase(String containerId, String caseId, String author, List<String> restrictions, String comment, String marshallingType) {
    verifyContainerId(containerId, caseId);
    author = getUser(author);
    String actualComment = marshallerHelper.unmarshal(containerId, comment, marshallingType, String.class, new ByCaseIdContainerLocator(caseId));
    logger.debug("Adding comment to case {} by {} with text '{}' with restrictions {}", caseId, author, actualComment, restrictions);
    String commentId = caseService.addCaseComment(caseId, author, actualComment, restrictions.toArray(new String[restrictions.size()]));
    return marshallerHelper.marshal(containerId, marshallingType, commentId);
}
Also used : ByCaseIdContainerLocator(org.kie.server.services.casemgmt.locator.ByCaseIdContainerLocator)

Example 8 with ByCaseIdContainerLocator

use of org.kie.server.services.casemgmt.locator.ByCaseIdContainerLocator in project droolsjbpm-integration by kiegroup.

the class CaseManagementServiceBase method updateCommentInCase.

public void updateCommentInCase(String containerId, String caseId, String commentId, String author, List<String> restrictions, String comment, String marshallingType) {
    verifyContainerId(containerId, caseId);
    author = getUser(author);
    String actualComment = marshallerHelper.unmarshal(containerId, comment, marshallingType, String.class, new ByCaseIdContainerLocator(caseId));
    logger.debug("Updating comment {} in case {} by {} with text '{}' with restrictions {}", commentId, caseId, author, actualComment, restrictions);
    caseService.updateCaseComment(caseId, commentId, author, actualComment, restrictions.toArray(new String[restrictions.size()]));
}
Also used : ByCaseIdContainerLocator(org.kie.server.services.casemgmt.locator.ByCaseIdContainerLocator)

Example 9 with ByCaseIdContainerLocator

use of org.kie.server.services.casemgmt.locator.ByCaseIdContainerLocator in project droolsjbpm-integration by kiegroup.

the class CaseManagementServiceBase method getCaseFileData.

public String getCaseFileData(String containerId, String caseId, List<String> names, String marshallingType) {
    verifyContainerId(containerId, caseId);
    CaseFileInstance caseFileInstance = caseService.getCaseFileInstance(caseId);
    Map<String, Object> caseFileData = caseFileInstance.getData();
    if (names != null && !names.isEmpty()) {
        logger.debug("Filtering case file data to return only items with following names {}", names);
        Map<String, Object> filtered = new HashMap<>();
        for (String name : names) {
            if (caseFileData.containsKey(name)) {
                filtered.put(name, caseFileData.get(name));
            }
        }
        caseFileData = filtered;
    }
    logger.debug("About to marshal case file data for case with id '{}' {}", caseId, caseFileData);
    return marshallerHelper.marshal(containerId, marshallingType, caseFileData, new ByCaseIdContainerLocator(caseId));
}
Also used : CaseFileInstance(org.jbpm.casemgmt.api.model.instance.CaseFileInstance) HashMap(java.util.HashMap) ByCaseIdContainerLocator(org.kie.server.services.casemgmt.locator.ByCaseIdContainerLocator)

Example 10 with ByCaseIdContainerLocator

use of org.kie.server.services.casemgmt.locator.ByCaseIdContainerLocator in project droolsjbpm-integration by kiegroup.

the class CaseManagementServiceBase method putCaseFileData.

public void putCaseFileData(String containerId, String caseId, List<String> restrictions, String payload, String marshallingType) {
    verifyContainerId(containerId, caseId);
    logger.debug("About to unmarshal case file data from payload: '{}'", payload);
    Map<String, Object> caseFileData = marshallerHelper.unmarshal(containerId, payload, marshallingType, Map.class, new ByCaseIdContainerLocator(caseId));
    logger.debug("Unmarshalled case file data {} for case with id '{}' with restrictions", caseFileData, caseId, restrictions);
    caseService.addDataToCaseFile(caseId, caseFileData, restrictions.toArray(new String[restrictions.size()]));
}
Also used : ByCaseIdContainerLocator(org.kie.server.services.casemgmt.locator.ByCaseIdContainerLocator)

Aggregations

ByCaseIdContainerLocator (org.kie.server.services.casemgmt.locator.ByCaseIdContainerLocator)13 HashMap (java.util.HashMap)2 CaseFileInstance (org.jbpm.casemgmt.api.model.instance.CaseFileInstance)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Consumes (javax.ws.rs.Consumes)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Variant (javax.ws.rs.core.Variant)1 CaseNotFoundException (org.jbpm.casemgmt.api.CaseNotFoundException)1 TaskSpecification (org.jbpm.casemgmt.api.dynamic.TaskSpecification)1 CaseDefinition (org.jbpm.casemgmt.api.model.CaseDefinition)1 CaseInstance (org.jbpm.casemgmt.api.model.instance.CaseInstance)1 DeploymentNotFoundException (org.jbpm.services.api.DeploymentNotFoundException)1 MarshallingFormat (org.kie.server.api.marshalling.MarshallingFormat)1 CaseInstance (org.kie.server.api.model.cases.CaseInstance)1 CaseInstanceList (org.kie.server.api.model.cases.CaseInstanceList)1 KieContainerInstanceImpl (org.kie.server.services.impl.KieContainerInstanceImpl)1 MarshallerHelper (org.kie.server.services.impl.marshal.MarshallerHelper)1