public Deploy(ProcessDefinition processDefinition) {
this.processDefinition = processDefinition;
}
public Object execute(Environment environment) throws Exception {
PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
String name = processDefinition.getName();
if (name==null) {
throw new PvmException("process must have a name to deploy it");
}
int version = processDefinition.getVersion();
if (pvmDbSession.findProcessDefinition(name, version)!=null) {
throw new PvmException("process ["+name+"|"+version+"] already exists");
}
pvmDbSession.save(processDefinition);
return processDefinition;
}