|
|
@ -1929,6 +1929,9 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
|
|
|
// Retrieve owner details and device IDs for the user using the service layer
|
|
|
|
// Retrieve owner details and device IDs for the user using the service layer
|
|
|
|
OwnerWithDeviceDTO ownerDetailsWithDevices =
|
|
|
|
OwnerWithDeviceDTO ownerDetailsWithDevices =
|
|
|
|
deviceManagementProviderService.getOwnersWithDeviceIds(userName, applicationDTO.getDeviceTypeId());
|
|
|
|
deviceManagementProviderService.getOwnersWithDeviceIds(userName, applicationDTO.getDeviceTypeId());
|
|
|
|
|
|
|
|
log.info("line no 1932 device ids : " + ownerDetailsWithDevices.getDeviceIds());
|
|
|
|
|
|
|
|
log.info("line no 1933 device identifiers : " + ownerDetailsWithDevices.getDeviceIdentifiers());
|
|
|
|
|
|
|
|
log.info("line no 1934 device names : " + ownerDetailsWithDevices.getDeviceNames());
|
|
|
|
|
|
|
|
|
|
|
|
SubscriptionsDTO userSubscriptionDTO = new SubscriptionsDTO();
|
|
|
|
SubscriptionsDTO userSubscriptionDTO = new SubscriptionsDTO();
|
|
|
|
userSubscriptionDTO.setName(userSubscription.getName());
|
|
|
|
userSubscriptionDTO.setName(userSubscription.getName());
|
|
|
@ -1965,15 +1968,20 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
|
|
|
for (Integer deviceId : deviceIds) {
|
|
|
|
for (Integer deviceId : deviceIds) {
|
|
|
|
List<DeviceSubscriptionDTO> deviceSubscriptions = subscriptionDAO.getSubscriptionDetailsByDeviceIds(
|
|
|
|
List<DeviceSubscriptionDTO> deviceSubscriptions = subscriptionDAO.getSubscriptionDetailsByDeviceIds(
|
|
|
|
userSubscription.getAppReleaseId(), unsubscribe, tenantId, deviceIds);
|
|
|
|
userSubscription.getAppReleaseId(), unsubscribe, tenantId, deviceIds);
|
|
|
|
|
|
|
|
OwnerWithDeviceDTO ownerWithDeviceByDeviceId =
|
|
|
|
|
|
|
|
deviceManagementProviderService.getOwnerWithDeviceByDeviceId(deviceId);
|
|
|
|
|
|
|
|
if (ownerWithDeviceByDeviceId == null) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
boolean isNewDevice = true;
|
|
|
|
boolean isNewDevice = true;
|
|
|
|
for (DeviceSubscriptionDTO subscription : deviceSubscriptions) {
|
|
|
|
for (DeviceSubscriptionDTO subscription : deviceSubscriptions) {
|
|
|
|
if (subscription.getDeviceId() == deviceId) {
|
|
|
|
if (subscription.getDeviceId() == deviceId) {
|
|
|
|
DeviceSubscriptionData deviceDetail = new DeviceSubscriptionData();
|
|
|
|
DeviceSubscriptionData deviceDetail = new DeviceSubscriptionData();
|
|
|
|
deviceDetail.setDeviceId(subscription.getDeviceId());
|
|
|
|
deviceDetail.setDeviceId(subscription.getDeviceId());
|
|
|
|
deviceDetail.setSubId(subscription.getId());
|
|
|
|
deviceDetail.setSubId(subscription.getId());
|
|
|
|
deviceDetail.setDeviceOwner(ownerDetailsWithDevices.getUserName());
|
|
|
|
deviceDetail.setDeviceOwner(ownerWithDeviceByDeviceId.getUserName());
|
|
|
|
deviceDetail.setDeviceStatus(ownerDetailsWithDevices.getDeviceStatus());
|
|
|
|
deviceDetail.setDeviceStatus(ownerWithDeviceByDeviceId.getDeviceStatus());
|
|
|
|
deviceDetail.setDeviceName(ownerDetailsWithDevices.getDeviceNames());
|
|
|
|
deviceDetail.setDeviceName(ownerWithDeviceByDeviceId.getDeviceNames());
|
|
|
|
deviceDetail.setActionType(subscription.getActionTriggeredFrom());
|
|
|
|
deviceDetail.setActionType(subscription.getActionTriggeredFrom());
|
|
|
|
deviceDetail.setStatus(subscription.getStatus());
|
|
|
|
deviceDetail.setStatus(subscription.getStatus());
|
|
|
|
deviceDetail.setActionType(subscription.getActionTriggeredFrom());
|
|
|
|
deviceDetail.setActionType(subscription.getActionTriggeredFrom());
|
|
|
@ -1982,8 +1990,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
|
|
|
deviceDetail.setUnsubscribed(subscription.isUnsubscribed());
|
|
|
|
deviceDetail.setUnsubscribed(subscription.isUnsubscribed());
|
|
|
|
deviceDetail.setUnsubscribedBy(subscription.getUnsubscribedBy());
|
|
|
|
deviceDetail.setUnsubscribedBy(subscription.getUnsubscribedBy());
|
|
|
|
deviceDetail.setUnsubscribedTimestamp(subscription.getUnsubscribedTimestamp());
|
|
|
|
deviceDetail.setUnsubscribedTimestamp(subscription.getUnsubscribedTimestamp());
|
|
|
|
deviceDetail.setType(ownerDetailsWithDevices.getDeviceTypes());
|
|
|
|
deviceDetail.setType(ownerWithDeviceByDeviceId.getDeviceTypes());
|
|
|
|
deviceDetail.setDeviceIdentifier(ownerDetailsWithDevices.getDeviceIdentifiers());
|
|
|
|
deviceDetail.setDeviceIdentifier(ownerWithDeviceByDeviceId.getDeviceIdentifiers());
|
|
|
|
|
|
|
|
|
|
|
|
status = subscription.getStatus();
|
|
|
|
status = subscription.getStatus();
|
|
|
|
switch (status) {
|
|
|
|
switch (status) {
|
|
|
@ -2013,16 +2021,16 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
|
|
|
if (subscribedDevice.getDeviceId() == deviceId) {
|
|
|
|
if (subscribedDevice.getDeviceId() == deviceId) {
|
|
|
|
DeviceSubscriptionData subscribedDeviceDetail = new DeviceSubscriptionData();
|
|
|
|
DeviceSubscriptionData subscribedDeviceDetail = new DeviceSubscriptionData();
|
|
|
|
subscribedDeviceDetail.setDeviceId(subscribedDevice.getDeviceId());
|
|
|
|
subscribedDeviceDetail.setDeviceId(subscribedDevice.getDeviceId());
|
|
|
|
subscribedDeviceDetail.setDeviceName(ownerDetailsWithDevices.getDeviceNames());
|
|
|
|
subscribedDeviceDetail.setDeviceName(ownerWithDeviceByDeviceId.getDeviceNames());
|
|
|
|
subscribedDeviceDetail.setDeviceOwner(ownerDetailsWithDevices.getUserName());
|
|
|
|
subscribedDeviceDetail.setDeviceOwner(ownerWithDeviceByDeviceId.getUserName());
|
|
|
|
subscribedDeviceDetail.setDeviceStatus(ownerDetailsWithDevices.getDeviceStatus());
|
|
|
|
subscribedDeviceDetail.setDeviceStatus(ownerWithDeviceByDeviceId.getDeviceStatus());
|
|
|
|
subscribedDeviceDetail.setSubId(subscribedDevice.getId());
|
|
|
|
subscribedDeviceDetail.setSubId(subscribedDevice.getId());
|
|
|
|
subscribedDeviceDetail.setActionTriggeredBy(subscribedDevice.getSubscribedBy());
|
|
|
|
subscribedDeviceDetail.setActionTriggeredBy(subscribedDevice.getSubscribedBy());
|
|
|
|
subscribedDeviceDetail.setActionTriggeredTimestamp(subscribedDevice.getSubscribedTimestamp());
|
|
|
|
subscribedDeviceDetail.setActionTriggeredTimestamp(subscribedDevice.getSubscribedTimestamp());
|
|
|
|
subscribedDeviceDetail.setActionType(subscribedDevice.getActionTriggeredFrom());
|
|
|
|
subscribedDeviceDetail.setActionType(subscribedDevice.getActionTriggeredFrom());
|
|
|
|
subscribedDeviceDetail.setStatus(subscribedDevice.getStatus());
|
|
|
|
subscribedDeviceDetail.setStatus(subscribedDevice.getStatus());
|
|
|
|
subscribedDeviceDetail.setType(ownerDetailsWithDevices.getDeviceTypes());
|
|
|
|
subscribedDeviceDetail.setType(ownerWithDeviceByDeviceId.getDeviceTypes());
|
|
|
|
subscribedDeviceDetail.setDeviceIdentifier(ownerDetailsWithDevices.getDeviceIdentifiers());
|
|
|
|
subscribedDeviceDetail.setDeviceIdentifier(ownerWithDeviceByDeviceId.getDeviceIdentifiers());
|
|
|
|
subscribedDevices.add(subscribedDeviceDetail);
|
|
|
|
subscribedDevices.add(subscribedDeviceDetail);
|
|
|
|
statusCounts.put("SUBSCRIBED", statusCounts.get("SUBSCRIBED") + 1);
|
|
|
|
statusCounts.put("SUBSCRIBED", statusCounts.get("SUBSCRIBED") + 1);
|
|
|
|
isSubscribedDevice = true;
|
|
|
|
isSubscribedDevice = true;
|
|
|
@ -2032,11 +2040,11 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
|
|
|
if (!isSubscribedDevice) {
|
|
|
|
if (!isSubscribedDevice) {
|
|
|
|
DeviceSubscriptionData newDeviceDetail = new DeviceSubscriptionData();
|
|
|
|
DeviceSubscriptionData newDeviceDetail = new DeviceSubscriptionData();
|
|
|
|
newDeviceDetail.setDeviceId(deviceId);
|
|
|
|
newDeviceDetail.setDeviceId(deviceId);
|
|
|
|
newDeviceDetail.setDeviceOwner(ownerDetailsWithDevices.getUserName());
|
|
|
|
newDeviceDetail.setDeviceOwner(ownerWithDeviceByDeviceId.getUserName());
|
|
|
|
newDeviceDetail.setDeviceStatus(ownerDetailsWithDevices.getDeviceStatus());
|
|
|
|
newDeviceDetail.setDeviceStatus(ownerWithDeviceByDeviceId.getDeviceStatus());
|
|
|
|
newDeviceDetail.setDeviceName(ownerDetailsWithDevices.getDeviceNames());
|
|
|
|
newDeviceDetail.setDeviceName(ownerWithDeviceByDeviceId.getDeviceNames());
|
|
|
|
newDeviceDetail.setType(ownerDetailsWithDevices.getDeviceTypes());
|
|
|
|
newDeviceDetail.setType(ownerWithDeviceByDeviceId.getDeviceTypes());
|
|
|
|
newDeviceDetail.setDeviceIdentifier(ownerDetailsWithDevices.getDeviceIdentifiers());
|
|
|
|
newDeviceDetail.setDeviceIdentifier(ownerWithDeviceByDeviceId.getDeviceIdentifiers());
|
|
|
|
newDevices.add(newDeviceDetail);
|
|
|
|
newDevices.add(newDeviceDetail);
|
|
|
|
statusCounts.put("NEW", statusCounts.get("NEW") + 1);
|
|
|
|
statusCounts.put("NEW", statusCounts.get("NEW") + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2153,7 +2161,11 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
|
|
|
subscribedDeviceSubscriptions = subscriptionDAO.getSubscriptionDetailsByDeviceIds(
|
|
|
|
subscribedDeviceSubscriptions = subscriptionDAO.getSubscriptionDetailsByDeviceIds(
|
|
|
|
appReleaseId, !unsubscribe, tenantId, deviceIds);
|
|
|
|
appReleaseId, !unsubscribe, tenantId, deviceIds);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OwnerWithDeviceDTO ownerWithDeviceByDeviceId =
|
|
|
|
|
|
|
|
deviceManagementProviderService.getOwnerWithDeviceByDeviceId(deviceId);
|
|
|
|
|
|
|
|
if (ownerWithDeviceByDeviceId == null) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
List<DeviceSubscriptionDTO> deviceSubscriptions;
|
|
|
|
List<DeviceSubscriptionDTO> deviceSubscriptions;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
deviceSubscriptions = subscriptionDAO.getSubscriptionDetailsByDeviceIds(
|
|
|
|
deviceSubscriptions = subscriptionDAO.getSubscriptionDetailsByDeviceIds(
|
|
|
@ -2167,9 +2179,9 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
|
|
|
if (deviceSubscription.getDeviceId() == deviceId) {
|
|
|
|
if (deviceSubscription.getDeviceId() == deviceId) {
|
|
|
|
DeviceSubscriptionData deviceDetail = new DeviceSubscriptionData();
|
|
|
|
DeviceSubscriptionData deviceDetail = new DeviceSubscriptionData();
|
|
|
|
deviceDetail.setDeviceId(deviceSubscription.getDeviceId());
|
|
|
|
deviceDetail.setDeviceId(deviceSubscription.getDeviceId());
|
|
|
|
deviceDetail.setDeviceName(ownerDetailsWithDevices.getDeviceNames());
|
|
|
|
deviceDetail.setDeviceName(ownerWithDeviceByDeviceId.getDeviceNames());
|
|
|
|
deviceDetail.setDeviceOwner(ownerDetailsWithDevices.getUserName());
|
|
|
|
deviceDetail.setDeviceOwner(ownerWithDeviceByDeviceId.getUserName());
|
|
|
|
deviceDetail.setDeviceStatus(ownerDetailsWithDevices.getDeviceStatus());
|
|
|
|
deviceDetail.setDeviceStatus(ownerWithDeviceByDeviceId.getDeviceStatus());
|
|
|
|
deviceDetail.setActionType(deviceSubscription.getActionTriggeredFrom());
|
|
|
|
deviceDetail.setActionType(deviceSubscription.getActionTriggeredFrom());
|
|
|
|
deviceDetail.setStatus(deviceSubscription.getStatus());
|
|
|
|
deviceDetail.setStatus(deviceSubscription.getStatus());
|
|
|
|
deviceDetail.setActionType(deviceSubscription.getActionTriggeredFrom());
|
|
|
|
deviceDetail.setActionType(deviceSubscription.getActionTriggeredFrom());
|
|
|
@ -2179,8 +2191,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
|
|
|
deviceDetail.setUnsubscribed(deviceSubscription.isUnsubscribed());
|
|
|
|
deviceDetail.setUnsubscribed(deviceSubscription.isUnsubscribed());
|
|
|
|
deviceDetail.setUnsubscribedBy(deviceSubscription.getUnsubscribedBy());
|
|
|
|
deviceDetail.setUnsubscribedBy(deviceSubscription.getUnsubscribedBy());
|
|
|
|
deviceDetail.setUnsubscribedTimestamp(deviceSubscription.getUnsubscribedTimestamp());
|
|
|
|
deviceDetail.setUnsubscribedTimestamp(deviceSubscription.getUnsubscribedTimestamp());
|
|
|
|
deviceDetail.setType(ownerDetailsWithDevices.getDeviceTypes());
|
|
|
|
deviceDetail.setType(ownerWithDeviceByDeviceId.getDeviceTypes());
|
|
|
|
deviceDetail.setDeviceIdentifier(ownerDetailsWithDevices.getDeviceIdentifiers());
|
|
|
|
deviceDetail.setDeviceIdentifier(ownerWithDeviceByDeviceId.getDeviceIdentifiers());
|
|
|
|
|
|
|
|
|
|
|
|
status = deviceSubscription.getStatus();
|
|
|
|
status = deviceSubscription.getStatus();
|
|
|
|
switch (status) {
|
|
|
|
switch (status) {
|
|
|
@ -2210,16 +2222,16 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
|
|
|
if (subscribedDevice.getDeviceId() == deviceId) {
|
|
|
|
if (subscribedDevice.getDeviceId() == deviceId) {
|
|
|
|
DeviceSubscriptionData subscribedDeviceDetail = new DeviceSubscriptionData();
|
|
|
|
DeviceSubscriptionData subscribedDeviceDetail = new DeviceSubscriptionData();
|
|
|
|
subscribedDeviceDetail.setDeviceId(subscribedDevice.getDeviceId());
|
|
|
|
subscribedDeviceDetail.setDeviceId(subscribedDevice.getDeviceId());
|
|
|
|
subscribedDeviceDetail.setDeviceName(ownerDetailsWithDevices.getDeviceNames());
|
|
|
|
subscribedDeviceDetail.setDeviceName(ownerWithDeviceByDeviceId.getDeviceNames());
|
|
|
|
subscribedDeviceDetail.setDeviceOwner(ownerDetailsWithDevices.getUserName());
|
|
|
|
subscribedDeviceDetail.setDeviceOwner(ownerWithDeviceByDeviceId.getUserName());
|
|
|
|
subscribedDeviceDetail.setDeviceStatus(ownerDetailsWithDevices.getDeviceStatus());
|
|
|
|
subscribedDeviceDetail.setDeviceStatus(ownerWithDeviceByDeviceId.getDeviceStatus());
|
|
|
|
subscribedDeviceDetail.setSubId(subscribedDevice.getId());
|
|
|
|
subscribedDeviceDetail.setSubId(subscribedDevice.getId());
|
|
|
|
subscribedDeviceDetail.setActionTriggeredBy(subscribedDevice.getSubscribedBy());
|
|
|
|
subscribedDeviceDetail.setActionTriggeredBy(subscribedDevice.getSubscribedBy());
|
|
|
|
subscribedDeviceDetail.setActionTriggeredTimestamp(subscribedDevice.getSubscribedTimestamp());
|
|
|
|
subscribedDeviceDetail.setActionTriggeredTimestamp(subscribedDevice.getSubscribedTimestamp());
|
|
|
|
subscribedDeviceDetail.setActionType(subscribedDevice.getActionTriggeredFrom());
|
|
|
|
subscribedDeviceDetail.setActionType(subscribedDevice.getActionTriggeredFrom());
|
|
|
|
subscribedDeviceDetail.setStatus(subscribedDevice.getStatus());
|
|
|
|
subscribedDeviceDetail.setStatus(subscribedDevice.getStatus());
|
|
|
|
subscribedDeviceDetail.setType(ownerDetailsWithDevices.getDeviceTypes());
|
|
|
|
subscribedDeviceDetail.setType(ownerWithDeviceByDeviceId.getDeviceTypes());
|
|
|
|
subscribedDeviceDetail.setDeviceIdentifier(ownerDetailsWithDevices.getDeviceIdentifiers());
|
|
|
|
subscribedDeviceDetail.setDeviceIdentifier(ownerWithDeviceByDeviceId.getDeviceIdentifiers());
|
|
|
|
subscribedDevices.add(subscribedDeviceDetail);
|
|
|
|
subscribedDevices.add(subscribedDeviceDetail);
|
|
|
|
statusCounts.put("SUBSCRIBED", statusCounts.get("SUBSCRIBED") + 1);
|
|
|
|
statusCounts.put("SUBSCRIBED", statusCounts.get("SUBSCRIBED") + 1);
|
|
|
|
isSubscribedDevice = true;
|
|
|
|
isSubscribedDevice = true;
|
|
|
@ -2229,11 +2241,11 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
|
|
|
if (!isSubscribedDevice) {
|
|
|
|
if (!isSubscribedDevice) {
|
|
|
|
DeviceSubscriptionData newDeviceDetail = new DeviceSubscriptionData();
|
|
|
|
DeviceSubscriptionData newDeviceDetail = new DeviceSubscriptionData();
|
|
|
|
newDeviceDetail.setDeviceId(deviceId);
|
|
|
|
newDeviceDetail.setDeviceId(deviceId);
|
|
|
|
newDeviceDetail.setDeviceName(ownerDetailsWithDevices.getDeviceNames());
|
|
|
|
newDeviceDetail.setDeviceName(ownerWithDeviceByDeviceId.getDeviceNames());
|
|
|
|
newDeviceDetail.setDeviceOwner(ownerDetailsWithDevices.getUserName());
|
|
|
|
newDeviceDetail.setDeviceOwner(ownerWithDeviceByDeviceId.getUserName());
|
|
|
|
newDeviceDetail.setDeviceStatus(ownerDetailsWithDevices.getDeviceStatus());
|
|
|
|
newDeviceDetail.setDeviceStatus(ownerWithDeviceByDeviceId.getDeviceStatus());
|
|
|
|
newDeviceDetail.setType(ownerDetailsWithDevices.getDeviceTypes());
|
|
|
|
newDeviceDetail.setType(ownerWithDeviceByDeviceId.getDeviceTypes());
|
|
|
|
newDeviceDetail.setDeviceIdentifier(ownerDetailsWithDevices.getDeviceIdentifiers());
|
|
|
|
newDeviceDetail.setDeviceIdentifier(ownerWithDeviceByDeviceId.getDeviceIdentifiers());
|
|
|
|
newDevices.add(newDeviceDetail);
|
|
|
|
newDevices.add(newDeviceDetail);
|
|
|
|
statusCounts.put("NEW", statusCounts.get("NEW") + 1);
|
|
|
|
statusCounts.put("NEW", statusCounts.get("NEW") + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2266,7 +2278,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return roleSubscriptionsWithDevices;
|
|
|
|
return roleSubscriptionsWithDevices;
|
|
|
|
} catch (ApplicationManagementDAOException e) {
|
|
|
|
} catch (ApplicationManagementDAOException | DeviceManagementDAOException e) {
|
|
|
|
String msg = "Error occurred in retrieving role subscriptions with devices";
|
|
|
|
String msg = "Error occurred in retrieving role subscriptions with devices";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
throw new ApplicationManagementException(msg, e);
|
|
|
|
throw new ApplicationManagementException(msg, e);
|
|
|
|