Marks the end of a query identified by the provided correlationId

@param query - Query data
@param correlationId - Identifier
@param type - allows queries to be grouped by type
@return
778176
public static <T> RemoveQuery<T> finish(T query, long correlationId, String type) {

        return new RemoveQuery<>(
                                 RequestData.builder()
                                            .query(query)
                                            .correlationId(correlationId)
                                            .type(type)
                                            .build());
    }
121498
protected final <T> TypedQuery<T> createQuery(CriteriaQuery<T> criteriaQuery) {
        return this.getEntityManager().createQuery(criteriaQuery);
    }
161005
public boolean recordTypedef(JSTypeExpression type) {
    if (type != null && !hasAnyTypeRelatedTags() && currentInfo.declareTypedefType(type)) {
      populated = true;
      return true;
    }
    return false;
  }
1172567
private static String initFindRelationshipQuery(EntityKeyMetadata ownerEntityKeyMetadata, AssociationKeyMetadata associationKeyMetadata) {
		int offset = 0;
		StringBuilder queryBuilder = new StringBuilder( "MATCH " );
		queryBuilder.append( "(n:" );
		queryBuilder.append( ENTITY );
		queryBuilder.append( ":" );
		appendLabel( ownerEntityKeyMetadata, queryBuilder );
		appendProperties( ownerEntityKeyMetadata, queryBuilder );
		queryBuilder.append( ") - " );
		queryBuilder.append( "[r" );
		queryBuilder.append( ":" );
		appendRelationshipType( queryBuilder, associationKeyMetadata );
		offset = ownerEntityKeyMetadata.getColumnNames().length;
		if ( associationKeyMetadata.getRowKeyIndexColumnNames().length > 0 ) {
			appendProperties( queryBuilder, associationKeyMetadata.getRowKeyIndexColumnNames(), offset );
			queryBuilder.append( "] - (t" );
		}
		else {
			queryBuilder.append( "] - (t" );
			appendProperties( queryBuilder, associationKeyMetadata.getAssociatedEntityKeyMetadata().getEntityKeyMetadata().getColumnNames(), offset );
		}
		queryBuilder.append( ")" );
		queryBuilder.append( " RETURN r" );
		return queryBuilder.toString();
	}
318154
public <E> QueryResponse<E> executeEntityQueryRequest(Class<E> expectedResultType,
      EntityQueryRequest request) {
    try {
      GqlQuery.Builder<Entity> queryBuilder = Query.newGqlQueryBuilder(ResultType.ENTITY,
          request.getQuery());
      queryBuilder.setNamespace(entityManager.getEffectiveNamespace());
      queryBuilder.setAllowLiteral(request.isAllowLiterals());
      QueryUtils.applyNamedBindings(queryBuilder, request.getNamedBindings());
      QueryUtils.applyPositionalBindings(queryBuilder, request.getPositionalBindings());
      GqlQuery<Entity> gqlQuery = queryBuilder.build();
      QueryResults<Entity> results = nativeReader.run(gqlQuery);
      List<E> entities = new ArrayList<>();
      DefaultQueryResponse<E> response = new DefaultQueryResponse<>();
      response.setStartCursor(new DefaultDatastoreCursor(results.getCursorAfter().toUrlSafe()));
      while (results.hasNext()) {
        Entity result = results.next();
        E entity = Unmarshaller.unmarshal(result, expectedResultType);
        entities.add(entity);
      }
      response.setResults(entities);
      response.setEndCursor(new DefaultDatastoreCursor(results.getCursorAfter().toUrlSafe()));
      response.setQueryResponseMetadata(
          new DefaultQueryResponseMetadata(
              QueryResponseMetadata.QueryState.forMoreResultsType(results.getMoreResults())));
      entityManager.executeEntityListeners(CallbackType.POST_LOAD, entities);
      return response;
    } catch (DatastoreException exp) {
      throw new EntityManagerException(exp);
    }
  }
