Skip to content

Commit

Permalink
bz-1004869: Jcr2vfs migration tool replaces '#' with '//' on places w…
Browse files Browse the repository at this point in the history
…here it shouldn'tJcr2vfs migration tool replaces '#' with '//' on places where it shouldn't
  • Loading branch information
jervisliu committed Sep 6, 2013
1 parent 4ea73df commit 03281ba
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Expand Up @@ -6,6 +6,7 @@
import javax.inject.Inject;
import javax.inject.Named;

import org.drools.guvnor.client.common.AssetFormats;
import org.drools.guvnor.client.rpc.Module;
import org.drools.guvnor.server.RepositoryAssetService;
import org.drools.repository.AssetItem;
Expand Down Expand Up @@ -47,8 +48,15 @@ public void migrate( Module jcrModule,

String content = jcrAssetItem.getContent();

//Support for # has been removed from Drools Expert
content = content.replaceAll( "#", "//" );
if (AssetFormats.DSL.equals(jcrAssetItem.getFormat())
|| AssetFormats.DSL_TEMPLATE_RULE.equals(jcrAssetItem.getFormat())
|| AssetFormats.RULE_TEMPLATE.equals(jcrAssetItem.getFormat())
|| AssetFormats.DRL.equals(jcrAssetItem.getFormat())
|| AssetFormats.FUNCTION.equals(jcrAssetItem.getFormat())) {
//Support for # has been removed from Drools Expert
content = content.replaceAll( "#", "//" );
}

ioService.write( nioPath,
content,
migrateMetaData(jcrModule, jcrAssetItem),
Expand Down
Expand Up @@ -68,9 +68,15 @@ public void migrate( Module jcrModule,
sb.append( "\n" );
sb.append( "end" );

//Support for # has been removed from Drools Expert
String content = sb.toString().replaceAll( "#",
"//" );
String content = sb.toString();
if (AssetFormats.DSL.equals(jcrAssetItem.getFormat())
|| AssetFormats.DSL_TEMPLATE_RULE.equals(jcrAssetItem.getFormat())
|| AssetFormats.RULE_TEMPLATE.equals(jcrAssetItem.getFormat())
|| AssetFormats.DRL.equals(jcrAssetItem.getFormat())
|| AssetFormats.FUNCTION.equals(jcrAssetItem.getFormat())) {
//Support for # has been removed from Drools Expert
content = content.replaceAll( "#", "//" );
}

String sourceWithImport = drlTextEditorServiceImpl.assertPackageName( content,
path );
Expand Down

0 comments on commit 03281ba

Please sign in to comment.