Tabnine Logo
MatchingRuleRegistry
Code IndexAdd Tabnine to your IDE (free)

How to use
MatchingRuleRegistry
in
com.evolveum.midpoint.prism.match

Best Java code snippets using com.evolveum.midpoint.prism.match.MatchingRuleRegistry (Showing top 20 results out of 315)

origin: Evolveum/midpoint

public static <T> ValueMatcher<T> createDefaultMatcher(QName type, MatchingRuleRegistry matchingRuleRegistry) throws SchemaException {
  MatchingRule<Object> matchingRule = matchingRuleRegistry.getMatchingRule(null, type);
  return new ValueMatcher<>((MatchingRule<T>) matchingRule);
}
origin: Evolveum/midpoint

@NotNull
MatchingRule getMatchingRuleFromRegistry(MatchingRuleRegistry matchingRuleRegistry, Item filterItem) {
  try {
    return matchingRuleRegistry.getMatchingRule(matchingRule, filterItem.getDefinition().getTypeName());
  } catch (SchemaException ex){
    throw new IllegalArgumentException(ex.getMessage(), ex);
  }
}
origin: Evolveum/midpoint

@NotNull
private MatchingRule<Object> getMatchingRuleForTargetNamingIdentifier(RefinedAssociationDefinition associationDefinition) throws SchemaException {
  RefinedAttributeDefinition<Object> targetNamingAttributeDef = associationDefinition.getAssociationTarget().getNamingAttribute();
  if (targetNamingAttributeDef != null) {
    QName matchingRuleName = targetNamingAttributeDef.getMatchingRuleQName();
    return matchingRuleRegistry.getMatchingRule(matchingRuleName, null);
  } else {
    throw new IllegalStateException(
        "Couldn't evaluate tolerant/intolerant value patterns, because naming attribute is not known for "
            + associationDefinition.getAssociationTarget());
  }
}
origin: Evolveum/midpoint

@Override
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
  super.initSystem(initTask, initResult);
  uidMatchingRule = matchingRuleRegistry.getMatchingRule(PrismConstants.STRING_IGNORE_CASE_MATCHING_RULE_NAME, DOMUtil.XSD_STRING);
}
origin: Evolveum/midpoint

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;
  }
}
origin: Evolveum/midpoint

<T> T getNormalizedAttributeValue(PrismPropertyValue<T> pval, RefinedAttributeDefinition rAttrDef) throws SchemaException {
  MatchingRule<T> matchingRule = matchingRuleRegistry.getMatchingRule(rAttrDef.getMatchingRuleQName(), rAttrDef.getTypeName());
  if (matchingRule != null) {
    T normalizedRealValue = matchingRule.normalize(pval.getValue());
    return normalizedRealValue;
  } else {
    return pval.getValue();
  }
}
 
origin: Evolveum/midpoint

private <T> List<PrismPropertyValue<T>> getNormalizedValue(PrismProperty<T> attr, RefinedObjectClassDefinition rObjClassDef) throws SchemaException {
  RefinedAttributeDefinition<T> refinedAttributeDefinition = rObjClassDef.findAttributeDefinition(attr.getElementName());
  QName matchingRuleQName = refinedAttributeDefinition.getMatchingRuleQName();
  MatchingRule<T> matchingRule = matchingRuleRegistry.getMatchingRule(matchingRuleQName, refinedAttributeDefinition.getTypeName());
  List<PrismPropertyValue<T>> normalized = new ArrayList<>();
  for (PrismPropertyValue<T> origPValue : attr.getValues()){
    T normalizedValue = matchingRule.normalize(origPValue.getValue());
    PrismPropertyValue<T> normalizedPValue = origPValue.clone();
    normalizedPValue.setValue(normalizedValue);
    normalized.add(normalizedPValue);
  }
  return normalized;
  
}
origin: Evolveum/midpoint

private void checkMatchingRule(ResourceValidationContext ctx, ItemPath path,
    ResourceObjectTypeDefinitionType objectType, ResourceAttributeDefinitionType attributeDef, QName ref, ResourceAttributeDefinition<?> rad) {
  QName matchingRule = attributeDef.getMatchingRule();
  if (matchingRule == null) {
    return;
  }
  try {
    matchingRuleRegistry.getMatchingRule(matchingRule, rad != null ? rad.getTypeName() : null);
  } catch (Throwable t) {
    ctx.validationResult.add(Issue.Severity.WARNING,
        CAT_SCHEMA_HANDLING, C_WRONG_MATCHING_RULE,
        getString(CLASS_DOT + C_WRONG_MATCHING_RULE, getName(objectType), prettyPrintUsingStandardPrefix(ref), t.getMessage()),
        ctx.resourceRef, path.append(ResourceItemDefinitionType.F_MATCHING_RULE));
  }
}
origin: Evolveum/midpoint

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);
    }
  }
}
 
