// Path: src/de/neuland/firefly/changes/Change.java
// public static class ChangeModifiedException extends Exception {
//     public ChangeModifiedException(Change change) {
//         super("Change " + change.getFile() + ":" + change.getAuthor() + ":" + change.getId() + " has been modified since execution.");
//     }
// }
// 
// Path: src/de/neuland/firefly/extensionfinder/FireflyExtensionRepository.java
// @Repository
// @Scope("prototype")
// public class FireflyExtensionRepository {
//     @Autowired ModelService modelService;
//     @Autowired FlexibleSearchService searchService;
// 
//     public FireflyExtensionModel findByName(String name) throws FireflyExtensionNotFoundException, FireflyNotInstalledException {
//         final FlexibleSearchQuery query = new FlexibleSearchQuery(
//                         "SELECT {" + FireflyExtensionModel.PK + "} " +
//                         "FROM {" + FireflyExtensionModel._TYPECODE + "} " +
//                         "WHERE {" + FireflyExtensionModel.NAME + "} = ?name");
//         query.addQueryParameter("name", name);
//         try {
//             return searchService.searchUnique(query);
//         } catch (FlexibleSearchException e) {
//             throw new FireflyNotInstalledException(e);
//         } catch (ModelNotFoundException e) {
//             throw new FireflyExtensionNotFoundException(name);
//         }
//     }
// 
//     public FireflyExtensionModel create(String name) {
//         Assert.hasText(name);
//         FireflyExtensionModel result = new FireflyExtensionModel();
//         result.setName(name);
//         result.setStates(new ArrayList<FireflyExtensionStateModel>());
//         return result;
//     }
// 
//     public void save(FireflyExtensionModel model) {
//         modelService.save(model);
//     }
// 
//     public static class FireflyNotInstalledException extends RuntimeException {
//         public FireflyNotInstalledException(Exception e) {
//             super(e);
//         }
//     }
// 
//     public static class FireflyExtensionNotFoundException extends Exception {
//         private String name;
// 
//         public FireflyExtensionNotFoundException(String name) {
//             super("No " + FireflyExtensionModel._TYPECODE + " found for name=" + name);
//             this.name = name;
//         }
// 
//         public String getName() {
//             return name;
//         }
//     }
// }


import de.neuland.firefly.changes.Change.ChangeModifiedException;
import de.neuland.firefly.extensionfinder.FireflyExtensionRepository;
import de.neuland.firefly.model.FireflyMigrationModel;
import java.util.ArrayList;
import java.util.List;
import static java.util.Collections.unmodifiableList;
        return unmodifiableList(changes);
    }

    boolean contains(String file, String author, String id) {
        for (Change change : changes) {
            if (file.equals(change.getFile()) &&
                author.equals(change.getAuthor()) &&
                id.equals(change.getId())) {
                return true;
            }
        }
        return false;
    }

    public List<Change> getChangesThatRequiredExecution() throws ChangeModifiedException {
        List<Change> result = new ArrayList<>();
        for (Change change : getChanges()) {
            if (change.executionRequired()) {
                result.add(change);
            }
        }
        return result;
    }

    public void executeChanges(FireflyMigrationModel migration) throws ChangeExecutionException, ChangeModifiedException, PreconditionFailedException {
        for (Change change : getChangesThatRequiredExecution()) {
            change.execute(migration);
        }
    }

// Path: src/de/neuland/firefly/changes/Change.java
// public static class ChangeModifiedException extends Exception {
//     public ChangeModifiedException(Change change) {
//         super("Change " + change.getFile() + ":" + change.getAuthor() + ":" + change.getId() + " has been modified since execution.");
//     }
// }
// 
// Path: src/de/neuland/firefly/extensionfinder/FireflyExtensionRepository.java
// @Repository
// @Scope("prototype")
// public class FireflyExtensionRepository {
//     @Autowired ModelService modelService;
//     @Autowired FlexibleSearchService searchService;
// 
//     public FireflyExtensionModel findByName(String name) throws FireflyExtensionNotFoundException, FireflyNotInstalledException {
//         final FlexibleSearchQuery query = new FlexibleSearchQuery(
//                         "SELECT {" + FireflyExtensionModel.PK + "} " +
//                         "FROM {" + FireflyExtensionModel._TYPECODE + "} " +
//                         "WHERE {" + FireflyExtensionModel.NAME + "} = ?name");
//         query.addQueryParameter("name", name);
//         try {
//             return searchService.searchUnique(query);
//         } catch (FlexibleSearchException e) {
//             throw new FireflyNotInstalledException(e);
//         } catch (ModelNotFoundException e) {
//             throw new FireflyExtensionNotFoundException(name);
//         }
//     }
// 
//     public FireflyExtensionModel create(String name) {
//         Assert.hasText(name);
//         FireflyExtensionModel result = new FireflyExtensionModel();
//         result.setName(name);
//         result.setStates(new ArrayList<FireflyExtensionStateModel>());
//         return result;
//     }
// 
//     public void save(FireflyExtensionModel model) {
//         modelService.save(model);
//     }
// 
//     public static class FireflyNotInstalledException extends RuntimeException {
//         public FireflyNotInstalledException(Exception e) {
//             super(e);
//         }
//     }
// 
//     public static class FireflyExtensionNotFoundException extends Exception {
//         private String name;
// 
//         public FireflyExtensionNotFoundException(String name) {
//             super("No " + FireflyExtensionModel._TYPECODE + " found for name=" + name);
//             this.name = name;
//         }
// 
//         public String getName() {
//             return name;
//         }
//     }
// }


// Path: src/de/neuland/firefly/changes/ChangeList.java
import de.neuland.firefly.changes.Change.ChangeModifiedException;
import de.neuland.firefly.extensionfinder.FireflyExtensionRepository;
import de.neuland.firefly.model.FireflyMigrationModel;
import java.util.ArrayList;
import java.util.List;
import static java.util.Collections.unmodifiableList;

        return unmodifiableList(changes);
    }

    boolean contains(String file, String author, String id) {
        for (Change change : changes) {
            if (file.equals(change.getFile()) &&
                author.equals(change.getAuthor()) &&
                id.equals(change.getId())) {
                return true;
            }
        }
        return false;
    }

    public List<Change> getChangesThatRequiredExecution() throws ChangeModifiedException {
        List<Change> result = new ArrayList<>();
        for (Change change : getChanges()) {
            if (change.executionRequired()) {
                result.add(change);
            }
        }
        return result;
    }

    public void executeChanges(FireflyMigrationModel migration) throws ChangeExecutionException, ChangeModifiedException, PreconditionFailedException {
        for (Change change : getChangesThatRequiredExecution()) {
            change.execute(migration);
        }
    }

    public void markChangesAsExecuted(FireflyMigrationModel migration) throws ChangeModifiedException, FireflyExtensionRepository.FireflyExtensionNotFoundException {