ChronoModel.java

package org.docascode.chrono;

import org.docascode.utils.DocAsCodeException;

import java.io.File;
import java.util.HashMap;

public class ChronoModel {
    private HashMap<String,FileModel> chronoHashMap = new HashMap<>();

    public void put(String chrono, String outputPath, String output){
        this.chronoHashMap.get(chrono).put(outputPath, output);
    }

    public void add(String chrono,String input) throws DocAsCodeException {
        if (this.chronoHashMap.containsKey(chrono)){
            throw new DocAsCodeException("Chrono "+chrono+" already exists.");
        } else {
            FileModel fileModel = new FileModel(input);
            this.chronoHashMap.put(chrono, fileModel);
        }
    }

    public void attach(String chrono, String classifier, String input) {
        this.chronoHashMap.get(chrono).attach(classifier,input);
    }

    public void put(String chrono, String classifier, String outputPath, String output){
        this.chronoHashMap.get(chrono).put(classifier, outputPath, output);
    }

    public String getInput(String chrono){
        return this.chronoHashMap.get(chrono).getInput();
    }

    public String getOutput(String chrono, String outputPath){
        return this.chronoHashMap.get(chrono).getOutput(outputPath);
    }

    public String getInput(String chrono, String classifier){
        return this.chronoHashMap.get(chrono).getInput(classifier);
    }

    public String getOutput(String chrono, String classifier, String outputPath){
        return this.chronoHashMap.get(chrono).getOutput(classifier, outputPath);
    }
}