📄 definitionserviceimpl.java
字号:
package org.jbpm.service;
import java.io.*;
import java.util.jar.*;
import org.apache.commons.logging.*;
import org.jbpm.*;
import org.jbpm.model.definition.impl.*;
import org.jbpm.persistence.*;
import org.jbpm.par.*;
public class DefinitionServiceImpl extends DefinitionReadServiceImpl implements DefinitionService {
public DefinitionServiceImpl( JbpmConfiguration jbpmConfiguration ) {
super( jbpmConfiguration );
}
public void deployProcessArchive(JarInputStream processArchiveStream) throws JpdlException, IOException {
log.info( "deploying process archive" );
PersistenceSessionTx sessionTx = persistenceSessionFactory.createPersistenceSessionTx();
try {
// parse the processdefinition.xml and create the object graph
ArchiveParser archiveParser = new ArchiveParser( processArchiveStream );
DefinitionImpl definition = archiveParser.getDefinition();
// assign the version number
int version = 1;
DefinitionImpl latest = sessionTx.findLatestDefinition( definition.getName() );
if ( latest != null ) {
version = latest.getVersion().intValue() + 1;
}
definition.setVersion( new Integer( version ) );
// save the definition (note that the SQL is not yet flushed to the database)
sessionTx.save( definition );
// save the files with the file manager
archiveParser.storeFiles( definition.getId(), fileMgr );
// TODO validate the delegations and their configurations after deploying a process archive
// aha, now the SQL is flushed to the database.
sessionTx.commitAndClose();
sessionTx = null;
log.debug( "deployed process " + definition.getName() + " and assigned version number " + definition.getVersion() );
} finally {
if ( sessionTx != null ) sessionTx.rollbackAndClose();
}
}
private static Log log = LogFactory.getLog(DefinitionServiceImpl.class);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -