diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api/pom.xml index 5a0986f8b7..fe91905214 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt grafana-mgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.common/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.common/pom.xml index 12ba1521c2..5b519b30d4 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.common/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.common/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt grafana-mgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.core/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.core/pom.xml index a952f3a7bc..46f2116b2b 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.core/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt grafana-mgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/pom.xml b/components/analytics-mgt/grafana-mgt/pom.xml index 5807691202..c27ad6278b 100644 --- a/components/analytics-mgt/grafana-mgt/pom.xml +++ b/components/analytics-mgt/grafana-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt analytics-mgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/analytics-mgt/pom.xml b/components/analytics-mgt/pom.xml index bc58bf24c1..82eafa0136 100644 --- a/components/analytics-mgt/pom.xml +++ b/components/analytics-mgt/pom.xml @@ -3,7 +3,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml index 25e610183c..270b13d80e 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml index fd3c2c03b6..b0699d43b8 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml index 8427e524c3..f4ee8cdd9b 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java index 7405737237..2507e4f132 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java @@ -62,11 +62,13 @@ public interface APIManagementProviderService { * @param applicationName Application Name * @param tokenType Token Type * @param validityPeriod Validity Period + * @param username Name of the user to create the token. If null, set as carbon context user * @return {@link String} Access Token * @throws APIManagerException if error occurred while getting the access token for given scopes, * validity period etc. */ - AccessTokenInfo getAccessToken(String scopes, String[] tags, String applicationName, String tokenType, String validityPeriod) + AccessTokenInfo getAccessToken(String scopes, String[] tags, String applicationName, String + tokenType, String validityPeriod, String username) throws APIManagerException; } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java index 7ba23fc4ce..d6fd929e13 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java @@ -233,7 +233,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe @Override public AccessTokenInfo getAccessToken(String scopes, String[] tags, String applicationName, String tokenType, - String validityPeriod) throws APIManagerException { + String validityPeriod, String username) throws APIManagerException { try { String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true); ApiApplicationKey clientCredentials = getClientCredentials(tenantDomain, tags, applicationName, tokenType, @@ -245,15 +245,22 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe throw new APIManagerException(msg); } - String user = - PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername() + "@" + PrivilegedCarbonContext + if (username == null || username.isEmpty()) { + username = + PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername() + "@" + PrivilegedCarbonContext + .getThreadLocalCarbonContext().getTenantDomain(true); + } else { + if (!username.contains("@")) { + username += "@" + PrivilegedCarbonContext .getThreadLocalCarbonContext().getTenantDomain(true); + } + } JWTClientManagerService jwtClientManagerService = APIApplicationManagerExtensionDataHolder.getInstance() .getJwtClientManagerService(); JWTClient jwtClient = jwtClientManagerService.getJWTClient(); AccessTokenInfo accessTokenForAdmin = jwtClient - .getAccessToken(clientCredentials.getConsumerKey(), clientCredentials.getConsumerSecret(), user, + .getAccessToken(clientCredentials.getConsumerKey(), clientCredentials.getConsumerSecret(), username, scopes); return accessTokenForAdmin; diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml index 4d5cbaaf15..9f27c44e1e 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index cda8059d2a..144b854504 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/components/application-mgt/io.entgra.application.mgt.addons/pom.xml b/components/application-mgt/io.entgra.application.mgt.addons/pom.xml index 8b57965f1f..d113cfd633 100644 --- a/components/application-mgt/io.entgra.application.mgt.addons/pom.xml +++ b/components/application-mgt/io.entgra.application.mgt.addons/pom.xml @@ -20,7 +20,7 @@ application-mgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/application-mgt/io.entgra.application.mgt.api/pom.xml b/components/application-mgt/io.entgra.application.mgt.api/pom.xml index 0fe8e6bb60..4fb755bab0 100644 --- a/components/application-mgt/io.entgra.application.mgt.api/pom.xml +++ b/components/application-mgt/io.entgra.application.mgt.api/pom.xml @@ -22,7 +22,7 @@ application-mgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/application-mgt/io.entgra.application.mgt.common/pom.xml b/components/application-mgt/io.entgra.application.mgt.common/pom.xml index b4ef88578f..c18db9cdd1 100644 --- a/components/application-mgt/io.entgra.application.mgt.common/pom.xml +++ b/components/application-mgt/io.entgra.application.mgt.common/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt application-mgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/DeviceSubscriptionData.java b/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/DeviceSubscriptionData.java index 6484080bef..ea1f09e6c5 100644 --- a/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/DeviceSubscriptionData.java +++ b/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/DeviceSubscriptionData.java @@ -23,6 +23,7 @@ import java.sql.Timestamp; public class DeviceSubscriptionData { + private int subId; private String action; private long actionTriggeredTimestamp; private String actionTriggeredBy; @@ -82,4 +83,12 @@ public class DeviceSubscriptionData { public String getCurrentInstalledVersion() { return currentInstalledVersion; } public void setCurrentInstalledVersion(String currentInstalledVersion) { this.currentInstalledVersion = currentInstalledVersion; } + + public int getSubId() { + return subId; + } + + public void setSubId(int subId) { + this.subId = subId; + } } diff --git a/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/Filter.java b/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/Filter.java index 6ce0f2b2d3..16858d7f90 100644 --- a/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/Filter.java +++ b/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/Filter.java @@ -108,6 +108,11 @@ public class Filter { */ private String appReleaseState; + /** + * Username of whose favourite apps to be retrieved + */ + private String favouredBy; + public int getLimit() { return limit; } @@ -195,4 +200,12 @@ public class Filter { public String getAppReleaseType() { return appReleaseType; } public void setAppReleaseType(String appReleaseType) { this.appReleaseType = appReleaseType; } + + public String getFavouredBy() { + return favouredBy; + } + + public void setFavouredBy(String favouredBy) { + this.favouredBy = favouredBy; + } } diff --git a/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/OperationStatusBean.java b/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/OperationStatusBean.java new file mode 100644 index 0000000000..3446d55576 --- /dev/null +++ b/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/OperationStatusBean.java @@ -0,0 +1,32 @@ +package io.entgra.application.mgt.common; + +public class OperationStatusBean { + + private int operationId; + private String status; + private String operationCode; + + public int getOperationId() { + return operationId; + } + + public void setOperationId(int operationId) { + this.operationId = operationId; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getOperationCode() { + return operationCode; + } + + public void setOperationCode(String operationCode) { + this.operationCode = operationCode; + } +} diff --git a/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/dto/ApplicationDTO.java b/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/dto/ApplicationDTO.java index 48bd1c6822..2877c02f94 100644 --- a/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/dto/ApplicationDTO.java +++ b/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/dto/ApplicationDTO.java @@ -96,6 +96,10 @@ public class ApplicationDTO { value = "package name of the application") private String packageName; + @ApiModelProperty(name = "isFavourite", + value = "if the app is favoured by the user") + private boolean isFavourite; + public String getPackageName() { return packageName; } @@ -189,4 +193,12 @@ public class ApplicationDTO { public double getAppRating() { return appRating; } public void setAppRating(double appRating) { this.appRating = appRating; } + + public boolean isFavourite() { + return isFavourite; + } + + public void setFavourite(boolean favourite) { + isFavourite = favourite; + } } diff --git a/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/response/Application.java b/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/response/Application.java index fc5251d3a8..0d11e7bfaa 100644 --- a/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/response/Application.java +++ b/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/response/Application.java @@ -103,6 +103,10 @@ public class Application { value = "package name of the application") private String packageName; + @ApiModelProperty(name = "isFavourite", + value = "if the app is favoured by the user") + private boolean isFavourite; + public String getPackageName() { return packageName; } @@ -181,4 +185,12 @@ public class Application { public String getInstallerName() { return installerName; } public void setInstallerName(String installerName) { this.installerName = installerName; } + + public boolean isFavourite() { + return isFavourite; + } + + public void setFavourite(boolean favourite) { + isFavourite = favourite; + } } diff --git a/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/services/ApplicationManager.java b/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/services/ApplicationManager.java index 018f9af7d9..88fc2a87f2 100644 --- a/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/services/ApplicationManager.java +++ b/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/services/ApplicationManager.java @@ -61,6 +61,27 @@ public interface ApplicationManager { Application createWebClip(WebAppWrapper webAppWrapper, ApplicationArtifact applicationArtifact, boolean isPublished) throws ApplicationManagementException; + /** + * Add an application to favourites + * @param appId id of the application + * @throws ApplicationManagementException Catch all other throwing exceptions and throw {@link ApplicationManagementException} + */ + void addAppToFavourites(int appId) throws ApplicationManagementException; + + /** + * Remove an application from favourites + * @param appId id of the application + * @throws ApplicationManagementException Catch all other throwing exceptions and throw {@link ApplicationManagementException} + */ + void removeAppFromFavourites(int appId) throws ApplicationManagementException; + + /** + * Check if an application is a favourite app + * @param appId id of the application + * @throws ApplicationManagementException Catch all other throwing exceptions and throw {@link ApplicationManagementException} + */ + boolean isFavouriteApp(int appId) throws ApplicationManagementException; + Application createPublicApp(PublicAppWrapper publicAppWrapper, ApplicationArtifact applicationArtifact, boolean isPublished) throws ApplicationManagementException; @@ -113,6 +134,8 @@ public interface ApplicationManager { */ void deleteApplicationRelease(String releaseUuid) throws ApplicationManagementException; + ApplicationList getFavouriteApplications(Filter filter) throws ApplicationManagementException; + /** * To get the applications based on the search filter. * @@ -304,7 +327,9 @@ public interface ApplicationManager { */ boolean checkSubDeviceIdsForOperations(int operationId, int deviceId) throws ApplicationManagementException; - void updateSubsStatus (int deviceId, int operationId, String status) throws ApplicationManagementException; + void updateSubStatus(int deviceId, List operationId, String status) throws ApplicationManagementException; + + void updateSubsStatus(int deviceId, int operationId, String status) throws ApplicationManagementException; /** diff --git a/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/services/SubscriptionManager.java b/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/services/SubscriptionManager.java index d77ee1401f..7b4f99e355 100644 --- a/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/services/SubscriptionManager.java +++ b/components/application-mgt/io.entgra.application.mgt.common/src/main/java/io/entgra/application/mgt/common/services/SubscriptionManager.java @@ -34,6 +34,16 @@ import java.util.Properties; */ public interface SubscriptionManager { + /** + * Use to update status of a subscription + * + * @param deviceId Id of the device + * @param subId subscription id + * @param status status to be changed + */ + void updateSubscriptionStatus(int deviceId, int subId, String status) + throws SubscriptionManagementException; + /** * Performs bulk subscription operation for a given application and a subscriber list. * @param applicationUUID UUID of the application to subscribe/unsubscribe diff --git a/components/application-mgt/io.entgra.application.mgt.core/pom.xml b/components/application-mgt/io.entgra.application.mgt.core/pom.xml index 1b9644dade..398c41cafc 100644 --- a/components/application-mgt/io.entgra.application.mgt.core/pom.xml +++ b/components/application-mgt/io.entgra.application.mgt.core/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt application-mgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/ApplicationDAO.java b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/ApplicationDAO.java index 6ffa843e5a..c64eba8814 100644 --- a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/ApplicationDAO.java +++ b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/ApplicationDAO.java @@ -39,6 +39,33 @@ public interface ApplicationDAO { */ int createApplication(ApplicationDTO applicationDTO, int tenantId) throws ApplicationManagementDAOException; + /** + * Use to add an application to favourites for given appId, username and tenantId + * + * @param appId id of the application + * @param userName currently logged-in user + * @throws ApplicationManagementDAOException if error occurred wile executing query to insert data into database. + */ + void addAppToFavourite(int appId, String userName, int tenantId) throws ApplicationManagementDAOException; + + /** + * Use to remove an application from favourites for given appId, username and tenantId + * + * @param appId id of the application + * @param userName currently logged-in username + * @throws ApplicationManagementDAOException if error occurred wile executing query to delete data from database. + */ + void removeAppFromFavourite(int appId, String userName, int tenantId) throws ApplicationManagementDAOException; + + /** + * Use to check if an app is favourite for given username and tenantId + * @param appId id of the application + * @param userName currently logged-in username + * @return If application is favourite + * @throws ApplicationManagementDAOException if error occurred wile executing query to check if application is a favourite + */ + boolean isFavouriteApp(int appId, String userName, int tenantId) throws ApplicationManagementDAOException; + /** * To add tags for a particular application. * diff --git a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/SubscriptionDAO.java b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/SubscriptionDAO.java index 9913d8e19c..c8747547d2 100644 --- a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/SubscriptionDAO.java +++ b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/SubscriptionDAO.java @@ -101,6 +101,10 @@ public interface SubscriptionDAO { List getDeviceSubIds(List deviceIds, int applicationReleaseId, int tenantId) throws ApplicationManagementDAOException; + int getDeviceIdForSubId(int subId, int tenantId) throws ApplicationManagementDAOException; + + List getOperationIdsForSubId(int subId, int tenantId) throws ApplicationManagementDAOException; + List getDeviceSubIdsForOperation(int operationId, int deviceID, int tenantId) throws ApplicationManagementDAOException; diff --git a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java index 9fa9743590..679f2ed713 100644 --- a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java @@ -24,7 +24,6 @@ import io.entgra.application.mgt.common.AppLifecycleState; import io.entgra.application.mgt.common.dto.ApplicationDTO; import io.entgra.application.mgt.common.dto.CategoryDTO; import io.entgra.application.mgt.common.Filter; -import io.entgra.application.mgt.common.dto.ReviewDTO; import io.entgra.application.mgt.common.dto.TagDTO; import io.entgra.application.mgt.common.exception.DBConnectionException; import io.entgra.application.mgt.core.dao.ApplicationDAO; @@ -136,10 +135,14 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic + "AP_APP_RELEASE.CURRENT_STATE AS RELEASE_CURRENT_STATE, " + "AP_APP_RELEASE.RATED_USERS AS RATED_USER_COUNT, " + "NEW_AP_APP_LIFECYCLE_STATE.UPDATED_AT AS LATEST_UPDATE " - + "FROM AP_APP " - + "INNER JOIN AP_APP_RELEASE ON " - + "AP_APP.ID = AP_APP_RELEASE.AP_APP_ID " - + "INNER JOIN (SELECT AP_APP.ID FROM AP_APP "; + + "FROM AP_APP "; + if (StringUtils.isNotEmpty(filter.getFavouredBy())) { + sql += "INNER JOIN AP_APP_FAVOURITES ON " + + "AP_APP.ID = AP_APP_FAVOURITES.AP_APP_ID "; + } + sql += "INNER JOIN AP_APP_RELEASE ON " + + "AP_APP.ID = AP_APP_RELEASE.AP_APP_ID " + + "INNER JOIN (SELECT AP_APP.ID FROM AP_APP "; if (StringUtils.isNotEmpty(filter.getVersion()) || StringUtils.isNotEmpty(filter.getAppReleaseState()) || StringUtils.isNotEmpty(filter.getAppReleaseType())) { sql += "INNER JOIN AP_APP_RELEASE ON AP_APP.ID = AP_APP_RELEASE.AP_APP_ID "; @@ -190,8 +193,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic + "FROM AP_APP_LIFECYCLE_STATE " + "GROUP BY AP_APP_LIFECYCLE_STATE.AP_APP_RELEASE_ID)) AS NEW_AP_APP_LIFECYCLE_STATE " + "ON AP_APP_RELEASE.ID = NEW_AP_APP_LIFECYCLE_STATE.AP_APP_RELEASE_ID " - + "WHERE AP_APP.TENANT_ID = ? " - + "ORDER BY AP_APP.ID, LATEST_UPDATE DESC"; + + "WHERE AP_APP.TENANT_ID = ? "; + if (StringUtils.isNotEmpty(filter.getFavouredBy())) { + sql += "AND AP_APP_FAVOURITES.USER_NAME = ? "; + } + sql += "ORDER BY AP_APP.ID, LATEST_UPDATE DESC"; try { Connection conn = this.getDBConnection(); @@ -230,7 +236,10 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic stmt.setInt(paramIndex++, filter.getLimit()); stmt.setInt(paramIndex++, filter.getOffset()); } - stmt.setInt(paramIndex, tenantId); + stmt.setInt(paramIndex++, tenantId); + if (StringUtils.isNotEmpty(filter.getFavouredBy())) { + stmt.setString(paramIndex, filter.getFavouredBy()); + } try (ResultSet rs = stmt.executeQuery()) { return DAOUtil.loadApplications(rs); } @@ -732,6 +741,95 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic } } + @Override + public void addAppToFavourite(int appId, String userName, int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to add app with the id " + appId + " favourites"); + } + String sql = "INSERT INTO AP_APP_FAVOURITES " + + "(AP_APP_ID, USER_NAME, " + + " TENANT_ID) " + + "VALUES (?, ?, ?)"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, appId); + stmt.setString(2, userName); + stmt.setInt(3, tenantId); + stmt.addBatch(); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when adding app to favourites"; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while adding app with the id " + appId + " to favourites. Executed Query: " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + @Override + public void removeAppFromFavourite(int appId, String userName, int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to add app with the id " + appId + " favourites"); + } + String sql = "DELETE FROM AP_APP_FAVOURITES " + + "WHERE AP_APP_ID = ? " + + "AND USER_NAME = ? " + + "AND TENANT_ID = ?"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, appId); + stmt.setString(2, userName); + stmt.setInt(3, tenantId); + stmt.addBatch(); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing app from favourites"; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing app with the id " + appId + " from favourites. Executed Query: " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + @Override + public boolean isFavouriteApp(int appId, String userName, int tenantId) throws ApplicationManagementDAOException { + String sql = "SELECT AP_APP_ID " + + "FROM AP_APP_FAVOURITES " + + "WHERE " + + "AP_APP_ID = ? AND " + + "USER_NAME = ? AND " + + "TENANT_ID = ?"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)){ + stmt.setInt(1, appId); + stmt.setString(2, userName); + stmt.setInt(3, tenantId); + try (ResultSet rs = stmt.executeQuery()){ + return rs.next(); + } + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection to check whether the application with the id " + + appId + " is a favourite app"; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while checking whether the application with the id " + + appId + " is a favourite app. executed query " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + @Override public void addTags(List tags, int tenantId) throws ApplicationManagementDAOException { if (log.isDebugEnabled()) { diff --git a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/OracleApplicationDAOImpl.java b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/OracleApplicationDAOImpl.java index 60e49f2a27..da3d5e8aae 100644 --- a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/OracleApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/OracleApplicationDAOImpl.java @@ -82,10 +82,14 @@ public class OracleApplicationDAOImpl extends GenericApplicationDAOImpl { + "AP_APP_RELEASE.CURRENT_STATE AS RELEASE_CURRENT_STATE, " + "AP_APP_RELEASE.RATED_USERS AS RATED_USER_COUNT, " + "NEW_AP_APP_LIFECYCLE_STATE.UPDATED_AT AS LATEST_UPDATE " - + "FROM AP_APP " - + "INNER JOIN AP_APP_RELEASE ON " - + "AP_APP.ID = AP_APP_RELEASE.AP_APP_ID " - + "INNER JOIN (SELECT AP_APP.ID FROM AP_APP ORDER BY ID "; + + "FROM AP_APP "; + if (StringUtils.isNotEmpty(filter.getFavouredBy())) { + sql += "INNER JOIN AP_APP_FAVOURITES ON " + + "AP_APP.ID = AP_APP_FAVOURITES.AP_APP_ID "; + } + sql += "INNER JOIN AP_APP_RELEASE ON " + + "AP_APP.ID = AP_APP_RELEASE.AP_APP_ID " + + "INNER JOIN (SELECT AP_APP.ID FROM AP_APP ORDER BY ID "; if (StringUtils.isNotEmpty(filter.getVersion()) || StringUtils.isNotEmpty(filter.getAppReleaseState()) || StringUtils.isNotEmpty(filter.getAppReleaseType())) { sql += "INNER JOIN AP_APP_RELEASE ON AP_APP.ID = AP_APP_RELEASE.AP_APP_ID "; diff --git a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java index 7420b9a057..1319c458e4 100644 --- a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java @@ -81,8 +81,12 @@ public class SQLServerApplicationDAOImpl extends GenericApplicationDAOImpl { + "AP_APP_RELEASE.CURRENT_STATE AS RELEASE_CURRENT_STATE, " + "AP_APP_RELEASE.RATED_USERS AS RATED_USER_COUNT, " + "NEW_AP_APP_LIFECYCLE_STATE.UPDATED_AT AS LATEST_UPDATE " - + "FROM AP_APP " - + "INNER JOIN AP_APP_RELEASE ON " + + "FROM AP_APP "; + if (StringUtils.isNotEmpty(filter.getFavouredBy())) { + sql += "INNER JOIN AP_APP_FAVOURITES ON " + + "AP_APP.ID = AP_APP_FAVOURITES.AP_APP_ID "; + } + sql += "INNER JOIN AP_APP_RELEASE ON " + "AP_APP.ID = AP_APP_RELEASE.AP_APP_ID " + "INNER JOIN (SELECT AP_APP.ID FROM AP_APP "; if (StringUtils.isNotEmpty(filter.getVersion()) || StringUtils.isNotEmpty(filter.getAppReleaseState()) diff --git a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java index 74b7741c18..c814392ae0 100644 --- a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java @@ -691,6 +691,68 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc } } + @Override + public int getDeviceIdForSubId(int subId, int tenantId) throws ApplicationManagementDAOException { + try { + Connection conn = this.getDBConnection(); + String sql = "SELECT DM_DEVICE_ID " + + "FROM AP_DEVICE_SUBSCRIPTION " + + "WHERE ID = ? AND " + + "TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, subId); + stmt.setInt(2, tenantId); + try (ResultSet rs = stmt.executeQuery()) { + if (rs.next()) { + return rs.getInt("DM_DEVICE_ID"); + } + } + return -1; + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection to get app operation ids for given " + + "subscription id."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred when processing SQL to get operation ids for given subscription id."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + @Override + public List getOperationIdsForSubId(int subId, int tenantId) throws ApplicationManagementDAOException { + try { + Connection conn = this.getDBConnection(); + List operationIds = new ArrayList<>(); + String sql = "SELECT OPERATION_ID " + + "FROM AP_APP_SUB_OP_MAPPING " + + "WHERE AP_DEVICE_SUBSCRIPTION_ID = ? AND " + + "TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, subId); + stmt.setInt(2, tenantId); + try (ResultSet rs = stmt.executeQuery()) { + while (rs.next()) { + operationIds.add(rs.getInt("OPERATION_ID")); + } + } + return operationIds; + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection to get app operation ids for given " + + "subscription id."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred when processing SQL to get operation ids for given subscription id."; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + @Override public List getDeviceSubIdsForOperation(int operationId, int deviceId, int tenantId) throws ApplicationManagementDAOException { @@ -1204,7 +1266,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc Connection conn = this.getDBConnection(); List subscribedGroups = new ArrayList<>(); String sql = "SELECT " - + "GS.GROUP_NAME AS GROUPS " + + "GS.GROUP_NAME AS APP_GROUPS " + "FROM AP_GROUP_SUBSCRIPTION GS " + "WHERE " + "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? LIMIT ? OFFSET ?"; @@ -1215,7 +1277,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc ps.setInt(4, offsetValue); try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { - subscribedGroups.add(rs.getString("GROUPS")); + subscribedGroups.add(rs.getString("APP_GROUPS")); } } return subscribedGroups; @@ -1244,7 +1306,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc try { Connection conn = this.getDBConnection(); String sql = "SELECT " - + "COUNT(GS.GROUP_NAME) AS GROUPS " + + "COUNT(GS.GROUP_NAME) AS APP_GROUPS_COUNT " + "FROM AP_GROUP_SUBSCRIPTION GS " + "WHERE " + "AP_APP_RELEASE_ID = ? AND TENANT_ID = ?"; @@ -1254,7 +1316,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { - return rs.getInt("GROUPS"); + return rs.getInt("APP_GROUPS_COUNT"); } } return 0; diff --git a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/ApplicationManagerImpl.java index 599576f7b3..5b1fb55588 100644 --- a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/ApplicationManagerImpl.java @@ -178,6 +178,116 @@ ApplicationManagerImpl implements ApplicationManager { return addAppDataIntoDB(applicationDTO, tenantId, isPublished); } + @Override + public void addAppToFavourites(int appId) throws ApplicationManagementException { + validateAddAppToFavouritesRequest(appId); + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); + String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); + try { + ConnectionManagerUtil.beginDBTransaction(); + applicationDAO.addAppToFavourite(appId, userName, tenantId); + ConnectionManagerUtil.commitDBTransaction(); + } catch (TransactionManagementException e) { + String msg = "Error occurred while staring transaction to add applicationId: " + + appId + " to favourites"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (DBConnectionException e) { + String msg = "Error occurred while adding application id " + appId + " to favourites "; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (ApplicationManagementDAOException e) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Error occurred while adding application with the id: " + appId + " to favourites "; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } + } + + @Override + public void removeAppFromFavourites(int appId) throws ApplicationManagementException { + validateRemoveAppFromFavouritesRequest(appId); + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); + String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); + try { + ConnectionManagerUtil.beginDBTransaction(); + applicationDAO.removeAppFromFavourite(appId, userName, tenantId); + ConnectionManagerUtil.commitDBTransaction(); + } catch (TransactionManagementException e) { + String msg = "Error occurred while staring transaction to remove applicationId: " + + appId + " from favourites"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (DBConnectionException e) { + String msg = "Error occurred while removing application id " + appId + " from favourites "; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (ApplicationManagementDAOException e) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Error occurred while removing application with the id: " + appId + " from favourites "; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } + } + + @Override + public boolean isFavouriteApp(int appId) throws ApplicationManagementException{ + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); + String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); + try { + ConnectionManagerUtil.openDBConnection(); + return applicationDAO.isFavouriteApp(appId, userName, tenantId); + } catch (DBConnectionException e) { + String msg = "Error occurred while getting DB connection to check is app with the id " + appId + + " is a favourite app"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (ApplicationManagementDAOException e) { + String msg = "Error occurred while checking app with the id " + appId + " is a favourite app."; + log.error(msg); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } + + } + + /** + * Use to check if the requested application id is valid before removing from favourites + * + * @param appId ID of the application + * @throws ApplicationManagementException if ID is not valid or errors while validating + */ + private void validateRemoveAppFromFavouritesRequest(int appId) throws ApplicationManagementException { + if (!isFavouriteApp(appId)) { + String msg = "Provided appId " + appId + " is not a favourite app in order remove from favourites"; + throw new BadRequestException(msg); + } + } + + /** + * Use to check if the requested application id is valid before adding to favourites + * + * @param appId ID of the application + * @throws ApplicationManagementException if ID is not valid or errors while validating + */ + private void validateAddAppToFavouritesRequest(int appId) throws ApplicationManagementException { + try { + getApplication(appId); + } catch (NotFoundException e) { + String msg = " No application exists for the provided appId " + appId; + throw new BadRequestException(msg); + } + if (isFavouriteApp(appId)) { + String msg = "Provided appId " + appId + " is already a favourite app"; + throw new BadRequestException(msg); + } + } + @Override public Application createPublicApp(PublicAppWrapper publicAppWrapper, ApplicationArtifact applicationArtifact, boolean isPublished) throws ApplicationManagementException { @@ -608,9 +718,17 @@ ApplicationManagerImpl implements ApplicationManager { return applicationReleaseDTO; } + @Override + public ApplicationList getFavouriteApplications(Filter filter) throws ApplicationManagementException { + String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); + filter.setFavouredBy(userName); + return getApplications(filter); + } + @Override public ApplicationList getApplications(Filter filter) throws ApplicationManagementException { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); ApplicationList applicationList = new ApplicationList(); List applications = new ArrayList<>(); DeviceType deviceType; @@ -636,6 +754,7 @@ ApplicationManagerImpl implements ApplicationManager { .setUnrestrictedRoles(visibilityDAO.getUnrestrictedRoles(applicationDTO.getId(), tenantId)); applicationDTO.setAppCategories(applicationDAO.getAppCategories(applicationDTO.getId(), tenantId)); applicationDTO.setTags(applicationDAO.getAppTags(applicationDTO.getId(), tenantId)); + applicationDTO.setFavourite(applicationDAO.isFavouriteApp(applicationDTO.getId(), userName, tenantId)); if (isFilteringApp(applicationDTO, filter)) { boolean isHideableApp = isHideableApp(applicationDTO.getApplicationReleaseDTOs()); @@ -3549,7 +3668,40 @@ ApplicationManagerImpl implements ApplicationManager { } @Override - public void updateSubsStatus (int deviceId, int operationId, String status) throws ApplicationManagementException { + public void updateSubStatus(int deviceId, List operationIds, String status) throws ApplicationManagementException { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + try { + ConnectionManagerUtil.beginDBTransaction(); + for (int operationId : operationIds) { + List deviceSubIds = subscriptionDAO.getDeviceSubIdsForOperation(operationId, deviceId, tenantId); + if (!subscriptionDAO.updateDeviceSubStatus(deviceId, deviceSubIds, status, tenantId)){ + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Didn't update an any app subscription of device for operation Id: " + operationId; + log.error(msg); + throw new ApplicationManagementException(msg); + } + } + ConnectionManagerUtil.commitDBTransaction(); + } catch (ApplicationManagementDAOException e) { + String msg = "Error occured while updating app subscription status of the device."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (DBConnectionException e) { + String msg = "Error occurred while obersving the database connection to update aoo subscription status of " + + "device."; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (TransactionManagementException e) { + String msg = "Error occurred while executing database transaction"; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } + } + + @Override + public void updateSubsStatus(int deviceId, int operationId, String status) throws ApplicationManagementException { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); try { ConnectionManagerUtil.beginDBTransaction(); diff --git a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/SubscriptionManagerImpl.java index 8f87f9b3f9..b6bec32655 100644 --- a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -20,6 +20,7 @@ package io.entgra.application.mgt.core.impl; import com.google.gson.Gson; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpMethodBase; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.StringRequestEntity; import org.apache.commons.lang.StringUtils; @@ -1189,18 +1190,62 @@ public class SubscriptionManagerImpl implements SubscriptionManager { } } + @Override + public void updateSubscriptionStatus(int deviceId, int subId, String status) + throws SubscriptionManagementException { + try { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); + List operationIds = getOperationIdsForSubId(subId, tenantId); + APIUtil.getApplicationManager().updateSubStatus(deviceId, operationIds, status); + } catch (DBConnectionException e) { + String msg = "Error occurred while observing the database connection to get operation Ids for " + subId; + log.error(msg, e); + throw new SubscriptionManagementException(msg, e); + } catch (ApplicationManagementException e) { + String msg = "Error occurred while updating subscription status with the id: " + + subId; + log.error(msg, e); + throw new SubscriptionManagementException(msg, e); + } + } + + private List getOperationIdsForSubId(int subId, int tenantId) throws SubscriptionManagementException { + try { + ConnectionManagerUtil.openDBConnection(); + return subscriptionDAO.getOperationIdsForSubId(subId, tenantId); + } catch (ApplicationManagementDAOException e) { + String msg = "Error occurred while getting operation Ids for subId" + subId; + log.error(msg, e); + throw new SubscriptionManagementException(msg, e); + } catch (DBConnectionException e) { + String msg = "Error occurred while observing the database connection to get operation Ids for " + subId; + log.error(msg, e); + throw new SubscriptionManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } + } + + private int invokeIOTCoreAPI(HttpMethodBase request) throws UserStoreException, APIManagerException, IOException { + HttpClient httpClient; + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); + ApiApplicationKey apiApplicationKey = OAuthUtils.getClientCredentials(tenantDomain); + String username = + PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration() + .getAdminUserName() + Constants.ApplicationInstall.AT + tenantDomain; + AccessTokenInfo tokenInfo = OAuthUtils.getOAuthCredentials(apiApplicationKey, username); + request.addRequestHeader(Constants.ApplicationInstall.AUTHORIZATION, + Constants.ApplicationInstall.AUTHORIZATION_HEADER_VALUE + tokenInfo.getAccessToken()); + httpClient = new HttpClient(); + httpClient.executeMethod(request); + return request.getStatusCode(); + } + public int installEnrollmentApplications(ApplicationPolicyDTO applicationPolicyDTO) throws ApplicationManagementException { - HttpClient httpClient; PostMethod request; try { - String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); - ApiApplicationKey apiApplicationKey = OAuthUtils.getClientCredentials(tenantDomain); - String username = - PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration() - .getAdminUserName() + Constants.ApplicationInstall.AT + tenantDomain; - AccessTokenInfo tokenInfo = OAuthUtils.getOAuthCredentials(apiApplicationKey, username); String requestUrl = Constants.ApplicationInstall.ENROLLMENT_APP_INSTALL_PROTOCOL + System .getProperty(Constants.ApplicationInstall.IOT_CORE_HOST) + Constants.ApplicationInstall.COLON + System.getProperty(Constants.ApplicationInstall.IOT_CORE_PORT) @@ -1210,14 +1255,9 @@ public class SubscriptionManagerImpl implements SubscriptionManager { StringRequestEntity requestEntity = new StringRequestEntity(payload, MediaType.APPLICATION_JSON, Constants.ApplicationInstall.ENCODING); - httpClient = new HttpClient(); request = new PostMethod(requestUrl); - request.addRequestHeader(Constants.ApplicationInstall.AUTHORIZATION, - Constants.ApplicationInstall.AUTHORIZATION_HEADER_VALUE + tokenInfo.getAccessToken()); request.setRequestEntity(requestEntity); - httpClient.executeMethod(request); - return request.getStatusCode(); - + return invokeIOTCoreAPI(request); } catch (UserStoreException e) { String msg = "Error while accessing user store for user with Android device."; log.error(msg, e); @@ -1240,6 +1280,13 @@ public class SubscriptionManagerImpl implements SubscriptionManager { } } + private String getIOTCoreBaseUrl() { + return Constants.HTTPS_PROTOCOL + Constants.SCHEME_SEPARATOR + System + .getProperty(Constants.IOT_CORE_HOST) + Constants.COLON + + System.getProperty(Constants.IOT_CORE_HTTPS_PORT); + } + + @Override public PaginationResult getAppInstalledDevices(PaginationRequest request, String appUUID) throws ApplicationManagementException { @@ -1430,6 +1477,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager { } deviceSubscriptionData.setActionType(subscription.getActionTriggeredFrom()); deviceSubscriptionData.setStatus(subscription.getStatus()); + deviceSubscriptionData.setSubId(subscription.getId()); deviceSubscriptionDataList.add(deviceSubscriptionData); break; } diff --git a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/util/APIUtil.java b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/util/APIUtil.java index 0afcc85ab5..45f1320176 100644 --- a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/util/APIUtil.java +++ b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/util/APIUtil.java @@ -362,6 +362,7 @@ public class APIUtil { application.setTags(applicationDTO.getTags()); application.setUnrestrictedRoles(applicationDTO.getUnrestrictedRoles()); application.setRating(applicationDTO.getAppRating()); + application.setFavourite(applicationDTO.isFavourite()); application.setInstallerName(applicationDTO.getApplicationReleaseDTOs().get(0).getInstallerName()); List applicationReleases = new ArrayList<>(); if (ApplicationType.PUBLIC.toString().equals(applicationDTO.getType()) && application.getCategories() diff --git a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/util/Constants.java b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/util/Constants.java index 3302ddd25d..299db3ea44 100644 --- a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/util/Constants.java +++ b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/util/Constants.java @@ -44,7 +44,11 @@ public class Constants { public static final String IOT_CORE_HTTPS_PORT = "iot.core.https.port"; public static final String HTTPS_PROTOCOL = "https"; public static final String HTTP_PROTOCOL = "http"; + public static final String SCHEME_SEPARATOR = "://"; + public static final String OPERATION_STATUS_UPDATE_API_BASE = "/api/device-mgt/v1.0/devices"; + public static final String OPERATION_STATUS_UPDATE_API_URI = "/operation"; + public static final String COLON = ":"; public static final String FORWARD_SLASH = "/"; public static final String ANY = "ANY"; public static final String DEFAULT_PCK_NAME = "default.app.com"; diff --git a/components/application-mgt/io.entgra.application.mgt.publisher.api/pom.xml b/components/application-mgt/io.entgra.application.mgt.publisher.api/pom.xml index 72b86a50c9..e1d4400d79 100644 --- a/components/application-mgt/io.entgra.application.mgt.publisher.api/pom.xml +++ b/components/application-mgt/io.entgra.application.mgt.publisher.api/pom.xml @@ -22,7 +22,7 @@ application-mgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/application-mgt/io.entgra.application.mgt.store.api/pom.xml b/components/application-mgt/io.entgra.application.mgt.store.api/pom.xml index 9605babf87..4adb35bdf3 100644 --- a/components/application-mgt/io.entgra.application.mgt.store.api/pom.xml +++ b/components/application-mgt/io.entgra.application.mgt.store.api/pom.xml @@ -22,7 +22,7 @@ application-mgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/beans/SubscriptionStatusBean.java b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/beans/SubscriptionStatusBean.java new file mode 100644 index 0000000000..99d71f3d5f --- /dev/null +++ b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/beans/SubscriptionStatusBean.java @@ -0,0 +1,43 @@ +package io.entgra.application.mgt.store.api.beans; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * This is used to map the status of subscription. + */ +@ApiModel( + value = "SubscriptionStatusBean", + description = "This class carries all information related map statuses of the subscription." +) +public class SubscriptionStatusBean { + @ApiModelProperty( + name = "sub id", + value = "Subscription Id.", + required = true + ) + private int subId; + + @ApiModelProperty( + name = "status", + value = "Status of the subscription.", + required = true + ) + private String status; + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public int getSubId() { + return subId; + } + + public void setSubId(int subId) { + this.subId = subId; + } +} diff --git a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/ApplicationManagementAPI.java b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/ApplicationManagementAPI.java index eb11be7a40..4eeab57384 100644 --- a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/ApplicationManagementAPI.java +++ b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/ApplicationManagementAPI.java @@ -35,8 +35,10 @@ import io.entgra.application.mgt.common.ApplicationList; import javax.validation.Valid; import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; +import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @@ -70,6 +72,13 @@ import javax.ws.rs.core.Response; key = "perm:app:store:view", roles = {"Internal/devicemgt-user"}, permissions = {"/app-mgt/store/application/view"} + ), + @Scope( + name = "Modify Application", + description = "Modify application state", + key = "perm:app:store:modify", + roles = {"Internal/devicemgt-user"}, + permissions = {"/app-mgt/store/application/modify"} ) } ) @@ -81,6 +90,120 @@ public interface ApplicationManagementAPI { String SCOPE = "scope"; + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Path("/favourite/{appId}") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + produces = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "add application to favourites", + notes = "This will add application to favourites", + tags = "Application Management", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = SCOPE, value = "perm:app:store:modify") + }) + } + ) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully added application to favourites.", + response = ApplicationList.class), + @ApiResponse( + code = 400, + message = "Bad Request. \n " + + "Payload contains unacceptable or vulnerable data"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Error occurred while adding the application to favourites.", + response = ErrorResponse.class) + }) + Response addAppToFavourite( + @ApiParam( + name = "appId", + value = "id of the application", + required = true) + @PathParam("appId") int appId); + + @DELETE + @Consumes(MediaType.APPLICATION_JSON) + @Path("/favourite/{appId}") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + produces = MediaType.APPLICATION_JSON, + httpMethod = "DELETE", + value = "remove application from favourites", + notes = "This will removing an application from favourites", + tags = "Application Management", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = SCOPE, value = "perm:app:store:modify") + }) + } + ) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully removed application from favourites.", + response = ApplicationList.class), + @ApiResponse( + code = 400, + message = "Bad Request. \n " + + "Payload contains unacceptable or vulnerable data"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Error occurred while removing the application from favourites.", + response = ErrorResponse.class) + }) + Response removeAppFromFavourite( + @ApiParam( + name = "appId", + value = "id of the application", + required = true) + @PathParam("appId") int appId); + + @POST + @Path("/favourite") + @Consumes(MediaType.APPLICATION_JSON) + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + produces = MediaType.APPLICATION_JSON, + httpMethod = "GET", + value = "get all favourite applications", + notes = "This will get all favourite applications", + tags = "Application Management", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = SCOPE, value = "perm:app:store:view") + }) + } + ) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully got application list.", + response = ApplicationList.class), + @ApiResponse( + code = 400, + message = "Bad Request. \n " + + "Application retrieving request payload contains unacceptable or vulnerable data"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Error occurred while getting the application list.", + response = ErrorResponse.class) + }) + Response getFavouriteApplications( + @ApiParam( + name = "filter", + value = "Application filtering data", + required = true) + @Valid Filter filter); + @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) diff --git a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/admin/SubscriptionManagementAdminAPI.java b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/admin/SubscriptionManagementAdminAPI.java index f9e5079095..8660975088 100644 --- a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/admin/SubscriptionManagementAdminAPI.java +++ b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/admin/SubscriptionManagementAdminAPI.java @@ -17,6 +17,7 @@ */ package io.entgra.application.mgt.store.api.services.admin; +import io.entgra.application.mgt.store.api.beans.SubscriptionStatusBean; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -34,6 +35,7 @@ import io.entgra.application.mgt.common.ErrorResponse; import javax.validation.constraints.Size; import javax.ws.rs.Consumes; import javax.ws.rs.GET; +import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @@ -69,6 +71,13 @@ import java.util.List; key = "perm:admin:app:subscription:view", roles = {"Internal/devicemgt-admin"}, permissions = {"/app-mgt/store/admin/subscription/view"} + ), + @Scope( + name = "View Application Subscriptions", + description = "View Application Subscriptions.", + key = "perm:admin:app:subscription:modify", + roles = {"Internal/devicemgt-admin"}, + permissions = {"/app-mgt/store/admin/subscription/modify"} ) } ) @@ -79,6 +88,51 @@ public interface SubscriptionManagementAdminAPI { String SCOPE = "scope"; + @PUT + @Consumes(MediaType.APPLICATION_JSON) + @Path("/device/{deviceId}/status") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + produces = MediaType.APPLICATION_JSON, + httpMethod = "PUT", + value = "Update subscription status", + notes = "This will update the subscription status that belongs to the given device id", + tags = "Subscription Management", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = SCOPE, value = "perm:admin:app:subscription:modify") + }) + } + ) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully updated subscription status.", + response = List.class, + responseContainer = "List"), + @ApiResponse( + code = 404, + message = "Not Found. \n No Application found which has application release of UUID.", + response = ErrorResponse.class), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Error occurred while updating subscription status", + response = ErrorResponse.class) + }) + Response updateSubscription( + @ApiParam( + name = "deviceId", + value = "Id of the device", + required = true) + @PathParam("deviceId") int deviceId, + @ApiParam( + name = "subscription status change bean", + value = "this bean contains the information related to status change", + required = true) + SubscriptionStatusBean subscriptionStatusBean + ); + @GET @Path("/{uuid}") @Produces(MediaType.APPLICATION_JSON) diff --git a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/ApplicationManagementAPIImpl.java b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/ApplicationManagementAPIImpl.java index 735df25c92..5f1f124d63 100644 --- a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/ApplicationManagementAPIImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/ApplicationManagementAPIImpl.java @@ -28,14 +28,15 @@ import io.entgra.application.mgt.core.exception.NotFoundException; import io.entgra.application.mgt.core.exception.UnexpectedServerErrorException; import io.entgra.application.mgt.core.util.APIUtil; import io.entgra.application.mgt.store.api.services.ApplicationManagementAPI; - import javax.validation.Valid; import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; /** @@ -47,30 +48,88 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI { private static final Log log = LogFactory.getLog(ApplicationManagementAPIImpl.class); + @POST + @Path("/favourite/{appId}") + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Response addAppToFavourite(@PathParam("appId") int appId) { + ApplicationManager applicationManager = APIUtil.getApplicationManager(); + try { + applicationManager.addAppToFavourites(appId); + return Response.status(Response.Status.OK).build(); + } catch (BadRequestException e) { + String msg = "Invalid payload found in the request. Hence verify the request payload."; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + } catch (ApplicationManagementException e) { + String msg = "Error occurred while adding application to favourites"; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } + } + + @DELETE + @Path("/favourite/{appId}") + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Response removeAppFromFavourite(@PathParam("appId") int appId) { + ApplicationManager applicationManager = APIUtil.getApplicationManager(); + try { + applicationManager.removeAppFromFavourites(appId); + return Response.status(Response.Status.OK).build(); + } catch (BadRequestException e) { + String msg = "Invalid payload found in the request. Hence verify the request payload."; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + } catch (ApplicationManagementException e) { + String msg = "Error occurred while removing application from favourites"; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } + } + + @POST + @Path("/favourite") + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Response getFavouriteApplications(@Valid Filter filter) { + ApplicationManager applicationManager = APIUtil.getApplicationManager(); + try { + validateFilter(filter); + ApplicationList applications = applicationManager.getFavouriteApplications(filter); + return Response.status(Response.Status.OK).entity(applications).build(); + } catch (BadRequestException e) { + String msg = "Invalid filter payload found in the request. Hence verify the filter payload."; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + } catch (ApplicationManagementException e) { + String msg = "Error occurred while retrieving favourite applications"; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } + } + @POST @Override @Consumes("application/json") public Response getApplications(@Valid Filter filter) { ApplicationManager applicationManager = APIUtil.getApplicationManager(); try { - if (filter == null) { - String msg = "Request Payload is null"; - log.error(msg); - return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); - } + validateFilter(filter); filter.setAppReleaseState(applicationManager.getInstallableLifecycleState()); ApplicationList applications = applicationManager.getApplications(filter); return Response.status(Response.Status.OK).entity(applications).build(); } catch (BadRequestException e) { - String msg = e.getMessage(); + String msg = "Invalid request payload found in the request. Hence verify the payload."; log.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } catch (UnexpectedServerErrorException e) { - String msg = e.getMessage(); + String msg = "Unexpected Error occurred while retrieving applications"; log.error(msg); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } catch (ApplicationManagementException e) { - String msg = e.getMessage(); + String msg = "Error occurred while retrieving applications"; + log.error(msg); log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } @@ -101,4 +160,18 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } } + + /** + * This method can be used to check & validate if {@link Filter} object exist. + * + * @param filter {@link Filter} + * @throws BadRequestException if filter object doesn't exist + */ + private void validateFilter(Filter filter) throws BadRequestException { + if (filter == null) { + String msg = "Request Payload is null"; + log.error(msg); + throw new BadRequestException(msg); + } + } } diff --git a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/admin/SubscriptionManagementAdminAPIImpl.java b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/admin/SubscriptionManagementAdminAPIImpl.java index d95853fcc7..158696d65e 100644 --- a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/admin/SubscriptionManagementAdminAPIImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/admin/SubscriptionManagementAdminAPIImpl.java @@ -18,6 +18,8 @@ package io.entgra.application.mgt.store.api.services.impl.admin; +import io.entgra.application.mgt.common.exception.SubscriptionManagementException; +import io.entgra.application.mgt.store.api.beans.SubscriptionStatusBean; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -34,10 +36,12 @@ import org.wso2.carbon.device.mgt.common.PaginationResult; import javax.ws.rs.Consumes; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; +import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; @@ -50,6 +54,30 @@ public class SubscriptionManagementAdminAPIImpl implements SubscriptionManagemen private static final Log log = LogFactory.getLog(SubscriptionManagementAdminAPIImpl.class); + @Override + @PUT + @Consumes(MediaType.APPLICATION_JSON) + @Path("/device/{deviceId}/status") + public Response updateSubscription( + @PathParam("deviceId") int deviceId, + SubscriptionStatusBean subscriptionStatusBean + ) { + try { + RequestValidationUtil.validateSubscriptionStatus(subscriptionStatusBean.getStatus()); + SubscriptionManager subscriptionManager = APIUtil.getSubscriptionManager(); + subscriptionManager.updateSubscriptionStatus(deviceId, subscriptionStatusBean.getSubId(), + subscriptionStatusBean.getStatus()); + return Response.status(Response.Status.OK).entity("Subscription status updated successfully").build(); + } catch (BadRequestException e) { + return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); + } catch (SubscriptionManagementException e) { + String msg = "Error occurred while changing subscription status of the subscription with the id " + + subscriptionStatusBean.getSubId(); + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } + } + @GET @Consumes("application/json") @Produces("application/json") diff --git a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/util/RequestValidationUtil.java b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/util/RequestValidationUtil.java index aeff5fe9f8..642107afc1 100644 --- a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/util/RequestValidationUtil.java +++ b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/util/RequestValidationUtil.java @@ -18,12 +18,16 @@ */ package io.entgra.application.mgt.store.api.services.impl.util; +import org.apache.commons.lang3.EnumUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import io.entgra.application.mgt.core.exception.BadRequestException; import io.entgra.application.mgt.store.api.util.Constants; +import org.wso2.carbon.device.mgt.common.operation.mgt.ActivityStatus; import java.util.List; +import java.util.StringJoiner; public class RequestValidationUtil { @@ -113,4 +117,18 @@ public class RequestValidationUtil { throw new BadRequestException(msg); } } + + /** + * Checks if user requested subscription status is valid. + * + */ + public static void validateSubscriptionStatus(String status) throws BadRequestException{ + if (!EnumUtils.isValidEnum(ActivityStatus.Status.class, status)) { + List validStatuses = EnumUtils.getEnumList(ActivityStatus.Status.class); + String validStatusesString = StringUtils.join(validStatuses, " | "); + String msg = "Invalid status type: " + status + ". \nValid status types are " + validStatusesString; + log.error(msg); + throw new BadRequestException(msg); + } + } } diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml index d3123b3c22..6215076220 100644 --- a/components/application-mgt/pom.xml +++ b/components/application-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml index ca0ed771dc..7f468c0d95 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml index c95a8f161f..c0228dd450 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml index c11cc38d00..ab7d21fe47 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml @@ -38,7 +38,7 @@ org.wso2.carbon.devicemgt certificate-mgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index aca194789f..d5816dac40 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml index f620a31a7d..5488bf8a1a 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml index 4db0d7698b..15904f573b 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml index 24fd2b6351..779b6f0dc8 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml index 48131ab1a6..c8c38d83b2 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 94eac19470..4657158241 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index c6b5ba9cb3..867a524d3c 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index 4cb0c55410..e1645847c7 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/pom.xml b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/pom.xml index 2f384c9f7a..74a8f7cd34 100644 --- a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/pom.xml +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml index 701f1153da..1bb61cc59a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml index 03a891f664..0a8dde45f3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml @@ -21,7 +21,7 @@ device-mgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml index 95d4568eb0..8007415ca7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java index 7e280d09c1..9e9da57149 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java @@ -20,7 +20,11 @@ package org.wso2.carbon.device.mgt.core.dao.impl.device; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.common.*; +import org.wso2.carbon.device.mgt.common.Count; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; +import org.wso2.carbon.device.mgt.common.EnrolmentInfo; +import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; @@ -926,6 +930,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { String name = request.getDeviceName(); String user = request.getOwner(); String ownership = request.getOwnership(); + String query = null; try { List devices = new ArrayList<>(); if (deviceIds.isEmpty()) { @@ -961,10 +966,10 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { + "INNER JOIN (SELECT ID, NAME FROM DM_DEVICE_TYPE) AS device_types ON " + "device_types.ID = DM_DEVICE.DEVICE_TYPE_ID " + "WHERE DM_DEVICE.ID IN (", - ") AND DM_DEVICE.TENANT_ID = ?"); + ") AND DM_DEVICE.TENANT_ID = ? AND e.STATUS != ?"); deviceIds.stream().map(ignored -> "?").forEach(joiner::add); - String query = joiner.toString(); + query = joiner.toString(); if (name != null && !name.isEmpty()) { query += " AND DM_DEVICE.NAME LIKE ?"; @@ -991,6 +996,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { ps.setObject(index++, deviceId); } ps.setInt(index++, tenantId); + ps.setString(index++, EnrolmentInfo.Status.REMOVED.toString()); if (isDeviceNameProvided) { ps.setString(index++, name + "%"); } @@ -1017,7 +1023,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { } } catch (SQLException e) { String msg = "Error occurred while retrieving information of all registered devices " + - "according to device ids and the limit area."; + "according to device ids and the limit area. Executed query " + query; log.error(msg, e); throw new DeviceManagementDAOException(msg, e); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml index 0d6d60fba4..254a0e06e5 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml index 93f632cf1e..168e99f485 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml @@ -23,7 +23,7 @@ device-mgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index b2b7fee19a..5e9565dd27 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/pom.xml b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/pom.xml index fb77c6ef90..d842f020d9 100644 --- a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/pom.xml +++ b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt heartbeat-management - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/heartbeat-management/pom.xml b/components/heartbeat-management/pom.xml index 83ed90631f..00dcc3a169 100644 --- a/components/heartbeat-management/pom.xml +++ b/components/heartbeat-management/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml index 682fb5da4c..c1b6a61b47 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt identity-extensions - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml index 7dbbd05450..1fe7630665 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt identity-extensions - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index 983d592aff..bea3ed30cd 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml index b187cbd1aa..6397a558a0 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.devicemgt policy-mgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml index cf3c2391f5..0c4862a266 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.devicemgt policy-mgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml index 8778e9bf06..8126f754c9 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt policy-mgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml index af70297c59..a7b2a911c0 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt policy-mgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index ab3ec8e8f3..487e942816 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/components/transport-mgt/email-sender/org.wso2.carbon.email.sender.core/pom.xml b/components/transport-mgt/email-sender/org.wso2.carbon.email.sender.core/pom.xml index 869e944ee5..fc04203754 100644 --- a/components/transport-mgt/email-sender/org.wso2.carbon.email.sender.core/pom.xml +++ b/components/transport-mgt/email-sender/org.wso2.carbon.email.sender.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt email-sender - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/email-sender/pom.xml b/components/transport-mgt/email-sender/pom.xml index 6013a3c4ba..49b0d1b4d3 100644 --- a/components/transport-mgt/email-sender/pom.xml +++ b/components/transport-mgt/email-sender/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt transport-mgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/pom.xml b/components/transport-mgt/pom.xml index 1b33d243a2..b5ade0b0c3 100644 --- a/components/transport-mgt/pom.xml +++ b/components/transport-mgt/pom.xml @@ -3,7 +3,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.api/pom.xml b/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.api/pom.xml index 4862160f92..408abff878 100644 --- a/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.api/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.api/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt sms-handler - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.common/pom.xml b/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.common/pom.xml index 1a4636921e..786ca943c1 100644 --- a/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.common/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.common/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt sms-handler - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.core/pom.xml b/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.core/pom.xml index bdd510c108..7ce23d075e 100644 --- a/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.core/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt sms-handler - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/sms-handler/pom.xml b/components/transport-mgt/sms-handler/pom.xml index 17ff6305f8..7037b73e5c 100644 --- a/components/transport-mgt/sms-handler/pom.xml +++ b/components/transport-mgt/sms-handler/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt transport-mgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/pom.xml b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/pom.xml index d94ee9485a..d4f5d22e05 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/pom.xml +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/pom.xml @@ -21,7 +21,7 @@ ui-request-interceptor io.entgra.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT 4.0.0 diff --git a/components/ui-request-interceptor/pom.xml b/components/ui-request-interceptor/pom.xml index 945df6c627..1e3917a86e 100644 --- a/components/ui-request-interceptor/pom.xml +++ b/components/ui-request-interceptor/pom.xml @@ -21,7 +21,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml index c6ef125b18..c073d222ea 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt webapp-authenticator-framework - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml index 8fb1d37ce4..e773a44ec6 100644 --- a/components/webapp-authenticator-framework/pom.xml +++ b/components/webapp-authenticator-framework/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api.feature/pom.xml index 087d7b9893..76e69e798e 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt grafana-mgt-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.server.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.server.feature/pom.xml index 68d245305c..d50ddc46a4 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.server.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.server.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt grafana-mgt-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/pom.xml b/features/analytics-mgt/grafana-mgt/pom.xml index 75efecfe18..74d6ec9eca 100644 --- a/features/analytics-mgt/grafana-mgt/pom.xml +++ b/features/analytics-mgt/grafana-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt analytics-mgt-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/pom.xml b/features/analytics-mgt/pom.xml index e0d8aa25e2..8f657bc162 100644 --- a/features/analytics-mgt/pom.xml +++ b/features/analytics-mgt/pom.xml @@ -3,7 +3,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml index 77ad82bdfc..2be4052a59 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml index 23e70102ae..4452caf2a8 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index e867f0f3d6..604debbc1d 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/features/application-mgt/io.entgra.application.mgt.api.feature/pom.xml b/features/application-mgt/io.entgra.application.mgt.api.feature/pom.xml index 4a642b4aaf..1278909489 100644 --- a/features/application-mgt/io.entgra.application.mgt.api.feature/pom.xml +++ b/features/application-mgt/io.entgra.application.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt application-mgt-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/application-mgt/io.entgra.application.mgt.server.feature/pom.xml b/features/application-mgt/io.entgra.application.mgt.server.feature/pom.xml index 1f0bc9e9d8..ad2482c694 100644 --- a/features/application-mgt/io.entgra.application.mgt.server.feature/pom.xml +++ b/features/application-mgt/io.entgra.application.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt application-mgt-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql index 150480f68d..6b07c6b757 100644 --- a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql +++ b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql @@ -278,3 +278,17 @@ CREATE TABLE IF NOT EXISTS AP_SCHEDULED_SUBSCRIPTION( FOREIGN KEY (APPLICATION_UUID) REFERENCES AP_APP_RELEASE (UUID) ON DELETE NO ACTION ON UPDATE NO ACTION ); + +-- ----------------------------------------------------- +-- Table AP_APP_FAVOURITES +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES( + ID INTEGER NOT NULL AUTO_INCREMENT, + AP_APP_ID INTEGER NOT NULL, + USER_NAME VARCHAR(100) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY(ID), + CONSTRAINT AP_APP_FAVOURITES_AP_APP_ID_fk + FOREIGN KEY (AP_APP_ID) + REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION +); diff --git a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql index 5d29525a8c..f1a4195699 100644 --- a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql +++ b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql @@ -278,4 +278,18 @@ CREATE TABLE AP_SCHEDULED_SUBSCRIPTION( CONSTRAINT fk_AP_SCHEDULED_SUBSCRIPTION_AP_APP_RELEASE FOREIGN KEY (APPLICATION_UUID) REFERENCES AP_APP_RELEASE (UUID) ON DELETE NO ACTION ON UPDATE NO ACTION -); \ No newline at end of file +); + +-- ----------------------------------------------------- +-- Table AP_APP_FAVOURITES +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES( + ID INTEGER NOT NULL IDENTITY, + AP_APP_ID INTEGER NOT NULL, + USER_NAME VARCHAR(100) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY(ID), + CONSTRAINT AP_APP_FAVOURITES_AP_APP_ID_fk + FOREIGN KEY (AP_APP_ID) + REFERENCES AP_APP (ID) +); diff --git a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql index 110ccdc606..375621018e 100644 --- a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql +++ b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql @@ -274,4 +274,18 @@ CREATE TABLE IF NOT EXISTS AP_SCHEDULED_SUBSCRIPTION( SCHEDULED_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, DELETED BOOLEAN, PRIMARY KEY (ID) -); \ No newline at end of file +); + +-- ----------------------------------------------------- +-- Table AP_APP_FAVOURITES +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES( + ID INTEGER NOT NULL AUTO_INCREMENT, + AP_APP_ID INTEGER NOT NULL, + USER_NAME VARCHAR(100) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY(ID), + CONSTRAINT AP_APP_FAVOURITES_AP_APP_ID_fk + FOREIGN KEY (AP_APP_ID) + REFERENCES AP_APP (ID) +); diff --git a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/oracle.sql b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/oracle.sql index edbc277ab2..b15ef930f6 100644 --- a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/oracle.sql +++ b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/oracle.sql @@ -382,3 +382,15 @@ CREATE TABLE AP_SCHEDULED_SUBSCRIPTION ( REFERENCES AP_APP_RELEASE (UUID) ) / + +CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES( + ID number GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL, + AP_APP_ID INTEGER NOT NULL, + USER_NAME VARCHAR(100) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY(ID), + CONSTRAINT AP_APP_FAVOURITES_AP_APP_ID_fk + FOREIGN KEY (AP_APP_ID) + REFERENCES AP_APP (ID) +) +/ diff --git a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql index c799b03245..e5f83986d6 100644 --- a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql +++ b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql @@ -305,3 +305,18 @@ CREATE TABLE IF NOT EXISTS AP_SCHEDULED_SUBSCRIPTION( DELETED BOOLEAN, PRIMARY KEY (ID) ); + + +-- ----------------------------------------------------- +-- Table AP_APP_FAVOURITES +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES( + ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_FAVOURITES_seq'), + AP_APP_ID INTEGER NOT NULL, + USER_NAME VARCHAR(100) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY(ID), + CONSTRAINT AP_APP_FAVOURITES_AP_APP_ID_fk + FOREIGN KEY (AP_APP_ID) + REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION +); diff --git a/features/application-mgt/pom.xml b/features/application-mgt/pom.xml index e3f067c1dd..6a53d9fa88 100644 --- a/features/application-mgt/pom.xml +++ b/features/application-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml index 89e21fb8e8..a9ea4dfba2 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml index 1cc6585b28..dcc3615536 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml index 2454902841..b5f340e61c 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml index 6de8afaaf8..662c4325af 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml index 3fbe2007d1..c6d3b7a856 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml index 88145b648f..b2d0d3b153 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml index 3315f1589f..16c161caf7 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index 661291de8d..9f34db1a96 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml index f64e14bf8e..27a6c0f30e 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml index deeffd9319..a513e38e58 100644 --- a/features/device-mgt-extensions/pom.xml +++ b/features/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml index d28122d4e6..ee84b3e83b 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml index c02eee01de..6420e924c8 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index 319980a59b..3143511d1a 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -47,6 +47,7 @@ perm:app:publisher:view perm:app:publisher:update perm:app:store:view + perm:app:store:modify perm:app:subscription:install perm:app:subscription:uninstall perm:admin:app:review:update @@ -54,6 +55,7 @@ perm:admin:app:publisher:update perm:admin:app:review:update perm:admin:app:subscription:view + perm:admin:app:subscription:modify perm:device-types:types perm:enterprise:modify perm:enterprise:view diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/mdm-ui-config.xml.j2 b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/mdm-ui-config.xml.j2 index 575f24ee8e..847ede3df7 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/mdm-ui-config.xml.j2 +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/mdm-ui-config.xml.j2 @@ -67,6 +67,7 @@ perm:admin:app:publisher:update perm:admin:app:review:update perm:admin:app:subscription:view + perm:admin:app:subscription:modify perm:device-types:types perm:enterprise:modify perm:enterprise:view diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml index 1ea5127efe..af1a3b165f 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml @@ -4,7 +4,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml index 993addbfc3..874edaca48 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml index 99344dc4f2..9e03680471 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 410dc359fe..65ab4f8708 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/features/heartbeat-management/io.entgra.server.heart.beat.feature/pom.xml b/features/heartbeat-management/io.entgra.server.heart.beat.feature/pom.xml index c0db3fb2f3..69639f2688 100644 --- a/features/heartbeat-management/io.entgra.server.heart.beat.feature/pom.xml +++ b/features/heartbeat-management/io.entgra.server.heart.beat.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt heart-beat-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/heartbeat-management/pom.xml b/features/heartbeat-management/pom.xml index abdd7e5df3..96d6215000 100644 --- a/features/heartbeat-management/pom.xml +++ b/features/heartbeat-management/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml index ed71f887a2..06427c4750 100644 --- a/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml +++ b/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt jwt-client-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml index 9271c282cb..1bcc6e4c9d 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml index 0d1d67de04..612783f39f 100644 --- a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt policy-mgt-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml index 8aff1762c9..d2dfee4663 100644 --- a/features/policy-mgt/pom.xml +++ b/features/policy-mgt/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/features/transport-mgt/email-sender/org.wso2.carbon.email.sender.feature/pom.xml b/features/transport-mgt/email-sender/org.wso2.carbon.email.sender.feature/pom.xml index 6ff05f5910..dfa2a8ebe9 100644 --- a/features/transport-mgt/email-sender/org.wso2.carbon.email.sender.feature/pom.xml +++ b/features/transport-mgt/email-sender/org.wso2.carbon.email.sender.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt email-sender-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/transport-mgt/email-sender/pom.xml b/features/transport-mgt/email-sender/pom.xml index bc2aecb40e..c4880eab25 100644 --- a/features/transport-mgt/email-sender/pom.xml +++ b/features/transport-mgt/email-sender/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt transport-mgt-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/transport-mgt/pom.xml b/features/transport-mgt/pom.xml index 10352a60ca..be7df6c6be 100644 --- a/features/transport-mgt/pom.xml +++ b/features/transport-mgt/pom.xml @@ -3,7 +3,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/features/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.api.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.api.feature/pom.xml index 45aff66c94..efb91751ba 100644 --- a/features/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.api.feature/pom.xml +++ b/features/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt sms-handler-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.server.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.server.feature/pom.xml index 1628c8cbbe..c09e4d3d27 100644 --- a/features/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.server.feature/pom.xml +++ b/features/transport-mgt/sms-handler/io.entgra.transport.mgt.sms.handler.server.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt sms-handler-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/transport-mgt/sms-handler/pom.xml b/features/transport-mgt/sms-handler/pom.xml index f81bf0e7bc..e8a77b147a 100644 --- a/features/transport-mgt/sms-handler/pom.xml +++ b/features/transport-mgt/sms-handler/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt transport-mgt-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/ui-request-interceptor/io.entgra.ui.request.interceptor.feature/pom.xml b/features/ui-request-interceptor/io.entgra.ui.request.interceptor.feature/pom.xml index 213a614a1e..22b6229db0 100644 --- a/features/ui-request-interceptor/io.entgra.ui.request.interceptor.feature/pom.xml +++ b/features/ui-request-interceptor/io.entgra.ui.request.interceptor.feature/pom.xml @@ -21,7 +21,7 @@ ui-request-interceptor-feature io.entgra.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT 4.0.0 diff --git a/features/ui-request-interceptor/pom.xml b/features/ui-request-interceptor/pom.xml index 3d8690e6e4..bd06e13b89 100644 --- a/features/ui-request-interceptor/pom.xml +++ b/features/ui-request-interceptor/pom.xml @@ -21,7 +21,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml index 6d25868998..679ea4dad0 100644 --- a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml +++ b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt webapp-authenticator-framework-feature - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../pom.xml diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml index a37f32b546..27fe3146c0 100644 --- a/features/webapp-authenticator-framework/pom.xml +++ b/features/webapp-authenticator-framework/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT ../../pom.xml diff --git a/pom.xml b/pom.xml index 8627ffe83b..5ae11399c5 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt pom - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components @@ -2076,7 +2076,7 @@ 1.2.11.wso2v10 - 5.0.4-SNAPSHOT + 5.0.6-SNAPSHOT 4.7.35