// Path: src/main/java/org/easycassandra/ClassInformations.java
// public enum ClassInformations {
// 
//     INSTACE;
//     /**
//      * field that contains all class on Cassandra.
//      * Key - qualifield
//      * value - the wrapper of class
//      */
//     private Map<String, ClassInformation> classMap;
// 
//     /**
//      * The integer class is used to enum how default.
//      */
//     public static final Class<?> DEFAULT_ENUM_CLASS = Integer.class;
// 
//     /**
//      * return the wrapper of class.
//      * @param clazz class to find
//      * @return {@link ClassInformation}
//      */
//     public ClassInformation getClass(Class<?> clazz) {
// 
//         if (classMap.get(clazz.getName()) == null) {
//             classMap.put(clazz.getName(), new ClassInformation(clazz));
//         }
//         return classMap.get(clazz.getName());
//     }
// 
//     {
//         classMap = Collections.synchronizedMap(new TreeMap<String, ClassInformation>());
//     }
// }
// 
// Path: src/main/java/org/easycassandra/FieldJavaNotEquivalentCQLException.java
// public class FieldJavaNotEquivalentCQLException extends EasyCassandraException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * Constructor to FieldJavaNotEquivalentCQLException.
//      * @param message information to log
//      */
//     public FieldJavaNotEquivalentCQLException(String message) {
//         super(message);
// 
//     }
// 
// }
// 
// Path: src/main/java/org/easycassandra/KeyProblemsException.java
// public class KeyProblemsException extends EasyCassandraException {
// 
//     /**
//      * Constructor to KeyProblemsException.
//      * @param message
//      *            information to log
//      */
//     public KeyProblemsException(String message) {
//         super(message);
// 
//     }
// 
// 	private static final long serialVersionUID = 1L;
// }


