mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Improve the subscribed category details API
This commit is contained in:
parent
29951a1560
commit
9d1171b620
@ -628,6 +628,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
|||||||
PaginationResult paginationResult = new PaginationResult();
|
PaginationResult paginationResult = new PaginationResult();
|
||||||
try {
|
try {
|
||||||
ConnectionManagerUtil.openDBConnection();
|
ConnectionManagerUtil.openDBConnection();
|
||||||
|
|
||||||
ApplicationDTO applicationDTO = this.applicationDAO
|
ApplicationDTO applicationDTO = this.applicationDAO
|
||||||
.getAppWithRelatedRelease(appUUID, tenantId);
|
.getAppWithRelatedRelease(appUUID, tenantId);
|
||||||
int applicationReleaseId = applicationDTO.getApplicationReleaseDTOs().get(0).getId();
|
int applicationReleaseId = applicationDTO.getApplicationReleaseDTOs().get(0).getId();
|
||||||
@ -667,53 +668,4 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
|||||||
ConnectionManagerUtil.closeDBConnection();
|
ConnectionManagerUtil.closeDBConnection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PaginationResult getAppInstalledCategories(int offsetValue, int limitValue,
|
|
||||||
String appUUID, String subType)
|
|
||||||
throws ApplicationManagementException {
|
|
||||||
|
|
||||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
|
|
||||||
PaginationResult paginationResult = new PaginationResult();
|
|
||||||
try {
|
|
||||||
ConnectionManagerUtil.openDBConnection();
|
|
||||||
|
|
||||||
ApplicationDTO applicationDTO = this.applicationDAO
|
|
||||||
.getAppWithRelatedRelease(appUUID, tenantId);
|
|
||||||
int applicationReleaseId = applicationDTO.getApplicationReleaseDTOs().get(0).getId();
|
|
||||||
|
|
||||||
int count=0;
|
|
||||||
List<String> SubscriptionList = new ArrayList<>();
|
|
||||||
|
|
||||||
if(SubsciptionType.USER.toString().equalsIgnoreCase(subType)){
|
|
||||||
SubscriptionList = subscriptionDAO
|
|
||||||
.getAppSubscribedUsers(offsetValue, limitValue, applicationReleaseId, tenantId);
|
|
||||||
}else if(SubsciptionType.ROLE.toString().equalsIgnoreCase(subType)){
|
|
||||||
SubscriptionList = subscriptionDAO
|
|
||||||
.getAppSubscribedRoles(offsetValue, limitValue, applicationReleaseId, tenantId);
|
|
||||||
}else if(SubsciptionType.GROUP.toString().equalsIgnoreCase(subType)) {
|
|
||||||
SubscriptionList = subscriptionDAO
|
|
||||||
.getAppSubscribedGroups(offsetValue, limitValue, applicationReleaseId, tenantId);
|
|
||||||
}
|
|
||||||
count = SubscriptionList.size();
|
|
||||||
paginationResult.setData(SubscriptionList);
|
|
||||||
paginationResult.setRecordsFiltered(count);
|
|
||||||
paginationResult.setRecordsTotal(count);
|
|
||||||
|
|
||||||
return paginationResult;
|
|
||||||
|
|
||||||
} catch (ApplicationManagementDAOException e) {
|
|
||||||
ConnectionManagerUtil.rollbackDBTransaction();
|
|
||||||
String msg = "Error occurred when get application release data for application" +
|
|
||||||
" release UUID: " + appUUID;
|
|
||||||
throw new ApplicationManagementException(msg, e);
|
|
||||||
} catch (DBConnectionException e) {
|
|
||||||
String msg = "DB Connection error occurred while getting category details that " +
|
|
||||||
"given application id";
|
|
||||||
log.error(msg);
|
|
||||||
throw new ApplicationManagementException(msg, e);
|
|
||||||
} finally {
|
|
||||||
ConnectionManagerUtil.closeDBConnection();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user