Skip to content

Commit

Permalink
ProvisioningServiceImpl: code cleanup, removed long unused private stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Mar 6, 2020
1 parent f5ddd8a commit 6bb06e7
Showing 1 changed file with 8 additions and 28 deletions.
Expand Up @@ -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;
Expand Down Expand Up @@ -107,8 +106,6 @@ public class ProvisioningServiceImpl implements ProvisioningService, SystemConfi
@Qualifier("cacheRepositoryService")
private RepositoryService cacheRepositoryService;

private PrismObjectDefinition<ShadowType> resourceObjectShadowDefinition;

private SystemConfigurationType systemConfiguration;

private static final Trace LOGGER = TraceManager.getTrace(ProvisioningServiceImpl.class);
Expand Down Expand Up @@ -269,7 +266,7 @@ public <T extends ObjectType> String addObject(PrismObject<T> 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
Expand Down Expand Up @@ -491,7 +488,7 @@ private <T extends ObjectType> SearchResultList<PrismObject<T>> 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());
Expand All @@ -518,8 +515,8 @@ private <T extends ObjectType> SearchResultList<PrismObject<T>> searchRepoObject

// TODO: move to ResourceManager and ConnectorManager
// the shadow-related code is already in the ShadowCache
private <T extends ObjectType> PrismObject<T> completeObject(Class<T> type, PrismObject<T> inObject,
Collection<SelectorOptions<GetOperationOptions>> options, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
private <T extends ObjectType> PrismObject<T> completeObject(
Class<T> type, PrismObject<T> inObject, Collection<SelectorOptions<GetOperationOptions>> options, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException {

if (ResourceType.class.equals(type)) {
//noinspection unchecked
Expand All @@ -530,7 +527,6 @@ private <T extends ObjectType> PrismObject<T> completeObject(Class<T> type, Pris
throw new IllegalStateException("BOOOM!");
} else {
//TODO: connectors etc..

}
return inObject;
}
Expand All @@ -551,7 +547,7 @@ public <T extends ObjectType> Integer countObjects(Class<T> 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");
Expand All @@ -570,11 +566,9 @@ public <T extends ObjectType> Integer countObjects(Class<T> 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;
Expand Down Expand Up @@ -704,7 +698,7 @@ public <T extends ObjectType> PrismObject<T> deleteObject(Class<T> 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);
Expand Down Expand Up @@ -743,9 +737,8 @@ public <T extends ObjectType> PrismObject<T> deleteObject(Class<T> 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 <T extends ObjectType> 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.");

Expand Down Expand Up @@ -1118,11 +1111,6 @@ public <T extends ObjectType> void applyDefinition(PrismObject<T> object, Task t
}
}

private void setProtectedShadow(PrismObject<ShadowType> shdaow, OperationResult result)
throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
shadowCache.setProtectedShadow(shdaow, result);
}

@Override
public <T extends ObjectType> void applyDefinition(Class<T> type, ObjectQuery query, Task task, OperationResult parentResult)
throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
Expand Down Expand Up @@ -1252,14 +1240,6 @@ public void exitConstraintsCheckerCache() {
ConstraintsChecker.exitCache();
}

private PrismObjectDefinition<ShadowType> getResourceObjectShadowDefinition() {
if (resourceObjectShadowDefinition == null) {
resourceObjectShadowDefinition = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(
ShadowType.class);
}
return resourceObjectShadowDefinition;
}

private <T extends ObjectType> PrismObject<T> getRepoObject(Class<T> type, String oid,
Collection<SelectorOptions<GetOperationOptions>> options, OperationResult result)
throws ObjectNotFoundException, SchemaException {
Expand Down

0 comments on commit 6bb06e7

Please sign in to comment.