return process;
}
public void storeAssetContent(RuleAsset asset,
AssetItem repoAsset) throws SerializationException {
RuleFlowContentModel content = (RuleFlowContentModel) asset.content;
System.out.println(content);
//
// 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/bpmn2_0serialization", content.getJson());
System.out.println("xml = " + xml);
repoAsset.updateContent(xml);
} catch (Exception e) {
log.error(e.getMessage(), e);
}