Package org.infinispan.query.dsl.embedded.impl

Examples of org.infinispan.query.dsl.embedded.impl.EmbeddedQuery


   private QueryResponse executeNonIndexedQuery(AdvancedCache<byte[], byte[]> cache, SerializationContext serCtx, QueryRequest request) throws IOException {
      boolean compatMode = cache.getCacheConfiguration().compatibility().enabled();
      Class<? extends Matcher> matcherImplClass = compatMode ? CompatibilityReflectionMatcher.class : ProtobufMatcher.class;

      EmbeddedQuery eq = new EmbeddedQuery(cache, request.getJpqlString(), request.getStartOffset(), request.getMaxResults(), matcherImplClass);
      List<?> list = eq.list();
      int projSize = 0;
      if (eq.getProjection() != null && eq.getProjection().length > 0) {
         projSize = eq.getProjection().length;
      }
      List<WrappedMessage> results = new ArrayList<WrappedMessage>(projSize == 0 ? list.size() : list.size() * projSize);
      for (Object o : list) {
         if (projSize == 0) {
            if (compatMode) {
               // if we are in compat mode then this is the real object so need to marshall it first
               o = ProtobufUtil.toWrappedByteArray(serCtx, o);
            }
            results.add(new WrappedMessage(o));
         } else {
            Object[] row = (Object[]) o;
            for (int j = 0; j < projSize; j++) {
               results.add(new WrappedMessage(row[j]));
            }
         }
      }

      QueryResponse response = new QueryResponse();
      response.setTotalResults(eq.getResultSize());
      response.setNumResults(list.size());
      response.setProjectionSize(projSize);
      response.setResults(results);

      return response;
View Full Code Here


   private QueryResponse executeNonIndexedQuery(AdvancedCache<byte[], byte[]> cache, SerializationContext serCtx, QueryRequest request) throws IOException {
      boolean compatMode = cache.getCacheConfiguration().compatibility().enabled();
      Class<? extends Matcher> matcherImplClass = compatMode ? CompatibilityReflectionMatcher.class : ProtobufMatcher.class;

      EmbeddedQuery eq = new EmbeddedQuery(cache, request.getJpqlString(), request.getStartOffset(), request.getMaxResults(), matcherImplClass);
      List<?> list = eq.list();
      int projSize = 0;
      if (eq.getProjection() != null && eq.getProjection().length > 0) {
         projSize = eq.getProjection().length;
      }
      List<WrappedMessage> results = new ArrayList<WrappedMessage>(projSize == 0 ? list.size() : list.size() * projSize);
      for (Object o : list) {
         if (projSize == 0) {
            if (compatMode) {
               // if we are in compat mode then this is the real object so need to marshall it first
               o = ProtobufUtil.toWrappedByteArray(serCtx, o);
            }
            results.add(new WrappedMessage(o));
         } else {
            Object[] row = (Object[]) o;
            for (int j = 0; j < projSize; j++) {
               results.add(new WrappedMessage(row[j]));
            }
         }
      }

      QueryResponse response = new QueryResponse();
      response.setTotalResults(eq.getResultSize());
      response.setNumResults(list.size());
      response.setProjectionSize(projSize);
      response.setResults(results);

      return response;
View Full Code Here

   private QueryResponse executeNonIndexedQuery(AdvancedCache<byte[], byte[]> cache, SerializationContext serCtx, QueryRequest request) throws IOException {
      boolean compatMode = cache.getCacheConfiguration().compatibility().enabled();
      Class<? extends Matcher> matcherImplClass = compatMode ? CompatibilityReflectionMatcher.class : ProtobufMatcher.class;

      EmbeddedQuery eq = new EmbeddedQuery(cache, request.getJpqlString(), request.getStartOffset(), request.getMaxResults(), matcherImplClass);
      List<?> list = eq.list();
      int projSize = 0;
      if (eq.getProjection() != null && eq.getProjection().length > 0) {
         projSize = eq.getProjection().length;
      }
      List<WrappedMessage> results = new ArrayList<WrappedMessage>(projSize == 0 ? list.size() : list.size() * projSize);
      for (Object o : list) {
         if (projSize == 0) {
            if (compatMode) {
               // if we are in compat mode then this is the real object so need to marshall it first
               o = ProtobufUtil.toWrappedByteArray(serCtx, o);
            }
            results.add(new WrappedMessage(o));
         } else {
            Object[] row = (Object[]) o;
            for (int j = 0; j < projSize; j++) {
               results.add(new WrappedMessage(row[j]));
            }
         }
      }

      QueryResponse response = new QueryResponse();
      response.setTotalResults(eq.getResultSize());
      response.setNumResults(list.size());
      response.setProjectionSize(projSize);
      response.setResults(results);

      return response;
View Full Code Here

   private QueryResponse executeNonIndexedQuery(AdvancedCache<byte[], byte[]> cache, QueryRequest request) throws IOException {
      Class<? extends Matcher> matcherImplClass = cache.getCacheConfiguration().compatibility().enabled()
            ? ReflectionMatcher.class : ProtobufMatcher.class;

      EmbeddedQuery eq = new EmbeddedQuery(cache, request.getJpqlString(), request.getStartOffset(), request.getMaxResults(), matcherImplClass);
      List<?> list = eq.list();
      int projSize = 0;
      if (eq.getProjection() != null && eq.getProjection().length > 0) {
         projSize = eq.getProjection().length;
      }
      List<WrappedMessage> results = new ArrayList<WrappedMessage>(projSize == 0 ? list.size() : list.size() * projSize);
      for (Object o : list) {
         if (projSize == 0) {
            results.add(new WrappedMessage(o));
         } else {
            Object[] row = (Object[]) o;
            for (int j = 0; j < projSize; j++) {
               results.add(new WrappedMessage(row[j]));
            }
         }
      }

      QueryResponse response = new QueryResponse();
      response.setTotalResults(eq.getResultSize());
      response.setNumResults(list.size());
      response.setProjectionSize(projSize);
      response.setResults(results);

      return response;
View Full Code Here

TOP

Related Classes of org.infinispan.query.dsl.embedded.impl.EmbeddedQuery

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.