Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3998307c authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

rewrite constructor of Process.java, PreparationProcess.java and update...

rewrite constructor of Process.java, PreparationProcess.java and update DeviceHelper to use new constructor
parent 379ce95e
Loading
Loading
Loading
Loading
+7 −13
Original line number Diff line number Diff line
@@ -99,10 +99,9 @@ public class DeviceHelper {

        final Map yamlContent = loadYaml(adbDevice+"_flash.yml");
        final int stepsCount = (Integer) yamlContent.get("stepsCount");
        final Process flashingProcess = new Process(stepsCount);
        HashMap<String, IStep> steps = parseSteps( (HashMap) yamlContent.get("steps") );

        flashingProcess.setSteps(steps );
        final HashMap<String, IStep> steps = parseSteps( (HashMap) yamlContent.get("steps") );
        //@TODO: check if steps is null, etc.
        final Process flashingProcess = new Process(stepsCount, steps);

        return flashingProcess;
    }
@@ -121,16 +120,11 @@ public class DeviceHelper {

        final HashMap yamlContent = loadYaml(adbDevice+"_preparation.yml");
        final int stepsCount = (Integer) yamlContent.get("stepsCount");
        final PreparationProcess prepProcess = new PreparationProcess(stepsCount);
        HashMap<String, IStep> steps = parseSteps( (HashMap) yamlContent.get("steps") );
        
        prepProcess.setSteps(steps );
        
        final HashMap<String, IStep> steps = parseSteps( (HashMap) yamlContent.get("steps") );
        final HashMap<String, RomSource> sourcesToDownload = ConfigParser.parseSourcesToDownload( (HashMap) yamlContent.get("sources"));
        
        prepProcess.setSourcesToDownload(sourcesToDownload);

        //@TODO: check if steps is null, etc.
        final PreparationProcess prepProcess = new PreparationProcess(stepsCount, steps, sourcesToDownload);
        return prepProcess;
        
    }
}
 No newline at end of file
+5 −13
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
 */
package ecorp.easy.installer.models;

import ecorp.easy.installer.models.steps.IStep;
import java.util.HashMap;

/**
@@ -32,9 +33,9 @@ public class PreparationProcess extends Process{
     * 
     * @param stepCount number of step in the process 
     */
    public PreparationProcess(int stepCount){
        super(stepCount);
        sourcesToDownload = new HashMap<>();
    public PreparationProcess(int stepCount, HashMap<String, IStep> steps, HashMap<String, RomSource> sources){
        super(stepCount, steps);
        sourcesToDownload = sources;
    }
    
    /**
@@ -44,13 +45,4 @@ public class PreparationProcess extends Process{
    public final HashMap<String, RomSource> getSourcesToDownload() {
        return sourcesToDownload;
    } 
    

    /**
     * define list of sources to download
     * @param sourcesToDownload 
     */
    public void setSourcesToDownload(HashMap<String, RomSource> sourcesToDownload) {
        this.sourcesToDownload = sourcesToDownload;
    }    
}
 No newline at end of file
+3 −10
Original line number Diff line number Diff line
@@ -34,10 +34,11 @@ public class Process {
     * Constructor of ProcessMould
     * Create an empty list of steps
     * @param stepCount int number of step used for FlashProcess
     * @param steps HashMap<String, IStep> list of steps
     */
    public Process(int stepCount){
    public Process(int stepCount, HashMap<String, IStep> steps){
        this.stepsCount = stepCount;
        this.steps = new HashMap<>();
        this.steps = steps;
    }
    
    /**
@@ -56,14 +57,6 @@ public class Process {
        return steps;
    }
    
    /**
     * Replace current steps by the new one
     * @param steps the new steps
     */
    public void setSteps(HashMap<String, IStep> steps) {
        this.steps = steps;
    }
    
    /**
     * Add a step object
     * @param key