Fix app installing issue in APPM

feature/appm-store/pbac
lasanthaDLPDS 5 years ago
parent 86fb8b16ef
commit 198bfc11f6

@ -77,7 +77,8 @@ public interface SubscriptionDAO {
void updateSubscriptions(int tenantId, String updateBy, List<String> paramList, void updateSubscriptions(int tenantId, String updateBy, List<String> paramList,
int releaseId, String subType, String action) throws ApplicationManagementDAOException; int releaseId, String subType, String action) throws ApplicationManagementDAOException;
List<Integer> getSubscribedDeviceIds(List<Integer> deviceIds, int tenantId) throws ApplicationManagementDAOException; List<Integer> getSubscribedDeviceIds(List<Integer> deviceIds, int applicationReleaseId, int tenantId)
throws ApplicationManagementDAOException;
List<Integer> getDeviceSubIdsForOperation (int operationId, int tenantId) throws ApplicationManagementDAOException; List<Integer> getDeviceSubIdsForOperation (int operationId, int tenantId) throws ApplicationManagementDAOException;

@ -533,7 +533,8 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
} }
@Override @Override
public List<Integer> getSubscribedDeviceIds(List<Integer> deviceIds, int tenantId) public List<Integer> getSubscribedDeviceIds(List<Integer> deviceIds, int applicationReleaseId,
int tenantId)
throws ApplicationManagementDAOException { throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Request received to DAO Layer to get already subscribed dvice Ids for given list of device Ids."); 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(",", StringJoiner joiner = new StringJoiner(",",
"SELECT DS.DM_DEVICE_ID " "SELECT DS.DM_DEVICE_ID "
+ "FROM AP_DEVICE_SUBSCRIPTION DS " + "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); deviceIds.stream().map(ignored -> "?").forEach(joiner::add);
String query = joiner.toString(); String query = joiner.toString();
try (PreparedStatement ps = conn.prepareStatement(query)) { try (PreparedStatement ps = conn.prepareStatement(query)) {
for (Integer deviceId : deviceIds) { for (Integer deviceId : deviceIds) {
ps.setObject(index++, deviceId); ps.setObject(index++, deviceId);
} }
ps.setInt(index, tenantId); ps.setInt(index++, tenantId);
ps.setInt(index, applicationReleaseId);
try (ResultSet rs = ps.executeQuery()) { try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) { while (rs.next()) {
subscribedDevices.add(rs.getInt("DM_DEVICE_ID")); subscribedDevices.add(rs.getInt("DM_DEVICE_ID"));

@ -366,7 +366,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
List<Integer> operationAddedDeviceIds = getOperationAddedDeviceIds(activity, List<Integer> operationAddedDeviceIds = getOperationAddedDeviceIds(activity,
subscribingDeviceIdHolder.getSubscribableDevices()); subscribingDeviceIdHolder.getSubscribableDevices());
List<Integer> alreadySubscribedDevices = subscriptionDAO List<Integer> alreadySubscribedDevices = subscriptionDAO
.getSubscribedDeviceIds(operationAddedDeviceIds, tenantId); .getSubscribedDeviceIds(operationAddedDeviceIds, applicationReleaseId, tenantId);
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) { if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
if (!alreadySubscribedDevices.isEmpty()) { if (!alreadySubscribedDevices.isEmpty()) {
List<Integer> deviceResubscribingIds = subscriptionDAO List<Integer> deviceResubscribingIds = subscriptionDAO

@ -190,7 +190,6 @@ class DeviceInstall extends React.Component {
this.props.onInstall("devices", payload); this.props.onInstall("devices", payload);
}; };
render() { render() {
const {data,pagination,loading,selectedRows} = this.state; const {data,pagination,loading,selectedRows} = this.state;
return ( return (

Loading…
Cancel
Save