origin: Evolveum/midpoint

public static <T> ValueMatcher<T> createMatcher(RefinedAttributeDefinition rAttrDef, MatchingRuleRegistry matchingRuleRegistry) throws SchemaException {
  QName matchingRuleQName = rAttrDef.getMatchingRuleQName();
  MatchingRule<T> matchingRule;
  try {
    matchingRule = matchingRuleRegistry.getMatchingRule(matchingRuleQName, rAttrDef.getTypeName());
  } catch (SchemaException e) {
    throw new SchemaException(e.getMessage()+", defined for attribute "+rAttrDef.getName(), e);
  }
  return new ValueMatcher<>(matchingRule);
}
origin: Evolveum/midpoint

public static <T> PropertyDelta<T> narrowPropertyDelta(PropertyDelta<T> propertyDelta,
    PrismObject<ShadowType> currentShadow, QName overridingMatchingRuleQName, MatchingRuleRegistry matchingRuleRegistry) throws SchemaException {
  QName matchingRuleQName = overridingMatchingRuleQName;
  ItemDefinition propertyDef = propertyDelta.getDefinition();
  if (matchingRuleQName == null && propertyDef instanceof RefinedAttributeDefinition) {
    matchingRuleQName = ((RefinedAttributeDefinition)propertyDef).getMatchingRuleQName();
  }
  MatchingRule<T> matchingRule = null;
  if (matchingRuleQName != null && propertyDef != null) {
    matchingRule = matchingRuleRegistry.getMatchingRule(matchingRuleQName, propertyDef.getTypeName());
  }
  LOGGER.trace("Narrowing attr def={}, matchingRule={} ({})", propertyDef, matchingRule, matchingRuleQName);
  PropertyDelta<T> filteredDelta = propertyDelta.narrow(currentShadow, matchingRule);
  if (LOGGER.isTraceEnabled() && (filteredDelta == null || !filteredDelta.equals(propertyDelta))) {
    LOGGER.trace("Narrowed delta: {}", filteredDelta==null?null:filteredDelta.debugDump());
  }
  return filteredDelta;
}
 
origin: Evolveum/midpoint

@Override
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
  // We need to switch off the encryption checks. Some values cannot be encrypted as we do
  // not have a definition here
  InternalsConfig.encryptionChecks = false;
  provisioningService.postInit(initResult);
  resource = addResourceFromFile(getResourceOpenDjFile(), IntegrationTestTools.CONNECTOR_LDAP_TYPE, initResult);
  repoAddShadowFromFile(ACCOUNT_BAD_FILE, initResult);
  dnMatchingRule = matchingRuleRegistry.getMatchingRule(PrismConstants.DISTINGUISHED_NAME_MATCHING_RULE_NAME, DOMUtil.XSD_STRING);
}
origin: Evolveum/midpoint

@Test
public void testStringDefault() throws Exception {
  // GIVEN
  MatchingRule<String> rule = matchingRuleRegistry.getMatchingRule(null, DOMUtil.XSD_STRING);
  // WHEN, THEN
  assertMatch(rule, "foo", "foo");
  assertNoMatch(rule, "foo", "bar");
  assertNoMatch(rule, "foo", "Foo");
  assertNoMatch(rule, "FOO", "Foo");
  assertNormalized(rule, "Foo", "Foo");
  assertNormalized(rule, "baR", "baR");
}
origin: Evolveum/midpoint

private boolean matches(ResourceAttribute<?> identifier, ResourceAttribute<?> attributeToMatch, MatchingRuleRegistry matchingRuleRegistry) throws SchemaException {
  if (!identifier.getElementName().equals(attributeToMatch.getElementName())) {
    return false;
  }
  RefinedAttributeDefinition rAttrDef = rOcDef.findAttributeDefinition(identifier.getElementName());
  QName matchingRuleQName = rAttrDef.getMatchingRuleQName();
  if (matchingRuleQName == null || matchingRuleRegistry == null) {
    return identifier.equals(attributeToMatch, EquivalenceStrategy.REAL_VALUE);
  }
  MatchingRule<Object> matchingRule = matchingRuleRegistry.getMatchingRule(matchingRuleQName, rAttrDef.getTypeName());
  return matchingRule.match(identifier.getRealValue(), attributeToMatch.getRealValue());
}
origin: Evolveum/midpoint

