Search in sources :

Example 11 with GetOperationOptionsBuilder

use of com.evolveum.midpoint.schema.GetOperationOptionsBuilder in project midpoint by Evolveum.

the class PageDebugDownloadBehaviour method dumpObjectsToStream.

private void dumpObjectsToStream(final Writer writer, OperationResult result) throws Exception {
    final PageBase page = getPage();
    ResultHandler handler = (object, parentResult) -> {
        try {
            String xml = page.getPrismContext().xmlSerializer().options(createSerializeForExport()).serialize(object);
            writer.write('\t');
            writer.write(xml);
            writer.write('\n');
        } catch (IOException | SchemaException ex) {
            throw new SystemException(ex.getMessage(), ex);
        }
        return true;
    };
    ModelService service = page.getModelService();
    GetOperationOptionsBuilder optionsBuilder = page.getSchemaService().getOperationOptionsBuilder().raw().resolveNames();
    if (showAllItems) {
        optionsBuilder = optionsBuilder.retrieve();
    }
    service.searchObjectsIterative(type, query, handler, optionsBuilder.build(), page.createSimpleTask(OPERATION_SEARCH_OBJECT), result);
}
Also used : ZipOutputStream(java.util.zip.ZipOutputStream) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) LocalDateTime(java.time.LocalDateTime) SchemaConstants(com.evolveum.midpoint.schema.constants.SchemaConstants) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Trace(com.evolveum.midpoint.util.logging.Trace) StringUtils(org.apache.commons.lang3.StringUtils) MidPointApplication(com.evolveum.midpoint.web.security.MidPointApplication) WebApplicationConfiguration(com.evolveum.midpoint.web.security.WebApplicationConfiguration) SchemaConstantsGenerated(com.evolveum.midpoint.schema.SchemaConstantsGenerated) RestartResponseException(org.apache.wicket.RestartResponseException) ZipEntry(java.util.zip.ZipEntry) ResultHandler(com.evolveum.midpoint.schema.ResultHandler) WebComponentUtil(com.evolveum.midpoint.gui.api.util.WebComponentUtil) Files(org.apache.wicket.util.file.Files) GetOperationOptionsBuilder(com.evolveum.midpoint.schema.GetOperationOptionsBuilder) LoggingUtils(com.evolveum.midpoint.util.logging.LoggingUtils) PageDebugList(com.evolveum.midpoint.web.page.admin.configuration.PageDebugList) ModelService(com.evolveum.midpoint.model.api.ModelService) File(org.apache.wicket.util.file.File) java.io(java.io) SerializationOptions.createSerializeForExport(com.evolveum.midpoint.prism.SerializationOptions.createSerializeForExport) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) SystemException(com.evolveum.midpoint.util.exception.SystemException) DateTimeFormatter(java.time.format.DateTimeFormatter) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) AjaxDownloadBehaviorFromFile(com.evolveum.midpoint.web.component.AjaxDownloadBehaviorFromFile) TraceManager(com.evolveum.midpoint.util.logging.TraceManager) SystemException(com.evolveum.midpoint.util.exception.SystemException) ResultHandler(com.evolveum.midpoint.schema.ResultHandler) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) GetOperationOptionsBuilder(com.evolveum.midpoint.schema.GetOperationOptionsBuilder) ModelService(com.evolveum.midpoint.model.api.ModelService)

Example 12 with GetOperationOptionsBuilder

use of com.evolveum.midpoint.schema.GetOperationOptionsBuilder in project midpoint by Evolveum.

the class TaskSubtasksAndThreadsPanel method createOperationOptions.

private Collection<SelectorOptions<GetOperationOptions>> createOperationOptions() {
    List<QName> propertiesToGet = new ArrayList<>();
    propertiesToGet.add(TaskType.F_SUBTASK_REF);
    propertiesToGet.add(TaskType.F_NODE_AS_OBSERVED);
    GetOperationOptionsBuilder getOperationOptionsBuilder = getPageBase().getOperationOptionsBuilder();
    getOperationOptionsBuilder = getOperationOptionsBuilder.resolveNames();
    return getOperationOptionsBuilder.items(propertiesToGet.toArray(new Object[0])).retrieve().build();
}
Also used : QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) PrismObject(com.evolveum.midpoint.prism.PrismObject) GetOperationOptionsBuilder(com.evolveum.midpoint.schema.GetOperationOptionsBuilder)

