From 363dca0b6175c912850497a9a75f242772987ecd Mon Sep 17 00:00:00 2001 From: prabathabey Date: Wed, 28 Oct 2015 17:55:38 +0530 Subject: [PATCH] code clean up --- .../impl/MobileDeviceOperationMappingDAOImpl.java | 14 +++++++------- .../mobile/dao/impl/MobileOperationDAOImpl.java | 9 ++++----- .../dao/impl/MobileOperationPropertyDAOImpl.java | 8 ++++---- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileDeviceOperationMappingDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileDeviceOperationMappingDAOImpl.java index 9058df9ae..931ab33a2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileDeviceOperationMappingDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileDeviceOperationMappingDAOImpl.java @@ -77,7 +77,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio String msg = "Error occurred while adding device id - '" + mblDeviceOperationMapping.getDeviceId() + " and operation id - " + mblDeviceOperationMapping.getOperationId() + - " to mapping table AD_DEVICE_OPERATION"; + " to mapping table AD_DEVICE_OPERATION_MAPPING"; log.error(msg, e); throw new MobileDeviceManagementDAOException(msg, e); } finally { @@ -114,7 +114,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio } catch (SQLException e) { String msg = "Error occurred while updating device id - '" + mblDeviceOperation.getDeviceId() + " and operation id - " + - mblDeviceOperation.getOperationId() + " in table MBL_DEVICE_OPERATION"; + mblDeviceOperation.getOperationId() + " in table AD_DEVICE_OPERATION_MAPPING"; log.error(msg, e); throw new MobileDeviceManagementDAOException(msg, e); } finally { @@ -151,7 +151,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio String msg = "Error occurred while updating the Status of operation to in-progress of device id - '" + mblDeviceId + " and operation id - " + - operationId + " in table MBL_DEVICE_OPERATION"; + operationId + " in table AD_DEVICE_OPERATION_MAPPING"; log.error(msg, e); throw new MobileDeviceManagementDAOException(msg, e); } finally { @@ -189,7 +189,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio String msg = "Error occurred while updating the Status of operation to completed of device id - '" + mblDeviceId + " and operation id - " + - operationId + " in table MBL_DEVICE_OPERATION"; + operationId + " in table AD_DEVICE_OPERATION_MAPPING"; log.error(msg, e); throw new MobileDeviceManagementDAOException(msg, e); } finally { @@ -280,7 +280,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio PreparedStatement stmt = null; MobileDeviceOperationMapping mblDeviceOperation; List mblDeviceOperations = - new ArrayList(); + new ArrayList<>(); try { conn = this.getConnection(); String selectDBQuery = @@ -303,7 +303,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio } } catch (SQLException e) { String msg = - "Error occurred while fetching mapping table MBL_DEVICE_OPERATION entries of " + + "Error occurred while fetching mapping table AD_DEVICE_OPERATION_MAPPING entries of " + "device id - '" + mblDeviceId; log.error(msg, e); throw new MobileDeviceManagementDAOException(msg, e); @@ -321,7 +321,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio PreparedStatement stmt = null; MobileDeviceOperationMapping mblDeviceOperation = null; List mblDeviceOperations = - new ArrayList(); + new ArrayList<>(); try { conn = this.getConnection(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileOperationDAOImpl.java index 9d5694a3a..12585f530 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileOperationDAOImpl.java @@ -36,7 +36,6 @@ import java.sql.SQLException; */ public class MobileOperationDAOImpl implements MobileOperationDAO { - public static final String COLUMN_OPERATION_ID = "OPERATION_ID"; private DataSource dataSource; private static final Log log = LogFactory.getLog(MobileOperationDAOImpl.class); @@ -54,7 +53,7 @@ public class MobileOperationDAOImpl implements MobileOperationDAO { conn = this.getConnection(); String createDBQuery = "INSERT INTO AD_OPERATION(FEATURE_CODE, CREATED_DATE) VALUES ( ?, ?)"; - stmt = conn.prepareStatement(createDBQuery, new String[] { COLUMN_OPERATION_ID }); + stmt = conn.prepareStatement(createDBQuery, new String[] { "OPERATION_ID" }); stmt.setString(1, mblOperation.getFeatureCode()); stmt.setLong(2, mblOperation.getCreatedDate()); int rows = stmt.executeUpdate(); @@ -70,7 +69,7 @@ public class MobileOperationDAOImpl implements MobileOperationDAO { } } catch (SQLException e) { String msg = "Error occurred while adding the operation - '" + - mblOperation.getFeatureCode() + "' to MBL_OPERATION table"; + mblOperation.getFeatureCode() + "' to AD_OPERATION table"; log.error(msg, e); throw new MobileDeviceManagementDAOException(msg, e); } finally { @@ -104,7 +103,7 @@ public class MobileOperationDAOImpl implements MobileOperationDAO { } } catch (SQLException e) { String msg = - "Error occurred while updating the MBL_OPERATION table entry with operation id - '" + + "Error occurred while updating the AD_OPERATION table entry with operation id - '" + mblOperation.getOperationId() + "'"; log.error(msg, e); throw new MobileDeviceManagementDAOException(msg, e); @@ -135,7 +134,7 @@ public class MobileOperationDAOImpl implements MobileOperationDAO { } } } catch (SQLException e) { - String msg = "Error occurred while deleting MBL_OPERATION entry with operation Id - "; + String msg = "Error occurred while deleting AD_OPERATION entry with operation Id - "; log.error(msg, e); throw new MobileDeviceManagementDAOException(msg, e); } finally { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileOperationPropertyDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileOperationPropertyDAOImpl.java index 0542e6347..d111dc653 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileOperationPropertyDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileOperationPropertyDAOImpl.java @@ -70,7 +70,7 @@ public class MobileOperationPropertyDAOImpl implements MobileOperationPropertyDA } } catch (SQLException e) { String msg = - "Error occurred while adding mobile operation property to MBL_OPERATION_PROPERTY " + + "Error occurred while adding mobile operation property to AD_OPERATION_PROPERTY " + "table"; log.error(msg, e); throw new MobileDeviceManagementDAOException(msg, e); @@ -107,7 +107,7 @@ public class MobileOperationPropertyDAOImpl implements MobileOperationPropertyDA } catch (SQLException e) { String msg = "Error occurred while updating the mobile operation property in" + - " MBL_OPERATION_PROPERTY table."; + " AD_OPERATION_PROPERTY table."; log.error(msg, e); throw new MobileDeviceManagementDAOException(msg, e); } finally { @@ -139,7 +139,7 @@ public class MobileOperationPropertyDAOImpl implements MobileOperationPropertyDA } } catch (SQLException e) { String msg = - "Error occurred while deleting MBL_OPERATION_PROPERTY entry with operation Id - "; + "Error occurred while deleting AD_OPERATION_PROPERTY entry with operation Id - "; log.error(msg, e); throw new MobileDeviceManagementDAOException(msg, e); } finally { @@ -193,7 +193,7 @@ public class MobileOperationPropertyDAOImpl implements MobileOperationPropertyDA Connection conn = null; PreparedStatement stmt = null; MobileOperationProperty mobileOperationProperty; - List properties = new ArrayList(); + List properties = new ArrayList<>(); try { conn = this.getConnection(); String selectDBQuery =