// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/AbstractPatch.java
// public abstract class AbstractPatch implements Serializable {
//     private static final long serialVersionUID = 4178101927323891639L;
//     private String name;
//     private int statementCount = -1;
//     private File file;
// 
//     public enum DbState {
//         COMMITTED, IN_PROGRESS, NOT_AVAILABLE
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public int getStatementCount() {
//         return statementCount;
//     }
// 
//     public void setStatementCount(int statementCount) {
//         this.statementCount = statementCount;
//     }
// 
//     public File getFile() {
//         return file;
//     }
// 
//     public void setFile(File file) {
//         this.file = file;
//     }
// 
//     public abstract void setDbDate(Date dbDate);
// 
//     public abstract void setDbState(DbState dbState);
// 
//     public abstract Date getDbDate();
// 
//     public abstract DbState getDbState();
// 
//     public abstract boolean canApply();
// 
//     public String toString() {
//         return super.toString() + "-" + name;
//     }
// 
//     public static String normalizeName(String name) {
//         String nameLC = name.toLowerCase();
//         while (nameLC.endsWith(".sql") || nameLC.endsWith(".undo") || nameLC.endsWith(".rollback")) {
//             int dot = nameLC.lastIndexOf('.');
//             nameLC = nameLC.substring(0, dot);
//         }
//         return name.substring(0, nameLC.length());
//     }
// 
// }
// 
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/ApplyStrategy.java
// public interface ApplyStrategy {
// 
//     /**
//      * @param connection connection
//      * @param patches all detected patches
//      * @return list of patches to apply
//      */
//     List<Patch> filter(Connection connection, List<Patch> patches);
// 
// }
// 
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/EnvSettings.java
// public class EnvSettings {
//     private final String prefix;
// 
//     private EnvSettings(String prefix) {
//         this.prefix = prefix;
//     }
// 
//     public String getDbPatchFile() {
//         return prefix + "dbpatch.file";
//     }
// 
//     public String getDbPatchConfiguration() {
//         return prefix + "dbpatch.configuration";
//     }
// 
//     public String getDbPatchStop() {
//         return prefix + "dbpatch.stop";
//     }
// 
//     public String getDbPatchSingle() {
//         return prefix + "dbpatch.single";
//     }
// 
//     public String getLogLevel() {
//         return prefix + "dbpatch.logLevel";
//     }
// 
//     public static EnvSettings standalone() {
//         return new EnvSettings("");
//     }
// 
//     public static EnvSettings maven() {
//         return new EnvSettings("maven.");
//     }
// 
//     public static EnvSettings gradle() {
//         return new EnvSettings("gradle.");
//     }
// 
// }


import org.jsoftware.dbpatch.config.AbstractPatch;
import org.jsoftware.dbpatch.config.ApplyStrategy;
import org.jsoftware.dbpatch.config.EnvSettings;
import org.jsoftware.dbpatch.config.Patch;
import java.io.IOException;
import java.util.List;
package org.jsoftware.dbpatch.command;




/**
 * Command:Show list of patches
 *
 * @author szalik
 */
public class ListCommand extends AbstractListCommand<Patch> {

    public ListCommand(EnvSettings envSettings) {
        super(envSettings);
    }


    protected List<Patch> generateList(List<Patch> inList) throws IOException {
        ApplyStrategy strategy = configurationEntry.getApplyStarters();
        log.debug("Apply strategy is " + strategy.getClass().getSimpleName() + ", configurationId:" + configurationEntry.getId());
        List<Patch> patchesToApply = strategy.filter(manager.getConnection(), inList);
        StringBuilder sb = new StringBuilder("Patch list:\n");
        for (Patch p : inList) {
            getConfigurationEntry().getPatchParser().parse(p, getConfigurationEntry());
            sb.append('\t');
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/AbstractPatch.java
// public abstract class AbstractPatch implements Serializable {
//     private static final long serialVersionUID = 4178101927323891639L;
//     private String name;
//     private int statementCount = -1;
//     private File file;
// 
//     public enum DbState {
//         COMMITTED, IN_PROGRESS, NOT_AVAILABLE
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public int getStatementCount() {
//         return statementCount;
//     }
// 
//     public void setStatementCount(int statementCount) {
//         this.statementCount = statementCount;
//     }
// 
//     public File getFile() {
//         return file;
//     }
// 
//     public void setFile(File file) {
//         this.file = file;
//     }
// 
//     public abstract void setDbDate(Date dbDate);
// 
//     public abstract void setDbState(DbState dbState);
// 
//     public abstract Date getDbDate();
// 
//     public abstract DbState getDbState();
// 
//     public abstract boolean canApply();
// 
//     public String toString() {
//         return super.toString() + "-" + name;
//     }
// 
//     public static String normalizeName(String name) {
//         String nameLC = name.toLowerCase();
//         while (nameLC.endsWith(".sql") || nameLC.endsWith(".undo") || nameLC.endsWith(".rollback")) {
//             int dot = nameLC.lastIndexOf('.');
//             nameLC = nameLC.substring(0, dot);
//         }
//         return name.substring(0, nameLC.length());
//     }
// 
// }
// 
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/ApplyStrategy.java
// public interface ApplyStrategy {
// 
//     /**
//      * @param connection connection
//      * @param patches all detected patches
//      * @return list of patches to apply
//      */
//     List<Patch> filter(Connection connection, List<Patch> patches);
// 
// }
// 
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/EnvSettings.java
// public class EnvSettings {
//     private final String prefix;
// 
//     private EnvSettings(String prefix) {
//         this.prefix = prefix;
//     }
// 
//     public String getDbPatchFile() {
//         return prefix + "dbpatch.file";
//     }
// 
//     public String getDbPatchConfiguration() {
//         return prefix + "dbpatch.configuration";
//     }
// 
//     public String getDbPatchStop() {
//         return prefix + "dbpatch.stop";
//     }
// 
//     public String getDbPatchSingle() {
//         return prefix + "dbpatch.single";
//     }
// 
//     public String getLogLevel() {
//         return prefix + "dbpatch.logLevel";
//     }
// 
//     public static EnvSettings standalone() {
//         return new EnvSettings("");
//     }
// 
//     public static EnvSettings maven() {
//         return new EnvSettings("maven.");
//     }
// 
//     public static EnvSettings gradle() {
//         return new EnvSettings("gradle.");
//     }
// 
// }


// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/command/ListCommand.java
import org.jsoftware.dbpatch.config.AbstractPatch;
import org.jsoftware.dbpatch.config.ApplyStrategy;
import org.jsoftware.dbpatch.config.EnvSettings;
import org.jsoftware.dbpatch.config.Patch;
import java.io.IOException;
import java.util.List;

package org.jsoftware.dbpatch.command;




/**
 * Command:Show list of patches
 *
 * @author szalik
 */
public class ListCommand extends AbstractListCommand<Patch> {

    public ListCommand(EnvSettings envSettings) {
        super(envSettings);
    }


    protected List<Patch> generateList(List<Patch> inList) throws IOException {
        ApplyStrategy strategy = configurationEntry.getApplyStarters();
        log.debug("Apply strategy is " + strategy.getClass().getSimpleName() + ", configurationId:" + configurationEntry.getId());
        List<Patch> patchesToApply = strategy.filter(manager.getConnection(), inList);
        StringBuilder sb = new StringBuilder("Patch list:\n");
        for (Patch p : inList) {
            getConfigurationEntry().getPatchParser().parse(p, getConfigurationEntry());
            sb.append('\t');
            if (p.getDbState() == AbstractPatch.DbState.COMMITTED) {