Skip to content

Commit

Permalink
Added Intiial interface (no implementation) for searchContainersItera…
Browse files Browse the repository at this point in the history
…tivelly

Signed-off-by: Tony Tkáčik <tonydamage@gmail.com>
  • Loading branch information
tonydamage committed Aug 23, 2023
1 parent 1a567cc commit d03bdd0
Show file tree
Hide file tree
Showing 7 changed files with 574 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,14 @@ public SearchResultMetadata searchReferencesIterative(
return null;
}

@Override
public <T extends Containerable> SearchResultMetadata searchContainersIterative(
Class<T> type, ObjectQuery query, ObjectHandler<T> handler,
Collection<SelectorOptions<GetOperationOptions>> options,
OperationResult parentResult) throws SchemaException {
return null;
}

@Override
public <O extends ObjectType> boolean isDescendant(
PrismObject<O> object, String ancestorOrgOid) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,23 @@ <T extends ObjectType> SearchResultMetadata searchObjectsIterative(Class<T> type
OperationResult parentResult)
throws SchemaException;

/**
* Executes iterative container search using the provided `handler` to process each container.
*
* @param query search query
* @param handler result handler
* @param options get options to use for the search
* @param parentResult parent OperationResult (in/out)
* @return summary information about the search result
*/
@Experimental
<T extends Containerable> SearchResultMetadata searchContainersIterative(
@NotNull Class<T> type,
@Nullable ObjectQuery query,
@NotNull ObjectHandler<T> handler,
@Nullable Collection<SelectorOptions<GetOperationOptions>> options,
@NotNull OperationResult parentResult) throws SchemaException;

/**
* Executes iterative reference search using the provided `handler` to process each references.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ public SearchResultMetadata searchReferencesIterative(
return searchOpHandler.searchReferencesIterative(query, handler, options, parentResult);
}

@Override
public <T extends Containerable> SearchResultMetadata searchContainersIterative(Class<T> type, ObjectQuery query, ObjectHandler<T> handler, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult parentResult) throws SchemaException {
return searchOpHandler.searchContainersIterative(type, query, handler, options, parentResult);
}

@Override
public @NotNull <T extends Containerable> SearchResultList<T> searchContainers(
@NotNull Class<T> type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public class SearchOpHandler extends CachedOpHandler {
private static final String OP_COUNT_REFERENCES = CLASS_NAME_WITH_DOT + "countReferences";
private static final String OP_SEARCH_REFERENCES_ITERATIVE = CLASS_NAME_WITH_DOT + "searchReferencesIterative";

private static final String OP_SEARCH_CONTAINERS_ITERATIVE = CLASS_NAME_WITH_DOT + "searchContainersIterative";


/**
* Queries resulting in more objects will not be cached "as such" - although individual objects/versions can be cached.
*/
Expand Down Expand Up @@ -438,6 +441,30 @@ public SearchResultMetadata searchReferencesIterative(
}
}

public <T extends Containerable> SearchResultMetadata searchContainersIterative(
@NotNull Class<T> type,
@Nullable ObjectQuery query,
@NotNull ObjectHandler<T> handler,
@Nullable Collection<SelectorOptions<GetOperationOptions>> options,
@NotNull OperationResult parentResult) throws SchemaException {
OperationResult result = parentResult.subresult(OP_SEARCH_CONTAINERS_ITERATIVE)
.addQualifier(type.getSimpleName())
.addParam("type", type)
.addParam("query", query)
.addArbitraryObjectAsParam("options", options)
.build();
Long startTime = repoOpStart();
try {
return repositoryService.searchContainersIterative(type, query, handler, options, result);
} catch (Throwable t) {
result.recordFatalError(t);
throw t;
} finally {
repoOpEnd(startTime);
result.computeStatusIfUnknown();
}
}

public <T extends ObjectType> int countObjects(Class<T> type, ObjectQuery query,
Collection<SelectorOptions<GetOperationOptions>> options, OperationResult parentResult)
throws SchemaException {
Expand All @@ -460,4 +487,6 @@ public <T extends ObjectType> int countObjects(Class<T> type, ObjectQuery query,
result.computeStatusIfUnknown();
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,18 @@ public SearchResultMetadata searchReferencesIterative(
operationResult.close();
}
}

@Override
public <T extends Containerable> SearchResultMetadata searchContainersIterative(
@NotNull Class<T> type,
@Nullable ObjectQuery query,
@NotNull ObjectHandler<T> handler,
@Nullable Collection<SelectorOptions<GetOperationOptions>> options,
@NotNull OperationResult parentResult) throws SchemaException {

return null;
}

// endregion

@Override
Expand Down

0 comments on commit d03bdd0

Please sign in to comment.