499914
public static String typeIdToUri(String type_id) {
//        System.err.println("typeIdToUri(" + type_id + ")");
        byte[] data = null;
        try {
          data = type_id.getBytes("ISO8859-1");
        } catch(Exception e) {}
        byte[] dx = new byte[data.length+1];
        System.arraycopy(data, 0, dx, 0, data.length);
        dx[data.length] = 0;
        data = dx;
        int cursor = 0;
        int limit = data.length;
        int marker = -1;

        int gotoPoint = -1;
        byte yych = (byte) 0;
        gotoNext: while(gotoPoint != -2) {
            int currentGoto = gotoPoint; gotoPoint = -2;
            switch(currentGoto) {
            case -1: 

                yych = data[cursor];
                switch (yych) {
                case 0x00:    {gotoPoint = 2; continue gotoNext;}
                case '!':    {gotoPoint = 6; continue gotoNext;}
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                case '_':
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 'u':
                case 'v':
                case 'w':
                case 'y':
                case 'z':    {gotoPoint = 8; continue gotoNext;}
                case 't':    {gotoPoint = 3; continue gotoNext;}
                case 'x':    {gotoPoint = 5; continue gotoNext;}
                default:    {gotoPoint = 9; continue gotoNext;}
                }
            case 2:
                cursor = marker;
                {gotoPoint = 4; continue gotoNext;}
            case 3:
                yych = data[(marker = ++cursor)];
                switch (yych) {
                case ',':    {gotoPoint = 14; continue gotoNext;}
                case '-':    {gotoPoint = 10; continue gotoNext;}
                case '.':    {gotoPoint = 15; continue gotoNext;}
                case '/':    {gotoPoint = 16; continue gotoNext;}
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                case '_':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':    {gotoPoint = 12; continue gotoNext;}
                case 'a':    {gotoPoint = 44; continue gotoNext;}
                default:    {gotoPoint = 4; continue gotoNext;}
                }
            case 4:
                {   return Parser.taguri(YAML.DOMAIN, type_id); }
            case 5:
                yych = data[(marker = ++cursor)];
                switch (yych) {
                case ',':
                case '.':
                case '/':
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                case '_':
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':    {gotoPoint = 13; continue gotoNext;}
                case '-':    {gotoPoint = 34; continue gotoNext;}
                default:    {gotoPoint = 4; continue gotoNext;}
                }
            case 6:
                ++cursor;
                {   return Parser.xprivate(type_id.substring(1)); }
            case 8:
                yych = data[(marker = ++cursor)];
                switch (yych) {
                case ',':    {gotoPoint = 14; continue gotoNext;}
                case '-':    {gotoPoint = 10; continue gotoNext;}
                case '.':    {gotoPoint = 15; continue gotoNext;}
                case '/':    {gotoPoint = 16; continue gotoNext;}
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                case '_':
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':    {gotoPoint = 12; continue gotoNext;}
                default:    {gotoPoint = 4; continue gotoNext;}
                }
            case 9:
                yych = data[++cursor];
                {gotoPoint = 4; continue gotoNext;}
            case 10:
                ++cursor;
                yych = data[cursor];
            case 11:
                switch (yych) {
                case '-':    {gotoPoint = 10; continue gotoNext;}
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                case '_':
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':    {gotoPoint = 12; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 12:
                ++cursor;
                yych = data[cursor];
            case 13:
                switch (yych) {
                case ',':    {gotoPoint = 14; continue gotoNext;}
                case '-':    {gotoPoint = 10; continue gotoNext;}
                case '.':    {gotoPoint = 15; continue gotoNext;}
                case '/':    {gotoPoint = 16; continue gotoNext;}
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                case '_':
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':    {gotoPoint = 12; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 14:
                yych = data[++cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':    {gotoPoint = 22; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 15:
                ++cursor;
                yych = data[cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                case '_':
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':    {gotoPoint = 18; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 16:
                ++cursor;
                {   
                    return Parser.taguri(type_id.substring(0, cursor -1) + "." + YAML.DOMAIN, type_id.substring(cursor));
                }
            case 18:
                ++cursor;
                yych = data[cursor];
                switch (yych) {
                case ',':    {gotoPoint = 14; continue gotoNext;}
                case '-':    {gotoPoint = 20; continue gotoNext;}
                case '.':    {gotoPoint = 15; continue gotoNext;}
                case '/':    {gotoPoint = 16; continue gotoNext;}
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                case '_':
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':    {gotoPoint = 18; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 20:
                ++cursor;
                yych = data[cursor];
                switch (yych) {
                case '-':    {gotoPoint = 20; continue gotoNext;}
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                case '_':
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':    {gotoPoint = 18; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 22:
                yych = data[++cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':    {gotoPoint = 23; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 23:
                yych = data[++cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':    {gotoPoint = 24; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 24:
                yych = data[++cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':    {gotoPoint = 25; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 25:
                yych = data[++cursor];
                switch (yych) {
                case '-':    {gotoPoint = 26; continue gotoNext;}
                case '/':    {gotoPoint = 27; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 26:
                yych = data[++cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':    {gotoPoint = 29; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 27:
                ++cursor;
                {   
                               return Parser.taguri(type_id.substring(0, cursor-1), type_id.substring(cursor));
                            }
            case 29:
                yych = data[++cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':    {gotoPoint = 30; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 30:
                yych = data[++cursor];
                switch (yych) {
                case '-':    {gotoPoint = 31; continue gotoNext;}
                case '/':    {gotoPoint = 27; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 31:
                yych = data[++cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':    {gotoPoint = 32; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 32:
                yych = data[++cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':    {gotoPoint = 33; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 33:
                yych = data[++cursor];
                switch (yych) {
                case '/':    {gotoPoint = 27; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 34:
                yych = data[++cursor];
                switch (yych) {
                case 'p':    {gotoPoint = 35; continue gotoNext;}
                default:    {gotoPoint = 11; continue gotoNext;}
                }
            case 35:
                yych = data[++cursor];
                switch (yych) {
                case ',':    {gotoPoint = 14; continue gotoNext;}
                case '.':    {gotoPoint = 15; continue gotoNext;}
                case '/':    {gotoPoint = 16; continue gotoNext;}
                case 'r':    {gotoPoint = 36; continue gotoNext;}
                default:    {gotoPoint = 11; continue gotoNext;}
                }
            case 36:
                yych = data[++cursor];
                switch (yych) {
                case ',':    {gotoPoint = 14; continue gotoNext;}
                case '.':    {gotoPoint = 15; continue gotoNext;}
                case '/':    {gotoPoint = 16; continue gotoNext;}
                case 'i':    {gotoPoint = 37; continue gotoNext;}
                default:    {gotoPoint = 11; continue gotoNext;}
                }
            case 37:
                yych = data[++cursor];
                switch (yych) {
                case ',':    {gotoPoint = 14; continue gotoNext;}
                case '.':    {gotoPoint = 15; continue gotoNext;}
                case '/':    {gotoPoint = 16; continue gotoNext;}
                case 'v':    {gotoPoint = 38; continue gotoNext;}
                default:    {gotoPoint = 11; continue gotoNext;}
                }
            case 38:
                yych = data[++cursor];
                switch (yych) {
                case ',':    {gotoPoint = 14; continue gotoNext;}
                case '.':    {gotoPoint = 15; continue gotoNext;}
                case '/':    {gotoPoint = 16; continue gotoNext;}
                case 'a':    {gotoPoint = 39; continue gotoNext;}
                default:    {gotoPoint = 11; continue gotoNext;}
                }
            case 39:
                yych = data[++cursor];
                switch (yych) {
                case ',':    {gotoPoint = 14; continue gotoNext;}
                case '.':    {gotoPoint = 15; continue gotoNext;}
                case '/':    {gotoPoint = 16; continue gotoNext;}
                case 't':    {gotoPoint = 40; continue gotoNext;}
                default:    {gotoPoint = 11; continue gotoNext;}
                }
            case 40:
                yych = data[++cursor];
                switch (yych) {
                case ',':    {gotoPoint = 14; continue gotoNext;}
                case '.':    {gotoPoint = 15; continue gotoNext;}
                case '/':    {gotoPoint = 16; continue gotoNext;}
                case 'e':    {gotoPoint = 41; continue gotoNext;}
                default:    {gotoPoint = 11; continue gotoNext;}
                }
            case 41:
                yych = data[++cursor];
                switch (yych) {
                case ',':    {gotoPoint = 14; continue gotoNext;}
                case '.':    {gotoPoint = 15; continue gotoNext;}
                case '/':    {gotoPoint = 16; continue gotoNext;}
                case ':':    {gotoPoint = 42; continue gotoNext;}
                default:    {gotoPoint = 11; continue gotoNext;}
                }
            case 42:
                ++cursor;
                {   return type_id; }
            case 44:
                yych = data[++cursor];
                switch (yych) {
                case ',':    {gotoPoint = 14; continue gotoNext;}
                case '.':    {gotoPoint = 15; continue gotoNext;}
                case '/':    {gotoPoint = 16; continue gotoNext;}
                case 'g':    {gotoPoint = 45; continue gotoNext;}
                default:    {gotoPoint = 11; continue gotoNext;}
                }
            case 45:
                yych = data[++cursor];
                switch (yych) {
                case ',':    {gotoPoint = 14; continue gotoNext;}
                case '.':    {gotoPoint = 15; continue gotoNext;}
                case '/':    {gotoPoint = 16; continue gotoNext;}
                case ':':    {gotoPoint = 46; continue gotoNext;}
                default:    {gotoPoint = 11; continue gotoNext;}
                }
            case 46:
                yych = data[++cursor];
                switch (yych) {
                case ',':
                case '-':
                case '.':    {gotoPoint = 2; continue gotoNext;}
                default:    {gotoPoint = 48; continue gotoNext;}
                }
            case 47:
                ++cursor;
                yych = data[cursor];
            case 48:
                switch (yych) {
                case ',':    {gotoPoint = 51; continue gotoNext;}
                case '-':    {gotoPoint = 49; continue gotoNext;}
                case '.':    {gotoPoint = 52; continue gotoNext;}
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                case '_':
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':    {gotoPoint = 47; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 49:
                ++cursor;
                yych = data[cursor];
                switch (yych) {
                case '-':    {gotoPoint = 49; continue gotoNext;}
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                case '_':
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':    {gotoPoint = 47; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 51:
                yych = data[++cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':    {gotoPoint = 57; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 52:
                ++cursor;
                yych = data[cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                case '_':
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':    {gotoPoint = 53; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 53:
                ++cursor;
                yych = data[cursor];
                switch (yych) {
                case ',':    {gotoPoint = 51; continue gotoNext;}
                case '-':    {gotoPoint = 55; continue gotoNext;}
                case '.':    {gotoPoint = 52; continue gotoNext;}
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                case '_':
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':    {gotoPoint = 53; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 55:
                ++cursor;
                yych = data[cursor];
                switch (yych) {
                case '-':    {gotoPoint = 55; continue gotoNext;}
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                case '_':
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':    {gotoPoint = 53; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 57:
                yych = data[++cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':    {gotoPoint = 58; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 58:
                yych = data[++cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':    {gotoPoint = 59; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 59:
                yych = data[++cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':    {gotoPoint = 60; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 60:
                yych = data[++cursor];
                switch (yych) {
                case '-':    {gotoPoint = 61; continue gotoNext;}
                case ':':    {gotoPoint = 62; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 61:
                yych = data[++cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':    {gotoPoint = 64; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 62:
                ++cursor;
                {   return type_id; }
            case 64:
                yych = data[++cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':    {gotoPoint = 65; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 65:
                yych = data[++cursor];
                switch (yych) {
                case '-':    {gotoPoint = 66; continue gotoNext;}
                case ':':    {gotoPoint = 62; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 66:
                yych = data[++cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':    {gotoPoint = 67; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 67:
                yych = data[++cursor];
                switch (yych) {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':    {gotoPoint = 68; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            case 68:
                ++cursor;
                switch ((yych = data[cursor])) {
                case ':':    {gotoPoint = 62; continue gotoNext;}
                default:    {gotoPoint = 2; continue gotoNext;}
                }
            }
        }

        return null;
    }
783980
public void deleteByQuery(String index, String type) throws IOException {
        logger.debug("deleteByQuery [{}]/[{}]", index, type);

        String deleteByQuery = "{\n" +
                "  \"query\": {\n" +
                "    \"match_all\": {}\n" +
                "  }\n" +
                "}";

        Request request = new Request("POST", "/" + index + "/" + type + "/_delete_by_query");
        request.setJsonEntity(deleteByQuery);
        Response restResponse = client.getLowLevelClient().performRequest(request);
        Map<String, Object> response = asMap(restResponse);
        logger.debug("reindex response: {}", response);
    }
593165
public void endElement(String uri, String name, String qName)
    {
        boolean isDebug = logger.isDebugEnabled();
        try
        {
            switch (getLiteralId(qName))
            {
                case MAPPING_REPOSITORY:
                    {
                        if (isDebug) logger.debug(" < " + tags.getTagById(MAPPING_REPOSITORY));
                        this.m_CurrentAttrContainer = null;
                        m_CurrentCLD = null;
                        break;
                    }
                case CLASS_DESCRIPTOR:
                    {
                        if (isDebug) logger.debug("  < " + tags.getTagById(CLASS_DESCRIPTOR));
                        m_CurrentCLD = null;
                        this.m_CurrentAttrContainer = null;
                        break;
                    }
                case OBJECT_CACHE:
                    {
                        if(m_CurrentAttrContainer != null)
                        {
                            if (isDebug) logger.debug("     < " + tags.getTagById(OBJECT_CACHE));
                        }
                        this.m_CurrentAttrContainer = m_CurrentCLD;
                        break;
                    }
                case CLASS_EXTENT:
                    {
                        break;
                    }
                case FIELD_DESCRIPTOR:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(FIELD_DESCRIPTOR));
                        m_CurrentFLD = null;
                        m_CurrentAttrContainer = m_CurrentCLD;
                        break;
                    }
                case REFERENCE_DESCRIPTOR:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(REFERENCE_DESCRIPTOR));
                        m_CurrentORD = null;
                        m_CurrentAttrContainer = m_CurrentCLD;
                        break;
                    }
                case FOREIGN_KEY:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(FOREIGN_KEY));
                        break;
                    }
                case COLLECTION_DESCRIPTOR:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(COLLECTION_DESCRIPTOR));
                        m_CurrentCOD = null;
                        m_CurrentAttrContainer = m_CurrentCLD;
                        break;
                    }
                case INVERSE_FK:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(INVERSE_FK));
                        break;
                    }
                case ORDERBY :
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(ORDERBY));
                        break;
                    }
                case FK_POINTING_TO_THIS_CLASS:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(FK_POINTING_TO_THIS_CLASS));
                        break;
                    }
                case FK_POINTING_TO_ITEMS_CLASS:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(FK_POINTING_TO_ITEMS_CLASS));
                        break;
                    }
                case ATTRIBUTE:
                    {
                        if(m_CurrentAttrContainer != null)
                        {
                            if (isDebug) logger.debug("      < " + tags.getTagById(ATTRIBUTE));
                        }
                        break;
                    }
                case DOCUMENTATION:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(DOCUMENTATION));
                        break;
                    }
//                case SEQUENCE_MANAGER:
//                    {
//                        // currently not used on class-descriptor level
//                        // if (isDebug) logger.debug("    < " + tags.getTagById(SEQUENCE_MANAGER));
//                        this.m_CurrentAttrContainer = null;
//                        break;
//                    }
//                case CONNECTION_POOL:
//                    {
//                        // not used on class-descriptor level
//                        // if (isDebug) logger.debug("    < " + tags.getTagById(CONNECTION_POOL));
//                        this.m_CurrentAttrContainer = null;
//                        break;
//                    }
//                case JDBC_CONNECTION_DESCRIPTOR:
//                    {
//                        // not used on class-descriptor level
//                        // if (isDebug) logger.debug("    < " + tags.getTagById(JDBC_CONNECTION_DESCRIPTOR));
//                        this.m_CurrentAttrContainer = null;
//                        break;
//                    }
                case QUERY_CUSTOMIZER:
                    {
                        m_CurrentAttrContainer = m_CurrentCOD;
                        break;
                    }
                case INDEX_DESCRIPTOR:
                    {
                        m_CurrentCLD.getIndexes().add(m_CurrentIndexDescriptor);
                        m_CurrentIndexDescriptor = null;
                        break;
                    }
                case INDEX_COLUMN:
                    {
                        // ignore; all processing done in startElement
                        break;
                    }
                case INSERT_PROCEDURE:
                {
                    if (isDebug) logger.debug("    < " + tags.getTagById(INSERT_PROCEDURE));
                    m_CurrentCLD.setInsertProcedure((InsertProcedureDescriptor)m_CurrentProcedure);
                    m_CurrentProcedure = null;
                    break;
                }
                case UPDATE_PROCEDURE:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(UPDATE_PROCEDURE));
                        m_CurrentCLD.setUpdateProcedure((UpdateProcedureDescriptor)m_CurrentProcedure);
                        m_CurrentProcedure = null;
                        break;
                    }
                case DELETE_PROCEDURE:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(DELETE_PROCEDURE));
                        m_CurrentCLD.setDeleteProcedure((DeleteProcedureDescriptor)m_CurrentProcedure);
                        m_CurrentProcedure = null;
                        break;
                    }
                case CONSTANT_ARGUMENT:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(CONSTANT_ARGUMENT));
                        break;
                    }
                case RUNTIME_ARGUMENT:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(RUNTIME_ARGUMENT));
                        break;
                    }

                    // handle failure:
                default :
                    {
                        logger.debug("Ignoring unused Element " + qName);
                    }
            }
        }
        catch (Exception ex)
        {
            if(ex instanceof MetadataException) throw (MetadataException) ex;
            else throw new MetadataException("Exception when reading metadata information,"+
                    " please check your repository.xml file", ex);
        }
    }
196858
private CheckpointQueryBuilder parseCheckpoint(CheckpointQueryBuilder query)
  {
    Token token = scanToken();

    if (token != Token.IDENTIFIER) {
      throw error("Expected IDENTIFIER at {0}", token);
    }
    
    String pod = _lexeme;
    String name;
    
    if (peekToken() == Token.DOT) {
      scanToken();

      if ((token = scanToken()) != Token.IDENTIFIER) {
        throw error("Expected IDENTIFIER at {0}", token);
      }
      
      name = _lexeme; 
    }
    else {
      name = pod;
      pod = getPodName();
    }
    
    query.setTableName(pod + '.' + name);

    return query;
  }
646750
protected <T, K extends Serializable>
    Query<T> _buildQuery(
                    final DAO<T, K>  dao,
                    final Class<T> type,
                    final QueryParams params
                    )
    {
        Query<T>  query = null;
        try {
            query = dao.createQuery();
            QueryBuilder  builder = _getQueryBuilderFactory().newBuilder( type );
            query = builder.build( query, params );
        } catch (RepositoryConfigurationException ex) {
            throw ex;
        } catch (QueryException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new QueryException( ex );
        }

        return query;
    }
1127141
private SqlModality deduceModality(SqlNode query) {
		if (query instanceof SqlSelect) {
			SqlSelect select = (SqlSelect) query;
			return select.getModifierNode(SqlSelectKeyword.STREAM) != null
				? SqlModality.STREAM
				: SqlModality.RELATION;
		} else if (query.getKind() == SqlKind.VALUES) {
			return SqlModality.RELATION;
		} else {
			assert query.isA(SqlKind.SET_QUERY);
			final SqlCall call = (SqlCall) query;
			return deduceModality(call.getOperandList().get(0));
		}
	}
1072388
protected Query buildMtoNImplementorQuery(Collection ids)
    {
        String[] indFkCols = getFksToThisClass();
        String[] indItemFkCols = getFksToItemClass();
        FieldDescriptor[] pkFields = getOwnerClassDescriptor().getPkFields();
        FieldDescriptor[] itemPkFields = getItemClassDescriptor().getPkFields();
        String[] cols = new String[indFkCols.length + indItemFkCols.length];
        int[] jdbcTypes = new int[indFkCols.length + indItemFkCols.length];

        // concatenate the columns[]
        System.arraycopy(indFkCols, 0, cols, 0, indFkCols.length);
        System.arraycopy(indItemFkCols, 0, cols, indFkCols.length, indItemFkCols.length);

        Criteria crit = buildPrefetchCriteria(ids, indFkCols, indItemFkCols, itemPkFields);

        // determine the jdbcTypes of the pks
        for (int i = 0; i < pkFields.length; i++)
        {
            jdbcTypes[i] = pkFields[i].getJdbcType().getType();
        }
        for (int i = 0; i < itemPkFields.length; i++)
        {
            jdbcTypes[pkFields.length + i] = itemPkFields[i].getJdbcType().getType();
        }

        ReportQueryByMtoNCriteria q = new ReportQueryByMtoNCriteria(getItemClassDescriptor().getClassOfObject(), cols,
                crit, false);
        q.setIndirectionTable(getCollectionDescriptor().getIndirectionTable());
        q.setJdbcTypes(jdbcTypes);

        CollectionDescriptor cds = getCollectionDescriptor();
        //check if collection must be ordered
        if (!cds.getOrderBy().isEmpty())
        {
            Iterator iter = cds.getOrderBy().iterator();
            while (iter.hasNext())
            {
                q.addOrderBy((FieldHelper) iter.next());
            }
        }
        
        return q;
    }
1132455
protected SolrQuery constructQuery(SolrDataQuery query, @Nullable Class<?> domainType) {
		return lookupQueryParser(query).constructSolrQuery(query, domainType);
	}
1008023
public static void writeCorrelationId(Message message, String correlationId) {
        if (!(message instanceof SoapMessage)) {
            return;
        }
        SoapMessage soapMessage = (SoapMessage) message;
        Header hdCorrelationId = soapMessage.getHeader(CORRELATION_ID_QNAME);
        if (hdCorrelationId != null) {
            LOG.warning("CorrelationId already existing in soap header, need not to write CorrelationId header.");
            return;
        }
        if ((soapMessage.getContent(javax.xml.stream.XMLStreamWriter.class) != null)
                && (soapMessage.getContent(javax.xml.stream.XMLStreamWriter.class) instanceof SAAJStreamWriter)
                && (((SAAJStreamWriter) soapMessage.getContent(javax.xml.stream.XMLStreamWriter.class))
                        .getDocument()
                        .getElementsByTagNameNS("http://www.talend.com/esb/sam/correlationId/v1",
                                "correlationId").getLength() > 0)) {
            LOG.warning("CorrelationId already existing in soap header, need not to write CorrelationId header.");
            return;
        }

        try {
            soapMessage.getHeaders().add(
                    new Header(CORRELATION_ID_QNAME, correlationId, new JAXBDataBinding(String.class)));
            if (LOG.isLoggable(Level.FINE)) {
                LOG.fine("Stored correlationId '" + correlationId + "' in soap header: "
                        + CORRELATION_ID_QNAME);
            }
        } catch (JAXBException e) {
            LOG.log(Level.SEVERE, "Couldn't create correlationId header.", e);
        }

    }
1306674
public static Map<String, ValueType> rowSignatureFor(final GroupByQuery query)
  {
    final ImmutableMap.Builder<String, ValueType> types = ImmutableMap.builder();

    for (DimensionSpec dimensionSpec : query.getDimensions()) {
      types.put(dimensionSpec.getOutputName(), dimensionSpec.getOutputType());
    }

    for (AggregatorFactory aggregatorFactory : query.getAggregatorSpecs()) {
      final String typeName = aggregatorFactory.getTypeName();
      final ValueType valueType;
      if (typeName != null) {
        valueType = GuavaUtils.getEnumIfPresent(ValueType.class, StringUtils.toUpperCase(typeName));
      } else {
        valueType = null;
      }
      if (valueType != null) {
        types.put(aggregatorFactory.getName(), valueType);
      }
    }

    // Don't include post-aggregators since we don't know what types they are.
    return types.build();
  }
1008347
public void deleteByQuery(String index, String type) throws IOException {
        logger.debug("deleteByQuery [{}]/[{}]", index, type);

        String deleteByQuery = "{\n" +
                "  \"query\": {\n" +
                "    \"match_all\": {}\n" +
                "  }\n" +
                "}";

        HttpEntity entity = EntityBuilder.create().setText(deleteByQuery).setContentType(ContentType.APPLICATION_JSON).build();
        Response restResponse = lowLevelClient.performRequest("POST", "/" + index + "/" + type + "/_delete_by_query", Collections.emptyMap(), entity);
        Map<String, Object> response = asMap(restResponse);
        logger.debug("reindex response: {}", response);
    }
369761
private static String initFindEntityQueryWithEmbeddedEndNode(EntityKeyMetadata entityKeyMetadata) {
		StringBuilder queryBuilder = new StringBuilder();
		appendMatchOwnerEntityNode( queryBuilder, entityKeyMetadata );
		appendGetEmbeddedNodesIfNeeded( true, queryBuilder );
		return queryBuilder.toString();
	}