Skip to content

Commit

Permalink
Finish operations only - preliminary.
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Feb 2, 2017
1 parent a8b3ee1 commit 0996754
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
Expand Up @@ -252,6 +252,7 @@ public abstract class SchemaConstants {
NS_MODEL_EXTENSION, "freshnessInterval"); // unused? TODO consider
// removing
public static final QName MODEL_EXTENSION_DRY_RUN = new QName(NS_MODEL_EXTENSION, "dryRun");
public static final QName MODEL_EXTENSION_FINISH_OPERATIONS_ONLY = new QName(NS_MODEL_EXTENSION, "finishOperationsOnly");
public static final QName MODEL_EXTENSION_KIND = new QName(NS_MODEL_EXTENSION, "kind");
public static final QName MODEL_EXTENSION_INTENT = new QName(NS_MODEL_EXTENSION, "intent");
public static final QName OBJECTCLASS_PROPERTY_NAME = new QName(NS_MODEL_EXTENSION, "objectclass");
Expand Down
Expand Up @@ -82,6 +82,20 @@
</xsd:annotation>
</xsd:element>

<xsd:element name="finishOperationsOnly" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>
TODO. EXPERIMENTAL.
</xsd:documentation>
<xsd:appinfo>
<!--<a:displayName>Dry run</a:displayName>-->
<!--<a:displayOrder>800</a:displayOrder>-->
<a:minOccurs>0</a:minOccurs>
<a:maxOccurs>1</a:maxOccurs>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>

<xsd:element name="lastScanTimestamp" type="xsd:dateTime">
<xsd:annotation>
<xsd:documentation>
Expand Down
Expand Up @@ -62,6 +62,7 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;
import org.apache.commons.lang.BooleanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -151,7 +152,10 @@ public TaskRunResult run(Task coordinatorTask) {

public TaskRunResult runInternal(Task coordinatorTask) {
ReconciliationTaskResult reconResult = new ReconciliationTaskResult();


boolean finishOperationsOnly = BooleanUtils.isTrue(
coordinatorTask.getExtensionPropertyRealValue(SchemaConstants.MODEL_EXTENSION_FINISH_OPERATIONS_ONLY));

OperationResult opResult = new OperationResult(OperationConstants.RECONCILIATION);
opResult.setStatus(OperationResultStatus.IN_PROGRESS);
TaskRunResult runResult = new TaskRunResult();
Expand Down Expand Up @@ -215,8 +219,8 @@ public TaskRunResult runInternal(Task coordinatorTask) {
reconResult.setResource(resource);
reconResult.setObjectclassDefinition(objectclassDef);

LOGGER.info("Start executing reconciliation of resource {}, reconciling object class {}",
resource, objectclassDef);
LOGGER.info("Start executing reconciliation of resource {}, reconciling object class {}, finish operations only: {}",
resource, objectclassDef, finishOperationsOnly);
long reconStartTimestamp = clock.currentTimeMillis();

AuditEventRecord requestRecord = new AuditEventRecord(AuditEventType.RECONCILIATION, AuditEventStage.REQUEST);
Expand Down Expand Up @@ -260,12 +264,12 @@ public TaskRunResult runInternal(Task coordinatorTask) {
long afterResourceReconTimestamp;
long afterShadowReconTimestamp;
try {
if (!performResourceReconciliation(resource, objectclassDef, reconResult, coordinatorTask, opResult)) {
if (!finishOperationsOnly && !performResourceReconciliation(resource, objectclassDef, reconResult, coordinatorTask, opResult)) {
processInterruption(runResult, resource, coordinatorTask, opResult);
return runResult;
}
afterResourceReconTimestamp = clock.currentTimeMillis();
if (!performShadowReconciliation(resource, objectclassDef, reconStartTimestamp, afterResourceReconTimestamp, reconResult, coordinatorTask, opResult)) {
if (!finishOperationsOnly && !performShadowReconciliation(resource, objectclassDef, reconStartTimestamp, afterResourceReconTimestamp, reconResult, coordinatorTask, opResult)) {
processInterruption(runResult, resource, coordinatorTask, opResult);
return runResult;
}
Expand Down

0 comments on commit 0996754

Please sign in to comment.