@@ -17,9 +17,9 @@ import { FileUtil, File } from '../../utils/file/fileUtil';
1717import { Logger } from '../../utils/logger' ;
1818import { ApexAssessmentInfo } from '../../utils' ;
1919import { FileDiffUtil } from '../../utils/lwcparser/fileutils/FileDiffUtil' ;
20- import { Stringutil } from '../../utils/StringValue/stringutil' ;
2120import { Constants } from '../../utils/constants/stringContants' ;
2221import { ComponentType , createProgressBar } from '../base' ;
22+ import { NameMappingRegistry } from '../NameMappingRegistry' ;
2323import { BaseRelatedObjectMigration } from './BaseRealtedObjectMigration' ;
2424
2525Messages . importMessagesDirectory ( __dirname ) ;
@@ -231,13 +231,16 @@ export class ApexMigration extends BaseRelatedObjectMigration {
231231 const tokenUpdates : TokenUpdater [ ] = [ ] ;
232232 // check and update for DM
233233 const dmVarInMethodCalls = parser . dmVarInMethodCalls ;
234+ const nameRegistry = NameMappingRegistry . getInstance ( ) ;
234235 for ( const varName of dmVarInMethodCalls ) {
235236 const varToken = simpleVarDeclarations . get ( varName ) ;
236237 if ( ! varToken ) {
237238 dmNameUpdateFailed . add ( varName ) ;
238239 continue ;
239240 }
240- const newName = `'${ Stringutil . cleanName ( varToken . text . substring ( 1 , varToken . text . length - 1 ) ) } '` ;
241+ const newName = `'${ nameRegistry . getDataMapperCleanedName (
242+ varToken . text . substring ( 1 , varToken . text . length - 1 )
243+ ) } '`;
241244 if ( newName === varToken . text ) {
242245 continue ;
243246 }
@@ -257,7 +260,7 @@ export class ApexMigration extends BaseRelatedObjectMigration {
257260 ipNameUpdateFailed . add ( varName ) ;
258261 continue ;
259262 }
260- const newName = `'${ Stringutil . cleanName ( parts [ 0 ] ) } _ ${ Stringutil . cleanName ( parts [ 1 ] ) } '` ;
263+ const newName = `'${ nameRegistry . getIntegrationProcedureCleanedName ( oldName ) } '` ;
261264 if ( newName === varToken . text ) {
262265 continue ;
263266 }
@@ -370,9 +373,10 @@ export class ApexMigration extends BaseRelatedObjectMigration {
370373 const methodParameters = parser . methodParameters ;
371374 if ( methodParameters . size === 0 ) return tokenUpdates ;
372375 const drParameters = methodParameters . get ( ParameterType . DR_NAME ) ;
376+ const nameRegistry = NameMappingRegistry . getInstance ( ) ;
373377 if ( drParameters ) {
374378 for ( const token of drParameters ) {
375- const newName = `'${ Stringutil . cleanName ( token . text ) } '` ;
379+ const newName = `'${ nameRegistry . getDataMapperCleanedName ( token . text ) } '` ;
376380 if ( token . text === newName ) continue ;
377381 Logger . info ( assessMessages . getMessage ( 'inApexDrNameWillBeUpdated' , [ file . name , token . text , newName ] ) ) ;
378382 tokenUpdates . push ( new SingleTokenUpdate ( newName , token ) ) ;
@@ -388,7 +392,7 @@ export class ApexMigration extends BaseRelatedObjectMigration {
388392 ipNameUpdateFailed . add ( oldName ) ;
389393 continue ;
390394 }
391- const newName = `'${ Stringutil . cleanName ( parts [ 0 ] ) } _ ${ Stringutil . cleanName ( parts [ 1 ] ) } '` ;
395+ const newName = `'${ nameRegistry . getIntegrationProcedureCleanedName ( oldName ) } '` ;
392396 if ( newName === oldName ) {
393397 continue ;
394398 }
0 commit comments