Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
*
* Copyright (C) 2012-2013 DuyHai DOAN
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package info.archinnov.achilles.entity.operations.impl;
import info.archinnov.achilles.composite.ThriftCompositeFactory;
import info.archinnov.achilles.context.ThriftPersistenceContext;
import info.archinnov.achilles.context.execution.SafeExecutionContext;
import info.archinnov.achilles.dao.ThriftGenericWideRowDao;
import info.archinnov.achilles.entity.metadata.EntityMeta;
import info.archinnov.achilles.entity.metadata.PropertyMeta;
import info.archinnov.achilles.iterator.ThriftCounterSliceIterator;
import info.archinnov.achilles.iterator.ThriftSliceIterator;
import info.archinnov.achilles.query.SliceQuery;
import info.archinnov.achilles.type.ConsistencyLevel;
import java.util.List;
import me.prettyprint.hector.api.beans.Composite;
import me.prettyprint.hector.api.beans.HColumn;
import me.prettyprint.hector.api.beans.HCounterColumn;
import me.prettyprint.hector.api.mutation.Mutator;
public class ThriftQueryExecutorImpl {
private ThriftCompositeFactory compositeFactory = new ThriftCompositeFactory();
public List> findColumns(final SliceQuery sliceQuery,
ThriftPersistenceContext context) {
final ThriftGenericWideRowDao wideRowDao = context.getWideRowDao();
final Composite[] composites = compositeFactory.createForClusteredQuery(sliceQuery);
final Object rowKey = compositeFactory.buildRowKey(context);
return context.executeWithReadConsistencyLevel(new SafeExecutionContext>>() {
@Override
public List> execute() {
return wideRowDao.findRawColumnsRange(rowKey, composites[0], composites[1], sliceQuery.getLimit(),
sliceQuery.getOrdering().isReverse());
}
}, sliceQuery.getConsistencyLevel());
}
public ThriftSliceIterator