@@ -12,12 +12,13 @@ import {
1212 SingleTokenUpdate ,
1313 TokenUpdater ,
1414} from '../../utils/apex/parser/apexparser' ;
15- import { MigrationResult , RelatedObjectsMigrate } from '../interfaces' ;
15+ import { MigrationResult } from '../interfaces' ;
1616import { sfProject } from '../../utils/sfcli/project/sfProject' ;
1717import { fileutil , File } from '../../utils/file/fileutil' ;
1818import { Logger } from '../../utils/logger' ;
1919import { ApexAssessmentInfo } from '../../utils' ;
2020import { FileDiffUtil } from '../../utils/lwcparser/fileutils/FileDiffUtil' ;
21+ import { Stringutil } from '../../utils/StringValue/stringutil' ;
2122import { BaseRelatedObjectMigration } from './BaseRealtedObjectMigration' ;
2223
2324const APEXCLASS = 'Apexclass' ;
@@ -26,7 +27,7 @@ const CALLABLE = 'Callable';
2627const VLOCITY_OPEN_INTERFACE2 = 'VlocityOpenInterface2' ;
2728const VLOCITY_OPEN_INTERFACE = 'VlocityOpenInterface' ;
2829
29- export class ApexMigration extends BaseRelatedObjectMigration implements RelatedObjectsMigrate {
30+ export class ApexMigration extends BaseRelatedObjectMigration {
3031 private readonly callableInterface : InterfaceImplements ;
3132 private readonly vlocityOpenInterface2 : InterfaceImplements ;
3233 private readonly vlocityOpenInterface : InterfaceImplements ;
@@ -43,25 +44,24 @@ export class ApexMigration extends BaseRelatedObjectMigration implements Related
4344 public identifyObjects ( migrationResults : MigrationResult [ ] ) : Promise < JSON [ ] > {
4445 throw new Error ( 'Method not implemented.' ) ;
4546 }
46- public migrateRelatedObjects ( migrationResults : MigrationResult [ ] , migrationCandidates : JSON [ ] ) : string [ ] {
47+ public migrateRelatedObjects ( migrationResults : MigrationResult [ ] , migrationCandidates : JSON [ ] ) : ApexAssessmentInfo [ ] {
4748 return this . migrate ( ) ;
4849 }
49- public migrate ( ) : string [ ] {
50+ public migrate ( ) : ApexAssessmentInfo [ ] {
5051 const pwd = shell . pwd ( ) ;
5152 shell . cd ( this . projectPath ) ;
5253 const targetOrg : Org = this . org ;
53- // sfProject.retrieve(APEXCLASS, targetOrg.getUsername());
54+ sfProject . retrieve ( APEXCLASS , targetOrg . getUsername ( ) ) ;
5455 const apexAssessmentInfos = this . processApexFiles ( this . projectPath ) ;
55- sfProject . deploy ( APEXCLASS , targetOrg . getUsername ( ) ) ;
56+ // sfProject.deploy(APEXCLASS, targetOrg.getUsername());
5657 shell . cd ( pwd ) ;
57- return this . mapTOName ( apexAssessmentInfos ) ;
58+ return apexAssessmentInfos ;
5859 }
5960
6061 public assess ( ) : ApexAssessmentInfo [ ] {
6162 const pwd = shell . pwd ( ) ;
6263 shell . cd ( this . projectPath ) ;
63- // const targetOrg: Org = this.org;
64- // sfProject.retrieve(APEXCLASS, this.org.getUsername());
64+ sfProject . retrieve ( APEXCLASS , this . org . getUsername ( ) ) ;
6565 const apexAssessmentInfos = this . processApexFiles ( this . projectPath ) ;
6666 shell . cd ( pwd ) ;
6767 return apexAssessmentInfos ;
@@ -158,6 +158,19 @@ export class ApexMigration extends BaseRelatedObjectMigration implements Related
158158 for ( const tokenChange of namespaceChanges . get ( this . namespace ) )
159159 tokenUpdates . push ( new SingleTokenUpdate ( this . updatedNamespace , tokenChange ) ) ;
160160 }
161+
162+ const methodParameters = parser . methodParameters ;
163+ if ( methodParameters . size === 0 ) return tokenUpdates ;
164+ const drParameters = methodParameters . get ( ParameterType . DR_NAME ) ;
165+ if ( drParameters ) {
166+ for ( const token of drParameters ) {
167+ const newName = `'${ Stringutil . cleanName ( token . text ) } '` ;
168+ if ( token . text === newName ) continue ;
169+ Logger . logger . info ( `In Apex ${ file . name } DR name ${ token . text } will be updated to ${ newName } ` ) ;
170+ Logger . ux . log ( `In Apex ${ file . name } DR name ${ token . text } will be updated to ${ newName } ` ) ;
171+ tokenUpdates . push ( new SingleTokenUpdate ( newName , token ) ) ;
172+ }
173+ }
161174 return tokenUpdates ;
162175 }
163176
@@ -184,10 +197,10 @@ export class ApexMigration extends BaseRelatedObjectMigration implements Related
184197 }
185198 ` ;
186199 }
187-
188- private mapTOName ( apexAssessmentInfos : ApexAssessmentInfo [ ] ) : string [ ] {
189- return apexAssessmentInfos . map ( ( apexAssessmentInfo ) => {
190- return apexAssessmentInfo . name ;
191- } ) ;
192- }
200+ /*
201+ private mapTOName(apexAssessmentInfos: ApexAssessmentInfo[]): string[] {
202+ return apexAssessmentInfos.map((apexAssessmentInfo) => {
203+ return apexAssessmentInfo.name;
204+ });
205+ } */
193206}
0 commit comments