use of com.evolveum.midpoint.schema.processor.ResourceObjectDefinition in project midpoint by Evolveum.
the class ProjectionUpdateOperation method setProjectionSecurityPolicy.
private void setProjectionSecurityPolicy(OperationResult result) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
ResourceObjectDefinition structuralObjectDefinition = projectionContext.getStructuralObjectDefinition();
if (structuralObjectDefinition != null) {
LOGGER.trace("setProjectionSecurityPolicy: structural object class def = {}", structuralObjectDefinition);
SecurityPolicyType projectionSecurityPolicy = beans.securityHelper.locateProjectionSecurityPolicy(structuralObjectDefinition, task, result);
LOGGER.trace("Located security policy for: {},\n {}", projectionContext, projectionSecurityPolicy);
projectionContext.setProjectionSecurityPolicy(projectionSecurityPolicy);
} else {
LOGGER.trace("No structural object class definition, skipping determining security policy");
}
}
use of com.evolveum.midpoint.schema.processor.ResourceObjectDefinition in project midpoint by Evolveum.
the class SyncTaskHelper method createObjectClassForShadow.
/**
* Creates {@link ResourceObjectClass} for a single shadow.
*/
@NotNull
public ResourceObjectClass createObjectClassForShadow(ShadowType shadow, Task task, OperationResult opResult) throws ActivityRunException, SchemaException {
String resourceOid = ShadowUtil.getResourceOid(shadow);
ResourceType resource = getResource(resourceOid, task, opResult);
checkNotInMaintenance(resource);
ResourceSchema refinedSchema = getRefinedResourceSchema(resource);
// TODO reconsider the algorithm used for deriving object class
ResourceObjectDefinition objectClass = requireNonNull(ModelImplUtils.determineObjectDefinition(refinedSchema, shadow.asPrismObject()), "No object class found for the shadow");
return new ResourceObjectClass(resource, objectClass, null, null);
}
use of com.evolveum.midpoint.schema.processor.ResourceObjectDefinition in project midpoint by Evolveum.
the class SyncTaskHelper method createResourceObjectClass.
@NotNull
private ResourceObjectClass createResourceObjectClass(@NotNull ResourceObjectSetType resourceObjectSet, boolean checkForMaintenance, Task task, OperationResult opResult) throws ActivityRunException {
String resourceOid = getResourceOid(resourceObjectSet);
ResourceType resource = getResource(resourceOid, task, opResult);
if (checkForMaintenance) {
checkNotInMaintenance(resource);
}
ResourceSchema refinedResourceSchema = getRefinedResourceSchema(resource);
ResourceObjectDefinition objectClassDefinition;
try {
objectClassDefinition = ModelImplUtils.determineObjectDefinition(refinedResourceSchema, resourceObjectSet, task);
} catch (SchemaException e) {
throw new ActivityRunException("Schema error", FATAL_ERROR, PERMANENT_ERROR, e);
}
if (objectClassDefinition == null) {
LOGGER.debug("Processing all object classes");
}
return new ResourceObjectClass(resource, objectClassDefinition, resourceObjectSet.getKind(), resourceObjectSet.getIntent());
}
use of com.evolveum.midpoint.schema.processor.ResourceObjectDefinition in project midpoint by Evolveum.
the class RefinedResourceSchemaAsserter method objectClass.
public ResourceObjectDefinitionAsserter<RefinedResourceSchemaAsserter<RA>> objectClass(QName ocQname) {
ResourceObjectDefinition objectClassDefinition = getSchema().findDefinitionForObjectClass(ocQname);
ResourceObjectDefinitionAsserter<RefinedResourceSchemaAsserter<RA>> asserter = new ResourceObjectDefinitionAsserter<>(objectClassDefinition, this, desc());
copySetupTo(asserter);
return asserter;
}
use of com.evolveum.midpoint.schema.processor.ResourceObjectDefinition in project midpoint by Evolveum.
the class ConstraintsChecker method checkAttributeUniqueness.
private boolean checkAttributeUniqueness(PrismProperty<?> identifier, OperationResult result) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
ResourceType resource = provisioningContext.getResource();
ResourceObjectDefinition definition = provisioningContext.getObjectDefinitionRequired();
List<? extends PrismPropertyValue<?>> identifierValues = identifier.getValues();
schemaCheck(!identifierValues.isEmpty(), "Empty identifier %s while checking uniqueness of %s (%s)", identifier, shadowOid, resource);
// Note that we do not set matching rule here. We assume that values in repo and here are already normalized.
ObjectQuery query = PrismContext.get().queryFor(ShadowType.class).itemWithDef(identifier.getDefinition(), ShadowType.F_ATTRIBUTES, identifier.getDefinition().getItemName()).eq(PrismValueCollectionsUtil.cloneCollection(identifierValues)).and().item(ShadowType.F_OBJECT_CLASS).eq(definition.getObjectClassName()).and().item(ShadowType.F_RESOURCE_REF).ref(resource.getOid()).and().block().item(ShadowType.F_DEAD).eq(false).or().item(ShadowType.F_DEAD).isNull().endBlock().build();
return checkUniquenessByQuery(identifier, query, result);
}
Aggregations