import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.easycassandra.ClassInformation;
import org.easycassandra.ClassInformations;
import org.easycassandra.FieldInformation;
import org.easycassandra.FieldJavaNotEquivalentCQLException;
import org.easycassandra.KeyProblemsException;
import org.easycassandra.persistence.cassandra.AddColumnUtil.AddColumn;
import org.easycassandra.persistence.cassandra.VerifyRowUtil.VerifyRow;
import com.datastax.driver.core.ColumnDefinitions.Definition;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Session;
import com.datastax.driver.core.exceptions.InvalidQueryException;
import com.datastax.driver.core.querybuilder.QueryBuilder;
import com.datastax.driver.core.querybuilder.Select;
import java.util.Collections;
import java.util.Comparator;
import org.easycassandra.Order;

     *            - field to add in column family
     */
    private void executeAlterTableAdd(ClassInformation classInformation, Session session,
            FieldInformation field) {
        StringBuilder cqlAlterTable = new StringBuilder();
        cqlAlterTable.append("ALTER TABLE ").append(classInformation.getNameSchema());
        cqlAlterTable.append(" ADD ");
        AddColumn addColumn = AddColumnUtil.INSTANCE.factory(field);
        cqlAlterTable.append(addColumn.addRow(field, RelationShipJavaCassandra.INSTANCE));
        cqlAlterTable.deleteCharAt(cqlAlterTable.length() - 1);
        cqlAlterTable.append(";");
        session.execute(cqlAlterTable.toString());
    }

    /**
     * Field Java isn't equivalents with CQL type create error mensage.
     * @param classInformation
     * @param field
     * @param cqlTypes
     */
    private void createMessageErro(ClassInformation classInformation,
            FieldInformation field, String cqlType) {
        StringBuilder erroMensage = new StringBuilder();
        erroMensage.append("In the objetc ").append(classInformation.getClass().getName());
        erroMensage.append(" the field ").append(field.getName());
        erroMensage.append(" of the type ").append(field.getField().getType().getName());
        erroMensage.append(" isn't equivalent with CQL type ").append(cqlType);
        erroMensage.append(" was expected: ").append(
                RelationShipJavaCassandra.INSTANCE.getJavaValue(cqlType
                        .toLowerCase()));

// Path: src/main/java/org/easycassandra/ClassInformations.java
// public enum ClassInformations {
// 
//     INSTACE;
//     /**
//      * field that contains all class on Cassandra.
//      * Key - qualifield
//      * value - the wrapper of class
//      */
//     private Map<String, ClassInformation> classMap;
// 
//     /**
//      * The integer class is used to enum how default.
//      */
//     public static final Class<?> DEFAULT_ENUM_CLASS = Integer.class;
// 
//     /**
//      * return the wrapper of class.
//      * @param clazz class to find
//      * @return {@link ClassInformation}
//      */
//     public ClassInformation getClass(Class<?> clazz) {
// 
//         if (classMap.get(clazz.getName()) == null) {
//             classMap.put(clazz.getName(), new ClassInformation(clazz));
//         }
//         return classMap.get(clazz.getName());
//     }
// 
//     {
//         classMap = Collections.synchronizedMap(new TreeMap<String, ClassInformation>());
//     }
// }
// 
// Path: src/main/java/org/easycassandra/FieldJavaNotEquivalentCQLException.java
// public class FieldJavaNotEquivalentCQLException extends EasyCassandraException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * Constructor to FieldJavaNotEquivalentCQLException.
//      * @param message information to log
//      */
//     public FieldJavaNotEquivalentCQLException(String message) {
//         super(message);
// 
//     }
// 
// }
// 
// Path: src/main/java/org/easycassandra/KeyProblemsException.java
// public class KeyProblemsException extends EasyCassandraException {
// 
//     /**
//      * Constructor to KeyProblemsException.
//      * @param message
//      *            information to log
//      */
//     public KeyProblemsException(String message) {
//         super(message);
// 
//     }
// 
// 	private static final long serialVersionUID = 1L;
// }


// Path: src/main/java/org/easycassandra/persistence/cassandra/FixColumnFamily.java
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.easycassandra.ClassInformation;
import org.easycassandra.ClassInformations;
import org.easycassandra.FieldInformation;
import org.easycassandra.FieldJavaNotEquivalentCQLException;
import org.easycassandra.KeyProblemsException;
import org.easycassandra.persistence.cassandra.AddColumnUtil.AddColumn;
import org.easycassandra.persistence.cassandra.VerifyRowUtil.VerifyRow;
import com.datastax.driver.core.ColumnDefinitions.Definition;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Session;
import com.datastax.driver.core.exceptions.InvalidQueryException;
import com.datastax.driver.core.querybuilder.QueryBuilder;
import com.datastax.driver.core.querybuilder.Select;
import java.util.Collections;
import java.util.Comparator;
import org.easycassandra.Order;

     *            - field to add in column family
     */
    private void executeAlterTableAdd(ClassInformation classInformation, Session session,
            FieldInformation field) {
        StringBuilder cqlAlterTable = new StringBuilder();
        cqlAlterTable.append("ALTER TABLE ").append(classInformation.getNameSchema());
        cqlAlterTable.append(" ADD ");
        AddColumn addColumn = AddColumnUtil.INSTANCE.factory(field);
        cqlAlterTable.append(addColumn.addRow(field, RelationShipJavaCassandra.INSTANCE));
        cqlAlterTable.deleteCharAt(cqlAlterTable.length() - 1);
        cqlAlterTable.append(";");
        session.execute(cqlAlterTable.toString());
    }

    /**
     * Field Java isn't equivalents with CQL type create error mensage.
     * @param classInformation
     * @param field
     * @param cqlTypes
     */
    private void createMessageErro(ClassInformation classInformation,
            FieldInformation field, String cqlType) {
        StringBuilder erroMensage = new StringBuilder();
        erroMensage.append("In the objetc ").append(classInformation.getClass().getName());
        erroMensage.append(" the field ").append(field.getName());
        erroMensage.append(" of the type ").append(field.getField().getType().getName());
        erroMensage.append(" isn't equivalent with CQL type ").append(cqlType);
        erroMensage.append(" was expected: ").append(
                RelationShipJavaCassandra.INSTANCE.getJavaValue(cqlType
                        .toLowerCase()));

        throw new FieldJavaNotEquivalentCQLException(erroMensage.toString());
