use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class ResourceAttributePanel method customEditItemPerformed.
// private void manageMappings(boolean outbound) {
// if (outbound) {
// collectionOutbounds();
// }
// PrismContainerWrapper<ResourceAttributeDefinitionType> resourceAttributeDefinition = getModelObject();
//
// }
//
// private void collectionOutbounds() {
// PrismContainerWrapper<ResourceAttributeDefinitionType> resourceAttributeDef = getModelObject();
//
// for (PrismContainerValueWrapper<ResourceAttributeDefinitionType> resourceAttributeDefVal : resourceAttributeDef.getValues()) {
// ResourceAttributeDefinitionType resourceAttrRealValue = resourceAttributeDefVal.getRealValue();
// if (resourceAttributeDef == null) {
// continue;
// }
// MappingType mappingType = resourceAttrRealValue.getOutbound();
// if (mappingType == null) {
// continue;
// }
//
// }
// }
@Override
protected boolean customEditItemPerformed(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ResourceAttributeDefinitionType>> rowModel, List<PrismContainerValueWrapper<ResourceAttributeDefinitionType>> listItems) {
if (getConfig() == null) {
return false;
}
AbstractPageObjectDetails parent = findParent(AbstractPageObjectDetails.class);
if (parent == null) {
return false;
}
ContainerPanelConfigurationType detailsPanel = new ContainerPanelConfigurationType(getPrismContext());
detailsPanel.setPanelType("attributeDefinitionDetails");
PrismContainerValueWrapper<ResourceAttributeDefinitionType> attrDef;
if (rowModel != null) {
attrDef = rowModel.getObject();
} else {
attrDef = listItems.iterator().next();
}
// VirtualContainersSpecificationType virtualContainer = new VirtualContainersSpecificationType(getPrismContext());
detailsPanel.setPath(new ItemPathType(attrDef.getPath()));
// detailsPanel.getContainer().add(virtualContainer);
detailsPanel.setIdentifier("attributeDefinitionDetails");
DisplayType displayType = new DisplayType();
displayType.setLabel(new PolyStringType(attrDef.getDisplayName()));
IconType icon = new IconType();
icon.setCssClass("fa fa-navicon");
displayType.setIcon(icon);
detailsPanel.setDisplay(displayType);
getPageBase().getSessionStorage().setObjectDetailsStorage("details" + parent.getType().getSimpleName(), detailsPanel);
ResourceAttributePanel.this.getConfig().getPanel().add(detailsPanel);
target.add(parent);
parent.replacePanel(detailsPanel, target);
return true;
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class FullTextSearchUtil method getFullTextSearchItemPaths.
@NotNull
public static Set<ItemPath> getFullTextSearchItemPaths(@NotNull FullTextSearchConfigurationType config, Class<? extends ObjectType> clazz) {
List<QName> types = ObjectTypes.getObjectType(clazz).thisAndSupertypes().stream().map(ot -> ot.getTypeQName()).collect(Collectors.toList());
Set<ItemPath> paths = new HashSet<>();
for (FullTextSearchIndexedItemsConfigurationType indexed : config.getIndexed()) {
if (isApplicable(indexed, types)) {
for (ItemPathType itemPathType : indexed.getItem()) {
ItemPath path = itemPathType.getItemPath();
if (!ItemPath.isEmpty(path) && !ItemPathCollectionsUtil.containsEquivalent(paths, path)) {
paths.add(path);
}
}
}
}
return paths;
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class GetOperationOptionsUtil method selectorToSelectorType.
private static OptionObjectSelectorType selectorToSelectorType(ObjectSelector selector) {
if (selector == null) {
return null;
}
OptionObjectSelectorType selectorType = new OptionObjectSelectorType();
selectorType.setPath(new ItemPathType(selector.getPath()));
return selectorType;
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class PopulatorUtil method evaluatePopulateExpression.
public static <IV extends PrismValue, ID extends ItemDefinition, C extends Containerable> ItemDelta<IV, ID> evaluatePopulateExpression(PopulateItemType populateItem, VariablesMap variables, ExpressionEvaluationContext context, PrismContainerDefinition<C> targetContainerDefinition, String contextDescription, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, SecurityViolationException {
ExpressionType expressionType = populateItem.getExpression();
if (expressionType == null) {
LOGGER.warn("No expression in populateObject in assignment expression in {}, " + "skipping. Subsequent operations will most likely fail", contextDescription);
return null;
}
VariableBindingDefinitionType targetType = populateItem.getTarget();
if (targetType == null) {
LOGGER.warn("No target in populateObject in assignment expression in {}, " + "skipping. Subsequent operations will most likely fail", contextDescription);
return null;
}
ItemPathType itemPathType = targetType.getPath();
if (itemPathType == null) {
throw new SchemaException("No path in target definition in " + contextDescription);
}
ItemPath targetPath = itemPathType.getItemPath();
ID propOutputDefinition = ExpressionUtil.resolveDefinitionPath(targetPath, variables, targetContainerDefinition, "target definition in " + contextDescription);
if (propOutputDefinition == null) {
throw new SchemaException("No target item that would conform to the path " + targetPath + " in " + contextDescription);
}
String expressionDesc = "expression in populate expression in " + contextDescription;
ExpressionFactory expressionFactory = context.getExpressionFactory();
Expression<IV, ID> expression = expressionFactory.makeExpression(expressionType, propOutputDefinition, context.getExpressionProfile(), expressionDesc, task, result);
ExpressionEvaluationContext localContext = new ExpressionEvaluationContext(null, variables, expressionDesc, task);
localContext.setExpressionFactory(expressionFactory);
localContext.setValuePolicySupplier(context.getValuePolicySupplier());
localContext.setSkipEvaluationMinus(true);
localContext.setSkipEvaluationPlus(false);
localContext.setVariableProducer(context.getVariableProducer());
localContext.setLocalContextDescription(context.getLocalContextDescription());
PrismValueDeltaSetTriple<IV> outputTriple = expression.evaluate(localContext, result);
LOGGER.trace("output triple:\n{}", DebugUtil.debugDumpLazily(outputTriple, 1));
if (outputTriple == null) {
return null;
}
Collection<IV> pvalues = outputTriple.getNonNegativeValues();
// Maybe not really clean but it works. TODO: refactor later
if (targetPath.startsWithVariable()) {
targetPath = targetPath.rest();
}
// noinspection unchecked
ItemDelta<IV, ID> itemDelta = propOutputDefinition.createEmptyDelta(targetPath);
itemDelta.addValuesToAdd(PrismValueCollectionsUtil.cloneCollection(pvalues));
LOGGER.trace("Item delta:\n{}", itemDelta.debugDumpLazily(1));
return itemDelta;
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class MappingTypeDto method prepareDtoToSave.
public MappingType prepareDtoToSave(PrismContext prismContext) throws SchemaException {
if (mappingObject == null) {
mappingObject = new MappingType();
}
if (target != null) {
VariableBindingDefinitionType mappingTarget = new VariableBindingDefinitionType();
mappingTarget.setPath(new ItemPathType(target));
mappingObject.setTarget(mappingTarget);
} else {
mappingObject.setTarget(null);
}
mappingObject.getSource().clear();
List<VariableBindingDefinitionType> mappingSourceList = new ArrayList<>();
for (String s : source) {
if (s == null) {
continue;
}
VariableBindingDefinitionType mappingSource = new VariableBindingDefinitionType();
mappingSource.setPath(new ItemPathType(s));
mappingSourceList.add(mappingSource);
}
mappingObject.getSource().addAll(mappingSourceList);
if (expression != null) {
if (mappingObject.getExpression() == null) {
mappingObject.setExpression(new ExpressionType());
}
ExpressionUtil.parseExpressionEvaluators(expression, mappingObject.getExpression(), prismContext);
}
if (condition != null) {
if (mappingObject.getCondition() == null) {
mappingObject.setCondition(new ExpressionType());
}
ExpressionUtil.parseExpressionEvaluators(condition, mappingObject.getCondition(), prismContext);
}
return mappingObject;
}
Aggregations