public static ResourceShadowDiscriminator getCoordinates(ObjectFilter filter) throws SchemaException { String resourceOid = null; QName objectClass = null; ShadowKindType kind = null; String intent = null; if (filter instanceof AndFilter) { List<? extends ObjectFilter> conditions = ((AndFilter) filter).getConditions(); resourceOid = getResourceOidFromFilter(conditions); objectClass = getValueFromFilter(conditions, ShadowType.F_OBJECT_CLASS); kind = getValueFromFilter(conditions, ShadowType.F_KIND); intent = getValueFromFilter(conditions, ShadowType.F_INTENT); } if (resourceOid == null) { throw new SchemaException("Resource not defined in a search query"); } if (objectClass == null && kind == null) { throw new SchemaException("Neither objectclass not kind is specified in a search query"); } ResourceShadowDiscriminator coordinates = new ResourceShadowDiscriminator(resourceOid, kind, intent, false); coordinates.setObjectClass(objectClass); return coordinates; }
@Override public CompositeRefinedObjectClassDefinition determineCompositeObjectClassDefinition( ResourceShadowDiscriminator discriminator) { if (discriminator.getKind() == null && discriminator.getObjectClass() == null) { return null; } RefinedObjectClassDefinition structuralObjectClassDefinition; if (discriminator.getKind() == null && discriminator.getObjectClass() != null) { structuralObjectClassDefinition = getRefinedDefinition(discriminator.getObjectClass()); } else { structuralObjectClassDefinition = getRefinedDefinition(discriminator.getKind(), discriminator.getIntent()); } if (structuralObjectClassDefinition == null) { return null; } Collection<RefinedObjectClassDefinition> auxiliaryObjectClassDefinitions = structuralObjectClassDefinition.getAuxiliaryObjectClassDefinitions(); return new CompositeRefinedObjectClassDefinitionImpl( structuralObjectClassDefinition, auxiliaryObjectClassDefinitions); }