Fixing the error reported by check styles plugin.

feature/appm-store/pbac
sinthuja 7 years ago
parent 783ead216e
commit 9656b9b747

@ -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 {
}

@ -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 {
}

@ -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 {

@ -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;
@ -108,6 +108,7 @@ public class DAOFactory {
/**
* To get the instance of ApplicationReleaseDAOImplementation of the particular database engine.
*
* @return specific ApplicationReleaseDAOImplementation
*/
public static ApplicationReleaseDAO getApplicationReleaseDAO() {
@ -127,6 +128,7 @@ public class DAOFactory {
/**
* To get the instance of VisibilityDAOImplementation of the particular database engine.
*
* @return specific VisibilityDAOImplementation
*/
public static VisibilityDAO getVisibilityDAO() {

@ -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;

@ -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;
@ -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);
@ -311,6 +310,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
/**
* To insert the application release properties.
*
* @param connection Database Connection
* @param applicationRelease Application Release the properties of which that need to be inserted.
* @throws SQLException SQL Exception.

@ -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,9 +132,9 @@ public class GenericVisibilityDAOImpl extends AbstractDAOImpl implements Visibil
List<String> 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);
}

@ -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;

@ -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

@ -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 {
}

@ -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<DeviceIdentifier> installApplicationForDevices(String applicationUUID, List<DeviceIdentifier> deviceList) throws ApplicationManagementException {
public List<DeviceIdentifier> installApplicationForDevices(String applicationUUID,
List<DeviceIdentifier> 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<String> installApplicationForUsers(String applicationUUID, List<String> userList) throws ApplicationManagementException {
public List<String> installApplicationForUsers(String applicationUUID, List<String> 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<String> installApplicationForRoles(String applicationUUID, List<String> roleList) throws ApplicationManagementException {
public List<String> installApplicationForRoles(String applicationUUID, List<String> 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<DeviceIdentifier> uninstallApplication(String applicationUUID, List<DeviceIdentifier> deviceList) throws ApplicationManagementException {
public List<DeviceIdentifier> uninstallApplication(String applicationUUID,
List<DeviceIdentifier> deviceList)
throws ApplicationManagementException {
return null;
}
}

@ -72,7 +72,8 @@ public class VisibilityManagerImpl implements VisibilityManager {
try {
VisibilityDAO visibilityDAO = DAOFactory.getVisibilityDAO();
Visibility visibility = visibilityDAO.get(applicationID);
if (visibility.getType() == null && (visibility.getAllowedList() == null || visibility.getAllowedList().isEmpty())){
if (visibility.getType() == null && (visibility.getAllowedList() == null ||
visibility.getAllowedList().isEmpty())) {
visibility.setType(Visibility.Type.PUBLIC);
}
return visibility;

Loading…
Cancel
Save