diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ProvisioningServiceImpl.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ProvisioningServiceImpl.java index 8f960e70d5d..c05a354644c 100644 --- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ProvisioningServiceImpl.java +++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ProvisioningServiceImpl.java @@ -39,7 +39,6 @@ import com.evolveum.midpoint.prism.Objectable; import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.prism.PrismObject; -import com.evolveum.midpoint.prism.PrismObjectDefinition; import com.evolveum.midpoint.prism.crypto.EncryptionException; import com.evolveum.midpoint.prism.delta.ItemDelta; import com.evolveum.midpoint.prism.delta.ObjectDelta; @@ -107,8 +106,6 @@ public class ProvisioningServiceImpl implements ProvisioningService, SystemConfi @Qualifier("cacheRepositoryService") private RepositoryService cacheRepositoryService; - private PrismObjectDefinition resourceObjectShadowDefinition; - private SystemConfigurationType systemConfiguration; private static final Trace LOGGER = TraceManager.getTrace(ProvisioningServiceImpl.class); @@ -269,7 +266,7 @@ public String addObject(PrismObject object, OperationP result.addArbitraryObjectAsParam("scripts", scripts); result.addContext(OperationResult.CONTEXT_IMPLEMENTATION_CLASS, ProvisioningServiceImpl.class); - String oid = null; + String oid; if (object.canRepresent(ShadowType.class)) { try { // calling shadow cache to add object @@ -491,7 +488,7 @@ private SearchResultList> searchRepoObject // TODO: what else do to with objResult?? - } catch (ObjectNotFoundException | SchemaException | CommunicationException | ConfigurationException | ExpressionEvaluationException e) { + } catch (ObjectNotFoundException | SchemaException | ExpressionEvaluationException e) { LOGGER.error("Error while completing {}: {}-{}. Using non-complete object.", repoObject, e.getMessage(), e); objResult.recordFatalError(e); repoObject.asObjectable().setFetchResult(objResult.createOperationResultType()); @@ -518,8 +515,8 @@ private SearchResultList> searchRepoObject // TODO: move to ResourceManager and ConnectorManager // the shadow-related code is already in the ShadowCache - private PrismObject completeObject(Class type, PrismObject inObject, - Collection> options, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, ExpressionEvaluationException { + private PrismObject completeObject( + Class type, PrismObject inObject, Collection> options, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException { if (ResourceType.class.equals(type)) { //noinspection unchecked @@ -530,7 +527,6 @@ private PrismObject completeObject(Class type, Pris throw new IllegalStateException("BOOOM!"); } else { //TODO: connectors etc.. - } return inObject; } @@ -551,7 +547,7 @@ public Integer countObjects(Class type, ObjectQuery qu LOGGER.trace("Start of counting objects. Query:\n{}", query != null ? query.debugDump(1) : " (null)"); } - if (filter != null && filter instanceof NoneFilter) { + if (filter instanceof NoneFilter) { result.recordSuccessIfUnknown(); result.cleanupResult(); LOGGER.trace("Finished counting. Nothing to do. Filter is NONE"); @@ -570,11 +566,9 @@ public Integer countObjects(Class type, ObjectQuery qu Integer count; try { - count = shadowCache.countObjects(query, task, result); result.computeStatus(); - } catch (ConfigurationException | CommunicationException | ObjectNotFoundException | SchemaException | ExpressionEvaluationException | RuntimeException | Error e) { ProvisioningUtil.recordFatalError(LOGGER, result, null, e); throw e; @@ -704,7 +698,7 @@ public PrismObject deleteObject(Class type, String ProvisioningUtil.recordFatalError(LOGGER, result, "Couldn't delete object: security violation: " + e.getMessage(), e); throw e; } catch (ExpressionEvaluationException e) { - ProvisioningUtil.recordFatalError(LOGGER, result, "Couldn't delete object: expression errror: " + e.getMessage(), e); + ProvisioningUtil.recordFatalError(LOGGER, result, "Couldn't delete object: expression error: " + e.getMessage(), e); throw e; } catch (PolicyViolationException | RuntimeException | Error e) { ProvisioningUtil.recordFatalError(LOGGER, result, "Couldn't delete object: " + e.getMessage(), e); @@ -743,9 +737,8 @@ public PrismObject deleteObject(Class type, String * @see com.evolveum.midpoint.provisioning.api.ProvisioningService#executeScript(java.lang.Class, java.lang.String, com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningScriptType, com.evolveum.midpoint.task.api.Task, com.evolveum.midpoint.schema.result.OperationResult) */ @Override - public Object executeScript(String resourceOid, ProvisioningScriptType script, - Task task, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, - CommunicationException, ConfigurationException, ExpressionEvaluationException { + public Object executeScript(String resourceOid, ProvisioningScriptType script, Task task, OperationResult parentResult) + throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException { Validate.notNull(resourceOid, "Oid of object for script execution must not be null."); Validate.notNull(parentResult, "Operation result must not be null."); @@ -1118,11 +1111,6 @@ public void applyDefinition(PrismObject object, Task t } } - private void setProtectedShadow(PrismObject shdaow, OperationResult result) - throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException { - shadowCache.setProtectedShadow(shdaow, result); - } - @Override public void applyDefinition(Class type, ObjectQuery query, Task task, OperationResult parentResult) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, ExpressionEvaluationException { @@ -1252,14 +1240,6 @@ public void exitConstraintsCheckerCache() { ConstraintsChecker.exitCache(); } - private PrismObjectDefinition getResourceObjectShadowDefinition() { - if (resourceObjectShadowDefinition == null) { - resourceObjectShadowDefinition = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass( - ShadowType.class); - } - return resourceObjectShadowDefinition; - } - private PrismObject getRepoObject(Class type, String oid, Collection> options, OperationResult result) throws ObjectNotFoundException, SchemaException {