// Path: acpg-lib/src/main/java/org/jraf/acpg/lib/GeneratorException.java
// public class GeneratorException extends Exception {
//     public GeneratorException(String message) {
//         super(message);
//     }
// 
//     public GeneratorException(String message, Throwable cause) {
//         super(message, cause);
//     }
// }


import org.apache.commons.lang.WordUtils;
import org.jraf.acpg.lib.GeneratorException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
    private static final String DOT = "\".\"";
    private static final String AS = "\" AS \"";
    private static final String PREFIX = ".PREFIX_";

    private static final Map<String, Entity> ALL_ENTITIES = new HashMap<>();

    private final String mName;
    private final List<Field> mFields = new ArrayList<>();
    private final List<Constraint> mConstraints = new ArrayList<>();
    private final String mDocumentation;
    private final List<SortOrder> mSortOrders = new ArrayList<>();

    public Entity(String name, String documentation) {
        mName = name;
        mDocumentation = documentation;
        ALL_ENTITIES.put(name, this);
    }

    public void addField(Field field) {
        mFields.add(field);
    }

    public void addField(int index, Field field) {
        mFields.add(index, field);
    }

    public List<Field> getFields() {
        return Collections.unmodifiableList(mFields);
    }

// Path: acpg-lib/src/main/java/org/jraf/acpg/lib/GeneratorException.java
// public class GeneratorException extends Exception {
//     public GeneratorException(String message) {
//         super(message);
//     }
// 
//     public GeneratorException(String message, Throwable cause) {
//         super(message, cause);
//     }
// }


// Path: acpg-lib/src/main/java/org/jraf/acpg/lib/model/Entity.java
import org.apache.commons.lang.WordUtils;
import org.jraf.acpg.lib.GeneratorException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;

    private static final String DOT = "\".\"";
    private static final String AS = "\" AS \"";
    private static final String PREFIX = ".PREFIX_";

    private static final Map<String, Entity> ALL_ENTITIES = new HashMap<>();

    private final String mName;
    private final List<Field> mFields = new ArrayList<>();
    private final List<Constraint> mConstraints = new ArrayList<>();
    private final String mDocumentation;
    private final List<SortOrder> mSortOrders = new ArrayList<>();

    public Entity(String name, String documentation) {
        mName = name;
        mDocumentation = documentation;
        ALL_ENTITIES.put(name, this);
    }

    public void addField(Field field) {
        mFields.add(field);
    }

    public void addField(int index, Field field) {
        mFields.add(index, field);
    }

    public List<Field> getFields() {
        return Collections.unmodifiableList(mFields);
    }

    public List<Field> getFieldsIncludingJoins() throws GeneratorException {