Skip to content

Commit

Permalink
MID-7534 added ProvisioningOperationContext to provisioning api
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed May 22, 2023
1 parent a7e7e15 commit 2ff8f49
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,30 @@ public class ProvisioningOperationContext {

private ObjectDeltaSchemaLevelUtil.NameResolver nameResolver;

public String getRequestIdentifier() {
public String requestIdentifier() {
return requestIdentifier;
}

public void setRequestIdentifier(String requestIdentifier) {
public ProvisioningOperationContext requestIdentifier(String requestIdentifier) {
this.requestIdentifier = requestIdentifier;
return this;
}

public ExpressionProfile getExpressionProfile() {
public ExpressionProfile expressionProfile() {
return expressionProfile;
}

public void setExpressionProfile(ExpressionProfile expressionProfile) {
public ProvisioningOperationContext expressionProfile(ExpressionProfile expressionProfile) {
this.expressionProfile = expressionProfile;
return this;
}

public ObjectDeltaSchemaLevelUtil.NameResolver getNameResolver() {
public ObjectDeltaSchemaLevelUtil.NameResolver nameResolver() {
return nameResolver;
}

public void setNameResolver(ObjectDeltaSchemaLevelUtil.NameResolver nameResolver) {
public ProvisioningOperationContext nameResolver(ObjectDeltaSchemaLevelUtil.NameResolver nameResolver) {
this.nameResolver = nameResolver;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,23 @@ public interface ProvisioningService {
@NotNull Class<T> type,
@NotNull String oid,
@Nullable Collection<SelectorOptions<GetOperationOptions>> options,
@Nullable ProvisioningOperationContext context,
@NotNull Task task,
@NotNull OperationResult parentResult)
throws ObjectNotFoundException, CommunicationException, SchemaException, ConfigurationException,
SecurityViolationException, ExpressionEvaluationException;

default @NotNull <T extends ObjectType> PrismObject<T> getObject(
@NotNull Class<T> type,
@NotNull String oid,
@Nullable Collection<SelectorOptions<GetOperationOptions>> options,
@NotNull Task task,
@NotNull OperationResult parentResult)
throws ObjectNotFoundException, CommunicationException, SchemaException, ConfigurationException,
SecurityViolationException, ExpressionEvaluationException {
return getObject(type, oid, options, new ProvisioningOperationContext(), task, parentResult);
}

/**
* Add new object.
*
Expand Down Expand Up @@ -364,11 +376,23 @@ <T extends ObjectType> String addObject(
@NotNull PrismObject<T> object,
@Nullable OperationProvisioningScriptsType scripts,
@Nullable ProvisioningOperationOptions options,
@Nullable ProvisioningOperationContext context,
@NotNull Task task,
@NotNull OperationResult parentResult)
throws ObjectAlreadyExistsException, SchemaException, CommunicationException, ObjectNotFoundException,
ConfigurationException, SecurityViolationException, PolicyViolationException, ExpressionEvaluationException;

default <T extends ObjectType> String addObject(
@NotNull PrismObject<T> object,
@Nullable OperationProvisioningScriptsType scripts,
@Nullable ProvisioningOperationOptions options,
@NotNull Task task,
@NotNull OperationResult parentResult)
throws ObjectAlreadyExistsException, SchemaException, CommunicationException, ObjectNotFoundException,
ConfigurationException, SecurityViolationException, PolicyViolationException, ExpressionEvaluationException {
return addObject(object, scripts, options, new ProvisioningOperationContext(), task, parentResult);
}

/**
* Fetches synchronization change events ({@link LiveSyncEvent}) from a resource and passes them into specified
* {@link LiveSyncEventHandler}. Uses provided {@link LiveSyncTokenStorage} to get and update the token
Expand Down Expand Up @@ -566,11 +590,24 @@ <T extends ObjectType> SearchResultList<PrismObject<T>> searchObjects(
@NotNull Class<T> type,
@Nullable ObjectQuery query,
@Nullable Collection<SelectorOptions<GetOperationOptions>> options,
@Nullable ProvisioningOperationContext context,
@NotNull Task task,
@NotNull OperationResult parentResult)
throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException,
SecurityViolationException, ExpressionEvaluationException;

@NotNull
default <T extends ObjectType> SearchResultList<PrismObject<T>> searchObjects(
@NotNull Class<T> type,
@Nullable ObjectQuery query,
@Nullable Collection<SelectorOptions<GetOperationOptions>> options,
@NotNull Task task,
@NotNull OperationResult parentResult)
throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException,
SecurityViolationException, ExpressionEvaluationException {
return searchObjects(type, query, options, new ProvisioningOperationContext(), task, parentResult);
}

/**
* Counts the objects of the respective type.
*
Expand Down Expand Up @@ -629,11 +666,24 @@ <T extends ObjectType> SearchResultMetadata searchObjectsIterative(
@Nullable ObjectQuery query,
@Nullable Collection<SelectorOptions<GetOperationOptions>> options,
@NotNull ResultHandler<T> handler,
@Nullable ProvisioningOperationContext context,
@NotNull Task task,
@NotNull OperationResult parentResult)
throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException,
SecurityViolationException, ExpressionEvaluationException;

default <T extends ObjectType> SearchResultMetadata searchObjectsIterative(
@NotNull Class<T> type,
@Nullable ObjectQuery query,
@Nullable Collection<SelectorOptions<GetOperationOptions>> options,
@NotNull ResultHandler<T> handler,
@NotNull Task task,
@NotNull OperationResult parentResult)
throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException,
SecurityViolationException, ExpressionEvaluationException {
return searchObjectsIterative(type, query, options, handler, new ProvisioningOperationContext(), task, parentResult);
}

/**
* Modifies object using relative change description. Must fail if user with
* provided OID does not exist. Must fail if any of the described changes
Expand Down Expand Up @@ -677,10 +727,23 @@ <T extends ObjectType> String modifyObject(
@NotNull Collection<? extends ItemDelta<?, ?>> modifications,
@Nullable OperationProvisioningScriptsType scripts,
@Nullable ProvisioningOperationOptions options,
@Nullable ProvisioningOperationContext context,
@NotNull Task task,
@NotNull OperationResult parentResult) throws ObjectNotFoundException, SchemaException,
CommunicationException, ConfigurationException, SecurityViolationException, PolicyViolationException, ObjectAlreadyExistsException, ExpressionEvaluationException;

default <T extends ObjectType> String modifyObject(
@NotNull Class<T> type,
@NotNull String oid,
@NotNull Collection<? extends ItemDelta<?, ?>> modifications,
@Nullable OperationProvisioningScriptsType scripts,
@Nullable ProvisioningOperationOptions options,
@NotNull Task task,
@NotNull OperationResult parentResult) throws ObjectNotFoundException, SchemaException,
CommunicationException, ConfigurationException, SecurityViolationException, PolicyViolationException, ObjectAlreadyExistsException, ExpressionEvaluationException {
return modifyObject(type, oid, modifications, scripts, options, new ProvisioningOperationContext(), task, parentResult);
}

/**
* Deletes object with specified OID.
*
Expand Down Expand Up @@ -710,9 +773,16 @@ <T extends ObjectType> String modifyObject(
* unknown connector framework error
*/
<T extends ObjectType> PrismObject<T> deleteObject(Class<T> type, String oid, ProvisioningOperationOptions option,
OperationProvisioningScriptsType scripts, ProvisioningOperationContext context, Task task, OperationResult parentResult)
throws ObjectNotFoundException, CommunicationException, SchemaException, ConfigurationException, SecurityViolationException,
PolicyViolationException, ExpressionEvaluationException;

default <T extends ObjectType> PrismObject<T> deleteObject(Class<T> type, String oid, ProvisioningOperationOptions option,
OperationProvisioningScriptsType scripts, Task task, OperationResult parentResult) throws ObjectNotFoundException,
CommunicationException, SchemaException, ConfigurationException, SecurityViolationException, PolicyViolationException,
ExpressionEvaluationException;
ExpressionEvaluationException {
return deleteObject(type, oid, option, scripts, new ProvisioningOperationContext(), task, parentResult);
}

/**
* Executes a single provisioning script.
Expand Down Expand Up @@ -877,10 +947,16 @@ List<ConnectorOperationalStatus> getConnectorOperationalStatus(String resourceOi
* And so on. However, this is NOT reconciliation function that will make sure that the resource object attributes are OK
* with all the policies. This is just a provisioning-level operation.
*/
void refreshShadow(PrismObject<ShadowType> shadow, ProvisioningOperationOptions options, Task task, OperationResult parentResult)
void refreshShadow(PrismObject<ShadowType> shadow, ProvisioningOperationOptions options, ProvisioningOperationContext context, Task task, OperationResult parentResult)
throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException,
ObjectAlreadyExistsException, SecurityViolationException, ExpressionEvaluationException;

default void refreshShadow(PrismObject<ShadowType> shadow, ProvisioningOperationOptions options, Task task, OperationResult parentResult)
throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException,
ObjectAlreadyExistsException, SecurityViolationException, ExpressionEvaluationException {
refreshShadow(shadow, options, new ProvisioningOperationContext(), task, parentResult);
}

/**
* Applies appropriate definition to the shadow/resource delta.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public <T extends ObjectType> String addObject(
@NotNull PrismObject<T> object,
@Nullable OperationProvisioningScriptsType scripts,
@Nullable ProvisioningOperationOptions options,
@Nullable ProvisioningOperationContext context,
@NotNull Task task,
@NotNull OperationResult parentResult)
throws ObjectAlreadyExistsException, SchemaException, CommunicationException, ObjectNotFoundException,
Expand Down Expand Up @@ -702,7 +703,7 @@ private OperationResult testResourceInternal(
}

@Override
public void refreshShadow(PrismObject<ShadowType> shadow, ProvisioningOperationOptions options, Task task, OperationResult parentResult)
public void refreshShadow(PrismObject<ShadowType> shadow, ProvisioningOperationOptions options, ProvisioningOperationContext context, Task task, OperationResult parentResult)
throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException,
ExpressionEvaluationException {
Validate.notNull(shadow, "Shadow for refresh must not be null.");
Expand Down

0 comments on commit 2ff8f49

Please sign in to comment.