use of java.lang.Integer in project storio by pushtorefresh.
the class BoxedTypesMethodsConstructorStorIOSQLiteGetResolver method mapFromCursor.
/**
* {@inheritDoc}
*/
@Override
@NonNull
public BoxedTypesMethodsConstructor mapFromCursor(@NonNull Cursor cursor) {
Boolean field1 = null;
if (!cursor.isNull(cursor.getColumnIndex("field1"))) {
field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1;
}
Short field2 = null;
if (!cursor.isNull(cursor.getColumnIndex("field2"))) {
field2 = cursor.getShort(cursor.getColumnIndex("field2"));
}
Integer field3 = null;
if (!cursor.isNull(cursor.getColumnIndex("field3"))) {
field3 = cursor.getInt(cursor.getColumnIndex("field3"));
}
Long field4 = null;
if (!cursor.isNull(cursor.getColumnIndex("field4"))) {
field4 = cursor.getLong(cursor.getColumnIndex("field4"));
}
Float field5 = null;
if (!cursor.isNull(cursor.getColumnIndex("field5"))) {
field5 = cursor.getFloat(cursor.getColumnIndex("field5"));
}
Double field6 = null;
if (!cursor.isNull(cursor.getColumnIndex("field6"))) {
field6 = cursor.getDouble(cursor.getColumnIndex("field6"));
}
BoxedTypesMethodsConstructor object = new BoxedTypesMethodsConstructor(field1, field2, field3, field4, field5, field6);
return object;
}
use of java.lang.Integer in project storio by pushtorefresh.
the class BoxedTypesMethodsFactoryMethodIgnoreNullStorIOSQLiteGetResolver method mapFromCursor.
/**
* {@inheritDoc}
*/
@Override
@NonNull
public BoxedTypesMethodsFactoryMethodIgnoreNull mapFromCursor(@NonNull Cursor cursor) {
Boolean field1 = null;
if (!cursor.isNull(cursor.getColumnIndex("field1"))) {
field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1;
}
Short field2 = null;
if (!cursor.isNull(cursor.getColumnIndex("field2"))) {
field2 = cursor.getShort(cursor.getColumnIndex("field2"));
}
Integer field3 = null;
if (!cursor.isNull(cursor.getColumnIndex("field3"))) {
field3 = cursor.getInt(cursor.getColumnIndex("field3"));
}
Long field4 = null;
if (!cursor.isNull(cursor.getColumnIndex("field4"))) {
field4 = cursor.getLong(cursor.getColumnIndex("field4"));
}
Float field5 = null;
if (!cursor.isNull(cursor.getColumnIndex("field5"))) {
field5 = cursor.getFloat(cursor.getColumnIndex("field5"));
}
Double field6 = null;
if (!cursor.isNull(cursor.getColumnIndex("field6"))) {
field6 = cursor.getDouble(cursor.getColumnIndex("field6"));
}
BoxedTypesMethodsFactoryMethodIgnoreNull object = BoxedTypesMethodsFactoryMethodIgnoreNull.create(field1, field2, field3, field4, field5, field6);
return object;
}
use of java.lang.Integer in project storio by pushtorefresh.
the class BoxedTypesMethodsFactoryMethodStorIOSQLiteGetResolver method mapFromCursor.
/**
* {@inheritDoc}
*/
@Override
@NonNull
public BoxedTypesMethodsFactoryMethod mapFromCursor(@NonNull Cursor cursor) {
Boolean field1 = null;
if (!cursor.isNull(cursor.getColumnIndex("field1"))) {
field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1;
}
Short field2 = null;
if (!cursor.isNull(cursor.getColumnIndex("field2"))) {
field2 = cursor.getShort(cursor.getColumnIndex("field2"));
}
Integer field3 = null;
if (!cursor.isNull(cursor.getColumnIndex("field3"))) {
field3 = cursor.getInt(cursor.getColumnIndex("field3"));
}
Long field4 = null;
if (!cursor.isNull(cursor.getColumnIndex("field4"))) {
field4 = cursor.getLong(cursor.getColumnIndex("field4"));
}
Float field5 = null;
if (!cursor.isNull(cursor.getColumnIndex("field5"))) {
field5 = cursor.getFloat(cursor.getColumnIndex("field5"));
}
Double field6 = null;
if (!cursor.isNull(cursor.getColumnIndex("field6"))) {
field6 = cursor.getDouble(cursor.getColumnIndex("field6"));
}
BoxedTypesMethodsFactoryMethod object = BoxedTypesMethodsFactoryMethod.create(field1, field2, field3, field4, field5, field6);
return object;
}
use of java.lang.Integer in project geode by apache.
the class PRQueryProcessor method doBucketQuery.
/**
* @throws ForceReattemptException if bucket was moved so caller should try query again
*/
private void doBucketQuery(final Integer bId, final PartitionedRegionDataStore prds, final DefaultQuery query, final Object[] params, final PRQueryResultCollector rq) throws QueryException, ForceReattemptException, InterruptedException {
final BucketRegion bukRegion = (BucketRegion) prds.localBucket2RegionMap.get(bId);
final PartitionedRegion pr = prds.getPartitionedRegion();
try {
pr.checkReadiness();
if (bukRegion == null) {
if (pr.isLocallyDestroyed || pr.isClosed) {
throw new RegionDestroyedException("PR destroyed during query", pr.getFullPath());
} else {
throw new ForceReattemptException("Bucket id " + pr.bucketStringForLogs(bId) + " not found on VM " + pr.getMyId());
}
}
bukRegion.waitForData();
SelectResults results = null;
// If the query has LIMIT and is not order by, apply the limit while building the result set.
int limit = -1;
if (query.getSimpleSelect().getOrderByAttrs() == null) {
limit = query.getLimit(params);
}
if (!bukRegion.isBucketDestroyed()) {
// If the result queue has reached the limit, no need to
// execute the query. Handle the bucket destroy condition
// and add the end bucket token.
int numBucketsProcessed = getNumBucketsProcessed();
if (limit < 0 || (rq.size() - numBucketsProcessed) < limit) {
results = (SelectResults) query.prExecuteOnBucket(params, pr, bukRegion);
this.resultType = results.getCollectionType().getElementType();
}
if (!bukRegion.isBucketDestroyed()) {
// here before we can start adding to the results queue
if (results != null) {
for (Object r : results) {
if (r == null) {
// Blocking queue does not support adding null.
rq.put(DefaultQuery.NULL_RESULT);
} else {
// Avoid if query is distinct as this Integer could be a region value.
if (!query.getSimpleSelect().isDistinct() && query.getSimpleSelect().isCount() && r instanceof Integer) {
if ((Integer) r != 0) {
rq.put(r);
}
} else {
rq.put(r);
}
}
// Check if limit is satisfied.
if (limit >= 0 && (rq.size() - numBucketsProcessed) >= limit) {
break;
}
}
}
rq.put(new EndOfBucket(bId));
this.incNumBucketsProcessed();
// success
return;
}
}
// if we get here then the bucket must have been moved
checkForBucketMoved(bId, bukRegion, pr);
Assert.assertTrue(false, "checkForBucketMoved should have thrown ForceReattemptException");
} catch (RegionDestroyedException rde) {
checkForBucketMoved(bId, bukRegion, pr);
throw rde;
} catch (QueryException qe) {
checkForBucketMoved(bId, bukRegion, pr);
throw qe;
}
}
Aggregations