ComputeConstants.COMPUTE_CONTAINER_HOST_PROP_NAME, "true") .addFieldClause( QuerySpecification.buildCompositeFieldName( ComputeState.FIELD_NAME_CUSTOM_PROPERTIES, ContainerHostService.CONTAINER_HOST_TYPE_PROP_NAME),
QuerySpecification qsPerGroup = new QuerySpecification(); qs.copyTo(qsPerGroup); qsPerGroup.query = new Query(); qsPerGroup.query.booleanClauses = new ArrayList<>(2);
.buildCollectionItemName(ContainerNetworkState.FIELD_NAME_PARENT_LINKS); Query parentsClause = new Query() .setTermPropertyName(parentLinksItemField)
stringValue = QuerySpecification.toMatchValue((URI) v); luceneField = getAndSetStringField(fieldName, stringValue, fsv, isCollectionItem); } else if (pd.typeName.equals(TypeName.ENUM)) { stringValue = QuerySpecification.toMatchValue((Enum<?>) v); luceneField = getAndSetStringField(fieldName, stringValue, fsv, isCollectionItem); } else if (pd.typeName.equals(TypeName.LONG)) { stringValue = QuerySpecification.toMatchValue((boolean) v); luceneField = getAndSetStringField(fieldName, stringValue, fsv, isCollectionItem); } else if (pd.typeName.equals(TypeName.BYTES)) {
QuerySpecification spec = new QuerySpecification(); qs.copyTo(spec);
QuerySpecification spec = new QuerySpecification(); qs.copyTo(spec);
if (item != null) { linksPerDocument.put( QuerySpecification.buildLinkCollectionItemName(qt.propertyName, index++), item); rsp.selectedLinks.add(item);
linksPerDocument.put( QuerySpecification .buildLinkCollectionItemName(qt.propertyName, index++), item); rsp.selectedLinks.add(item);
for (Query subclause: clause.booleanClauses) { assertTrue(Arrays .asList(QuerySpecification.buildCollectionItemName( ProjectState.FIELD_NAME_ADMINISTRATORS_USER_GROUP_LINKS), QuerySpecification.buildCollectionItemName( ProjectState.FIELD_NAME_MEMBERS_USER_GROUP_LINKS), QuerySpecification.buildCollectionItemName( ProjectState.FIELD_NAME_VIEWERS_USER_GROUP_LINKS)) .contains(subclause.term.propertyName));
queryTask.querySpec = new QueryTask.QuerySpecification(); queryTask.taskInfo.isDirect = true; .buildCompositeFieldName(ComputeState.FIELD_NAME_CUSTOM_PROPERTIES, REGISTRY_TRUST_CERTS_PROP_NAME), registryTrustCertLink, MatchType.TERM,
.buildCollectionItemName(ContainerNetworkState.FIELD_NAME_PARENT_LINKS); QueryUtil.addListValueClause(networkQuery, parentLinksItemField, state.resourceLinks); QueryUtil.addExpandOption(networkQuery);
.buildCollectionItemName(ContainerVolumeState.FIELD_NAME_PARENT_LINKS); Query parentsClause = new Query() .setTermPropertyName(parentLinksItemField)
computeHost.occurance = Occurance.MUST_OCCUR; Query containerHost = new Query().setTermPropertyName(QuerySpecification .buildCompositeFieldName(ComputeState.FIELD_NAME_CUSTOM_PROPERTIES, ComputeConstants.COMPUTE_CONTAINER_HOST_PROP_NAME)) .setTermMatchValue("true");
.setTermPropertyName(QuerySpecification.buildCompositeFieldName( ComputeState.FIELD_NAME_CUSTOM_PROPERTIES, ContainerHostService.CONTAINER_HOST_TYPE_PROP_NAME))
.addCompositeFieldClause(ResourceMetrics.FIELD_NAME_CUSTOM_PROPERTIES, ResourceMetrics.PROPERTY_RESOURCE_LINK, resourceLink) .addRangeClause(QuerySpecification.buildCompositeFieldName( ResourceMetrics.FIELD_NAME_ENTRIES, metricKey), NumericRange.createDoubleRange(Double.MIN_VALUE, Double.MAX_VALUE,
.buildCollectionItemName( ContainerNetworkState.FIELD_NAME_COMPOSITE_COMPONENT_LINKS); List<String> cclValues = new ArrayList<>(
private void removeTrustCerts(ContainerHostRemovalTaskState state) { QueryTask queryTask = new QueryTask(); queryTask.querySpec = new QueryTask.QuerySpecification(); queryTask.taskInfo.isDirect = true; Query q = Query.Builder.create() .addFieldClause(QuerySpecification .buildCompositeFieldName(ComputeState.FIELD_NAME_CUSTOM_PROPERTIES, ComputeConstants.HOST_TRUST_CERTS_PROP_NAME), UriUtils.URI_WILDCARD_CHAR, MatchType.WILDCARD, Occurance.MUST_NOT_OCCUR).build(); q.addBooleanClause(createKindClause(ComputeState.class)); queryTask.querySpec.query.addBooleanClause(q); sendWithDeferredResult(Operation .createPost(UriUtils.buildUri(getHost(), ServiceUriPaths.CORE_QUERY_TASKS)) .setBody(queryTask) .setReferer(getHost().getUri()), QueryTask.class) .thenAccept(qrt -> { if (qrt.results.documentCount == 0) { doRemoveTrustCerts(state); } else { proceedTo(SubStage.REMOVED_CERTIFICATES); } }).exceptionally(e -> { logWarning("Failed to remove unused trust certificate.", e); proceedTo(SubStage.REMOVED_CERTIFICATES); return null; }); }
QuerySpecification.buildCollectionItemName( ProjectState.FIELD_NAME_ADMINISTRATORS_USER_GROUP_LINKS), groupLinks, MatchType.TERM); .buildCollectionItemName(ProjectState.FIELD_NAME_MEMBERS_USER_GROUP_LINKS), groupLinks, MatchType.TERM); membersGroupQuery.setOccurance(Occurance.SHOULD_OCCUR); .buildCollectionItemName(ProjectState.FIELD_NAME_VIEWERS_USER_GROUP_LINKS), groupLinks, MatchType.TERM); viewersGroupQuery.setOccurance(Occurance.SHOULD_OCCUR);
public static QueryTask getVolumeByHostAndNameQueryTask(String hostLink, String volumeName) { QueryTask queryTask = QueryUtil.buildQuery(ContainerVolumeState.class, true); String parentLinksItemField = QueryTask.QuerySpecification .buildCollectionItemName(ContainerVolumeState.FIELD_NAME_PARENT_LINKS); QueryTask.Query parentsClause = new QueryTask.Query() .setTermPropertyName(parentLinksItemField) .setTermMatchValue(hostLink) .setTermMatchType(MatchType.TERM) .setOccurance(Occurance.MUST_OCCUR); QueryTask.Query nameClause = new QueryTask.Query() .setTermPropertyName(ContainerVolumeState.FIELD_NAME_NAME) .setCaseInsensitiveTermMatchValue(volumeName) .setTermMatchType(MatchType.TERM) .setOccurance(Occurance.MUST_OCCUR); QueryTask.Query stateClause = new QueryTask.Query() .setTermPropertyName(ContainerVolumeState.FIELD_NAME_POWER_STATE) .setTermMatchValue(PowerState.CONNECTED.toString()) .setTermMatchType(MatchType.TERM) .setOccurance(Occurance.MUST_OCCUR); Query intermediate = new QueryTask.Query().setOccurance(Occurance.MUST_OCCUR); intermediate.addBooleanClause(parentsClause); intermediate.addBooleanClause(nameClause); intermediate.addBooleanClause(stateClause); queryTask.querySpec.query.addBooleanClause(intermediate); QueryUtil.addExpandOption(queryTask); QueryUtil.addBroadcastOption(queryTask); return queryTask; }
.map(p -> QuerySpecification.buildCompositeFieldName(propertyName, p)) .collect(Collectors.toSet()); } else { .map(p -> QuerySpecification.buildCompositeFieldName(propertyName, p)) .collect(Collectors.toSet()); } else {