diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/SubscriptionDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/SubscriptionDAO.java index c41dda76d7f..469ee440304 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/SubscriptionDAO.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/SubscriptionDAO.java @@ -77,7 +77,8 @@ public interface SubscriptionDAO { void updateSubscriptions(int tenantId, String updateBy, List paramList, int releaseId, String subType, String action) throws ApplicationManagementDAOException; - List getSubscribedDeviceIds(List deviceIds, int tenantId) throws ApplicationManagementDAOException; + List getSubscribedDeviceIds(List deviceIds, int applicationReleaseId, int tenantId) + throws ApplicationManagementDAOException; List getDeviceSubIdsForOperation (int operationId, int tenantId) throws ApplicationManagementDAOException; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java index 9eabccb38cb..cc6938c9349 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java @@ -533,7 +533,8 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc } @Override - public List getSubscribedDeviceIds(List deviceIds, int tenantId) + public List getSubscribedDeviceIds(List deviceIds, int applicationReleaseId, + int tenantId) throws ApplicationManagementDAOException { if (log.isDebugEnabled()) { log.debug("Request received to DAO Layer to get already subscribed dvice Ids for given list of device Ids."); @@ -545,14 +546,15 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc StringJoiner joiner = new StringJoiner(",", "SELECT DS.DM_DEVICE_ID " + "FROM AP_DEVICE_SUBSCRIPTION DS " - + "WHERE DS.DM_DEVICE_ID IN (", ") AND TENANT_ID = ?"); + + "WHERE DS.DM_DEVICE_ID IN (", ") AND AP_APP_RELEASE_ID = ? AND TENANT_ID = ?"); deviceIds.stream().map(ignored -> "?").forEach(joiner::add); String query = joiner.toString(); try (PreparedStatement ps = conn.prepareStatement(query)) { for (Integer deviceId : deviceIds) { ps.setObject(index++, deviceId); } - ps.setInt(index, tenantId); + ps.setInt(index++, tenantId); + ps.setInt(index, applicationReleaseId); try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { subscribedDevices.add(rs.getInt("DM_DEVICE_ID")); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java index 5cbe5b86969..c49167f90bf 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -366,7 +366,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager { List operationAddedDeviceIds = getOperationAddedDeviceIds(activity, subscribingDeviceIdHolder.getSubscribableDevices()); List alreadySubscribedDevices = subscriptionDAO - .getSubscribedDeviceIds(operationAddedDeviceIds, tenantId); + .getSubscribedDeviceIds(operationAddedDeviceIds, applicationReleaseId, tenantId); if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) { if (!alreadySubscribedDevices.isEmpty()) { List deviceResubscribingIds = subscriptionDAO diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/DeviceInstall.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/DeviceInstall.js index 7946dd833a4..57bbf1c5323 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/DeviceInstall.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/DeviceInstall.js @@ -190,7 +190,6 @@ class DeviceInstall extends React.Component { this.props.onInstall("devices", payload); }; - render() { const {data,pagination,loading,selectedRows} = this.state; return (