use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class ResourceAttributeRefPanelFactory method getChoicesList.
private List<ItemName> getChoicesList(PrismPropertyPanelContext<ItemPathType> ctx) {
PrismPropertyWrapper<?> wrapper = ctx.unwrapWrapperModel();
// attribute/ref
if (wrapper == null) {
return Collections.emptyList();
}
// attribute value
if (wrapper.getParent() == null) {
return Collections.emptyList();
}
// attribute
ItemWrapper<?, ?> attributeWrapper = wrapper.getParent().getParent();
if (attributeWrapper == null) {
return Collections.emptyList();
}
PrismContainerValueWrapper<?> itemWrapper = attributeWrapper.getParent();
if (itemWrapper == null) {
return Collections.emptyList();
}
if (!(itemWrapper instanceof ConstructionValueWrapper)) {
return Collections.emptyList();
}
ConstructionValueWrapper constructionWrapper = (ConstructionValueWrapper) itemWrapper;
try {
ResourceSchema schema = constructionWrapper.getRefinedSchema();
if (schema == null) {
return new ArrayList<>();
}
ResourceObjectDefinition rOcd = schema.findObjectDefinition(constructionWrapper.getKind(), constructionWrapper.getIntent());
if (rOcd == null) {
return Collections.emptyList();
}
if (ConstructionType.F_ASSOCIATION.equivalent(attributeWrapper.getItemName())) {
Collection<ResourceAssociationDefinition> associationDefs = rOcd.getAssociationDefinitions();
return associationDefs.stream().map(ResourceAssociationDefinition::getName).collect(Collectors.toList());
}
Collection<? extends ResourceAttributeDefinition<?>> attrDefs = rOcd.getAttributeDefinitions();
return attrDefs.stream().map(a -> a.getItemName()).collect(Collectors.toList());
} catch (SchemaException e) {
LOGGER.warn("Cannot get resource attribute definitions");
}
return Collections.emptyList();
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class ConstructionAssociationPanel method addNewShadowRefValuePerformed.
private void addNewShadowRefValuePerformed(AjaxRequestTarget target, ResourceAssociationDefinition def) {
ObjectFilter filter = WebComponentUtil.createAssociationShadowRefFilter(def, getPageBase().getPrismContext(), resourceModel.getObject().getOid());
ObjectBrowserPanel<ShadowType> objectBrowserPanel = new ObjectBrowserPanel<ShadowType>(getPageBase().getMainPopupBodyId(), ShadowType.class, Collections.singletonList(ShadowType.COMPLEX_TYPE), false, getPageBase(), filter) {
private static final long serialVersionUID = 1L;
@Override
protected void onSelectPerformed(AjaxRequestTarget target, ShadowType object) {
getPageBase().hideMainPopup(target);
try {
PrismContainerWrapper<ConstructionType> constructionContainerWrapper = ConstructionAssociationPanel.this.getModelObject();
PrismContainerWrapper<ResourceObjectAssociationType> associationWrapper = constructionContainerWrapper.findContainer(ConstructionType.F_ASSOCIATION);
List<PrismContainerValue<ResourceObjectAssociationType>> associationValueList = associationWrapper.getItem().getValues();
PrismContainerValue<ResourceObjectAssociationType> associationValue;
if (CollectionUtils.isEmpty(associationValueList)) {
associationValue = associationWrapper.getItem().createNewValue();
} else {
associationValue = associationValueList.get(0);
}
ItemName associationRefPath = def.getName();
associationValue.asContainerable().setRef(new ItemPathType(associationRefPath));
ExpressionType newAssociationExpression = associationValue.asContainerable().beginOutbound().beginExpression();
ExpressionUtil.addShadowRefEvaluatorValue(newAssociationExpression, object.getOid(), getPageBase().getPrismContext());
} catch (SchemaException ex) {
LOGGER.error("Couldn't find association container: {}", ex.getLocalizedMessage());
}
target.add(ConstructionAssociationPanel.this);
}
};
getPageBase().showMainPopup(objectBrowserPanel, target);
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class TestJaxbConstruction method createFilter.
private MapXNode createFilter() {
XNodeFactory factory = getPrismContext().xnodeFactory();
Map<QName, XNode> equalsElementSource = new HashMap<>();
PrimitiveXNode<ItemPathType> pathElement = factory.primitive(new ItemPathType(new ItemName("name")));
equalsElementSource.put(new QName(SchemaConstantsGenerated.NS_QUERY, "path"), pathElement);
PrimitiveXNode<String> valueElement = factory.primitive("čučoriedka");
equalsElementSource.put(new QName(SchemaConstantsGenerated.NS_QUERY, "value"), valueElement);
MapXNode equalsElement = factory.map(equalsElementSource);
return factory.map(new QName(SchemaConstantsGenerated.NS_QUERY, "equal"), equalsElement);
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class ArchetypeManager method mergeDataReduction.
private LifecycleStateActionDataReductionType mergeDataReduction(LifecycleStateActionDataReductionType currentDataReduction, LifecycleStateActionDataReductionType superDataReduction) {
List<ItemPathType> currentItems = currentDataReduction.getPurgeItem();
List<ItemPathType> superItems = superDataReduction.getPurgeItem();
LifecycleStateActionDataReductionType mergedDataReduction = currentDataReduction.clone();
if (currentItems.isEmpty()) {
if (superItems.isEmpty()) {
return null;
}
superItems.forEach(i -> mergedDataReduction.getPurgeItem().add(i.clone()));
return mergedDataReduction;
}
for (ItemPathType superItem : superItems) {
if (!currentItems.contains(superItem)) {
mergedDataReduction.getPurgeItem().add(superItem.clone());
}
}
return mergedDataReduction;
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class GenerateValueExecutor method execute.
@Override
public PipelineData execute(ActionExpressionType action, PipelineData input, ExecutionContext context, OperationResult globalResult) throws ScriptExecutionException, SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException, SecurityViolationException, ExpressionEvaluationException {
PolicyItemsDefinitionType itemsDefinition;
PolicyItemsDefinitionType configured = expressionHelper.getActionArgument(PolicyItemsDefinitionType.class, action, GenerateValueActionExpressionType.F_ITEMS, PARAMETER_ITEMS, input, context, null, PARAMETER_ITEMS, globalResult);
if (configured != null) {
itemsDefinition = configured;
} else {
itemsDefinition = new PolicyItemsDefinitionType().policyItemDefinition(new PolicyItemDefinitionType().target(new PolicyItemTargetType().path(new ItemPathType(PATH_CREDENTIALS_PASSWORD_VALUE))).execute(false));
}
iterateOverObjects(input, context, globalResult, (object, item, result) -> {
modelInteraction.generateValue(object, itemsDefinition, context.getTask(), result);
context.println("Generated value(s) for " + object);
}, (object, exception) -> {
context.println("Failed to generate value(s) for " + object + exceptionSuffix(exception));
});
return input;
}
Aggregations