use of com.evolveum.midpoint.prism.query.InOidFilter in project midpoint by Evolveum.
the class AccCertQueryHelper method searchCases.
// public because of certification tests
public List<AccessCertificationCaseType> searchCases(String campaignOid, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult result) throws SchemaException {
ObjectQuery newQuery;
InOidFilter inOidFilter = InOidFilter.createOwnerHasOidIn(campaignOid);
newQuery = replaceFilter(query, inOidFilter);
return repositoryService.searchContainers(AccessCertificationCaseType.class, newQuery, options, result);
}
use of com.evolveum.midpoint.prism.query.InOidFilter in project midpoint by Evolveum.
the class ImportRepositoryAction method execute.
@Override
public void execute() throws Exception {
OperationResult result = new OperationResult(OPERATION_IMPORT);
OperationStatus progress = new OperationStatus(context, result);
BlockingQueue<ObjectType> queue = new LinkedBlockingQueue<>(QUEUE_CAPACITY_PER_THREAD * options.getMultiThread());
// "+ 2" will be used for producer and progress reporter
ExecutorService executor = Executors.newFixedThreadPool(options.getMultiThread() + 2);
ImportProducerWorker<ObjectType> producer;
if (options.getOid() != null) {
InOidFilter filter = context.getPrismContext().queryFactory().createInOid(options.getOid());
producer = importByFilter(filter, true, queue, progress);
} else {
ObjectFilter filter = NinjaUtils.createObjectFilter(options.getFilter(), context, ObjectType.class);
producer = importByFilter(filter, false, queue, progress);
}
executor.execute(producer);
Thread.sleep(CONSUMERS_WAIT_FOR_START);
executor.execute(new ProgressReporterWorker<>(context, options, queue, progress));
List<ImportRepositoryConsumerWorker> consumers = createConsumers(queue, progress);
consumers.forEach(c -> executor.execute(c));
executor.shutdown();
boolean awaitResult = executor.awaitTermination(NinjaUtils.WAIT_FOR_EXECUTOR_FINISH, TimeUnit.DAYS);
if (!awaitResult) {
log.error("Executor did not finish before timeout");
}
handleResultOnFinish(progress, "Import finished");
}
use of com.evolveum.midpoint.prism.query.InOidFilter in project midpoint by Evolveum.
the class PageDebugList method createDeleteAllUsersQuery.
private ObjectQuery createDeleteAllUsersQuery() {
InOidFilter inOid = InOidFilter.createInOid(SystemObjectsType.USER_ADMINISTRATOR.value());
NotFilter not = new NotFilter(inOid);
return ObjectQuery.createObjectQuery(not);
}
use of com.evolveum.midpoint.prism.query.InOidFilter in project midpoint by Evolveum.
the class TestAdHocCertification method test010HireUserOutOfScope.
@Test
public void test010HireUserOutOfScope() throws Exception {
// GIVEN
Task task = getTestTask();
task.setOwner(userAdministrator.asPrismObject());
OperationResult result = task.getResult();
// WHEN
when();
assignOrg(USER_INDIGO_OID, ORG_LABORATORY_OID, task, result);
// THEN
then();
result.computeStatus();
TestUtil.assertSuccess(result);
SearchResultList<PrismObject<AccessCertificationCampaignType>> campaigns = getAllCampaigns(result);
assertEquals("Wrong # of campaigns", 1, campaigns.size());
AccessCertificationObjectBasedScopeType scope = (AccessCertificationObjectBasedScopeType) campaigns.get(0).asObjectable().getScopeDefinition();
Class<? extends ObjectType> objectClass = ObjectTypes.getObjectTypeClass(scope.getObjectType());
ObjectFilter parsedFilter = prismContext.getQueryConverter().parseFilter(scope.getSearchFilter(), objectClass);
assertTrue("Unexpected type of scope filter, expected AndFilter", parsedFilter instanceof AndFilter);
for (ObjectFilter subFilter : ((AndFilter) parsedFilter).getConditions()) {
assertTrue("Unexpected type of subfilter in scope filter, expected EqualFilter or InOidFilter", (subFilter instanceof EqualFilter || subFilter instanceof InOidFilter));
}
}
use of com.evolveum.midpoint.prism.query.InOidFilter in project midpoint by Evolveum.
the class DeleteRepositoryAction method deleteByOid.
private void deleteByOid() throws SchemaException {
QueryFactory queryFactory = context.getPrismContext().queryFactory();
InOidFilter filter = queryFactory.createInOid(options.getOid());
ObjectQuery query = queryFactory.createQuery(filter);
deleteByFilter(query);
}
Aggregations