MatchingRule<T> matchingRule = matchingRuleRegistry.getMatchingRule(matchingRuleQName, rAttrDef.getTypeName());
List<PrismValue> newValues = new ArrayList<>();
if (eqFilter.getValues() != null) {
origin: Evolveum/midpoint

  matchingRule = matchingRuleRegistry.getMatchingRule(matchingRuleQName, typeName);
} else {
  matchingRule = null;
origin: Evolveum/midpoint

private <T> void normalizeDelta(ItemDelta<PrismPropertyValue<T>,PrismPropertyDefinition<T>> delta, RefinedAttributeDefinition rAttrDef) throws SchemaException{
  MatchingRule<T> matchingRule = matchingRuleRegistry.getMatchingRule(rAttrDef.getMatchingRuleQName(), rAttrDef.getTypeName());
  if (matchingRule != null) {
    if (delta.getValuesToReplace() != null){
      normalizeValues(delta.getValuesToReplace(), matchingRule);
    }
    if (delta.getValuesToAdd() != null){
      normalizeValues(delta.getValuesToAdd(), matchingRule);
    }
    
    if (delta.getValuesToDelete() != null){
      normalizeValues(delta.getValuesToDelete(), matchingRule);
    }
  }
}
 
origin: Evolveum/midpoint

@Test
public void testStringCaseInsensitive() throws Exception {
  // GIVEN
  MatchingRule<String> rule = matchingRuleRegistry.getMatchingRule(PrismConstants.STRING_IGNORE_CASE_MATCHING_RULE_NAME,
      DOMUtil.XSD_STRING);
  // WHEN, THEN
  assertMatch(rule, "foo", "foo");
  assertNoMatch(rule, "foo", "bar");
  assertMatch(rule, "foo", "Foo");
  assertMatch(rule, "FOO", "Foo");
  assertNormalized(rule, "bar", "baR");
  assertNormalized(rule, "foo", "FoO");
  assertNormalized(rule, "foobar", "foobar");
}
origin: Evolveum/midpoint

private <TV,TA> ObjectQuery createQuery(RefinedAssociationDefinition assocDefType, RefinedAttributeDefinition<TA> assocAttrDef, ResourceAttribute<TV> valueAttr) throws SchemaException{
  MatchingRule<TA> matchingRule = matchingRuleRegistry.getMatchingRule(assocDefType.getResourceObjectAssociationType().getMatchingRule(),
      assocAttrDef.getTypeName());
  if (valueAttr.size() > 1) {
    throw new IllegalStateException("Attributes with more than 1 values are not supported here");
  }
  PrismPropertyValue<TA> converted = PrismUtil.convertPropertyValue(valueAttr.getAnyValue(), valueAttr.getDefinition(), assocAttrDef, prismContext);
  TA normalizedRealValue = matchingRule.normalize(converted.getValue());
  PrismPropertyValue<TA> normalized = prismContext.itemFactory().createPropertyValue(normalizedRealValue);
  LOGGER.trace("Converted entitlement filter value: {} ({}) def={}", normalized, normalized.getValue().getClass(), assocAttrDef);
  ObjectQuery query = prismContext.queryFor(ShadowType.class)
      .item(ItemPath.create(ShadowType.F_ATTRIBUTES, assocAttrDef.getName()), assocAttrDef).eq(normalized)
      .build();
  query.setAllowPartialResults(true);
  return query;
}
origin: Evolveum/midpoint

final MatchingRule caseIgnoreMatchingRule = matchingRuleRegistry.getMatchingRule(PrismConstants.STRING_IGNORE_CASE_MATCHING_RULE_NAME, DOMUtil.XSD_STRING);
ResultHandler handler = new ResultHandler<ObjectType>() {
com.evolveum.midpoint.prism.matchMatchingRuleRegistry

Most used methods

  • getMatchingRule

Popular in Java

  • Making http post requests using okhttp
  • putExtra (Intent)
  • getSupportFragmentManager (FragmentActivity)
  • addToBackStack (FragmentTransaction)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now