private boolean matchesAssociationPattern(@NotNull List<String> patterns, @NotNull ResourceAttribute<?> identifier, @NotNull MatchingRule<Object> matchingRule) { for (String pattern : patterns) { for (PrismPropertyValue<?> identifierValue : identifier.getValues()) { try { if (identifierValue != null && matchingRule.matchRegex(identifierValue.getRealValue(), pattern)) { return true; } } catch (SchemaException e) { LOGGER.warn("Value '{}' is invalid: {}", identifierValue, e.getMessage(), e); return false; } } } return false; } }
private <T> Collection<T> getNormalizedAttributeValues(ResourceAttribute<T> attribute, RefinedAttributeDefinition rAttrDef) throws SchemaException { MatchingRule<T> matchingRule = matchingRuleRegistry.getMatchingRule(rAttrDef.getMatchingRuleQName(), rAttrDef.getTypeName()); if (matchingRule == null) { return attribute.getRealValues(); } else { Collection<T> normalizedValues = new ArrayList<>(); for (PrismPropertyValue<T> pval: attribute.getValues()) { T normalizedRealValue = matchingRule.normalize(pval.getValue()); normalizedValues.add(normalizedRealValue); } return normalizedValues; } }
private Attribute convertToConnIdAttribute(ResourceAttribute<?> mpAttribute, ObjectClassComplexTypeDefinition ocDef) throws SchemaException { QName midPointAttrQName = mpAttribute.getElementName(); if (midPointAttrQName.equals(SchemaConstants.ICFS_UID)) { throw new SchemaException("ICF UID explicitly specified in attributes"); } String connIdAttrName = icfNameMapper.convertAttributeNameToConnId(mpAttribute, ocDef); Set<Object> connIdAttributeValues = new HashSet<>(); for (PrismPropertyValue<?> pval: mpAttribute.getValues()) { connIdAttributeValues.add(ConnIdUtil.convertValueToIcf(pval, protector, mpAttribute.getElementName())); } try { return AttributeBuilder.build(connIdAttrName, connIdAttributeValues); } catch (IllegalArgumentException e) { throw new SchemaException(e.getMessage(), e); } }
throw new SchemaException("No definition for attribute "+attrName+" in object class "+objectClassDefinition); List<PrismPropertyValue<T>> pvals = attribute.getValues(); if (pvals == null || pvals.isEmpty()) { if (attrDef.isMandatory()) {
private <T> void normalizeAttribute(ResourceAttribute<T> attribute, RefinedAttributeDefinition rAttrDef) throws SchemaException { MatchingRule<T> matchingRule = matchingRuleRegistry.getMatchingRule(rAttrDef.getMatchingRuleQName(), rAttrDef.getTypeName()); if (matchingRule != null) { for (PrismPropertyValue<T> pval: attribute.getValues()) { T normalizedRealValue = matchingRule.normalize(pval.getValue()); pval.setValue(normalizedRealValue); } } }
List<PrismPropertyValue<String>> possibleValues = namingAttribute.getValues();
List<? extends PrismPropertyValue<?>> valuesToReplace; if (isIdentifier) { valuesToReplace = CloneUtil.cloneCollectionMembers(attribute.getValues()); LOGGER.trace("- updating identifier {} value of {}", attributeName, attribute.getValues()); rv.add(prismContext.deltaFor(ShadowType.class) .item(ItemPath.create(ShadowType.F_ATTRIBUTES, attributeName), attribute.getDefinition()).replace(valuesToReplace)
List<PrismPropertyValue<String>> secondaryIdentifierValues = (List) secondaryIdentifier.getValues(); PrismPropertyValue<String> secondaryIdentifierValue; if (secondaryIdentifierValues.size() > 1) { throw new IllegalStateException("Secondary identifier has more than one value: " + secondaryIdentifier.getValues()); } else if (secondaryIdentifierValues.size() == 1) { secondaryIdentifierValue = secondaryIdentifierValues.get(0).clone();
.getValue(); String changedSn = resObj.findAttribute(new QName(ResourceTypeUtil.getResourceNamespace(resourceType), "sn")) .getValues(String.class).iterator().next().getValue(); String addedStreet = resObj.findAttribute(new QName(ResourceTypeUtil.getResourceNamespace(resourceType), "street")) .getValues(String.class).iterator().next().getValue();
attrDelta.addValuesToDelete(PrismValueCollectionsUtil.cloneCollection(attrToDelete.getValues())); projCtx.swallowToSecondaryDelta(attrDelta);
if (repoAttr == null) { attrDelta = attrDef.createEmptyDelta(ItemPath.create(ShadowType.F_ATTRIBUTES, attrDef.getName())); attrDelta.setValuesToReplace(PrismValueCollectionsUtil.cloneCollection(normalizedResourceAttribute.getValues())); } else { attrDelta = repoAttr.diff(normalizedResourceAttribute);
for (PrismPropertyValue<T> assocAttrPVal : assocAttr.getValues()) {