com.chutneytesting.admin.domain.Backup Maven / Gradle / Ivy
package com.chutneytesting.admin.domain;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
public class Backup {
public final static DateTimeFormatter backupIdTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
public final LocalDateTime time;
public final boolean homePage;
public final boolean agentsNetwork;
public final boolean environments;
public final boolean components;
public final boolean globalVars;
public final boolean jiraLinks;
public Backup(boolean homePage, boolean agentsNetwork, boolean environments, boolean components, boolean globalVars, boolean jiraLinks) {
if (!(homePage || agentsNetwork || environments || components || globalVars || jiraLinks)) {
throw new IllegalArgumentException("Nothing to backup !!");
}
this.time = LocalDateTime.now().truncatedTo(ChronoUnit.SECONDS);
this.homePage = homePage;
this.agentsNetwork = agentsNetwork;
this.environments = environments;
this.components = components;
this.globalVars = globalVars;
this.jiraLinks = jiraLinks;
}
public Backup(String id, Boolean homePage, Boolean agentsNetwork, Boolean environments, Boolean components, Boolean globalVars, Boolean jiraLinks) {
this.time = LocalDateTime.parse(id, backupIdTimeFormatter);
this.homePage = homePage;
this.agentsNetwork = agentsNetwork;
this.environments = environments;
this.components = components;
this.globalVars = globalVars;
this.jiraLinks = jiraLinks;
}
public String id() {
return this.time.format(backupIdTimeFormatter);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy