.addInCollectionItemClause(LocalPrincipalState.FIELD_NAME_GROUP_MEMBERS_LINKS, groupsToCheckLinks) .build();
qb.addInCollectionItemClause(ComputeState.FIELD_NAME_TENANT_LINKS, Collections.singletonList(projectLink), Occurance.MUST_OCCUR); });
@SuppressWarnings({"rawtypes"}) private void doInCollectionQuery(String collName, Collection coll, long documentCount, long expectedResultCount) throws Throwable { for (Object val : coll) { QuerySpecification spec = new QuerySpecification(); spec.query = Query.Builder.create().addInCollectionItemClause( collName, Arrays.asList( UUID.randomUUID().toString(), (String) val, UUID.randomUUID().toString())) .build(); this.host.createAndWaitSimpleDirectQuery(spec, documentCount, expectedResultCount); } }
ComputeConstants.COMPUTE_CONTAINER_HOST_PROP_NAME, "true"); if (projectLink != null && !projectLink.isEmpty()) { queryBuilder.addInCollectionItemClause(ComputeState.FIELD_NAME_TENANT_LINKS, Collections.singletonList(projectLink), Occurance.MUST_OCCUR);
.addFieldClause(ServiceDocument.FIELD_NAME_UPDATE_ACTION, Action.DELETE.name()) .addInCollectionItemClause(ResourceState.FIELD_NAME_TENANT_LINKS, task.tenantLinks) .build(); } else { query = Query.Builder.create() .addInClause(ServiceDocument.FIELD_NAME_KIND, DOCUMENT_KINDS) .addInCollectionItemClause(ResourceState.FIELD_NAME_TENANT_LINKS, task.tenantLinks) .build();
.addInCollectionItemClause(ResourceState.FIELD_NAME_TAG_LINKS, tagLinks) .build();
.addInCollectionItemClause(ProjectState.FIELD_NAME_ADMINISTRATORS_USER_GROUP_LINKS, userGroupLinkList, Occurance.SHOULD_OCCUR) .addInCollectionItemClause(ProjectState.FIELD_NAME_MEMBERS_USER_GROUP_LINKS, userGroupLinkList, Occurance.SHOULD_OCCUR) .addInCollectionItemClause(ProjectState.FIELD_NAME_VIEWERS_USER_GROUP_LINKS, userGroupLinkList, Occurance.SHOULD_OCCUR) .build();
private DeferredResult<Set<String>> getDirectlyAssignedGroupsForPrincipal(String principalId) { String principalSelfLink = UriUtils.buildUriPath(LocalPrincipalFactoryService.SELF_LINK, encode(principalId)); DeferredResult<Set<String>> result = new DeferredResult<>(); Set<String> groups = new HashSet<>(); Query query = Query.Builder.create() .addInCollectionItemClause(LocalPrincipalState.FIELD_NAME_GROUP_MEMBERS_LINKS, Collections.singleton(principalSelfLink)) .build(); QueryTask queryTask = QueryUtil.buildQuery(LocalPrincipalState.class, true, query); QueryUtil.addExpandOption(queryTask); new ServiceDocumentQuery<>(service.getHost(), LocalPrincipalState.class) .query(queryTask, (r) -> { if (r.hasException()) { result.fail(r.getException()); } else if (r.hasResult()) { groups.add(r.getResult().id); } else { result.complete(groups); } }); return result; }
@SuppressWarnings({"rawtypes"}) private void doInCollectionQuery(String collName, Collection coll, long documentCount, long expectedResultCount) throws Throwable { for (Object val : coll) { QuerySpecification spec = new QuerySpecification(); spec.query = Query.Builder.create().addInCollectionItemClause( collName, Arrays.asList( UUID.randomUUID().toString(), (String) val, UUID.randomUUID().toString())) .build(); this.host.createAndWaitSimpleDirectQuery(spec, documentCount, expectedResultCount); } }
public static Query buildQueryForUsers(String userGroupLink) { Query resultQuery = new Query(); Query kindClause = QueryUtil.createKindClause(AuthUtil.USER_STATE_CLASS) .setOccurance(Occurance.MUST_OCCUR); Query matchUsers = Query.Builder.create() .addInCollectionItemClause(FIELD_NAME_USER_GROUP_LINK, Collections.singletonList(userGroupLink), Occurance.MUST_OCCUR) .build(); resultQuery.addBooleanClause(kindClause); resultQuery.addBooleanClause(matchUsers); return resultQuery; }
private Query getAssociatedDocumentsQuery(EndpointRemovalTaskState state, Collection<String> documentKinds) { Query resourceQuery = Query.Builder.create() .addInClause(ServiceDocument.FIELD_NAME_KIND, documentKinds) .addInCollectionItemClause(FIELD_NAME_ENDPOINT_LINKS, Collections .singleton(state.endpoint.documentSelfLink), Query.Occurance.MUST_OCCUR) .build(); return resourceQuery; }