Example 13 with GetOperationOptionsBuilder

use of com.evolveum.midpoint.schema.GetOperationOptionsBuilder in project midpoint by Evolveum.

the class PageTasks method createOperationOptions.

private Collection<SelectorOptions<GetOperationOptions>> createOperationOptions() {
    List<QName> propertiesToGet = new ArrayList<>();
    propertiesToGet.add(TaskType.F_NODE_AS_OBSERVED);
    propertiesToGet.add(TaskType.F_NEXT_RUN_START_TIMESTAMP);
    propertiesToGet.add(TaskType.F_NEXT_RETRY_TIMESTAMP);
    GetOperationOptionsBuilder getOperationOptionsBuilder = getSchemaService().getOperationOptionsBuilder();
    getOperationOptionsBuilder = getOperationOptionsBuilder.resolveNames();
    return getOperationOptionsBuilder.items(propertiesToGet.toArray(new Object[0])).retrieve().build();
}
Also used : QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) GetOperationOptionsBuilder(com.evolveum.midpoint.schema.GetOperationOptionsBuilder)

Example 14 with GetOperationOptionsBuilder

use of com.evolveum.midpoint.schema.GetOperationOptionsBuilder in project midpoint by Evolveum.

the class TaskSubtasksAndThreadsTabPanel method createOperationOptions.

private Collection<SelectorOptions<GetOperationOptions>> createOperationOptions() {
    List<QName> propertiesToGet = new ArrayList<>();
    propertiesToGet.add(TaskType.F_SUBTASK_REF);
    propertiesToGet.add(TaskType.F_NODE_AS_OBSERVED);
    GetOperationOptionsBuilder getOperationOptionsBuilder = getSchemaService().getOperationOptionsBuilder();
    getOperationOptionsBuilder = getOperationOptionsBuilder.resolveNames();
    return getOperationOptionsBuilder.items(propertiesToGet.toArray(new Object[0])).retrieve().build();
}
Also used : QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) PrismObject(com.evolveum.midpoint.prism.PrismObject) GetOperationOptionsBuilder(com.evolveum.midpoint.schema.GetOperationOptionsBuilder)

Example 15 with GetOperationOptionsBuilder

use of com.evolveum.midpoint.schema.GetOperationOptionsBuilder in project midpoint by Evolveum.

the class SqaleRepoLookupTableTest method test124LookupLanguagesOrderById.

@Test
public void test124LookupLanguagesOrderById() throws Exception {
    given();
    OperationResult result = createOperationResult();
    when();
    GetOperationOptionsBuilder optionsBuilder = SchemaService.get().getOperationOptionsBuilder().item(LookupTableType.F_ROW).retrieveQuery().item(LookupTableRowType.F_KEY).contains("_").offset(2).maxSize(1).asc(PrismConstants.T_ID).end();
    PrismObject<LookupTableType> lookup = repositoryService.getObject(LookupTableType.class, LOOKUP_LANGUAGES_OID, optionsBuilder.build(), result);
    then();
    assertThatOperationResult(result).isSuccess();
    assertThat(lookup).isNotNull();
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) GetOperationOptionsBuilder(com.evolveum.midpoint.schema.GetOperationOptionsBuilder) LookupTableType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType) Test(org.testng.annotations.Test) SqaleRepoBaseTest(com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)

Aggregations

GetOperationOptionsBuilder (com.evolveum.midpoint.schema.GetOperationOptionsBuilder)20 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)13 SqaleRepoBaseTest (com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)9 LookupTableType (com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType)9 Test (org.testng.annotations.Test)9 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)4 QName (javax.xml.namespace.QName)4 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)3 ArrayList (java.util.ArrayList)3 NinjaContext (com.evolveum.midpoint.ninja.impl.NinjaContext)2 NinjaException (com.evolveum.midpoint.ninja.impl.NinjaException)2 Log (com.evolveum.midpoint.ninja.util.Log)2 NinjaUtils (com.evolveum.midpoint.ninja.util.NinjaUtils)2 OperationStatus (com.evolveum.midpoint.ninja.util.OperationStatus)2 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 ResultHandler (com.evolveum.midpoint.schema.ResultHandler)2 Task (com.evolveum.midpoint.task.api.Task)2 MidPointApplication (com.evolveum.midpoint.web.security.MidPointApplication)2 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)2 List (java.util.List)2