Package org.easycassandra

Examples of org.easycassandra.ClassInformation


    super(keySpace);
  }

    public <T, I> List<T> findByIndex(I index, Class<T> bean, Session session,
            ConsistencyLevel consistency) {
        ClassInformation classInformation = ClassInformations.INSTACE.getClass(bean);
        List<FieldInformation> fields = classInformation.getIndexFields();
        checkFieldNull(bean, fields);
        return findByIndex(fields.get(0).getName(), index, bean, session, consistency);
    }
View Full Code Here


        return RecoveryObject.INTANCE.recoverObjet(bean, resultSet);
    }

    protected <T> void prepareIndex(String indexName, Class<T> bean,
            QueryBean byKeyBean) {
        ClassInformation classInformation = ClassInformations.INSTACE.getClass(bean);

        byKeyBean.setSearchField(classInformation.findIndexByName(indexName));
        checkIndexProblem(bean, byKeyBean);
    }
View Full Code Here

        ResultSet resultSet = session.execute(select);
        return resultSet.all().get(0).getLong(0);
    }

    protected Select prepareCount(Class<?> bean, ConsistencyLevel consistency) {
        ClassInformation classInformation = ClassInformations.INSTACE.getClass(bean);
        KeySpaceInformation key = classInformation.getKeySpace(keySpace);
        Select select = QueryBuilder.select().countAll()
                .from(key.getKeySpace(), key.getColumnFamily());
        select.setConsistencyLevel(consistency);
        return select;
    }
View Full Code Here

        }

        return null;
    }
    protected void defineSearchField(QueryBean byKeyBean, Class<?> bean) {
        ClassInformation classInformation = ClassInformations.INSTACE.getClass(bean);
        byKeyBean.setSearchField(classInformation.getKeyInformation());
    }
View Full Code Here

        return session.execute(byKeyBean.getSelect());

    }

    protected void executeEqKey(Object key, QueryBean byKeyBean) {
        ClassInformation classInformation = ClassInformations.INSTACE.getClass(key.getClass());

        for (FieldInformation complexKey : classInformation.getFields()) {

            byKeyBean.getSelect().where(
                    QueryBuilder.eq(
                            complexKey.getName(),
                            ReflectionUtil.INSTANCE.getMethod(key,
View Full Code Here

    public Update runUpdate(Object key, Class<?> bean) {
        if (key == null) {
            throw new KeyProblemsException(
                    "The parameter key to column family should be passed");
        }
        ClassInformation classInformations = ClassInformations.INSTACE.getClass(bean);
        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

        session.executeAsync(delete);
    }

    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

        super(keySpace);
    }

    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 <T> List<T> executeConditions(String indexName, Object indexStart,
            Object indexEnd, Boolean inclusive, Object key, Class<T> bean,
            Session session, QueryBean byKeyBean) {

        ClassInformation classInformation = ClassInformations.INSTACE.getClass(bean);
        super.prepare(byKeyBean, classInformation);
        if (classInformation.isComplexKey()) {
            for (FieldInformation complexKey : classInformation
                    .getKeyInformation().getSubFields().getFields()) {

                byKeyBean.getSelect().where(QueryBuilder.eq(complexKey.getName(),
                        ReflectionUtil.INSTANCE.getMethod(key, complexKey.getField())));
            }
        } else {
            byKeyBean.getSelect().where(QueryBuilder.eq(
                    classInformation.getKeyInformation().getName(), key));
        }

        // Add index criteria
        byKeyBean.setSearchField(classInformation.findIndexByName(indexName));
        FindByIndexQuery.checkIndexProblem(bean, byKeyBean);

        // Add indexed key
        if (indexEnd != null && inclusive != null) {
View Full Code Here

TOP

Related Classes of org.easycassandra.ClassInformation

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.