Remove calls to deprecated public intent data constructor

Change-Id: Ic77c1d2cfb3e954bc0b7ee6a8a66d9c4b8167872
diff --git a/apps/virtual/app/src/main/java/org/onosproject/incubator/net/virtual/impl/intent/VirtualIntentInstallCoordinator.java b/apps/virtual/app/src/main/java/org/onosproject/incubator/net/virtual/impl/intent/VirtualIntentInstallCoordinator.java
index 4a09250..3cc61f8 100644
--- a/apps/virtual/app/src/main/java/org/onosproject/incubator/net/virtual/impl/intent/VirtualIntentInstallCoordinator.java
+++ b/apps/virtual/app/src/main/java/org/onosproject/incubator/net/virtual/impl/intent/VirtualIntentInstallCoordinator.java
@@ -185,12 +185,12 @@
             if (toInstall.isPresent()) {
                 IntentData installData = toInstall.get();
                 log.debug("Completed installing: {}", installData.key());
-                installData = new IntentData(installData, installData.installables());
+                installData = IntentData.compiled(installData, installData.installables());
                 installData.setState(INSTALLED);
                 intentStore.write(networkId, installData);
             } else if (toUninstall.isPresent()) {
                 IntentData uninstallData = toUninstall.get();
-                uninstallData = new IntentData(uninstallData, Collections.emptyList());
+                uninstallData = IntentData.compiled(uninstallData, Collections.emptyList());
                 log.debug("Completed withdrawing: {}", uninstallData.key());
                 switch (uninstallData.request()) {
                     case INSTALL_REQ:
diff --git a/apps/virtual/app/src/main/java/org/onosproject/incubator/net/virtual/impl/intent/phase/VirtualIntentCompiling.java b/apps/virtual/app/src/main/java/org/onosproject/incubator/net/virtual/impl/intent/phase/VirtualIntentCompiling.java
index 639c04c..f569ff7 100644
--- a/apps/virtual/app/src/main/java/org/onosproject/incubator/net/virtual/impl/intent/phase/VirtualIntentCompiling.java
+++ b/apps/virtual/app/src/main/java/org/onosproject/incubator/net/virtual/impl/intent/phase/VirtualIntentCompiling.java
@@ -72,7 +72,7 @@
                 // removing orphaned flows and deallocating resources
                 return Optional.of(
                         new VirtualIntentWithdrawing(networkId, processor,
-                                                     new IntentData(data, stored.get().installables())));
+                                                     IntentData.compiled(data, stored.get().installables())));
             } else {
                 return Optional.of(new VirtualIntentFailed(data));
             }
diff --git a/apps/virtual/app/src/main/java/org/onosproject/incubator/net/virtual/impl/intent/phase/VirtualIntentWithdrawRequest.java b/apps/virtual/app/src/main/java/org/onosproject/incubator/net/virtual/impl/intent/phase/VirtualIntentWithdrawRequest.java
index ce8dfc9..a3ae7ce 100644
--- a/apps/virtual/app/src/main/java/org/onosproject/incubator/net/virtual/impl/intent/phase/VirtualIntentWithdrawRequest.java
+++ b/apps/virtual/app/src/main/java/org/onosproject/incubator/net/virtual/impl/intent/phase/VirtualIntentWithdrawRequest.java
@@ -76,6 +76,6 @@
         }
 
         return Optional.of(new VirtualIntentWithdrawing(networkId, processor,
-                                                        new IntentData(data, stored.get().installables())));
+                                                        IntentData.compiled(data, stored.get().installables())));
     }
 }
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentData.java b/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
index 3375570..8ca5182 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
@@ -248,13 +248,11 @@
      * @param original original data
      * @param installables new installable intents to set
      *
-     * @deprecated in 1.11.0 use {@link #compiled(IntentData, List)} instead
      */
     // used to create an instance who reached stable state
     // note that state is mutable field, so it gets altered else where
     // (probably that design is mother of all intent bugs)
-    @Deprecated
-    public IntentData(IntentData original, List<Intent> installables) {
+    private  IntentData(IntentData original, List<Intent> installables) {
         this(original);
         this.internalStateVersion++;
 
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/InstallCoordinator.java b/core/net/src/main/java/org/onosproject/net/intent/impl/InstallCoordinator.java
index 6539ddc..d12b239 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/InstallCoordinator.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/InstallCoordinator.java
@@ -181,12 +181,12 @@
                 log.debug("Completed installing: {}:{}",
                           installData.key(),
                           installData.intent().id());
-                installData = new IntentData(installData, installData.installables());
+                installData = IntentData.compiled(installData, installData.installables());
                 installData.setState(INSTALLED);
                 intentStore.write(installData);
             } else if (toUninstall.isPresent()) {
                 IntentData uninstallData = toUninstall.get();
-                uninstallData = new IntentData(uninstallData, Collections.emptyList());
+                uninstallData = IntentData.compiled(uninstallData, Collections.emptyList());
                 log.debug("Completed withdrawing: {}:{}",
                           uninstallData.key(),
                           uninstallData.intent().id());
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Compiling.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Compiling.java
index ce722f8..9eb3106 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Compiling.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Compiling.java
@@ -62,7 +62,7 @@
             log.warn("Unable to compile intent {} due to:", data.intent(), e.getMessage());
             if (stored.filter(x -> !x.installables().isEmpty()).isPresent()) {
                 // removing orphaned flows and deallocating resources
-                return Optional.of(new Withdrawing(processor, new IntentData(data, stored.get().installables())));
+                return Optional.of(new Withdrawing(processor, IntentData.compiled(data, stored.get().installables())));
             } else {
                 return Optional.of(new Failed(data));
             }
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawRequest.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawRequest.java
index 3327ef4..7e55a74 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawRequest.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawRequest.java
@@ -70,6 +70,6 @@
             }
         }
 
-        return Optional.of(new Withdrawing(processor, new IntentData(data, stored.get().installables())));
+        return Optional.of(new Withdrawing(processor, IntentData.compiled(data, stored.get().installables())));
     }
 }
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/InstallCoordinatorTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/InstallCoordinatorTest.java
index 7d1273b..58af6d7 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/InstallCoordinatorTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/InstallCoordinatorTest.java
@@ -87,7 +87,7 @@
         IntStream.range(0, 10).forEach(val -> {
             intents.add(new TestInstallableIntent(val));
         });
