diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/Filter.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/Filter.java index 97f9688b6d..272e9ba8a3 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/Filter.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/Filter.java @@ -113,6 +113,11 @@ public class Filter { */ private String favouredBy; + /** + * Checking if retired apps needs to be excluded + */ + private boolean isNotRetired; + public int getLimit() { return limit; } @@ -208,4 +213,12 @@ public class Filter { public void setFavouredBy(String favouredBy) { this.favouredBy = favouredBy; } + + public boolean isNotRetired() { + return isNotRetired; + } + + public void setNotRetired(boolean notRetired) { + isNotRetired = notRetired; + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java index 1e403e5848..09bea80fa5 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java @@ -180,6 +180,9 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic if (deviceTypeId != -1) { sql += "AND AP_APP.DEVICE_TYPE_ID = ? "; } + if (filter.isNotRetired()) { + sql += "AND AP_APP.STATUS != 'RETIRED' "; + } sql += "GROUP BY AP_APP.ID ORDER BY AP_APP.ID "; if (StringUtils.isNotEmpty(filter.getSortBy())) { sql += filter.getSortBy() +" "; @@ -308,6 +311,9 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic if (deviceTypeId != -1) { sql += " AND AP_APP.DEVICE_TYPE_ID = ?"; } + if (filter.isNotRetired()) { + sql += " AND AP_APP.STATUS != 'RETIRED'"; + } try { conn = this.getDBConnection();