Skip to content

Commit

Permalink
SqaleRepositoryService: modifyObjectDynamically temporary implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Jul 15, 2021
1 parent 3f27598 commit 02bf414
Showing 1 changed file with 29 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -469,16 +469,7 @@ public <T extends ObjectType> ModifyObjectResult<T> modifyObject(
return new ModifyObjectResult<>(modifications);
}

if (InternalsConfig.encryptionChecks) {
CryptoUtil.checkEncrypted(modifications);
}

if (InternalsConfig.consistencyChecks) {
ItemDeltaCollectionsUtil.checkConsistence(modifications, ConsistencyCheckScope.THOROUGH);
} else {
ItemDeltaCollectionsUtil.checkConsistence(modifications, ConsistencyCheckScope.MANDATORY_CHECKS_ONLY);
}

checkModifications(modifications);
logTraceModifications(modifications);

return executeModifyObject(type, oidUuid, modifications, precondition);
Expand Down Expand Up @@ -561,6 +552,34 @@ RootUpdateContext<S, Q, R> prepareUpdateContext(
return new RootUpdateContext<>(repositoryContext, jdbcSession, object, rootRow);
}

@Override
public @NotNull <T extends ObjectType> ModifyObjectResult<T> modifyObjectDynamically(
@NotNull Class<T> type,
@NotNull String oid,
@Nullable Collection<SelectorOptions<GetOperationOptions>> getOptions,
@NotNull ModificationsSupplier<T> modificationsSupplier,
@Nullable RepoModifyOptions modifyOptions,
@NotNull OperationResult parentResult)
throws ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException {
// TODO write proper implementation
PrismObject<T> object = executeGetObject(type, UUID.fromString(oid), getOptions);
Collection<? extends ItemDelta<?, ?>> modifications =
modificationsSupplier.get(object.asObjectable());
return modifyObject(type, oid, modifications, modifyOptions, parentResult);
}

private void checkModifications(@NotNull Collection<? extends ItemDelta<?, ?>> modifications) {
if (InternalsConfig.encryptionChecks) {
CryptoUtil.checkEncrypted(modifications);
}

if (InternalsConfig.consistencyChecks) {
ItemDeltaCollectionsUtil.checkConsistence(modifications, ConsistencyCheckScope.THOROUGH);
} else {
ItemDeltaCollectionsUtil.checkConsistence(modifications, ConsistencyCheckScope.MANDATORY_CHECKS_ONLY);
}
}

private void logTraceModifications(@NotNull Collection<? extends ItemDelta<?, ?>> modifications) {
if (LOGGER.isTraceEnabled()) {
for (ItemDelta<?, ?> modification : modifications) {
Expand Down

0 comments on commit 02bf414

Please sign in to comment.