Skip to content

Commit

Permalink
Do some cosmetic (mostly formatting) changes
Browse files Browse the repository at this point in the history
Also:
- re-enabled failing asserts in TestProgressReporting,
- updated GetOperationOptions#staleness javadoc.
  • Loading branch information
mederly committed Nov 23, 2022
1 parent 1b38d16 commit 2e1d4c5
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,27 @@ public class GetOperationOptions extends AbstractOptions implements Serializable
private PointInTimeType pointInTimeType;

/**
* Requirement how stale or fresh the retrieved data should be. It specifies maximum age of the value in millisecods.
* Requirement how stale or fresh the retrieved data should be. It specifies maximum age of the value in milliseconds.
*
* *Meaning for Provisioning service*
*
* The default value is zero, which means that a fresh value must always be returned. This means that caches that do
* not guarantee fresh value cannot be used. If non-zero value is specified then such caches may be used. In case that
* Long.MAX_VALUE is specified then the caches are always used and fresh value is never retrieved.
* <p>
* {@link Long#MAX_VALUE} is specified then the caches are always used and fresh value is never retrieved.
*
* Null value is special in one more aspect: it allows to return partial cached data in case that the original is not
* accessible. E.g. in that case provisioning can return repository shadow in case that the resource is not reachable.
* Explicit specification of staleness=0 disables this behavior.
*
* *Meaning for Repository cache*
*
* The default value means that the cache may be used, if other options do not preclude the use. An explicit value of zero
* disables the cache.
*
* *Open question*
*
* We should somehow unify these meanings. When the client calls `getObject` at the level of the model API, it does not
* know whether provisioning and/or repository will be ultimately called.
*/
private Long staleness;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ private void evaluateConditionAndTransformation(VariablesMap staticVariables) {
try {
conditionResult = evaluateCondition(staticVariables);
if (conditionResult) {
transformationResult = evaluateTransformation(staticVariables);
transformationResult = evaluateTransformation(staticVariables);
} else {
setTraceComment("Skipping value transformation because condition evaluated to false.");
transformationResult = emptySet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,6 @@ <T extends ObjectType> List<PcpStartInstruction> getStartInstructions(
@NotNull OperationResult result)
throws SchemaException, ObjectNotFoundException, ConfigurationException;

// /**
// * Returns a list of users who have approved the particular request. This information is then stored in the task by the wf module,
// * and eventually fetched from there and put into metadata (createApproverRef/modifyApproverRef) by the model ChangeExecutor.
// *
// * However, information about the approvers is process-specific. Default implementation of this method in BasePrimaryChangeAspect corresponds
// * to behavior of general ItemApproval process.
// *
// * @param event Current ProcessEvent providing information on what happened within wf process instance.
// * @param job Reference to a job (pair of process instance and a task) in which the event happened.
// * @param result Operation result - the method should report any errors here.
// * @return List of references to approvers that approved this request.
// */
// List<ObjectReferenceType> prepareApprovedBy(ProcessEvent event, PcpWfTask job, OperationResult result);

/**
* Returns true if this aspect is enabled by default, i.e. even if not listed in primary change processor configuration.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ public AsynchronousOperationReturnValue<Collection<PropertyModificationOperation
result.recordInProgress();
result.setAsynchronousOperationReference(ticketIdentifier);

AsynchronousOperationReturnValue<Collection<PropertyModificationOperation<?>>> ret = new AsynchronousOperationReturnValue<>();
AsynchronousOperationReturnValue<Collection<PropertyModificationOperation<?>>> ret =
new AsynchronousOperationReturnValue<>();
ret.setOperationType(PendingOperationTypeType.MANUAL);
ret.setOperationResult(result);
return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -936,16 +936,16 @@ public AsynchronousOperationReturnValue<Collection<PropertyModificationOperation
* Modifies object by using new delta update operations.
*/
private AsynchronousOperationReturnValue<Collection<PropertyModificationOperation<?>>> modifyObjectDelta(
ResourceObjectIdentification identification,
ObjectClass objClass,
Uid uid,
PrismObject<ShadowType> shadow,
Collection<Operation> changes,
ConnectorOperationOptions options,
UcfExecutionContext reporter,
OperationResult result)
throws ObjectNotFoundException, CommunicationException,
GenericFrameworkException, SchemaException, SecurityViolationException, PolicyViolationException, ObjectAlreadyExistsException {
ResourceObjectIdentification identification,
ObjectClass objClass,
Uid uid,
PrismObject<ShadowType> shadow,
Collection<Operation> changes,
ConnectorOperationOptions options,
UcfExecutionContext reporter,
OperationResult result)
throws ObjectNotFoundException, CommunicationException, GenericFrameworkException, SchemaException,
SecurityViolationException, PolicyViolationException, ObjectAlreadyExistsException {

ResourceObjectDefinition objectClassDef = identification.getResourceObjectDefinition();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ private PrismValueDeltaSetTriple<V> evaluateExpressionEvaluators(ExpressionEvalu
processEvaluatorProfile(contextWithProcessedVariables, evaluator);

//noinspection unchecked
PrismValueDeltaSetTriple<V> outputTriple = (PrismValueDeltaSetTriple<V>) evaluator.evaluate(contextWithProcessedVariables, result);
PrismValueDeltaSetTriple<V> outputTriple =
(PrismValueDeltaSetTriple<V>) evaluator.evaluate(contextWithProcessedVariables, result);

if (outputTriple != null) {
boolean allowEmptyRealValues = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ public class CaseManagementHelper {

// TODO find a better name
CaseWorkItemType updateLoadedCaseWorkItem(
GetContainerableIdOnlyResult result, Map<String, PrismObject<CaseType>> ownersMap,
Session session, Collection<SelectorOptions<GetOperationOptions>> options)
GetContainerableIdOnlyResult result,
Map<String, PrismObject<CaseType>> ownersMap,
Session session,
Collection<SelectorOptions<GetOperationOptions>> options)
throws SchemaException, ObjectNotFoundException, DtoTranslationException {

String ownerOid = result.getOwnerOid();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,14 @@ public ActivityProgressInformation get() {
}

public ActivityProgressInformationAsserter<RA> assertBucketsItemsConsistency(int bucketSize, int workers) {
// FIXME re-enable
// int progress = information.getItemsProgress().getProgress();
// int completedBuckets = getCompletedBuckets();
// if (progress < completedBuckets * bucketSize) {
// fail("Progress (" + progress + ") is lower than buckets (" + completedBuckets + ") x size (" + bucketSize + ")");
// } else if (progress > completedBuckets * bucketSize + workers *bucketSize) {
// fail("Progress (" + progress + ") is greater than buckets (" + completedBuckets + ") x size (" + bucketSize
// + ") + workers (" + workers + ") x size (" + bucketSize + ")");
// }
int progress = information.getItemsProgress().getProgress();
int completedBuckets = getCompletedBuckets();
if (progress < completedBuckets * bucketSize) {
fail("Progress (" + progress + ") is lower than buckets (" + completedBuckets + ") x size (" + bucketSize + ")");
} else if (progress > completedBuckets * bucketSize + workers *bucketSize) {
fail("Progress (" + progress + ") is greater than buckets (" + completedBuckets + ") x size (" + bucketSize
+ ") + workers (" + workers + ") x size (" + bucketSize + ")");
}
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,7 @@ default boolean isIndestructible() {
/** Returns the execution mode of this task. */
@NotNull TaskExecutionMode getExecutionMode();

/** Sets the execution mode of this task. Use with care - preferably only for new tasks. */
void setExecutionMode(@NotNull TaskExecutionMode mode);
//endregion
}

0 comments on commit 2e1d4c5

Please sign in to comment.