@@ -62,7 +62,7 @@ export class Step {
6262 return step ;
6363 }
6464
65- static fromJSON ( json ) {
65+ static fromJSON ( json , projectDirectory , databases ) {
6666 const newStep = new Step ( ) ;
6767 if ( json . id ) {
6868 newStep . id = json . id ;
@@ -79,28 +79,47 @@ export class Step {
7979 if ( json . stepDefinitionType ) {
8080 newStep . stepDefinitionType = json . stepDefinitionType ;
8181 }
82- if ( json . isValid ) {
83- newStep . isValid = json . isValid ;
84- }
8582 if ( json . fileLocations ) {
8683 newStep . fileLocations = json . fileLocations ;
8784 }
85+ if ( json . isValid ) {
86+ newStep . isValid = json . isValid ;
87+ }
8888 if ( json . modulePath ) {
8989 newStep . modulePath = json . modulePath ;
9090 }
9191 // Check options
9292 if ( json . options ) {
93+ // set defaults for each step type
9394 if ( json . stepDefinitionType === StepType . INGESTION ) {
95+ // Hard check to see if it's default gradle step
96+ if ( json . fileLocations . inputFilePath === 'path/to/folder' ) {
97+ const fileLocations = {
98+ inputFilePath : projectDirectory ,
99+ inputFileType : 'json' ,
100+ outputURIReplacement : ''
101+ } ;
102+ newStep . fileLocations = fileLocations ;
103+ }
94104 newStep . options = new IngestionOptions ( ) ;
105+ newStep . options . permissions = 'rest-reader,read,rest-writer,update' ;
106+ newStep . options . outputFormat = 'json' ;
107+ newStep . options . targetDatabase = databases . final ;
95108 }
96109 if ( json . stepDefinitionType === StepType . MAPPING ) {
97110 newStep . options = new MappingOptions ( ) ;
111+ newStep . options . sourceDatabase = databases . staging ;
112+ newStep . options . targetDatabase = databases . final ;
98113 }
99114 if ( json . stepDefinitionType === StepType . MASTERING ) {
100115 newStep . options = new MasteringOptions ( ) ;
116+ newStep . options . sourceDatabase = databases . final ;
117+ newStep . options . targetDatabase = databases . final ;
101118 }
102119 if ( json . stepDefinitionType === StepType . CUSTOM ) {
103120 newStep . options = new CustomOptions ( ) ;
121+ newStep . options . sourceDatabase = databases . staging ;
122+ newStep . options . targetDatabase = databases . final ;
104123 }
105124 const newOptions = Object . assign ( newStep . options , json . options ) ;
106125 newStep . options = newOptions ;
0 commit comments