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" });
}
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" });
}
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();
}
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();
}
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;
}
};
}
Aggregations