return process;
}
public void storeAssetContent(RuleAsset asset,
AssetItem repoAsset) throws SerializationException {
RuleFlowContentModel content = (RuleFlowContentModel) asset.getContent();
//
// Migrate v4 ruleflows to v5
// Added guards to check for nulls in the case where the ruleflows
// have not been migrated from drools 4 to 5.
//
if ( content != null ) {
if ( content.getXml() != null ) {
RuleFlowProcess process = readProcess( new ByteArrayInputStream( content.getXml().getBytes() ) );
if ( process != null ) {
RuleFlowProcessBuilder.updateProcess( process,
content.getNodes() );
XmlRuleFlowProcessDumper dumper = XmlRuleFlowProcessDumper.INSTANCE;
String out = dumper.dump( process );
repoAsset.updateContent( out );
} else {
//
// Migrate v4 ruleflows to v5
// Put the old contents back as there is no updating possible
//
repoAsset.updateContent( content.getXml() );
}
}
if ( content.getJson() != null ) {
try {
String xml = serialize( "http://localhost:8080/designer/uuidRepository?profile=jbpm&action=toXML&pp=" +
URLEncoder.encode( content.getPreprocessingdata(),
"UTF-8" ),
content.getJson() );
content.setXml( xml );
repoAsset.updateContent( content.getXml() );
} catch ( Exception e ) {
log.error( e.getMessage(),
e );
}
}