Skip to content

Commit

Permalink
Remove operationExecution.taskPartUri
Browse files Browse the repository at this point in the history
It is now replaced by activity path.
  • Loading branch information
mederly committed Sep 29, 2021
1 parent 045a851 commit 12da7ce
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22188,6 +22188,11 @@
<xsd:appinfo>
<a:since>3.6</a:since>
<a:container/>
<a:schemaMigration>
<a:element>tns:taskPartUri</a:element>
<a:version>4.4</a:version>
<a:operation>removed</a:operation>
</a:schemaMigration>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
Expand Down Expand Up @@ -22266,19 +22271,6 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="taskPartUri" type="xsd:anyURI" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
URI of the task part. Necessary to distinguish between results of various task parts.
Currently supported only for complex operations.
</xsd:documentation>
<xsd:appinfo>
<a:since>4.3</a:since>
<a:deprecated>true</a:deprecated>
<a:deprecatedSince>4.4</a:deprecatedSince>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="activityPath" type="tns:ActivityPathType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import com.evolveum.midpoint.repo.common.util.OperationExecutionWriter;
import com.evolveum.midpoint.schema.constants.ObjectTypes;

import com.evolveum.midpoint.task.api.ExecutionSupport;

import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -180,6 +182,13 @@ private OperationExecutionType createExecutionRecord(Collection<LensObjectDeltaO
}
}
createTaskRef(record, ctx);

ExecutionSupport executionSupport = ctx.task.getExecutionSupport();
if (executionSupport != null) {
record.setActivityPath(
executionSupport.getActivityPath().toBean());
}

summaryResult.computeStatus();
record.setStatus(summaryResult.getStatus().createStatusType());
record.setMessage(summaryResult.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ private List<OperationExecutionType> selectRecordsToDelete(Request<?> request,

OperationExecutionRecordTypeType currentRecordType = toNotNull(request.recordToAdd.getRecordType());
String taskOid = request.getTaskOid();
String taskPartUri = request.getTaskPartUri();
ActivityPathType activityPath = request.getActivityPath();

List<OperationExecutionType> recordsToDelete = new ArrayList<>();
List<OperationExecutionType> recordsToConsider = new ArrayList<>(existingRecords);
Expand All @@ -211,7 +211,7 @@ private List<OperationExecutionType> selectRecordsToDelete(Request<?> request,
// If the former is preferable, then please move this block of code just above the filtering on record type.
for (Iterator<OperationExecutionType> iterator = recordsToConsider.iterator(); iterator.hasNext(); ) {
OperationExecutionType record = iterator.next();
if (shouldDeleteBecauseOfTheSameTaskAndPart(record, taskOid, taskPartUri)) {
if (shouldDeleteBecauseOfTheSameTaskAndActivity(record, taskOid, activityPath)) {
recordsToDelete.add(record);
iterator.remove();
}
Expand Down Expand Up @@ -246,10 +246,10 @@ private boolean recordTypeMatches(@NotNull OperationExecutionType record,
return toNotNull(record.getRecordType()) == recordType;
}

private boolean shouldDeleteBecauseOfTheSameTaskAndPart(OperationExecutionType execution, String taskOid,
String taskPartUri) {
private boolean shouldDeleteBecauseOfTheSameTaskAndActivity(OperationExecutionType execution, String taskOid,
ActivityPathType activityPath) {
return taskOid != null && taskOid.equals(getTaskOid(execution)) &&
Objects.equals(taskPartUri, execution.getTaskPartUri());
Objects.equals(activityPath, execution.getActivityPath());
}

@PostConstruct
Expand Down Expand Up @@ -396,8 +396,8 @@ private String getTaskOid() {
return OperationExecutionWriter.getTaskOid(recordToAdd);
}

private String getTaskPartUri() {
return recordToAdd.getTaskPartUri();
private ActivityPathType getActivityPath() {
return recordToAdd.getActivityPath();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import java.util.Collection;
import java.util.Map;

import com.evolveum.midpoint.schema.util.task.ActivityPath;

import org.jetbrains.annotations.NotNull;

import com.evolveum.midpoint.prism.path.ItemName;
Expand All @@ -34,6 +36,9 @@ public interface ExecutionSupport {
*/
@NotNull ExecutionModeType getExecutionMode();

/** Returns the path of the activity we are executing. */
@NotNull ActivityPath getActivityPath();

/**
* Increments given counters related to the activity execution.
*
Expand Down

0 comments on commit 12da7ce

Please sign in to comment.