@Override public RefinedObjectClassDefinition getRefinedDefinition( ShadowKindType kind, Collection<String> intents) throws SchemaException { RefinedObjectClassDefinition found = null; for (RefinedObjectClassDefinition acctDef : getRefinedDefinitions(kind)) { RefinedObjectClassDefinition foundCurrent = null; if (intents == null || intents.isEmpty()) { if (acctDef.isDefault()) { foundCurrent = acctDef; } } else { if (intents.contains(acctDef.getIntent())) { foundCurrent = acctDef; } } if (foundCurrent != null) { if (found != null) { if (!QNameUtil.match(found.getTypeName(), foundCurrent.getTypeName())) { throw new SchemaException( "More than one ObjectClass found for kind " + kind + ", intents: " + intents + ": " + found.getTypeName() + ", " + foundCurrent.getTypeName()); } } else { found = foundCurrent; } } } return found; }
@Override public RefinedObjectClassDefinition getRefinedDefinition(QName objectClassName) { for (RefinedObjectClassDefinition def : getRefinedDefinitions()) { if (def.isDefault() && (QNameUtil.match(def.getTypeName(), objectClassName))) { return def; } } // No default for this object class, so just use the first one. // This is not strictly correct .. but it is a "compatible bug" :-) // TODO: remove this in next major revision for (RefinedObjectClassDefinition def : getRefinedDefinitions()) { if ((QNameUtil.match(def.getTypeName(), objectClassName))) { return def; } } return null; }