Remove IntentStore access in IntentUpdate subclasses
Change-Id: I923c62f1d34dc2c911323f11990de5c9788bf655
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawRequest.java b/core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawRequest.java
index 5af60dc..7444d35 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawRequest.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/WithdrawRequest.java
@@ -20,7 +20,6 @@
import java.util.Optional;
import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onosproject.net.intent.IntentState.WITHDRAWN;
/**
* Represents a phase of requesting a withdraw of an intent.
@@ -30,19 +29,16 @@
// TODO: define an interface and use it, instead of IntentManager
private final IntentManager intentManager;
private final IntentData pending;
+ private final IntentData current;
- WithdrawRequest(IntentManager intentManager, IntentData intentData) {
+ WithdrawRequest(IntentManager intentManager, IntentData intentData, IntentData current) {
this.intentManager = checkNotNull(intentManager);
this.pending = checkNotNull(intentData);
+ this.current = checkNotNull(current);
}
@Override
public Optional<IntentUpdate> execute() {
- //FIXME need store interface
- IntentData current = intentManager.store.getIntentData(pending.key());
- if (current == null) {
- return Optional.of(new Withdrawn(pending, WITHDRAWN));
- }
//TODO perhaps we want to validate that the pending and current are the
// same version i.e. they are the same
// Note: this call is not just the symmetric version of submit