use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class ModelUtils method determineObjectPolicyConfiguration.
public static <O extends ObjectType> ObjectPolicyConfigurationType determineObjectPolicyConfiguration(Class<O> objectClass, List<String> objectSubtypes, SystemConfigurationType systemConfigurationType) throws ConfigurationException {
ObjectPolicyConfigurationType applicablePolicyConfigurationType = null;
for (ObjectPolicyConfigurationType aPolicyConfigurationType : systemConfigurationType.getDefaultObjectPolicyConfiguration()) {
QName typeQName = aPolicyConfigurationType.getType();
ObjectTypes objectType = ObjectTypes.getObjectTypeFromTypeQName(typeQName);
if (objectType == null) {
throw new ConfigurationException("Unknown type " + typeQName + " in default object policy definition in system configuration");
}
if (objectType.getClassDefinition() == objectClass) {
String aSubType = aPolicyConfigurationType.getSubtype();
if (aSubType == null) {
if (applicablePolicyConfigurationType == null) {
applicablePolicyConfigurationType = aPolicyConfigurationType;
}
} else if (objectSubtypes != null && objectSubtypes.contains(aSubType)) {
applicablePolicyConfigurationType = aPolicyConfigurationType;
}
}
}
if (applicablePolicyConfigurationType != null) {
return applicablePolicyConfigurationType;
}
// Deprecated
for (ObjectPolicyConfigurationType aPolicyConfigurationType : systemConfigurationType.getObjectTemplate()) {
QName typeQName = aPolicyConfigurationType.getType();
ObjectTypes objectType = ObjectTypes.getObjectTypeFromTypeQName(typeQName);
if (objectType == null) {
throw new ConfigurationException("Unknown type " + typeQName + " in object template definition in system configuration");
}
if (objectType.getClassDefinition() == objectClass) {
return aPolicyConfigurationType;
}
}
// Deprecated method to specify user template. For compatibility only
if (objectClass == UserType.class) {
ObjectReferenceType templateRef = systemConfigurationType.getDefaultUserTemplateRef();
if (templateRef == null) {
return null;
}
ObjectPolicyConfigurationType policy = new ObjectPolicyConfigurationType();
policy.setObjectTemplateRef(templateRef.clone());
return policy;
}
return null;
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class ExpressionHandler method resolveRef.
// Called from the ObjectResolver.resolve
public ObjectType resolveRef(ObjectReferenceType ref, String contextDescription, OperationResult result) throws ObjectNotFoundException, SchemaException {
Class<? extends ObjectType> type = ObjectType.class;
if (ref.getType() != null) {
ObjectTypes objectTypeType = ObjectTypes.getObjectTypeFromTypeQName(ref.getType());
type = objectTypeType.getClassDefinition();
}
return repositoryService.getObject(type, ref.getOid(), null, result).asObjectable();
}
Aggregations