public void removeProcess( final String id ) { Process process = this.processes.get( id ); if (process == null) { throw new IllegalArgumentException( "Process '" + id + "' does not exist for this Rule Base." ); } this.eventSupport.fireBeforeProcessRemoved( process ); lock(); try { this.processes.remove( id ); this.pkgs.get(process.getPackageName()).removeRuleFlow(id); } finally { unlock(); } this.eventSupport.fireAfterProcessRemoved( process ); }
public static ProcessDefinitionRef processDefinition(Process process) { long version = 0; try { version = new Long(process.getVersion()); } catch (NumberFormatException e) { // Do nothing, keep version 0 } ProcessDefinitionRef result = new ProcessDefinitionRef( process.getId(), process.getName(), version); result.setPackageName(process.getPackageName()); result.setDeploymentId("N/A"); return result; }
@Test public void testProcessDefinition(){ org.drools.definition.process.Process process = CommandDelegate.getProcess("Minimal"); ProcessDefinitionRef processDefinitionRef = Transform.processDefinition(process); assertEquals(processDefinitionRef.getId(),process.getId()); assertEquals(processDefinitionRef.getPackageName(),process.getPackageName()); assertEquals(processDefinitionRef.getName(),process.getName()); }