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

Commit 66735393 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

remove unused import in ThreadFactory & delete deprecated 'Step' class because not used anymore

parent f0a63ef7
Loading
Loading
Loading
Loading
+0 −199
Original line number Diff line number Diff line
/* Copyright 2019-2020 - ECORP SAS 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
package ecorp.easy.installer.models;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * This class encapsulate data about a step in the flashing process
 * @author Vincent Bourgmayer
 * @deprecated 
 */
@Deprecated
public class Step {
    private StepUi ui; //Datas about user interface
    private String script;  //script's file script
    private String output;  //Key of output to store as common parameter
    private String afterSuccess; // index of next script if succeed
    private String afterFail; //index of next script if failure
    private Map<Integer, String> okCode;
    private Map<Integer, String> koCode;
    private Map<String, String> parameters; //parameters to add to the script //@TODO think if is possible to set only one map in Thread instance instead of in each Step.
    
    /**
     * Default constructor
     */
    public Step(){}
    
    /**
     * Copy constructor
     * Create a new instance with same value
     * @param s the step to copy
     */
    public Step (Step s){
        this.script = s.script;
        afterSuccess = s.afterSuccess;
        afterFail = s.afterFail;
        ui = s.ui;
        okCode = s.okCode;
        koCode = s.koCode;
        output = s.output;
        if(s.parameters != null){
            parameters = new LinkedHashMap<>();
            for(Map.Entry<String, String> param : s.parameters.entrySet()){
                parameters.put(param.getKey(), param.getValue());
            }
        }
    }

    /**
     * Get the name of the script to run
     * @return can be null
     */
    public String getScript() {
        return script;
    }

    /**
     * Set the name of the script to execute into this step
     * @param name 
     */
    public void setScript(String name) {
        this.script = name;
    }

    /**
     * In some particular case, a step can produce an output
     * that could be use later. This is the "output" of the step
     * @return can be null
     */
    public String getOutput() {
        return output;
    }

    /**
     * Set the output of the step
     * @param output 
     */
    public void setOutput(String output) {
        this.output = output;
    }

    /**
     * List of parameters that should be integrated in
     * the command to execute the step
     * @return 
     */
    public Map<String, String> getParameters() {
        return parameters;
    }

    /**
     * Replace the parameter list by a new one
     * @param parameters 
     */
    public void setParameters(LinkedHashMap<String, String> parameters) {
        this.parameters = parameters;
    }
    
    /**
     * Give the index of the next key to execute
     * if the current one succeed
     * @return can be null if not set
     */
     public String getAfterSuccess() {
        return afterSuccess;
    }

     /**
      * Define the key of the next step
      * in case of success
      * @param afterSuccess 
      */
    public void setAfterSuccess(String afterSuccess) {
        this.afterSuccess = afterSuccess;
    }

    /**
     * Get the index of the next step
     * in case of failure
     * @return can be null if not set
     */
    public String getAfterFail() {
        return afterFail;
    }

    /**
     * Set the index of the next step
     * in case of failure
     * @param afterFail 
     */
    public void setAfterFail(String afterFail) {
        this.afterFail = afterFail;
    }

    /**
     * Get the list of result code that correspond
     * to a success
     * @return can be null if not set
     */
    public Map<Integer, String> getOkCode() {
        return okCode;
    }

    /**
     * Define the list of success result's code
     * @param okCode 
     */
    public void setOkCode(Map<Integer, String> okCode) {
        this.okCode = okCode;
    }
    
    /**
     * Get the list of result code that
     * corresponds to a failure
     * @return can be null if not set
     */
    public Map<Integer, String> getKoCode() {
        return koCode;
    }

    /**
     * Set the list of result's codes that correspond
     * to a failure
     * @param koCode 
     */
    public void setKoCode(Map<Integer, String> koCode) {
        this.koCode = koCode;
    }
    
    /**
     * Get the StepUI object which encapsulate new value for UI.
     * It will be "null" if UI must not change.
     * @return null or StepUI instance
     */
    public StepUi getUI() {
        return ui;
    }

    /**
     * Define the UI's datas of the current step
     * @param ui can be null if not setted
     */
    public void setUI(StepUi ui) {
        this.ui = ui;
    }
}
+0 −3
Original line number Diff line number Diff line
@@ -15,12 +15,9 @@
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
package ecorp.easy.installer.threads;
import ecorp.easy.installer.models.StepUi;
import ecorp.easy.installer.AppConstants;
import ecorp.easy.installer.models.Command;
import ecorp.easy.installer.models.Phone;
import ecorp.easy.installer.models.ProcessMould;
import ecorp.easy.installer.models.Step;
import ecorp.easy.installer.models.steps.IStep;
import ecorp.easy.installer.utils.ConfigParser;
import ecorp.easy.installer.utils.IFlashHandler;