-        toInstall = new IntentData(toInstall, intents);
+        toInstall = IntentData.compiled(toInstall, intents);
         installCoordinator.installIntents(Optional.empty(), Optional.of(toInstall));
         Intent toInstallIntent = toInstall.intent();
         TestTools.assertAfter(INSTALL_DELAY, INSTALL_DURATION, () -> {
@@ -112,7 +112,7 @@
             intents.add(new TestInstallableIntent(val));
         });
 
-        toUninstall = new IntentData(toUninstall, intents);
+        toUninstall = IntentData.compiled(toUninstall, intents);
 
         installCoordinator.installIntents(Optional.of(toUninstall), Optional.empty());
         Intent toUninstallIntent = toUninstall.intent();
@@ -147,8 +147,8 @@
             intentsToInstall.add(new TestInstallableIntent(val));
         });
 
-        toUninstall = new IntentData(toUninstall, intentsToUninstall);
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
 
         installCoordinator.installIntents(Optional.of(toUninstall), Optional.of(toInstall));
         Intent toInstallIntent = toInstall.intent();
@@ -194,8 +194,8 @@
             intentsToInstall.add(new TestInstallableIntent(val));
         });
 
-        toUninstall = new IntentData(toUninstall, intentsToUninstall);
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
 
         installCoordinator.installIntents(Optional.of(toUninstall), Optional.of(toInstall));
 
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/installer/DomainIntentInstallerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/installer/DomainIntentInstallerTest.java
index 8de12e0..3ddfd72 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/installer/DomainIntentInstallerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/installer/DomainIntentInstallerTest.java
@@ -74,7 +74,7 @@
         IntentData toInstall = new IntentData(createP2PIntent(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
         IntentOperationContext<DomainIntent> operationContext;
         IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
         operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
@@ -93,7 +93,7 @@
                                                 IntentState.WITHDRAWING,
                                                 new WallClockTimestamp());
         IntentData toInstall = null;
-        toUninstall = new IntentData(toUninstall, intentsToUninstall);
+        toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
         IntentOperationContext<DomainIntent> operationContext;
         IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
         operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
@@ -111,11 +111,11 @@
         IntentData toUninstall = new IntentData(createP2PIntent(),
                                                 IntentState.INSTALLED,
                                                 new WallClockTimestamp());
-        toUninstall = new IntentData(toUninstall, intentsToUninstall);
+        toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
         IntentData toInstall = new IntentData(createP2PIntent(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
         IntentOperationContext<DomainIntent> operationContext;
         IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
         operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
@@ -151,7 +151,7 @@
         IntentData toInstall = new IntentData(createP2PIntent(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
         IntentOperationContext<DomainIntent> operationContext;
         IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
         operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/installer/FlowObjectiveIntentInstallerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/installer/FlowObjectiveIntentInstallerTest.java
index c8df722..1e00dad 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/installer/FlowObjectiveIntentInstallerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/installer/FlowObjectiveIntentInstallerTest.java
@@ -92,7 +92,7 @@
         IntentData toInstall = new IntentData(createP2PIntent(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
 
 
         IntentOperationContext<FlowObjectiveIntent> operationContext;
@@ -118,7 +118,7 @@
         IntentData toUninstall = new IntentData(createP2PIntent(),
                                               IntentState.WITHDRAWING,
                                               new WallClockTimestamp());
-        toUninstall = new IntentData(toUninstall, intentsToUninstall);
+        toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
         IntentOperationContext<FlowObjectiveIntent> operationContext;
         IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
         operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
@@ -139,11 +139,11 @@
         IntentData toInstall = new IntentData(createP2PIntent(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
         IntentData toUninstall = new IntentData(createP2PIntent(),
                                                 IntentState.INSTALLED,
                                                 new WallClockTimestamp());
-        toUninstall = new IntentData(toUninstall, intentsToUninstall);
+        toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
 
         IntentOperationContext<FlowObjectiveIntent> operationContext;
         IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
@@ -341,7 +341,7 @@
         IntentData toUninstall = new IntentData(createP2PIntent(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toUninstall = new IntentData(toUninstall, intentsToUninstall);
+        toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
         IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
         return new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
     }
@@ -358,7 +358,7 @@
         IntentData toInstall = new IntentData(createP2PIntent(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
         IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
         return new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
     }
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/installer/FlowRuleIntentInstallerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/installer/FlowRuleIntentInstallerTest.java
index e1e186a..712f8bf 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/installer/FlowRuleIntentInstallerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/installer/FlowRuleIntentInstallerTest.java
@@ -101,7 +101,7 @@
         IntentData toInstall = new IntentData(createP2PIntent(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
 
 
         IntentOperationContext<FlowRuleIntent> operationContext;
@@ -134,7 +134,7 @@
         IntentData toUninstall = new IntentData(createP2PIntent(),
                                               IntentState.WITHDRAWING,
                                               new WallClockTimestamp());
-        toUninstall = new IntentData(toUninstall, intentsToUninstall);
+        toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
 
 
         IntentOperationContext<FlowRuleIntent> operationContext;
@@ -166,11 +166,11 @@
         IntentData toInstall = new IntentData(createP2PIntent(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
         IntentData toUninstall = new IntentData(createP2PIntent(),
                                                 IntentState.INSTALLED,
                                                 new WallClockTimestamp());
-        toUninstall = new IntentData(toUninstall, intentsToUninstall);
+        toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
 
         IntentOperationContext<FlowRuleIntent> operationContext;
         IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
@@ -209,11 +209,11 @@
         IntentData toInstall = new IntentData(createP2PIntent(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
         IntentData toUninstall = new IntentData(createP2PIntent(),
                                                 IntentState.INSTALLED,
                                                 new WallClockTimestamp());
-        toUninstall = new IntentData(toUninstall, intentsToUninstall);
+        toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
 
         IntentOperationContext<FlowRuleIntent> operationContext;
         IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
@@ -240,11 +240,11 @@
         IntentData toInstall = new IntentData(createP2PIntent(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
         IntentData toUninstall = new IntentData(createP2PIntent(),
                                                 IntentState.INSTALLED,
                                                 new WallClockTimestamp());
-        toUninstall = new IntentData(toUninstall, intentsToUninstall);
+        toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
 
         IntentOperationContext<FlowRuleIntent> operationContext;
         IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
@@ -293,7 +293,7 @@
         IntentData toInstall = new IntentData(createP2PIntent(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
 
 
         IntentOperationContext<FlowRuleIntent> operationContext;
@@ -317,11 +317,11 @@
         IntentData toInstall = new IntentData(createP2PIntent(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
         IntentData toUninstall = new IntentData(createP2PIntent(),
                                                 IntentState.INSTALLED,
                                                 new WallClockTimestamp());
-        toUninstall = new IntentData(toUninstall, intentsToUninstall);
+        toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
 
         IntentOperationContext<FlowRuleIntent> operationContext;
         IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
@@ -355,11 +355,11 @@
         IntentData toInstall = new IntentData(createP2PIntentNonDisruptive(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
         IntentData toUninstall = new IntentData(createP2PIntentNonDisruptive(),
                                                 IntentState.INSTALLED,
                                                 new WallClockTimestamp());
-        toUninstall = new IntentData(toUninstall, intentsToUninstall);
+        toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
 
         IntentOperationContext<FlowRuleIntent> operationContext;
         IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/installer/ProtectionEndpointIntentInstallerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/installer/ProtectionEndpointIntentInstallerTest.java
index 6ca2d62..70de4c3 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/installer/ProtectionEndpointIntentInstallerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/installer/ProtectionEndpointIntentInstallerTest.java
@@ -113,7 +113,7 @@
         IntentData toInstall = new IntentData(createP2PIntent(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
         IntentOperationContext<ProtectionEndpointIntent> operationContext;
         IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
         operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
@@ -151,11 +151,11 @@
         IntentData toUninstall = new IntentData(createP2PIntent(),
                                                 IntentState.INSTALLED,
                                                 new WallClockTimestamp());
-        toUninstall = new IntentData(toUninstall, intentsToInstall);
+        toUninstall = IntentData.compiled(toUninstall, intentsToInstall);
         IntentData toInstall = new IntentData(createP2PIntent(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
         IntentOperationContext<ProtectionEndpointIntent> operationContext;
         IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
         operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
@@ -192,7 +192,7 @@
         IntentData toInstall = new IntentData(createP2PIntent(),
                                               IntentState.INSTALLING,
                                               new WallClockTimestamp());
-        toInstall = new IntentData(toInstall, intentsToInstall);
+        toInstall = IntentData.compiled(toInstall, intentsToInstall);
         IntentOperationContext<ProtectionEndpointIntent> operationContext;
         IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
         operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);