Search in sources :

Example 6 with GetOperationOptionsBuilder

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

the class SqaleRepoLookupTableTest method test123LookupLanguagesGetByKeyContainingWithPaging.

@Test
public void test123LookupLanguagesGetByKeyContainingWithPaging() 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(LookupTableRowType.F_KEY).end();
    PrismObject<LookupTableType> lookup = repositoryService.getObject(LookupTableType.class, LOOKUP_LANGUAGES_OID, optionsBuilder.build(), result);
    then();
    result.computeStatus();
    TestUtil.assertSuccess(result);
    checkLookupResult(lookup, new String[] { "sk_SK", "sk", "Slovak" });
}
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)

Example 7 with GetOperationOptionsBuilder

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

the class SqaleRepoLookupTableTest method test122LookupLanguagesGetByKeyContaining.

@Test
public void test122LookupLanguagesGetByKeyContaining() throws Exception {
    given();
    OperationResult result = createOperationResult();
    when();
    GetOperationOptionsBuilder optionsBuilder = SchemaService.get().getOperationOptionsBuilder().item(LookupTableType.F_ROW).retrieveQuery().item(LookupTableRowType.F_KEY).contains("r").end();
    PrismObject<LookupTableType> lookup = repositoryService.getObject(LookupTableType.class, LOOKUP_LANGUAGES_OID, optionsBuilder.build(), result);
    then();
    result.computeStatus();
    TestUtil.assertSuccess(result);
    checkLookupResult(lookup, new String[] { "tr_TR", "tr", "Turkish" });
}
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)

Example 8 with GetOperationOptionsBuilder

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

the class DefaultColumnUtils method createOption.

public static Collection<SelectorOptions<GetOperationOptions>> createOption(Class<Containerable> type, SchemaService schemaService) {
    if (type == null) {
        return null;
    }
    List<QName> propertiesToGet = new ArrayList<>();
    GetOperationOptionsBuilder getOperationOptionsBuilder = schemaService.getOperationOptionsBuilder();
    getOperationOptionsBuilder = getOperationOptionsBuilder.resolveNames();
    if (TaskType.class.isAssignableFrom(type)) {
        propertiesToGet.add(TaskType.F_NODE_AS_OBSERVED);
        propertiesToGet.add(TaskType.F_NEXT_RUN_START_TIMESTAMP);
        propertiesToGet.add(TaskType.F_NEXT_RETRY_TIMESTAMP);
        propertiesToGet.add(TaskType.F_SUBTASK_REF);
    } else if (ResourceType.class.isAssignableFrom(type)) {
        propertiesToGet.add(ResourceType.F_CONNECTOR_REF);
    }
    // }
    return getOperationOptionsBuilder.items(propertiesToGet.toArray(new Object[0])).retrieve().build();
}
Also used : QName(javax.xml.namespace.QName) GetOperationOptionsBuilder(com.evolveum.midpoint.schema.GetOperationOptionsBuilder)

Example 9 with GetOperationOptionsBuilder

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

the class ResourceContentPanel method createSearchOptions.

private Collection<SelectorOptions<GetOperationOptions>> createSearchOptions() {
    GetOperationOptionsBuilder builder = getPageBase().getOperationOptionsBuilder().item(ShadowType.F_ASSOCIATION).dontRetrieve();
    builder = addAdditionalOptions(builder);
    return builder.build();
}
Also used : GetOperationOptionsBuilder(com.evolveum.midpoint.schema.GetOperationOptionsBuilder)

Example 10 with GetOperationOptionsBuilder

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

the class PageDebugView method initObjectViewObject.

private LoadableModel<ObjectViewDto<?>> initObjectViewObject() {
    return new LoadableModel<ObjectViewDto<?>>(false) {

        private static final long serialVersionUID = 1L;

        @Override
        protected ObjectViewDto<?> load() {
            ObjectViewDto<?> objectViewDto = new ObjectViewDto<>();
            StringValue objectOid = getPageParameters().get(PARAM_OBJECT_ID);
            if (objectOid == null || StringUtils.isEmpty(objectOid.toString())) {
                getSession().error(getString("pageDebugView.message.oidNotDefined"));
                throw new RestartResponseException(PageDebugList.class);
            }
            Task task = createSimpleTask(OPERATION_LOAD_OBJECT);
            // todo is this result != null ?
            OperationResult result = task.getResult();
            try {
                MidPointApplication application = PageDebugView.this.getMidpointApplication();
                Class<? extends ObjectType> type = getTypeFromParameters();
                GetOperationOptionsBuilder optionsBuilder = getSchemaService().getOperationOptionsBuilder().raw().resolveNames().tolerateRawData();
                if (getPageParameters().get(PARAM_SHOW_ALL_ITEMS).toBoolean(true)) {
                    optionsBuilder = optionsBuilder.retrieve();
                }
                PrismObject<? extends ObjectType> object = getModelService().getObject(type, objectOid.toString(), optionsBuilder.build(), task, result);
                PrismContext context = application.getPrismContext();
                String lex = context.serializerFor(dataLanguage).serialize(object);
                objectViewDto = new ObjectViewDto<>(object.getOid(), WebComponentUtil.getName(object), object, lex);
                result.recomputeStatus();
            } catch (Exception ex) {
                result.recordFatalError(getString("WebModelUtils.couldntLoadObject"), ex);
            }
            showResult(result, false);
            if (!WebComponentUtil.isSuccessOrHandledErrorOrWarning(result)) {
                showResult(result, false);
                throw new RestartResponseException(PageDebugList.class);
            }
            return objectViewDto;
        }
    };
}
Also used : Task(com.evolveum.midpoint.task.api.Task) PrismContext(com.evolveum.midpoint.prism.PrismContext) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RestartResponseException(org.apache.wicket.RestartResponseException) MidPointApplication(com.evolveum.midpoint.web.security.MidPointApplication) RestartResponseException(org.apache.wicket.RestartResponseException) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) StringValue(org.apache.wicket.util.string.StringValue) ObjectViewDto(com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto) GetOperationOptionsBuilder(com.evolveum.midpoint.schema.GetOperationOptionsBuilder)

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