Search in sources :

Example 1 with ProcessPackage

use of org.drools.core.definitions.ProcessPackage in project drools by kiegroup.

the class KnowledgePackageImpl method removeRuleFlow.

/**
 * Rule flows can be removed by ID.
 */
public void removeRuleFlow(String id) {
    ProcessPackage rtp = (ProcessPackage) getResourceTypePackages().get(ResourceType.BPMN2);
    if (rtp == null || rtp.lookup(id) == null) {
        throw new IllegalArgumentException("The rule flow with id [" + id + "] is not part of this package.");
    }
    rtp.remove(id);
}
Also used : ProcessPackage(org.drools.core.definitions.ProcessPackage)

Example 2 with ProcessPackage

use of org.drools.core.definitions.ProcessPackage in project drools by kiegroup.

the class KnowledgePackageImpl method addProcess.

/**
 * Add a rule flow to this package.
 */
public void addProcess(Process process) {
    ResourceTypePackageRegistry rtps = getResourceTypePackages();
    ProcessPackage rtp = ProcessPackage.getOrCreate(rtps);
    rtp.add(process);
}
Also used : ProcessPackage(org.drools.core.definitions.ProcessPackage) ResourceTypePackageRegistry(org.drools.core.definitions.ResourceTypePackageRegistry)

Example 3 with ProcessPackage

use of org.drools.core.definitions.ProcessPackage in project drools by kiegroup.

the class KnowledgePackageImpl method getProcessesGeneratedFromResource.

private List<Process> getProcessesGeneratedFromResource(Resource resource) {
    ProcessPackage rtp = (ProcessPackage) getResourceTypePackages().get(ResourceType.BPMN2);
    if (rtp == null) {
        return Collections.emptyList();
    }
    List<Process> processesFromResource = new ArrayList<>();
    for (Process process : rtp) {
        if (resource.equals(process.getResource())) {
            processesFromResource.add(process);
        }
    }
    return processesFromResource;
}
Also used : ArrayList(java.util.ArrayList) Process(org.kie.api.definition.process.Process) ProcessPackage(org.drools.core.definitions.ProcessPackage)

Aggregations

ProcessPackage (org.drools.core.definitions.ProcessPackage)3 ArrayList (java.util.ArrayList)1 ResourceTypePackageRegistry (org.drools.core.definitions.ResourceTypePackageRegistry)1 Process (org.kie.api.definition.process.Process)1