public static List<String> getIntentsForKind(RefinedResourceSchema rSchema, ShadowKindType kind) { List<String> intents = new ArrayList<>(); for (ObjectClassComplexTypeDefinition objClassDef : rSchema.getObjectClassDefinitions()) { if (objClassDef.getKind() == kind) { intents.add(objClassDef.getIntent()); } } return intents; }
@Override public List<? extends RefinedObjectClassDefinition> getRefinedDefinitions(ShadowKindType kind) { List<RefinedObjectClassDefinition> rv = new ArrayList<>(); for (RefinedObjectClassDefinition def : getRefinedDefinitions()) { if (MiscSchemaUtil.matchesKind(kind, def.getKind())) { rv.add(def); } } return rv; }
@Override public CompositeRefinedObjectClassDefinition determineCompositeObjectClassDefinition( PrismObject<ShadowType> shadow, Collection<QName> additionalAuxiliaryObjectClassQNames) throws SchemaException { ShadowType shadowType = shadow.asObjectable(); RefinedObjectClassDefinition structuralObjectClassDefinition = null; ShadowKindType kind = shadowType.getKind(); String intent = shadowType.getIntent(); QName structuralObjectClassQName = shadowType.getObjectClass(); if (kind != null) { structuralObjectClassDefinition = getRefinedDefinition(kind, intent); } if (structuralObjectClassDefinition == null) { // Fallback to objectclass only if (structuralObjectClassQName == null) { return null; } structuralObjectClassDefinition = getRefinedDefinition(structuralObjectClassQName); } if (structuralObjectClassDefinition == null) { return null; } List<QName> auxiliaryObjectClassQNames = shadowType.getAuxiliaryObjectClass(); if (additionalAuxiliaryObjectClassQNames != null) { auxiliaryObjectClassQNames.addAll(additionalAuxiliaryObjectClassQNames); } Collection<RefinedObjectClassDefinition> auxiliaryObjectClassDefinitions = new ArrayList<>(auxiliaryObjectClassQNames.size()); for (QName auxiliaryObjectClassQName : auxiliaryObjectClassQNames) { RefinedObjectClassDefinition auxiliaryObjectClassDef = getRefinedDefinition(auxiliaryObjectClassQName); if (auxiliaryObjectClassDef == null) { throw new SchemaException( "Auxiliary object class " + auxiliaryObjectClassQName + " specified in " + shadow + " does not exist"); } auxiliaryObjectClassDefinitions.add(auxiliaryObjectClassDef); } return new CompositeRefinedObjectClassDefinitionImpl( structuralObjectClassDefinition, auxiliaryObjectClassDefinitions); }