Search in sources :

Example 1 with CaseDefinitionNotFoundException

use of org.jbpm.casemgmt.api.CaseDefinitionNotFoundException in project jbpm by kiegroup.

the class CaseServiceImpl method newCaseFileInstance.

/*
     * new instances methods
     */
@Override
public CaseFileInstance newCaseFileInstance(String deploymentId, String caseDefinition, Map<String, Object> data) {
    CaseDefinition def = caseRuntimeDataService.getCase(deploymentId, caseDefinition);
    if (def == null) {
        throw new CaseDefinitionNotFoundException("Case definition " + caseDefinition + " does not exist in deployment " + deploymentId);
    }
    CaseFileInstanceImpl caseFile = new CaseFileInstanceImpl(caseDefinition, data);
    caseFile.setupRoles(def.getCaseRoles());
    caseFile.setAccessRestrictions(def.getDataAccessRestrictions());
    return caseFile;
}
Also used : CaseDefinition(org.jbpm.casemgmt.api.model.CaseDefinition) CaseFileInstanceImpl(org.jbpm.casemgmt.impl.model.instance.CaseFileInstanceImpl) CaseDefinitionNotFoundException(org.jbpm.casemgmt.api.CaseDefinitionNotFoundException)

Example 2 with CaseDefinitionNotFoundException

use of org.jbpm.casemgmt.api.CaseDefinitionNotFoundException in project jbpm by kiegroup.

the class CaseServiceImpl method newCaseFileInstanceWithRestrictions.

@Override
public CaseFileInstance newCaseFileInstanceWithRestrictions(String deploymentId, String caseDefinition, Map<String, Object> data, Map<String, List<String>> accessRestrictions) {
    CaseDefinition def = caseRuntimeDataService.getCase(deploymentId, caseDefinition);
    if (def == null) {
        throw new CaseDefinitionNotFoundException("Case definition " + caseDefinition + " does not exist in deployment " + deploymentId);
    }
    CaseFileInstanceImpl caseFile = new CaseFileInstanceImpl(caseDefinition, data);
    caseFile.setupRoles(def.getCaseRoles());
    Map<String, List<String>> combinedAccessRestrictions = def.getDataAccessRestrictions();
    if (accessRestrictions != null) {
        combinedAccessRestrictions.putAll(accessRestrictions);
    }
    caseFile.setAccessRestrictions(combinedAccessRestrictions);
    return caseFile;
}
Also used : CaseDefinition(org.jbpm.casemgmt.api.model.CaseDefinition) CaseFileInstanceImpl(org.jbpm.casemgmt.impl.model.instance.CaseFileInstanceImpl) List(java.util.List) ArrayList(java.util.ArrayList) CaseDefinitionNotFoundException(org.jbpm.casemgmt.api.CaseDefinitionNotFoundException)

Example 3 with CaseDefinitionNotFoundException

use of org.jbpm.casemgmt.api.CaseDefinitionNotFoundException in project jbpm by kiegroup.

the class CaseServiceImpl method newCaseFileInstanceWithRestrictions.

@Override
public CaseFileInstance newCaseFileInstanceWithRestrictions(String deploymentId, String caseDefinition, Map<String, Object> data, Map<String, OrganizationalEntity> rolesAssignment, Map<String, List<String>> accessRestrictions) {
    CaseDefinition def = caseRuntimeDataService.getCase(deploymentId, caseDefinition);
    if (def == null) {
        throw new CaseDefinitionNotFoundException("Case definition " + caseDefinition + " does not exist in deployment " + deploymentId);
    }
    CaseFileInstanceImpl caseFile = new CaseFileInstanceImpl(caseDefinition, data);
    caseFile.setupRoles(def.getCaseRoles());
    Map<String, List<String>> combinedAccessRestrictions = def.getDataAccessRestrictions();
    if (accessRestrictions != null) {
        combinedAccessRestrictions.putAll(accessRestrictions);
    }
    caseFile.setAccessRestrictions(combinedAccessRestrictions);
    rolesAssignment.entrySet().stream().forEach(entry -> caseFile.assign(entry.getKey(), entry.getValue()));
    return caseFile;
}
Also used : CaseDefinition(org.jbpm.casemgmt.api.model.CaseDefinition) CaseFileInstanceImpl(org.jbpm.casemgmt.impl.model.instance.CaseFileInstanceImpl) List(java.util.List) ArrayList(java.util.ArrayList) CaseDefinitionNotFoundException(org.jbpm.casemgmt.api.CaseDefinitionNotFoundException)

Example 4 with CaseDefinitionNotFoundException

use of org.jbpm.casemgmt.api.CaseDefinitionNotFoundException in project jbpm by kiegroup.

the class CaseServiceImpl method newCaseFileInstance.

@Override
public CaseFileInstance newCaseFileInstance(String deploymentId, String caseDefinition, Map<String, Object> data, Map<String, OrganizationalEntity> rolesAssignment) {
    CaseDefinition def = caseRuntimeDataService.getCase(deploymentId, caseDefinition);
    if (def == null) {
        throw new CaseDefinitionNotFoundException("Case definition " + caseDefinition + " does not exist in deployment " + deploymentId);
    }
    CaseFileInstanceImpl caseFile = new CaseFileInstanceImpl(caseDefinition, data);
    caseFile.setupRoles(def.getCaseRoles());
    caseFile.setAccessRestrictions(def.getDataAccessRestrictions());
    rolesAssignment.entrySet().stream().forEach(entry -> caseFile.assign(entry.getKey(), entry.getValue()));
    return caseFile;
}
Also used : CaseDefinition(org.jbpm.casemgmt.api.model.CaseDefinition) CaseFileInstanceImpl(org.jbpm.casemgmt.impl.model.instance.CaseFileInstanceImpl) CaseDefinitionNotFoundException(org.jbpm.casemgmt.api.CaseDefinitionNotFoundException)

Aggregations

CaseDefinitionNotFoundException (org.jbpm.casemgmt.api.CaseDefinitionNotFoundException)4 CaseDefinition (org.jbpm.casemgmt.api.model.CaseDefinition)4 CaseFileInstanceImpl (org.jbpm.casemgmt.impl.model.instance.CaseFileInstanceImpl)4 ArrayList (java.util.ArrayList)2 List (java.util.List)2