Package org.easycassandra

Examples of org.easycassandra.FieldInformation


     * @return
     */
    protected ResultSet executeQuery(Object key, Class<?> bean,
            Session session, QueryBean byKeyBean) {

        FieldInformation fieldInformation = findKey(key, bean, byKeyBean);
        if (fieldInformation.isEmbedded()) {
            return executeComplexKey(key, session, byKeyBean);
        } else {
            return executeSingleKey(key, session, byKeyBean);
        }
    }
View Full Code Here


    protected FieldInformation findKey(Object key, Class<?> bean,
            QueryBean byKeyBean) {
        defineSearchField(byKeyBean, bean);

        FieldInformation fieldInformation = byKeyBean.getSearchField();

        if (!key.getClass().equals(fieldInformation.getField().getType())) {
            createKeyProblemMensage(key, fieldInformation.getField().getType());
        }
        return fieldInformation;
    }
View Full Code Here

        KeySpaceInformation keyInformation = classInformations.getKeySpace(keySpace);

        Update update = QueryBuilder.update(keyInformation.getKeySpace(),
                        keyInformation.getColumnFamily());

        FieldInformation keyField = classInformations.getKeyInformation();
        if (classInformations.isComplexKey()) {
            runComplexKey(update, key, keyField.getSubFields().getFields());
        } else {
            update.where(QueryBuilder.eq(keyField.getName(), key));
        }
        return update;
    }
View Full Code Here

    }

    public <T> void deleteByKeyAsync(T bean, Session session,
            ConsistencyLevel consistency) {
        ClassInformation classInformation = ClassInformations.INSTACE.getClass(bean.getClass());
        FieldInformation keyField = classInformation.getKeyInformation();

        deleteByKeyAsync(
                ReflectionUtil.INSTANCE.getMethod(bean, keyField.getField()),
                bean.getClass(), session, consistency);
    }
View Full Code Here


    private ResultSetFuture executeQueryAsync(Object key, Class<?> bean,
            Session session, QueryBean byKeyBean) {

        FieldInformation fieldInformation = findKey(key, bean, byKeyBean);
        if (fieldInformation.isEmbedded()) {
            return executeComplexKeyAsync(key, session, byKeyBean);
        } else {
            return executeSingleKeyAsync(key, session, byKeyBean);
        }
    }
View Full Code Here

    public <T, I> List<T> findByKeyAndIndex(Object key, I index, Class<T> bean,
            Session session, ConsistencyLevel consistency) {
        ClassInformation classInformation = ClassInformations.INSTACE.getClass(bean);

        FindByIndexQuery.checkFieldNull(bean, classInformation.getFields());
        FieldInformation indexField = classInformation.getIndexFields().get(0);

        return findByKeyAndIndex(key, indexField.getName(), index, bean, session,
                consistency);
    }
View Full Code Here

    public <T, I> List<T> findByKeyAndIndex(Object key, I indexStart,
            I indexEnd, boolean inclusive, Class<T> bean, Session session,
            ConsistencyLevel consistency) {
        ClassInformation classInformation = ClassInformations.INSTACE.getClass(bean);
        FindByIndexQuery.checkFieldNull(bean, classInformation.getIndexFields());
        FieldInformation indexField = classInformation.getIndexFields().get(0);
        return findByKeyAndIndex(key, indexField.getName(), indexStart, indexEnd,
                inclusive, bean, session, consistency);
    }
View Full Code Here

    private void isKeyNull(Object bean, ClassInformation classInformation) {

        if (classInformation.isComplexKey()) {

            FieldInformation keyInformation = classInformation.getKeyInformation();

            verifyKeyNull(ReflectionUtil.INSTANCE.getMethod(bean,
                    keyInformation.getField()), keyInformation.getSubFields()
                    .getFields());
        } else {
            verifyKeyNull(bean, Arrays.asList(classInformation.getKeyInformation()));
        }
View Full Code Here

     * add in the query a simple id.
     * @param class1
     * @param cqlCreateTable
     */
    private void addSimpleId(ClassInformation classInformation, StringBuilder cqlCreateTable) {
        FieldInformation keyField = classInformation.getKeyInformation();
        if (keyField == null) {
            createErro(classInformation);
        }
        cqlCreateTable.append(QUERY_PRIMARY_KEY)
                .append(keyField.getName())
                .append(") );");
    }
View Full Code Here

     * @param classInformation
     * @param cqlCreateTable
     */
    private void addComlexID(ClassInformation classInformation, StringBuilder cqlCreateTable) {

        FieldInformation keyField = classInformation.getKeyInformation();
        cqlCreateTable.append(QUERY_PRIMARY_KEY);
        boolean firstTime = true;
        if (keyField == null) {
            createErro(classInformation);
        }
        for (FieldInformation subKey : keyField.getSubFields().getFields()) {
            if (firstTime) {
                cqlCreateTable.append(subKey.getName());
                firstTime = false;
            } else {
                cqlCreateTable.append(",").append(subKey.getName());
View Full Code Here

TOP

Related Classes of org.easycassandra.FieldInformation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.