Path previousVersionPath) {
if ( !AssetFormats.DECISION_TABLE_GUIDED.equals( jcrAssetItem.getFormat() ) ) {
throw new IllegalArgumentException( "The jcrAsset (" + jcrAssetItem.getName() + ") has the wrong format (" + jcrAssetItem.getFormat() + ")." );
}
Path path = migrationPathManager.generatePathForAsset( jcrModule,
jcrAssetItem );
final org.uberfire.java.nio.file.Path nioPath = Paths.convert( path );
//The asset was renamed in this version. We move this asset first.
if(previousVersionPath != null && !previousVersionPath.equals(path)) {
ioService.move(Paths.convert( previousVersionPath ), nioPath, StandardCopyOption.REPLACE_EXISTING);
}
String content = jcrAssetItem.getContent();
/* while(content.indexOf("<auditLog>") > -1) {
content = content.replaceAll(content.substring(content.indexOf("<auditLog>"), content.indexOf("</auditLog>")+11), "");
}
*/
content = content.replaceAll( "org.drools.guvnor.client.modeldriven.dt52.Pattern52",
"Pattern52" );
GuidedDecisionTable52 model = GuidedDTXMLPersistence.getInstance().unmarshal( content );
//Add package
final Package pkg = projectService.resolvePackage( path );
String pkName =pkg.getPackageName();
try{
if(pkName!=null && pkg.getPackageName().endsWith(path.getFileName())){
pkName = pkg.getPackageName().substring(0,pkg.getPackageName().indexOf(path.getFileName())-1);
}
}catch (Exception e){
}
final String requiredPackageName = pkName;