From 9656b9b74702334364d386b8c9b60c7c378e5e15 Mon Sep 17 00:00:00 2001 From: sinthuja Date: Thu, 7 Sep 2017 14:26:50 +0530 Subject: [PATCH] Fixing the error reported by check styles plugin. --- .../application/mgt/core/dao/CommentDAO.java | 3 + .../mgt/core/dao/SubscriptionDAO.java | 4 ++ .../mgt/core/dao/VisibilityDAO.java | 4 +- .../mgt/core/dao/common/DAOFactory.java | 68 ++++++++++--------- .../GenericApplicationDAOImpl.java | 1 - .../GenericApplicationReleaseDAOImpl.java | 24 +++---- .../visibility/GenericVisibilityDAOImpl.java | 14 ++-- .../mgt/core/impl/ApplicationManagerImpl.java | 10 ++- .../mgt/core/impl/CategoryManagerImpl.java | 4 ++ .../mgt/core/impl/CommentsManagerImpl.java | 3 + .../core/impl/SubscriptionManagerImpl.java | 17 +++-- .../mgt/core/impl/VisibilityManagerImpl.java | 7 +- 12 files changed, 97 insertions(+), 62 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/CommentDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/CommentDAO.java index f4999c020f..27cbe337e3 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/CommentDAO.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/CommentDAO.java @@ -18,5 +18,8 @@ */ package org.wso2.carbon.device.application.mgt.core.dao; +/** + * This interface specifies the database access operations performed for comments. + */ public interface CommentDAO { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/SubscriptionDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/SubscriptionDAO.java index 1991c68f9e..010e50203b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/SubscriptionDAO.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/SubscriptionDAO.java @@ -18,5 +18,9 @@ */ package org.wso2.carbon.device.application.mgt.core.dao; +/** + * This interface provides the list of operations that are supported with subscription database. + * + */ public interface SubscriptionDAO { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/VisibilityDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/VisibilityDAO.java index 6d93e091f0..c1c6a1fd30 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/VisibilityDAO.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/VisibilityDAO.java @@ -24,7 +24,9 @@ import org.wso2.carbon.device.application.mgt.core.exception.VisibilityManagemen import java.util.List; /** - * This interface provides the list of operations that are performed in the database layer with respect to the visibility. + * This interface provides the list of operations that are performed in the database + * layer with respect to the visibility. + * */ public interface VisibilityDAO { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/DAOFactory.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/DAOFactory.java index aad3ab53f4..51a4b39347 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/DAOFactory.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/DAOFactory.java @@ -25,8 +25,8 @@ import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager; import org.wso2.carbon.device.application.mgt.core.dao.ApplicationDAO; import org.wso2.carbon.device.application.mgt.core.dao.ApplicationReleaseDAO; import org.wso2.carbon.device.application.mgt.core.dao.LifecycleStateDAO; -import org.wso2.carbon.device.application.mgt.core.dao.VisibilityDAO; import org.wso2.carbon.device.application.mgt.core.dao.PlatformDAO; +import org.wso2.carbon.device.application.mgt.core.dao.VisibilityDAO; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.GenericApplicationDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.release.GenericApplicationReleaseDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.release.OracleApplicationDAOImpl; @@ -61,14 +61,14 @@ public class DAOFactory { public static ApplicationDAO getApplicationDAO() { if (databaseEngine != null) { switch (databaseEngine) { - case Constants.DataBaseTypes.DB_TYPE_H2: - case Constants.DataBaseTypes.DB_TYPE_MYSQL: - case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: - return new GenericApplicationDAOImpl(); - case Constants.DataBaseTypes.DB_TYPE_ORACLE: - return new OracleApplicationDAOImpl(); - default: - throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine); + case Constants.DataBaseTypes.DB_TYPE_H2: + case Constants.DataBaseTypes.DB_TYPE_MYSQL: + case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: + return new GenericApplicationDAOImpl(); + case Constants.DataBaseTypes.DB_TYPE_ORACLE: + return new OracleApplicationDAOImpl(); + default: + throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine); } } throw new IllegalStateException("Database engine has not initialized properly."); @@ -77,15 +77,15 @@ public class DAOFactory { public static PlatformDAO getPlatformDAO() { if (databaseEngine != null) { switch (databaseEngine) { - case Constants.DataBaseTypes.DB_TYPE_H2: - case Constants.DataBaseTypes.DB_TYPE_MYSQL: - case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: - return new GenericPlatformDAOImpl(); - case Constants.DataBaseTypes.DB_TYPE_MSSQL: - case Constants.DataBaseTypes.DB_TYPE_ORACLE: - return new OracleMsSQLPlatformDAOImpl(); - default: - throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine); + case Constants.DataBaseTypes.DB_TYPE_H2: + case Constants.DataBaseTypes.DB_TYPE_MYSQL: + case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: + return new GenericPlatformDAOImpl(); + case Constants.DataBaseTypes.DB_TYPE_MSSQL: + case Constants.DataBaseTypes.DB_TYPE_ORACLE: + return new OracleMsSQLPlatformDAOImpl(); + default: + throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine); } } throw new IllegalStateException("Database engine has not initialized properly."); @@ -94,13 +94,13 @@ public class DAOFactory { public static LifecycleStateDAO getLifecycleStateDAO() { if (databaseEngine != null) { switch (databaseEngine) { - case Constants.DataBaseTypes.DB_TYPE_H2: - case Constants.DataBaseTypes.DB_TYPE_MYSQL: - case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: - case Constants.DataBaseTypes.DB_TYPE_ORACLE: - return new GenericLifecycleStateImpl(); - default: - throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine); + case Constants.DataBaseTypes.DB_TYPE_H2: + case Constants.DataBaseTypes.DB_TYPE_MYSQL: + case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: + case Constants.DataBaseTypes.DB_TYPE_ORACLE: + return new GenericLifecycleStateImpl(); + default: + throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine); } } throw new IllegalStateException("Database engine has not initialized properly."); @@ -108,18 +108,19 @@ public class DAOFactory { /** * To get the instance of ApplicationReleaseDAOImplementation of the particular database engine. + * * @return specific ApplicationReleaseDAOImplementation */ public static ApplicationReleaseDAO getApplicationReleaseDAO() { if (databaseEngine != null) { switch (databaseEngine) { - case Constants.DataBaseTypes.DB_TYPE_H2: - case Constants.DataBaseTypes.DB_TYPE_MYSQL: - case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: - case Constants.DataBaseTypes.DB_TYPE_ORACLE: - return new GenericApplicationReleaseDAOImpl(); - default: - throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine); + case Constants.DataBaseTypes.DB_TYPE_H2: + case Constants.DataBaseTypes.DB_TYPE_MYSQL: + case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: + case Constants.DataBaseTypes.DB_TYPE_ORACLE: + return new GenericApplicationReleaseDAOImpl(); + default: + throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine); } } throw new IllegalStateException("Database engine has not initialized properly."); @@ -127,9 +128,10 @@ public class DAOFactory { /** * To get the instance of VisibilityDAOImplementation of the particular database engine. + * * @return specific VisibilityDAOImplementation */ - public static VisibilityDAO getVisibilityDAO(){ + public static VisibilityDAO getVisibilityDAO() { if (databaseEngine != null) { switch (databaseEngine) { case Constants.DataBaseTypes.DB_TYPE_H2: diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java index 76a9e33e2e..db1f7fe928 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java @@ -39,7 +39,6 @@ import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.sql.Statement; import java.util.ArrayList; import java.util.Iterator; import java.util.List; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/release/GenericApplicationReleaseDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/release/GenericApplicationReleaseDAOImpl.java index fd9b2deaef..fb9f371a50 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/release/GenericApplicationReleaseDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/release/GenericApplicationReleaseDAOImpl.java @@ -32,7 +32,6 @@ import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.sql.Statement; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -41,7 +40,7 @@ import java.util.Map; /** * GenericApplicationReleaseDAOImpl holds the implementation of ApplicationRelease related DAO operations. */ -public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements ApplicationReleaseDAO { +public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements ApplicationReleaseDAO { @Override public ApplicationRelease createRelease(ApplicationRelease applicationRelease) throws @@ -56,7 +55,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements String sql = "insert into APPM_APPLICATION_RELEASE(VERSION_NAME, RELEASE_RESOURCE, RELEASE_CHANNEL ," + "RELEASE_DETAILS, CREATED_AT, APPM_APPLICATION_ID, IS_DEFAULT) values (?, ?, ?, ?, ?, ?, ?)"; int index = 0; - String generatedColumns[] = { "ID" }; + String generatedColumns[] = {"ID"}; try { connection = this.getDBConnection(); statement = connection.prepareStatement(sql, generatedColumns); @@ -134,7 +133,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements versionName, e); } catch (SQLException e) { throw new ApplicationManagementDAOException("Error while getting release details of the application " + - applicationUuid + " and version " + versionName + " , while executing the query " + sql, e); + applicationUuid + " and version " + versionName + " , while executing the query " + sql, e); } finally { Util.cleanupResources(statement, resultSet); Util.cleanupResources(null, rsProperties); @@ -199,9 +198,9 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements throws ApplicationManagementDAOException { Connection connection; PreparedStatement statement = null; - String sql = "UPDATE APPM_APPLICATION_RELEASE SET RELEASE_RESOURCE = IFNULL (?, RELEASE_RESOURCE), RELEASE_CHANNEL = IFNULL " - + "(?, RELEASE_CHANNEL), RELEASE_DETAILS = IFNULL (?, RELEASE_DETAILS), IS_DEFAULT = IFNULL " - + "(?, IS_DEFAULT) WHERE APPM_APPLICATION_ID = ? AND VERSION_NAME = ?"; + String sql = "UPDATE APPM_APPLICATION_RELEASE SET RELEASE_RESOURCE = IFNULL (?, RELEASE_RESOURCE)," + + " RELEASE_CHANNEL = IFNULL (?, RELEASE_CHANNEL), RELEASE_DETAILS = IFNULL (?, RELEASE_DETAILS), " + + "IS_DEFAULT = IFNULL (?, IS_DEFAULT) WHERE APPM_APPLICATION_ID = ? AND VERSION_NAME = ?"; try { connection = this.getDBConnection(); statement = connection.prepareStatement(sql); @@ -277,7 +276,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements @Override public void changeReleaseDefault(String uuid, String version, boolean isDefault, String releaseChannel, - int tenantId) throws ApplicationManagementDAOException { + int tenantId) throws ApplicationManagementDAOException { Connection connection; PreparedStatement statement = null; String sql = "UPDATE APPM_APPLICATION_RELEASE SET IS_DEFAULT = ? AND RELEASE_CHANNEL = ? WHERE " @@ -311,7 +310,8 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements /** * To insert the application release properties. - * @param connection Database Connection + * + * @param connection Database Connection * @param applicationRelease Application Release the properties of which that need to be inserted. * @throws SQLException SQL Exception. */ @@ -343,11 +343,11 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements /** * To make all the releases of particular release channel as non-default ones. * - * @param uuid UUID of the Application. + * @param uuid UUID of the Application. * @param releaseChannel ReleaseChannel for which we need to make all the releases as non-default ones. - * @param tenantId ID of the tenant. + * @param tenantId ID of the tenant. * @throws DBConnectionException Database Connection Exception. - * @throws SQLException SQL Exception. + * @throws SQLException SQL Exception. */ private void removeDefaultReleases(String uuid, String releaseChannel, int tenantId) throws DBConnectionException, SQLException { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/visibility/GenericVisibilityDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/visibility/GenericVisibilityDAOImpl.java index 82c07f5dea..06e9902d8b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/visibility/GenericVisibilityDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/visibility/GenericVisibilityDAOImpl.java @@ -117,12 +117,12 @@ public class GenericVisibilityDAOImpl extends AbstractDAOImpl implements Visibil public Visibility get(int applicationId) throws VisibilityManagementDAOException { PreparedStatement stmt = null; ResultSet resultSet = null; - final String VISIBILITY_TYPE = "VISIBILITY_TYPE"; - final String ALLOWED_VAL = "ALLOWED_VAL"; + final String visibilityTypeColumn = "VISIBILITY_TYPE"; + final String allowedValColumn = "ALLOWED_VAL"; try { Connection connection = getDBConnection(); - String sql = "SELECT APPM_VISIBILITY.VALUE as " + ALLOWED_VAL + ", APPM_RESOURCE_TYPE.NAME AS " + - VISIBILITY_TYPE + " FROM APPM_VISIBILITY JOIN APPM_RESOURCE_TYPE " + + String sql = "SELECT APPM_VISIBILITY.VALUE as " + allowedValColumn + ", APPM_RESOURCE_TYPE.NAME AS " + + visibilityTypeColumn + " FROM APPM_VISIBILITY JOIN APPM_RESOURCE_TYPE " + "ON APPM_VISIBILITY.RESOURCE_TYPE_ID = APPM_RESOURCE_TYPE.ID " + "WHERE APPM_VISIBILITY.APPLICATION_ID = ?"; stmt = connection.prepareStatement(sql); @@ -132,14 +132,14 @@ public class GenericVisibilityDAOImpl extends AbstractDAOImpl implements Visibil List allowedVal = new ArrayList<>(); while (resultSet.next()) { if (visibility.getType() == null) { - visibility.setType(Visibility.Type.valueOf(resultSet.getString(VISIBILITY_TYPE))); + visibility.setType(Visibility.Type.valueOf(resultSet.getString(visibilityTypeColumn))); } - String val = resultSet.getString(ALLOWED_VAL); + String val = resultSet.getString(allowedValColumn); if (val != null) { allowedVal.add(val); } } - if (!allowedVal.isEmpty()){ + if (!allowedVal.isEmpty()) { visibility.setAllowedList(allowedVal); } return visibility; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java index fb3ea6b54f..8e2190d117 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java @@ -22,7 +22,15 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.CarbonConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.application.mgt.common.*; +import org.wso2.carbon.device.application.mgt.common.Application; +import org.wso2.carbon.device.application.mgt.common.ApplicationList; +import org.wso2.carbon.device.application.mgt.common.Filter; +import org.wso2.carbon.device.application.mgt.common.Lifecycle; +import org.wso2.carbon.device.application.mgt.common.LifecycleState; +import org.wso2.carbon.device.application.mgt.common.LifecycleStateTransition; +import org.wso2.carbon.device.application.mgt.common.Platform; +import org.wso2.carbon.device.application.mgt.common.User; +import org.wso2.carbon.device.application.mgt.common.Visibility; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; import org.wso2.carbon.device.application.mgt.core.dao.ApplicationDAO; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java index c165a58fc0..58089fa300 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java @@ -22,6 +22,10 @@ import org.wso2.carbon.device.application.mgt.common.Filter; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.services.CategoryManager; +/** + * This class is the default implementation for the CategoryManager. + * + */ public class CategoryManagerImpl implements CategoryManager { @Override diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java index fbecc5a7eb..23c5903344 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java @@ -19,5 +19,8 @@ package org.wso2.carbon.device.application.mgt.core.impl; import org.wso2.carbon.device.application.mgt.common.services.CommentsManager; +/** + * This class is the default implementation for the Managing the comments. + */ public class CommentsManagerImpl implements CommentsManager { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java index 29adbbab6c..0c89f63114 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -25,12 +25,17 @@ import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManage import java.util.List; +/** + * This is the default implementation for the Subscription Manager. + */ public class SubscriptionManagerImpl implements SubscriptionManager { private static final Log log = LogFactory.getLog(SubscriptionManagerImpl.class); @Override - public List installApplicationForDevices(String applicationUUID, List deviceList) throws ApplicationManagementException { + public List installApplicationForDevices(String applicationUUID, + List deviceList) + throws ApplicationManagementException { log.info("Install application: " + applicationUUID + " to: " + deviceList.size() + " devices."); for (DeviceIdentifier device : deviceList) { String deviceId = device.getId(); @@ -42,7 +47,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager { } @Override - public List installApplicationForUsers(String applicationUUID, List userList) throws ApplicationManagementException { + public List installApplicationForUsers(String applicationUUID, List userList) + throws ApplicationManagementException { log.info("Install application: " + applicationUUID + " to: " + userList.size() + " users."); for (String user : userList) { //Todo: implementation @@ -51,7 +57,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager { } @Override - public List installApplicationForRoles(String applicationUUID, List roleList) throws ApplicationManagementException { + public List installApplicationForRoles(String applicationUUID, List roleList) + throws ApplicationManagementException { log.info("Install application: " + applicationUUID + " to: " + roleList.size() + " users."); for (String role : roleList) { //Todo: implementation @@ -60,7 +67,9 @@ public class SubscriptionManagerImpl implements SubscriptionManager { } @Override - public List uninstallApplication(String applicationUUID, List deviceList) throws ApplicationManagementException { + public List uninstallApplication(String applicationUUID, + List deviceList) + throws ApplicationManagementException { return null; } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityManagerImpl.java index e12a20fab0..85d032c561 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityManagerImpl.java @@ -32,7 +32,7 @@ public class VisibilityManagerImpl implements VisibilityManager { @Override public Visibility put(int applicationID, Visibility visibility) throws VisibilityManagementException { - if (visibility == null){ + if (visibility == null) { visibility = new Visibility(); visibility.setType(Visibility.Type.PUBLIC); } @@ -71,8 +71,9 @@ public class VisibilityManagerImpl implements VisibilityManager { public Visibility get(int applicationID) throws VisibilityManagementException { try { VisibilityDAO visibilityDAO = DAOFactory.getVisibilityDAO(); - Visibility visibility = visibilityDAO.get(applicationID); - if (visibility.getType() == null && (visibility.getAllowedList() == null || visibility.getAllowedList().isEmpty())){ + Visibility visibility = visibilityDAO.get(applicationID); + if (visibility.getType() == null && (visibility.getAllowedList() == null || + visibility.getAllowedList().isEmpty())) { visibility.setType(Visibility.Type.PUBLIC); } return visibility;