use of com.evolveum.prism.xml.ns._public.types_3.ObjectType in project midpoint by Evolveum.
the class SchemaTransformer method applyObjectTemplateToDefinition.
public <O extends ObjectType> void applyObjectTemplateToDefinition(PrismObjectDefinition<O> objectDefinition, ObjectTemplateType objectTemplateType, OperationResult result) throws ObjectNotFoundException, SchemaException {
if (objectTemplateType == null) {
return;
}
for (ObjectReferenceType includeRef : objectTemplateType.getIncludeRef()) {
PrismObject<ObjectTemplateType> subTemplate = cacheRepositoryService.getObject(ObjectTemplateType.class, includeRef.getOid(), null, result);
applyObjectTemplateToDefinition(objectDefinition, subTemplate.asObjectable(), result);
}
for (ObjectTemplateItemDefinitionType templateItemDefType : objectTemplateType.getItem()) {
ItemPathType ref = templateItemDefType.getRef();
if (ref == null) {
throw new SchemaException("No 'ref' in item definition in " + objectTemplateType);
}
ItemPath itemPath = ref.getItemPath();
ItemDefinition itemDef = objectDefinition.findItemDefinition(itemPath);
if (itemDef != null) {
applyObjectTemplateItem(itemDef, templateItemDefType, "item " + itemPath + " in object type " + objectDefinition.getTypeName() + " as specified in item definition in " + objectTemplateType);
} else {
OperationResult subResult = result.createMinorSubresult(SchemaTransformer.class.getName() + ".applyObjectTemplateToDefinition");
subResult.recordPartialError("No definition for item " + itemPath + " in object type " + objectDefinition.getTypeName() + " as specified in item definition in " + objectTemplateType);
continue;
}
}
}
use of com.evolveum.prism.xml.ns._public.types_3.ObjectType in project midpoint by Evolveum.
the class SchemaTransformer method applyObjectTemplateToObject.
private <O extends ObjectType> void applyObjectTemplateToObject(PrismObject<O> object, ObjectTemplateType objectTemplateType, OperationResult result) throws ObjectNotFoundException, SchemaException {
if (objectTemplateType == null) {
return;
}
for (ObjectReferenceType includeRef : objectTemplateType.getIncludeRef()) {
PrismObject<ObjectTemplateType> subTemplate = cacheRepositoryService.getObject(ObjectTemplateType.class, includeRef.getOid(), null, result);
applyObjectTemplateToObject(object, subTemplate.asObjectable(), result);
}
for (ObjectTemplateItemDefinitionType templateItemDefType : objectTemplateType.getItem()) {
ItemPathType ref = templateItemDefType.getRef();
if (ref == null) {
throw new SchemaException("No 'ref' in item definition in " + objectTemplateType);
}
ItemPath itemPath = ref.getItemPath();
ItemDefinition itemDefFromObject = object.getDefinition().findItemDefinition(itemPath);
if (itemDefFromObject != null) {
applyObjectTemplateItem(itemDefFromObject, templateItemDefType, "item " + itemPath + " in " + object + " as specified in item definition in " + objectTemplateType);
} else {
OperationResult subResult = result.createMinorSubresult(SchemaTransformer.class.getName() + ".applyObjectTemplateToObject");
subResult.recordPartialError("No definition for item " + itemPath + " in " + object + " as specified in item definition in " + objectTemplateType);
continue;
}
Item<?, ?> item = object.findItem(itemPath);
if (item != null) {
ItemDefinition itemDef = item.getDefinition();
if (itemDef != itemDefFromObject) {
applyObjectTemplateItem(itemDef, templateItemDefType, "item " + itemPath + " in " + object + " as specified in item definition in " + objectTemplateType);
}
}
}
}
use of com.evolveum.prism.xml.ns._public.types_3.ObjectType in project midpoint by Evolveum.
the class ObjectSelectionPanel method initLayout.
public void initLayout(PageBase pageBase) {
Form searchForm = new Form(ID_SEARCH_FORM);
searchForm.setOutputMarkupId(true);
add(searchForm);
searchForm.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return context.isSearchEnabled();
}
});
BasicSearchPanel<ObjectSearchDto> basicSearch = new BasicSearchPanel<ObjectSearchDto>(ID_BASIC_SEARCH) {
@Override
protected IModel<String> createSearchTextModel() {
return new PropertyModel<>(searchModel, ObjectSearchDto.F_SEARCH_TEXT);
}
@Override
protected void searchPerformed(AjaxRequestTarget target) {
ObjectSelectionPanel.this.searchPerformed(target);
}
@Override
protected void clearSearchPerformed(AjaxRequestTarget target) {
ObjectSelectionPanel.this.clearSearchPerformed(target);
}
};
searchForm.add(basicSearch);
add(context.createExtraContentContainer(ID_EXTRA_CONTENT_CONTAINER, this));
List<IColumn<SelectableBean<ObjectType>, String>> columns = initColumns();
ObjectDataProvider provider = new ObjectDataProvider(pageBase, this.objectType);
provider.setQuery(context.getDataProviderQuery());
provider.setOptions(context.getDataProviderOptions());
TablePanel table = new TablePanel<>(ID_TABLE, provider, columns);
table.setOutputMarkupId(true);
addOrReplace(table);
AjaxButton cancelButton = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("chooseTypeDialog.button.cancel")) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
modalWindow.close(ajaxRequestTarget);
}
};
add(cancelButton);
}
use of com.evolveum.prism.xml.ns._public.types_3.ObjectType in project midpoint by Evolveum.
the class ObjectSelectionPanel method initColumns.
private List<IColumn<SelectableBean<ObjectType>, String>> initColumns() {
List<IColumn<SelectableBean<ObjectType>, String>> columns = new ArrayList<>();
IColumn column = new LinkColumn<SelectableBean<ObjectType>>(createStringResource("chooseTypeDialog.column.name"), context.getSortableProperty(), "value.name") {
@Override
public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ObjectType>> rowModel) {
ObjectType object = rowModel.getObject().getValue();
context.chooseOperationPerformed(target, object);
}
};
columns.add(column);
return columns;
}
use of com.evolveum.prism.xml.ns._public.types_3.ObjectType in project midpoint by Evolveum.
the class PageRepositoryQuery method updateRequestWithMidpointQuery.
private void updateRequestWithMidpointQuery(RepositoryQueryDiagRequest request, QName objectType, String queryText, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException {
PrismContext prismContext = getPrismContext();
if (objectType == null) {
objectType = ObjectType.COMPLEX_TYPE;
}
@SuppressWarnings("unchecked") Class<? extends ObjectType> clazz = (Class<? extends ObjectType>) prismContext.getSchemaRegistry().getCompileTimeClassForObjectType(objectType);
if (clazz == null) {
throw new SchemaException("Couldn't find compile-time class for object type of " + objectType);
}
QueryType queryType = prismContext.parserFor(queryText).xml().parseRealValue(QueryType.class);
request.setType(clazz);
ObjectQuery objectQuery = QueryJaxbConvertor.createObjectQuery(clazz, queryType, prismContext);
ObjectQuery queryWithExprEvaluated = ExpressionUtil.evaluateQueryExpressions(objectQuery, new ExpressionVariables(), getExpressionFactory(), getPrismContext(), "evaluate query expressions", task, result);
request.setQuery(queryWithExprEvaluated);
}
Aggregations