Skip to content

Commit

Permalink
Refactored out Aggregate implementation, made part of Repository API
Browse files Browse the repository at this point in the history
  • Loading branch information
tonydamage committed Jul 11, 2023
1 parent 58715e5 commit d7eb18f
Show file tree
Hide file tree
Showing 5 changed files with 448 additions and 325 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.evolveum.midpoint.schema.selector.spec.ValueSelector;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -137,9 +138,16 @@ public interface RepositoryService extends OrgTreeEvaluator, CaseSupportMixin, A
String OP_SEARCH_CONTAINERS = "searchContainers";
String OP_COUNT_CONTAINERS = "countContainers";
String OP_SEARCH_REFERENCES = "searchReferences";


String OP_SEARCH_REFERENCES_ITERATIVE = "searchReferencesIterative";
String OP_SEARCH_REFERENCES_ITERATIVE_PAGE = "searchReferencesIterativePage";
String OP_COUNT_REFERENCES = "countReferences";

String OP_SEARCH_AGGREGATE = "searchAggregate";
String OP_COUNT_AGGREGATE = "countAggregate";


String OP_FETCH_EXT_ITEMS = "fetchExtItems";
String OP_ADD_DIAGNOSTIC_INFORMATION = "addDiagnosticInformation";
String OP_HAS_CONFLICT = "hasConflict";
Expand All @@ -152,6 +160,9 @@ public interface RepositoryService extends OrgTreeEvaluator, CaseSupportMixin, A
String DELETE_OBJECT = CLASS_NAME_WITH_DOT + OP_DELETE_OBJECT;
String SEARCH_OBJECTS = CLASS_NAME_WITH_DOT + OP_SEARCH_OBJECTS;
String SEARCH_CONTAINERS = CLASS_NAME_WITH_DOT + OP_SEARCH_CONTAINERS;

String SEARCH_AGGREGATE = CLASS_NAME_WITH_DOT + OP_SEARCH_AGGREGATE;
String COUNT_AGGREGATE = CLASS_NAME_WITH_DOT + OP_COUNT_AGGREGATE;
String COUNT_CONTAINERS = CLASS_NAME_WITH_DOT + OP_COUNT_CONTAINERS;
String MODIFY_OBJECT = CLASS_NAME_WITH_DOT + OP_MODIFY_OBJECT;
String COUNT_OBJECTS = CLASS_NAME_WITH_DOT + OP_COUNT_OBJECTS;
Expand Down Expand Up @@ -588,6 +599,20 @@ default <F extends FocusType> PrismObject<F> searchShadowOwner(
*/
void returnUnusedValuesToSequence(String oid, Collection<Long> unusedValues, OperationResult parentResult) throws ObjectNotFoundException, SchemaException;


@Experimental
@ApiStatus.Internal
@NotNull
default SearchResultList<PrismContainerValue<?>> searchAggregate(AggregateQuery<?> query, OperationResult parentResult) throws SchemaException {
throw new UnsupportedOperationException("Not Supported");
}

@Experimental
@ApiStatus.Internal
default int countAggregate(AggregateQuery<?> query, OperationResult parentResult) throws SchemaException {
throw new UnsupportedOperationException("Not Supported");
}

/**
* Provide repository run-time configuration and diagnostic information.
* May execute diagnostic query on the database.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.evolveum.midpoint.prism.PrismContainerValue;

import jakarta.annotation.PreDestroy;

import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -256,6 +259,16 @@ public <T extends ObjectType> void addDiagnosticInformation(Class<T> type, Strin

//region --- Other methods (delegated directly to repository service) ------------------------------------------

@Override
public int countAggregate(AggregateQuery<?> query, OperationResult parentResult) throws SchemaException {
return repositoryService.countAggregate(query, parentResult);
}

@Override
public @NotNull SearchResultList<PrismContainerValue<?>> searchAggregate(AggregateQuery<?> query, OperationResult parentResult) throws SchemaException {
return repositoryService.searchAggregate(query, parentResult);
}

@Override
public boolean supports(@NotNull Class<? extends ObjectType> type) {
return repositoryService.supports(type);
Expand Down

0 comments on commit d7eb18f

Please sign in to comment.