Introducing API changes to Android, iOS and Windows plugin implementations

revert-dabc3590
prabathabey 10 years ago
parent c09e16021e
commit 83fbfc98be

@ -28,15 +28,13 @@ import java.util.List;
public abstract class AbstractMobileOperationManager implements OperationManager { public abstract class AbstractMobileOperationManager implements OperationManager {
@Override @Override
public List<Operation> getOperations(DeviceIdentifier deviceIdentifier) public List<Operation> getOperations(DeviceIdentifier deviceIdentifier) throws OperationManagementException {
throws OperationManagementException {
return null; return null;
} }
@Override @Override
public boolean addOperation(Operation operation, public boolean addOperation(Operation operation,
List<DeviceIdentifier> devices) List<DeviceIdentifier> devices) throws OperationManagementException {
throws OperationManagementException {
return true; return true;
} }

@ -54,7 +54,7 @@ public class MobileDeviceDAOImpl implements MobileDeviceDAO {
conn = this.getConnection(); conn = this.getConnection();
String selectDBQuery = String selectDBQuery =
"SELECT MOBILE_DEVICE_ID, PUSH_TOKEN, IMEI, IMSI, OS_VERSION,DEVICE_MODEL, VENDOR, " + "SELECT MOBILE_DEVICE_ID, PUSH_TOKEN, IMEI, IMSI, OS_VERSION,DEVICE_MODEL, VENDOR, " +
"LATITUDE, LONGITUDE, CHALLENGE, SERIAL, TOKEN, UNLOCK_TOKEN FROM MBL_DEVICE" + "LATITUDE, LONGITUDE, CHALLENGE, SERIAL, TOKEN, UNLOCK_TOKEN FROM AD_DEVICE" +
" WHERE MOBILE_DEVICE_ID = ?"; " WHERE MOBILE_DEVICE_ID = ?";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, mblDeviceId); stmt.setString(1, mblDeviceId);
@ -98,7 +98,7 @@ public class MobileDeviceDAOImpl implements MobileDeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String createDBQuery = String createDBQuery =
"INSERT INTO MBL_DEVICE(MOBILE_DEVICE_ID, PUSH_TOKEN, IMEI, IMSI, OS_VERSION," + "INSERT INTO AD_DEVICE(MOBILE_DEVICE_ID, PUSH_TOKEN, IMEI, IMSI, OS_VERSION," +
"DEVICE_MODEL, VENDOR, LATITUDE, LONGITUDE, CHALLENGE, SERIAL, TOKEN, " + "DEVICE_MODEL, VENDOR, LATITUDE, LONGITUDE, CHALLENGE, SERIAL, TOKEN, " +
"UNLOCK_TOKEN) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; "UNLOCK_TOKEN) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
@ -144,7 +144,7 @@ public class MobileDeviceDAOImpl implements MobileDeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String updateDBQuery = String updateDBQuery =
"UPDATE MBL_DEVICE SET PUSH_TOKEN = ?, IMEI = ?, IMSI = ?, OS_VERSION = ?," + "UPDATE AD_DEVICE SET PUSH_TOKEN = ?, IMEI = ?, IMSI = ?, OS_VERSION = ?," +
"DEVICE_MODEL = ?, VENDOR = ? , LATITUDE = ?, LONGITUDE = ?, CHALLENGE = ?," + "DEVICE_MODEL = ?, VENDOR = ? , LATITUDE = ?, LONGITUDE = ?, CHALLENGE = ?," +
"SERIAL = ?, TOKEN = ?, UNLOCK_TOKEN = ? WHERE MOBILE_DEVICE_ID = ?"; "SERIAL = ?, TOKEN = ?, UNLOCK_TOKEN = ? WHERE MOBILE_DEVICE_ID = ?";
stmt = conn.prepareStatement(updateDBQuery); stmt = conn.prepareStatement(updateDBQuery);
@ -188,7 +188,7 @@ public class MobileDeviceDAOImpl implements MobileDeviceDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String deleteDBQuery = String deleteDBQuery =
"DELETE FROM MBL_DEVICE WHERE MOBILE_DEVICE_ID = ?"; "DELETE FROM AD_DEVICE WHERE MOBILE_DEVICE_ID = ?";
stmt = conn.prepareStatement(deleteDBQuery); stmt = conn.prepareStatement(deleteDBQuery);
stmt.setString(1, mblDeviceId); stmt.setString(1, mblDeviceId);
int rows = stmt.executeUpdate(); int rows = stmt.executeUpdate();
@ -219,7 +219,7 @@ public class MobileDeviceDAOImpl implements MobileDeviceDAO {
conn = this.getConnection(); conn = this.getConnection();
String selectDBQuery = String selectDBQuery =
"SELECT MOBILE_DEVICE_ID, PUSH_TOKEN, IMEI, IMSI, OS_VERSION,DEVICE_MODEL, VENDOR," + "SELECT MOBILE_DEVICE_ID, PUSH_TOKEN, IMEI, IMSI, OS_VERSION,DEVICE_MODEL, VENDOR," +
"LATITUDE, LONGITUDE, CHALLENGE, SERIAL, TOKEN, UNLOCK_TOKEN FROM MBL_DEVICE"; "LATITUDE, LONGITUDE, CHALLENGE, SERIAL, TOKEN, UNLOCK_TOKEN FROM AD_DEVICE";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
ResultSet resultSet = stmt.executeQuery(); ResultSet resultSet = stmt.executeQuery();
while (resultSet.next()) { while (resultSet.next()) {

@ -55,7 +55,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio
try { try {
conn = this.getConnection(); conn = this.getConnection();
String createDBQuery = String createDBQuery =
"INSERT INTO MBL_DEVICE_OPERATION_MAPPING (DEVICE_ID, OPERATION_ID, SENT_DATE, " + "INSERT INTO AD_DEVICE_OPERATION_MAPPING (DEVICE_ID, OPERATION_ID, SENT_DATE, " +
"RECEIVED_DATE, STATUS) VALUES (?, ?, ?, ?, ?)"; "RECEIVED_DATE, STATUS) VALUES (?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(createDBQuery); stmt = conn.prepareStatement(createDBQuery);
@ -77,7 +77,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio
String msg = "Error occurred while adding device id - '" + String msg = "Error occurred while adding device id - '" +
mblDeviceOperationMapping.getDeviceId() + " and operation id - " + mblDeviceOperationMapping.getDeviceId() + " and operation id - " +
mblDeviceOperationMapping.getOperationId() + mblDeviceOperationMapping.getOperationId() +
" to mapping table MBL_DEVICE_OPERATION"; " to mapping table AD_DEVICE_OPERATION";
log.error(msg, e); log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e); throw new MobileDeviceManagementDAOException(msg, e);
} finally { } finally {
@ -95,7 +95,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio
try { try {
conn = this.getConnection(); conn = this.getConnection();
String updateDBQuery = String updateDBQuery =
"UPDATE MBL_DEVICE_OPERATION_MAPPING SET SENT_DATE = ?, RECEIVED_DATE = ?, " + "UPDATE AD_DEVICE_OPERATION_MAPPING SET SENT_DATE = ?, RECEIVED_DATE = ?, " +
"STATUS = ? WHERE DEVICE_ID = ? AND OPERATION_ID=?"; "STATUS = ? WHERE DEVICE_ID = ? AND OPERATION_ID=?";
stmt = conn.prepareStatement(updateDBQuery); stmt = conn.prepareStatement(updateDBQuery);
stmt.setLong(1, mblDeviceOperation.getSentDate()); stmt.setLong(1, mblDeviceOperation.getSentDate());
@ -132,7 +132,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio
try { try {
conn = this.getConnection(); conn = this.getConnection();
String updateDBQuery = String updateDBQuery =
"UPDATE MBL_DEVICE_OPERATION_MAPPING SET SENT_DATE = ?, STATUS = ? " + "UPDATE AD_DEVICE_OPERATION_MAPPING SET SENT_DATE = ?, STATUS = ? " +
"WHERE DEVICE_ID = ? AND OPERATION_ID=?"; "WHERE DEVICE_ID = ? AND OPERATION_ID=?";
stmt = conn.prepareStatement(updateDBQuery); stmt = conn.prepareStatement(updateDBQuery);
stmt.setLong(1, new Date().getTime()); stmt.setLong(1, new Date().getTime());
@ -170,7 +170,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio
try { try {
conn = this.getConnection(); conn = this.getConnection();
String updateDBQuery = String updateDBQuery =
"UPDATE MBL_DEVICE_OPERATION_MAPPING SET RECEIVED_DATE = ?, STATUS = ? " + "UPDATE AD_DEVICE_OPERATION_MAPPING SET RECEIVED_DATE = ?, STATUS = ? " +
"WHERE DEVICE_ID = ? AND OPERATION_ID = ?"; "WHERE DEVICE_ID = ? AND OPERATION_ID = ?";
stmt = conn.prepareStatement(updateDBQuery); stmt = conn.prepareStatement(updateDBQuery);
stmt.setLong(1, new Date().getTime()); stmt.setLong(1, new Date().getTime());
@ -207,7 +207,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio
try { try {
conn = this.getConnection(); conn = this.getConnection();
String deleteDBQuery = String deleteDBQuery =
"DELETE FROM MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND " + "DELETE FROM AD_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND " +
"OPERATION_ID = ?"; "OPERATION_ID = ?";
stmt = conn.prepareStatement(deleteDBQuery); stmt = conn.prepareStatement(deleteDBQuery);
stmt.setString(1, mblDeviceId); stmt.setString(1, mblDeviceId);
@ -222,7 +222,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio
} }
} catch (SQLException e) { } catch (SQLException e) {
String msg = String msg =
"Error occurred while deleting the table entry MBL_DEVICE_OPERATION with " + "Error occurred while deleting the table entry AD_DEVICE_OPERATION with " +
" device id - '" + mblDeviceId + " and operation id - " + operationId; " device id - '" + mblDeviceId + " and operation id - " + operationId;
log.error(msg, e); log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e); throw new MobileDeviceManagementDAOException(msg, e);
@ -243,7 +243,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio
conn = this.getConnection(); conn = this.getConnection();
String selectDBQuery = String selectDBQuery =
"SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE, STATUS FROM " + "SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE, STATUS FROM " +
"MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID = ?"; "AD_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID = ?";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, mblDeviceId); stmt.setString(1, mblDeviceId);
stmt.setInt(2, operationId); stmt.setInt(2, operationId);
@ -285,7 +285,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio
conn = this.getConnection(); conn = this.getConnection();
String selectDBQuery = String selectDBQuery =
"SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE, STATUS FROM " + "SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE, STATUS FROM " +
"MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ?"; "AD_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ?";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, mblDeviceId); stmt.setString(1, mblDeviceId);
ResultSet resultSet = stmt.executeQuery(); ResultSet resultSet = stmt.executeQuery();
@ -327,7 +327,7 @@ public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperatio
conn = this.getConnection(); conn = this.getConnection();
String selectDBQuery = String selectDBQuery =
"SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE, STATUS FROM" + "SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE, STATUS FROM" +
" MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND STATUS = ?"; " AD_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND STATUS = ?";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, mblDeviceId); stmt.setString(1, mblDeviceId);
stmt.setString(2, MobileDeviceOperationMapping.Status.NEW.name()); stmt.setString(2, MobileDeviceOperationMapping.Status.NEW.name());

@ -54,7 +54,7 @@ public class MobileFeatureDAOImpl implements MobileFeatureDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String createDBQuery = String createDBQuery =
"INSERT INTO MBL_FEATURE(CODE, NAME, DESCRIPTION, DEVICE_TYPE) VALUES (?, ?, ?, ?)"; "INSERT INTO AD_FEATURE(CODE, NAME, DESCRIPTION, DEVICE_TYPE) VALUES (?, ?, ?, ?)";
stmt = conn.prepareStatement(createDBQuery); stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, mobileFeature.getCode()); stmt.setString(1, mobileFeature.getCode());
@ -92,7 +92,7 @@ public class MobileFeatureDAOImpl implements MobileFeatureDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String updateDBQuery = String updateDBQuery =
"UPDATE MBL_FEATURE SET CODE = ?, NAME = ?, DESCRIPTION = ?, DEVICE_TYPE = ?" + "UPDATE AD_FEATURE SET CODE = ?, NAME = ?, DESCRIPTION = ?, DEVICE_TYPE = ?" +
" WHERE FEATURE_ID = ?"; " WHERE FEATURE_ID = ?";
stmt = conn.prepareStatement(updateDBQuery); stmt = conn.prepareStatement(updateDBQuery);
stmt.setString(1, mobileFeature.getCode()); stmt.setString(1, mobileFeature.getCode());
@ -127,7 +127,7 @@ public class MobileFeatureDAOImpl implements MobileFeatureDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String deleteDBQuery = String deleteDBQuery =
"DELETE FROM MBL_FEATURE WHERE CODE = ?"; "DELETE FROM AD_FEATURE WHERE CODE = ?";
stmt = conn.prepareStatement(deleteDBQuery); stmt = conn.prepareStatement(deleteDBQuery);
stmt.setString(1, mblFeatureCode); stmt.setString(1, mblFeatureCode);
int rows = stmt.executeUpdate(); int rows = stmt.executeUpdate();
@ -157,7 +157,7 @@ public class MobileFeatureDAOImpl implements MobileFeatureDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String deleteDBQuery = String deleteDBQuery =
"DELETE FROM MBL_FEATURE WHERE FEATURE_ID = ?"; "DELETE FROM AD_FEATURE WHERE FEATURE_ID = ?";
stmt = conn.prepareStatement(deleteDBQuery); stmt = conn.prepareStatement(deleteDBQuery);
stmt.setInt(1, mblFeatureId); stmt.setInt(1, mblFeatureId);
int rows = stmt.executeUpdate(); int rows = stmt.executeUpdate();
@ -187,7 +187,7 @@ public class MobileFeatureDAOImpl implements MobileFeatureDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String selectDBQuery = String selectDBQuery =
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM MBL_FEATURE " + "SELECT FEATURE_ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM AD_FEATURE " +
"WHERE CODE = ?"; "WHERE CODE = ?";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, mblFeatureCode); stmt.setString(1, mblFeatureCode);
@ -224,7 +224,7 @@ public class MobileFeatureDAOImpl implements MobileFeatureDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String selectDBQuery = String selectDBQuery =
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM MBL_FEATURE" + "SELECT FEATURE_ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM AD_FEATURE" +
" WHERE FEATURE_ID = ?"; " WHERE FEATURE_ID = ?";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
stmt.setInt(1, mblFeatureId); stmt.setInt(1, mblFeatureId);
@ -261,7 +261,7 @@ public class MobileFeatureDAOImpl implements MobileFeatureDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String selectDBQuery = String selectDBQuery =
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM MBL_FEATURE"; "SELECT FEATURE_ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM AD_FEATURE";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
ResultSet resultSet = stmt.executeQuery(); ResultSet resultSet = stmt.executeQuery();
while (resultSet.next()) { while (resultSet.next()) {
@ -296,7 +296,7 @@ public class MobileFeatureDAOImpl implements MobileFeatureDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String selectDBQuery = String selectDBQuery =
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM MBL_FEATURE" + "SELECT FEATURE_ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM AD_FEATURE" +
" WHERE DEVICE_TYPE = ?"; " WHERE DEVICE_TYPE = ?";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, deviceType); stmt.setString(1, deviceType);

@ -54,7 +54,7 @@ public class MobileFeaturePropertyDAOImpl implements MobileFeaturePropertyDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String createDBQuery = String createDBQuery =
"INSERT INTO MBL_FEATURE_PROPERTY(PROPERTY, FEATURE_ID) VALUES (?, ?)"; "INSERT INTO AD_FEATURE_PROPERTY(PROPERTY, FEATURE_ID) VALUES (?, ?)";
stmt = conn.prepareStatement(createDBQuery); stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, mblFeatureProperty.getProperty()); stmt.setString(1, mblFeatureProperty.getProperty());
@ -87,7 +87,7 @@ public class MobileFeaturePropertyDAOImpl implements MobileFeaturePropertyDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String updateDBQuery = String updateDBQuery =
"UPDATE MBL_FEATURE_PROPERTY SET FEATURE_ID = ? WHERE PROPERTY = ?"; "UPDATE AD_FEATURE_PROPERTY SET FEATURE_ID = ? WHERE PROPERTY = ?";
stmt = conn.prepareStatement(updateDBQuery); stmt = conn.prepareStatement(updateDBQuery);
stmt.setInt(1, mblFeatureProperty.getFeatureID()); stmt.setInt(1, mblFeatureProperty.getFeatureID());
stmt.setString(2, mblFeatureProperty.getProperty()); stmt.setString(2, mblFeatureProperty.getProperty());
@ -118,7 +118,7 @@ public class MobileFeaturePropertyDAOImpl implements MobileFeaturePropertyDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String deleteDBQuery = String deleteDBQuery =
"DELETE FROM MBL_FEATURE_PROPERTY WHERE PROPERTY = ?"; "DELETE FROM AD_FEATURE_PROPERTY WHERE PROPERTY = ?";
stmt = conn.prepareStatement(deleteDBQuery); stmt = conn.prepareStatement(deleteDBQuery);
stmt.setString(1, property); stmt.setString(1, property);
int rows = stmt.executeUpdate(); int rows = stmt.executeUpdate();
@ -148,7 +148,7 @@ public class MobileFeaturePropertyDAOImpl implements MobileFeaturePropertyDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String deleteDBQuery = String deleteDBQuery =
"DELETE FROM MBL_FEATURE_PROPERTY WHERE FEATURE_ID = ?"; "DELETE FROM AD_FEATURE_PROPERTY WHERE FEATURE_ID = ?";
stmt = conn.prepareStatement(deleteDBQuery); stmt = conn.prepareStatement(deleteDBQuery);
stmt.setInt(1, mblFeatureId); stmt.setInt(1, mblFeatureId);
int rows = stmt.executeUpdate(); int rows = stmt.executeUpdate();
@ -179,7 +179,7 @@ public class MobileFeaturePropertyDAOImpl implements MobileFeaturePropertyDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String selectDBQuery = String selectDBQuery =
"SELECT PROPERTY, FEATURE_ID FROM MBL_FEATURE_PROPERTY WHERE PROPERTY = ?"; "SELECT PROPERTY, FEATURE_ID FROM AD_FEATURE_PROPERTY WHERE PROPERTY = ?";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, property); stmt.setString(1, property);
ResultSet resultSet = stmt.executeQuery(); ResultSet resultSet = stmt.executeQuery();
@ -213,7 +213,7 @@ public class MobileFeaturePropertyDAOImpl implements MobileFeaturePropertyDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String selectDBQuery = String selectDBQuery =
"SELECT PROPERTY, FEATURE_ID FROM MBL_FEATURE_PROPERTY WHERE FEATURE_ID = ?"; "SELECT PROPERTY, FEATURE_ID FROM AD_FEATURE_PROPERTY WHERE FEATURE_ID = ?";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
stmt.setInt(1, mblFeatureId); stmt.setInt(1, mblFeatureId);
ResultSet resultSet = stmt.executeQuery(); ResultSet resultSet = stmt.executeQuery();

@ -53,7 +53,7 @@ public class MobileOperationDAOImpl implements MobileOperationDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String createDBQuery = String createDBQuery =
"INSERT INTO MBL_OPERATION(FEATURE_CODE, CREATED_DATE) VALUES ( ?, ?)"; "INSERT INTO AD_OPERATION(FEATURE_CODE, CREATED_DATE) VALUES ( ?, ?)";
stmt = conn.prepareStatement(createDBQuery, new String[] { COLUMN_OPERATION_ID }); stmt = conn.prepareStatement(createDBQuery, new String[] { COLUMN_OPERATION_ID });
stmt.setString(1, mblOperation.getFeatureCode()); stmt.setString(1, mblOperation.getFeatureCode());
stmt.setLong(2, mblOperation.getCreatedDate()); stmt.setLong(2, mblOperation.getCreatedDate());
@ -88,7 +88,7 @@ public class MobileOperationDAOImpl implements MobileOperationDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String updateDBQuery = String updateDBQuery =
"UPDATE MBL_OPERATION SET FEATURE_CODE = ?, CREATED_DATE = ? WHERE " + "UPDATE AD_OPERATION SET FEATURE_CODE = ?, CREATED_DATE = ? WHERE " +
"OPERATION_ID = ?"; "OPERATION_ID = ?";
stmt = conn.prepareStatement(updateDBQuery); stmt = conn.prepareStatement(updateDBQuery);
stmt.setString(1, mblOperation.getFeatureCode()); stmt.setString(1, mblOperation.getFeatureCode());
@ -123,7 +123,7 @@ public class MobileOperationDAOImpl implements MobileOperationDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String deleteDBQuery = String deleteDBQuery =
"DELETE FROM MBL_OPERATION WHERE OPERATION_ID = ?"; "DELETE FROM AD_OPERATION WHERE OPERATION_ID = ?";
stmt = conn.prepareStatement(deleteDBQuery); stmt = conn.prepareStatement(deleteDBQuery);
stmt.setInt(1, mblOperationId); stmt.setInt(1, mblOperationId);
int rows = stmt.executeUpdate(); int rows = stmt.executeUpdate();
@ -153,7 +153,7 @@ public class MobileOperationDAOImpl implements MobileOperationDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String selectDBQuery = String selectDBQuery =
"SELECT OPERATION_ID, FEATURE_CODE, CREATED_DATE FROM MBL_OPERATION WHERE " + "SELECT OPERATION_ID, FEATURE_CODE, CREATED_DATE FROM AD_OPERATION WHERE " +
"OPERATION_ID = ?"; "OPERATION_ID = ?";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
stmt.setInt(1, mblOperationId); stmt.setInt(1, mblOperationId);

@ -54,7 +54,7 @@ public class MobileOperationPropertyDAOImpl implements MobileOperationPropertyDA
try { try {
conn = this.getConnection(); conn = this.getConnection();
String createDBQuery = String createDBQuery =
"INSERT INTO MBL_OPERATION_PROPERTY(OPERATION_ID, PROPERTY, VALUE) " + "INSERT INTO AD_OPERATION_PROPERTY(OPERATION_ID, PROPERTY, VALUE) " +
"VALUES ( ?, ?, ?)"; "VALUES ( ?, ?, ?)";
stmt = conn.prepareStatement(createDBQuery); stmt = conn.prepareStatement(createDBQuery);
stmt.setInt(1, mblOperationProperty.getOperationId()); stmt.setInt(1, mblOperationProperty.getOperationId());
@ -90,7 +90,7 @@ public class MobileOperationPropertyDAOImpl implements MobileOperationPropertyDA
try { try {
conn = this.getConnection(); conn = this.getConnection();
String createDBQuery = String createDBQuery =
"UPDATE MBL_OPERATION_PROPERTY SET VALUE = ? WHERE OPERATION_ID = ? AND " + "UPDATE AD_OPERATION_PROPERTY SET VALUE = ? WHERE OPERATION_ID = ? AND " +
"PROPERTY = ?"; "PROPERTY = ?";
stmt = conn.prepareStatement(createDBQuery); stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, mblOperationProperty.getValue()); stmt.setString(1, mblOperationProperty.getValue());
@ -125,7 +125,7 @@ public class MobileOperationPropertyDAOImpl implements MobileOperationPropertyDA
try { try {
conn = this.getConnection(); conn = this.getConnection();
String deleteDBQuery = String deleteDBQuery =
"DELETE FROM MBL_OPERATION_PROPERTY WHERE OPERATION_ID = ?"; "DELETE FROM AD_OPERATION_PROPERTY WHERE OPERATION_ID = ?";
stmt = conn.prepareStatement(deleteDBQuery); stmt = conn.prepareStatement(deleteDBQuery);
stmt.setInt(1, mblOperationId); stmt.setInt(1, mblOperationId);
int rows = stmt.executeUpdate(); int rows = stmt.executeUpdate();
@ -158,7 +158,7 @@ public class MobileOperationPropertyDAOImpl implements MobileOperationPropertyDA
try { try {
conn = this.getConnection(); conn = this.getConnection();
String selectDBQuery = String selectDBQuery =
"SELECT OPERATION_ID, PROPERTY, VALUE FROM MBL_OPERATION_PROPERTY WHERE " + "SELECT OPERATION_ID, PROPERTY, VALUE FROM AD_OPERATION_PROPERTY WHERE " +
"OPERATION_ID = ? AND PROPERTY = ?"; "OPERATION_ID = ? AND PROPERTY = ?";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
stmt.setInt(1, mblOperationId); stmt.setInt(1, mblOperationId);
@ -197,7 +197,7 @@ public class MobileOperationPropertyDAOImpl implements MobileOperationPropertyDA
try { try {
conn = this.getConnection(); conn = this.getConnection();
String selectDBQuery = String selectDBQuery =
"SELECT OPERATION_ID, PROPERTY, VALUE FROM MBL_OPERATION_PROPERTY WHERE " + "SELECT OPERATION_ID, PROPERTY, VALUE FROM AD_OPERATION_PROPERTY WHERE " +
"OPERATION_ID = ?"; "OPERATION_ID = ?";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
stmt.setInt(1, mblOperationId); stmt.setInt(1, mblOperationId);

@ -78,6 +78,10 @@ public class MobileDeviceManagementDAOUtil {
} }
} }
public static void cleanupResources(PreparedStatement stmt, ResultSet rs) {
cleanupResources(null, stmt, rs);
}
/** /**
* Creates the mobile device management schema. * Creates the mobile device management schema.
* *

@ -18,6 +18,8 @@
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.android; package org.wso2.carbon.device.mgt.mobile.impl.android;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.Feature; import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.common.FeatureManagementException; import org.wso2.carbon.device.mgt.common.FeatureManagementException;
@ -31,6 +33,7 @@ import java.util.List;
public class AndroidFeatureManager implements FeatureManager { public class AndroidFeatureManager implements FeatureManager {
private FeatureDAO featureDAO; private FeatureDAO featureDAO;
private static final Log log = LogFactory.getLog(AndroidFeatureManager.class);
public AndroidFeatureManager() { public AndroidFeatureManager() {
this.featureDAO = FeatureManagementDAOFactory.getFeatureDAO(); this.featureDAO = FeatureManagementDAOFactory.getFeatureDAO();
@ -39,9 +42,16 @@ public class AndroidFeatureManager implements FeatureManager {
@Override @Override
public boolean addFeature(Feature feature) throws DeviceManagementException { public boolean addFeature(Feature feature) throws DeviceManagementException {
try { try {
FeatureManagementDAOFactory.beginTransaction();
featureDAO.addFeature(feature); featureDAO.addFeature(feature);
FeatureManagementDAOFactory.commitTransaction();
return true; return true;
} catch (FeatureManagementDAOException e) { } catch (FeatureManagementDAOException e) {
try {
FeatureManagementDAOFactory.rollbackTransaction();
} catch (FeatureManagementDAOException e1) {
log.warn("Error occurred while roll-backing the transaction", e);
}
throw new DeviceManagementException("Error occurred while adding the feature", e); throw new DeviceManagementException("Error occurred while adding the feature", e);
} }
} }
@ -49,8 +59,16 @@ public class AndroidFeatureManager implements FeatureManager {
@Override @Override
public Feature getFeature(String name) throws DeviceManagementException { public Feature getFeature(String name) throws DeviceManagementException {
try { try {
return featureDAO.getFeature(name); FeatureManagementDAOFactory.beginTransaction();
Feature feature = featureDAO.getFeature(name);
FeatureManagementDAOFactory.commitTransaction();
return feature;
} catch (FeatureManagementDAOException e) { } catch (FeatureManagementDAOException e) {
try {
FeatureManagementDAOFactory.rollbackTransaction();
} catch (FeatureManagementDAOException e1) {
log.warn("Error occurred while roll-backing the transaction", e);
}
throw new DeviceManagementException("Error occurred while retrieving the feature", e); throw new DeviceManagementException("Error occurred while retrieving the feature", e);
} }
} }

@ -144,6 +144,11 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
return operations; return operations;
} }
@Override
public Operation getPendingOperation(DeviceIdentifier deviceIdentifier) throws OperationManagementException {
return null;
}
public List<Feature> getFeatures(String deviceType) throws FeatureManagementException { public List<Feature> getFeatures(String deviceType) throws FeatureManagementException {
MobileFeatureDAO featureDAO = MobileDeviceManagementDAOFactory.getFeatureDAO(); MobileFeatureDAO featureDAO = MobileDeviceManagementDAOFactory.getFeatureDAO();
MobileFeaturePropertyDAO featurePropertyDAO = MobileFeaturePropertyDAO featurePropertyDAO =

@ -19,7 +19,6 @@
package org.wso2.carbon.device.mgt.mobile.impl.android.dao; package org.wso2.carbon.device.mgt.mobile.impl.android.dao;
import org.wso2.carbon.device.mgt.common.Feature; import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.common.FeatureManagementException;
import java.util.List; import java.util.List;

@ -19,4 +19,59 @@
package org.wso2.carbon.device.mgt.mobile.impl.android.dao; package org.wso2.carbon.device.mgt.mobile.impl.android.dao;
public class FeatureManagementDAOException extends Exception { public class FeatureManagementDAOException extends Exception {
private String message;
private static final long serialVersionUID = 2021891706072918865L;
/**
* Constructs a new MobileDeviceManagementDAOException with the specified detail message and
* nested exception.
*
* @param message error message
* @param nestedException exception
*/
public FeatureManagementDAOException(String message, Exception nestedException) {
super(message, nestedException);
setErrorMessage(message);
}
/**
* Constructs a new MobileDeviceManagementDAOException with the specified detail message
* and cause.
*
* @param message the detail message.
* @param cause the cause of this exception.
*/
public FeatureManagementDAOException(String message, Throwable cause) {
super(message, cause);
setErrorMessage(message);
}
/**
* Constructs a new MobileDeviceManagementDAOException with the specified detail message.
*
* @param message the detail message.
*/
public FeatureManagementDAOException(String message) {
super(message);
setErrorMessage(message);
}
/**
* Constructs a new MobileDeviceManagementDAOException with the specified and cause.
*
* @param cause the cause of this exception.
*/
public FeatureManagementDAOException(Throwable cause) {
super(cause);
}
public String getMessage() {
return message;
}
public void setErrorMessage(String errorMessage) {
this.message = errorMessage;
}
} }

@ -18,12 +18,76 @@
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.android.dao; package org.wso2.carbon.device.mgt.mobile.impl.android.dao;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.impl.FeatureDAOImpl; import org.wso2.carbon.device.mgt.mobile.impl.android.dao.impl.FeatureDAOImpl;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
public class FeatureManagementDAOFactory { public class FeatureManagementDAOFactory {
private static DataSource dataSource;
private static ThreadLocal<Connection> currentConnection = new ThreadLocal<Connection>();
private static final Log log = LogFactory.getLog(FeatureManagementDAOFactory.class);
public static FeatureDAO getFeatureDAO() { public static FeatureDAO getFeatureDAO() {
return new FeatureDAOImpl(); return new FeatureDAOImpl();
} }
public static void init(DataSource dtSource) {
dataSource = dtSource;
}
public static void beginTransaction() throws FeatureManagementDAOException {
try {
Connection conn = dataSource.getConnection();
conn.setAutoCommit(false);
currentConnection.set(conn);
} catch (SQLException e) {
throw new FeatureManagementDAOException("Error occurred while retrieving datasource connection", e);
}
}
public static Connection getConnection() {
return currentConnection.get();
}
public static void commitTransaction() throws FeatureManagementDAOException {
try {
Connection conn = currentConnection.get();
if (conn != null) {
conn.commit();
} else {
if (log.isDebugEnabled()) {
log.debug("Datasource connection associated with the current thread is null, hence commit " +
"has not been attempted");
}
}
} catch (SQLException e) {
throw new FeatureManagementDAOException("Error occurred while committing the transaction", e);
}
}
public static void rollbackTransaction() throws FeatureManagementDAOException {
try {
Connection conn = currentConnection.get();
if (conn != null) {
conn.rollback();
} else {
if (log.isDebugEnabled()) {
log.debug("Datasource connection associated with the current thread is null, hence rollback " +
"has not been attempted");
}
}
} catch (SQLException e) {
throw new FeatureManagementDAOException("Error occurred while rollbacking the transaction", e);
}
}
public static DataSource getDataSource() {
return dataSource;
}
} }

@ -19,31 +19,110 @@
package org.wso2.carbon.device.mgt.mobile.impl.android.dao.impl; package org.wso2.carbon.device.mgt.mobile.impl.android.dao.impl;
import org.wso2.carbon.device.mgt.common.Feature; import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.FeatureDAO; import org.wso2.carbon.device.mgt.mobile.impl.android.dao.FeatureDAO;
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.FeatureManagementDAOException; import org.wso2.carbon.device.mgt.mobile.impl.android.dao.FeatureManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.FeatureManagementDAOFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
public class FeatureDAOImpl implements FeatureDAO { public class FeatureDAOImpl implements FeatureDAO {
@Override @Override
public void addFeature(Feature feature) throws FeatureManagementDAOException { public void addFeature(Feature feature) throws FeatureManagementDAOException {
PreparedStatement stmt = null;
try {
Connection conn = FeatureManagementDAOFactory.getConnection();
String sql = "INSERT INTO MBL_FEATURE(CODE, NAME, DESCRIPTION) VALUES (?, ?, ?)";
stmt = conn.prepareStatement(sql);
stmt.setString(1, feature.getCode());
stmt.setString(2, feature.getName());
stmt.setString(3, feature.getDescription());
stmt.executeUpdate();
} catch (SQLException e) {
throw new FeatureManagementDAOException("Error occurred while adding feature '" +
feature.getName() + "' into the metadata repository", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
}
} }
@Override @Override
public void removeFeature(String name) throws FeatureManagementDAOException { public void removeFeature(String code) throws FeatureManagementDAOException {
PreparedStatement stmt = null;
try {
Connection conn = FeatureManagementDAOFactory.getConnection();
String sql = "DELETE FROM MBL_FEATURE WHERE CODE = ?";
stmt = conn.prepareStatement(sql);
stmt.setString(1, code);
stmt.execute();
} catch (SQLException e) {
throw new FeatureManagementDAOException("Error occurred while adding feature '" +
code + "' into the metadata repository", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
}
} }
@Override @Override
public Feature getFeature(String name) throws FeatureManagementDAOException { public Feature getFeature(String code) throws FeatureManagementDAOException {
return null; PreparedStatement stmt = null;
ResultSet rs = null;
try {
Connection conn = FeatureManagementDAOFactory.getConnection();
String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM AD_FEATURE WHERE CODE = ?";
stmt = conn.prepareStatement(sql);
stmt.setString(1, code);
rs = stmt.executeQuery();
Feature feature = null;
if (rs.next()) {
feature = new Feature();
feature.setId(rs.getInt("ID"));
feature.setCode(rs.getString("CODE"));
feature.setName(rs.getString("NAME"));
feature.setDescription(rs.getString("DESCRIPTION"));
}
return feature;
} catch (SQLException e) {
throw new FeatureManagementDAOException("Error occurred while retrieving feature metadata '" +
code + "' from the feature metadata repository", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
} }
@Override @Override
public List<Feature> getFeatures() throws FeatureManagementDAOException { public List<Feature> getFeatures() throws FeatureManagementDAOException {
return null; PreparedStatement stmt = null;
ResultSet rs = null;
List<Feature> features = new ArrayList<Feature>();
try {
Connection conn = FeatureManagementDAOFactory.getConnection();
String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM AD_FEATURE";
stmt = conn.prepareStatement(sql);
rs = stmt.executeQuery();
while (rs.next()) {
Feature feature = new Feature();
feature.setId(rs.getInt("ID"));
feature.setCode(rs.getString("CODE"));
feature.setName(rs.getString("NAME"));
feature.setDescription(rs.getString("DESCRIPTION"));
}
return features;
} catch (SQLException e) {
throw new FeatureManagementDAOException("Error occurred while retrieving all feature metadata from the " +
"feature metadata repository", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
} }
} }

@ -20,8 +20,6 @@ package org.wso2.carbon.device.mgt.mobile.impl.ios;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.common.FeatureManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.mobile.AbstractMobileOperationManager; import org.wso2.carbon.device.mgt.mobile.AbstractMobileOperationManager;
@ -118,4 +116,9 @@ public class IOSMobileOperationManager extends AbstractMobileOperationManager {
return operations; return operations;
} }
@Override
public Operation getPendingOperation(DeviceIdentifier deviceIdentifier) throws OperationManagementException {
return null;
}
} }

@ -0,0 +1,98 @@
-- -----------------------------------------------------
-- Table AD_DEVICE
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AD_FEATURE(
ID INTEGER NOT NULL,
CODE VARCHAR(50) NOT NULL,
NAME VARCHAR(100) NOT NULL,
DESCRIPTION VARCHAR(200) NOT NULL,
)
-- -----------------------------------------------------
-- Table AD_DEVICE
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AD_DEVICE (
MOBILE_DEVICE_ID VARCHAR(45) NOT NULL ,
PUSH_TOKEN VARCHAR(45) NULL DEFAULT NULL ,
IMEI VARCHAR(45) NULL DEFAULT NULL ,
IMSI VARCHAR(45) NULL DEFAULT NULL ,
OS_VERSION VARCHAR(45) NULL DEFAULT NULL ,
DEVICE_MODEL VARCHAR(45) NULL DEFAULT NULL ,
VENDOR VARCHAR(45) NULL DEFAULT NULL ,
LATITUDE VARCHAR(45) NULL DEFAULT NULL,
LONGITUDE VARCHAR(45) NULL DEFAULT NULL,
CHALLENGE VARCHAR(45) NULL DEFAULT NULL,
TOKEN VARCHAR(500) NULL DEFAULT NULL,
UNLOCK_TOKEN VARCHAR(500) NULL DEFAULT NULL,
SERIAL VARCHAR(45) NULL DEFAULT NULL,
PRIMARY KEY (MOBILE_DEVICE_ID) );
-- -----------------------------------------------------
-- Table AD_FEATURE
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AD_FEATURE (
FEATURE_ID INT NOT NULL AUTO_INCREMENT ,
CODE VARCHAR(45) NOT NULL,
NAME VARCHAR(100) NULL ,
DESCRIPTION VARCHAR(200) NULL ,
DEVICE_TYPE VARCHAR(50) NULL ,
PRIMARY KEY (FEATURE_ID) );
-- -----------------------------------------------------
-- Table AD_OPERATION
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AD_OPERATION (
OPERATION_ID INT NOT NULL AUTO_INCREMENT ,
FEATURE_CODE VARCHAR(45) NOT NULL ,
CREATED_DATE BIGINT NULL ,
PRIMARY KEY (OPERATION_ID));
-- -----------------------------------------------------
-- Table AD_DEVICE_OPERATION_MAPPING
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AD_DEVICE_OPERATION_MAPPING (
DEVICE_ID VARCHAR(45) NOT NULL ,
OPERATION_ID INT NOT NULL ,
SENT_DATE BIGINT NULL ,
RECEIVED_DATE BIGINT NULL ,
STATUS VARCHAR(10) NOT NULL ,
PRIMARY KEY (DEVICE_ID, OPERATION_ID) ,
CONSTRAINT fk_AD_DEVICE_OPERATION_AD_DEVICE
FOREIGN KEY (DEVICE_ID )
REFERENCES AD_DEVICE (MOBILE_DEVICE_ID )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_AD_DEVICE_OPERATION_AD_OPERATION1
FOREIGN KEY (OPERATION_ID )
REFERENCES AD_OPERATION (OPERATION_ID )
ON DELETE NO ACTION
ON UPDATE NO ACTION);
-- -----------------------------------------------------
-- Table AD_OPERATION_PROPERTY
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AD_OPERATION_PROPERTY (
OPERATION_ID INT NOT NULL ,
PROPERTY VARCHAR(45) NOT NULL ,
VALUE TEXT NULL ,
PRIMARY KEY (OPERATION_ID, PROPERTY) ,
CONSTRAINT fk_AD_OPERATION_PROPERTY_AD_OPERATION1
FOREIGN KEY (OPERATION_ID )
REFERENCES AD_OPERATION (OPERATION_ID )
ON DELETE NO ACTION
ON UPDATE NO ACTION);
-- -----------------------------------------------------
-- Table AD_FEATURE_PROPERTY
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AD_FEATURE_PROPERTY (
PROPERTY VARCHAR(45) NOT NULL ,
FEATURE_ID INT NOT NULL ,
PRIMARY KEY (PROPERTY) ,
CONSTRAINT fk_AD_FEATURE_PROPERTY_AD_FEATURE1
FOREIGN KEY (FEATURE_ID )
REFERENCES AD_FEATURE (FEATURE_ID )
ON DELETE NO ACTION
ON UPDATE NO ACTION);

@ -85,8 +85,7 @@ public class MobileDeviceDAOTestSuite {
} }
@Test @Test
public void addMobileDeviceTest() public void addMobileDeviceTest() throws MobileDeviceManagementDAOException {
throws MobileDeviceManagementDAOException {
Connection conn = null; Connection conn = null;
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
@ -111,7 +110,7 @@ public class MobileDeviceDAOTestSuite {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String selectDBQuery = String selectDBQuery =
"SELECT MOBILE_DEVICE_ID, PUSH_TOKEN, IMEI, IMSI, OS_VERSION,DEVICE_MODEL, VENDOR, " + "SELECT MOBILE_DEVICE_ID, PUSH_TOKEN, IMEI, IMSI, OS_VERSION,DEVICE_MODEL, VENDOR, " +
"LATITUDE, LONGITUDE, CHALLENGE, SERIAL, TOKEN, UNLOCK_TOKEN FROM MBL_DEVICE " + "LATITUDE, LONGITUDE, CHALLENGE, SERIAL, TOKEN, UNLOCK_TOKEN FROM AD_DEVICE " +
"WHERE MOBILE_DEVICE_ID = ?"; "WHERE MOBILE_DEVICE_ID = ?";
preparedStatement = conn.prepareStatement(selectDBQuery); preparedStatement = conn.prepareStatement(selectDBQuery);
preparedStatement.setString(1, TEST_MOBILE_DEVICE_ID); preparedStatement.setString(1, TEST_MOBILE_DEVICE_ID);
@ -209,8 +208,7 @@ public class MobileDeviceDAOTestSuite {
@Test(dependsOnMethods = { "addMobileDeviceTest", "getMobileDeviceTest", @Test(dependsOnMethods = { "addMobileDeviceTest", "getMobileDeviceTest",
"getAllMobileDevicesTest" }) "getAllMobileDevicesTest" })
public void updateMobileDeviceTest() public void updateMobileDeviceTest() throws MobileDeviceManagementDAOException {
throws MobileDeviceManagementDAOException {
Connection conn = null; Connection conn = null;
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
@ -235,7 +233,7 @@ public class MobileDeviceDAOTestSuite {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String selectDBQuery = String selectDBQuery =
"SELECT MOBILE_DEVICE_ID, PUSH_TOKEN, IMEI, IMSI, OS_VERSION,DEVICE_MODEL, VENDOR, " + "SELECT MOBILE_DEVICE_ID, PUSH_TOKEN, IMEI, IMSI, OS_VERSION,DEVICE_MODEL, VENDOR, " +
"LATITUDE, LONGITUDE, CHALLENGE, SERIAL, TOKEN, UNLOCK_TOKEN FROM MBL_DEVICE " + "LATITUDE, LONGITUDE, CHALLENGE, SERIAL, TOKEN, UNLOCK_TOKEN FROM AD_DEVICE " +
"WHERE MOBILE_DEVICE_ID = ?"; "WHERE MOBILE_DEVICE_ID = ?";
preparedStatement = conn.prepareStatement(selectDBQuery); preparedStatement = conn.prepareStatement(selectDBQuery);
preparedStatement.setString(1, TEST_MOBILE_DEVICE_ID); preparedStatement.setString(1, TEST_MOBILE_DEVICE_ID);
@ -279,7 +277,7 @@ public class MobileDeviceDAOTestSuite {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String selectDBQuery = String selectDBQuery =
"SELECT MOBILE_DEVICE_ID, PUSH_TOKEN, IMEI, IMSI, OS_VERSION,DEVICE_MODEL, VENDOR, " + "SELECT MOBILE_DEVICE_ID, PUSH_TOKEN, IMEI, IMSI, OS_VERSION,DEVICE_MODEL, VENDOR, " +
"LATITUDE, LONGITUDE, CHALLENGE, SERIAL, TOKEN, UNLOCK_TOKEN FROM MBL_DEVICE " + "LATITUDE, LONGITUDE, CHALLENGE, SERIAL, TOKEN, UNLOCK_TOKEN FROM AD_DEVICE " +
"WHERE MOBILE_DEVICE_ID = ?"; "WHERE MOBILE_DEVICE_ID = ?";
preparedStatement = conn.prepareStatement(selectDBQuery); preparedStatement = conn.prepareStatement(selectDBQuery);
preparedStatement.setString(1, TEST_MOBILE_DEVICE_ID); preparedStatement.setString(1, TEST_MOBILE_DEVICE_ID);
@ -296,4 +294,5 @@ public class MobileDeviceDAOTestSuite {
} }
Assert.assertTrue(deleted, "MobileDevice has deleted "); Assert.assertTrue(deleted, "MobileDevice has deleted ");
} }
} }

@ -155,7 +155,7 @@ public class MobileDeviceOperationMappingDAOTestSuite {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String selectDBQuery = String selectDBQuery =
"SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE, STATUS FROM " + "SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE, STATUS FROM " +
"MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ?"; "AD_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ?";
preparedStatement = conn.prepareStatement(selectDBQuery); preparedStatement = conn.prepareStatement(selectDBQuery);
preparedStatement.setString(1, TEST_MOBILE_DEVICE_ID); preparedStatement.setString(1, TEST_MOBILE_DEVICE_ID);
ResultSet resultSet = preparedStatement.executeQuery(); ResultSet resultSet = preparedStatement.executeQuery();
@ -252,7 +252,7 @@ public class MobileDeviceOperationMappingDAOTestSuite {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String selectDBQuery = String selectDBQuery =
"SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, STATUS FROM " + "SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, STATUS FROM " +
"MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID = ?"; "AD_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID = ?";
preparedStatement = conn.prepareStatement(selectDBQuery); preparedStatement = conn.prepareStatement(selectDBQuery);
preparedStatement.setString(1, TEST_MOBILE_DEVICE_ID); preparedStatement.setString(1, TEST_MOBILE_DEVICE_ID);
preparedStatement.setInt(2, mblOperationId1); preparedStatement.setInt(2, mblOperationId1);
@ -296,7 +296,7 @@ public class MobileDeviceOperationMappingDAOTestSuite {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String selectDBQuery = String selectDBQuery =
"SELECT DEVICE_ID, OPERATION_ID, RECEIVED_DATE, STATUS FROM " + "SELECT DEVICE_ID, OPERATION_ID, RECEIVED_DATE, STATUS FROM " +
"MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID = ?"; "AD_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID = ?";
preparedStatement = conn.prepareStatement(selectDBQuery); preparedStatement = conn.prepareStatement(selectDBQuery);
preparedStatement.setString(1, TEST_MOBILE_DEVICE_ID); preparedStatement.setString(1, TEST_MOBILE_DEVICE_ID);
preparedStatement.setInt(2, mblOperationId1); preparedStatement.setInt(2, mblOperationId1);
@ -348,7 +348,7 @@ public class MobileDeviceOperationMappingDAOTestSuite {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String selectDBQuery = String selectDBQuery =
"SELECT DEVICE_ID, OPERATION_ID, RECEIVED_DATE, SENT_DATE, STATUS FROM " + "SELECT DEVICE_ID, OPERATION_ID, RECEIVED_DATE, SENT_DATE, STATUS FROM " +
"MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID = ?"; "AD_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID = ?";
preparedStatement = conn.prepareStatement(selectDBQuery); preparedStatement = conn.prepareStatement(selectDBQuery);
preparedStatement.setString(1, TEST_MOBILE_DEVICE_ID); preparedStatement.setString(1, TEST_MOBILE_DEVICE_ID);
preparedStatement.setInt(2, mblOperationId1); preparedStatement.setInt(2, mblOperationId1);
@ -422,7 +422,7 @@ public class MobileDeviceOperationMappingDAOTestSuite {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String selectDBQuery = String selectDBQuery =
"SELECT DEVICE_ID, OPERATION_ID, RECEIVED_DATE, SENT_DATE, STATUS FROM " + "SELECT DEVICE_ID, OPERATION_ID, RECEIVED_DATE, SENT_DATE, STATUS FROM " +
"MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID = ?"; "AD_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID = ?";
preparedStatement = conn.prepareStatement(selectDBQuery); preparedStatement = conn.prepareStatement(selectDBQuery);
preparedStatement.setString(1, TEST_MOBILE_DEVICE_ID); preparedStatement.setString(1, TEST_MOBILE_DEVICE_ID);
preparedStatement.setInt(2, mblOperationId1); preparedStatement.setInt(2, mblOperationId1);

@ -91,7 +91,7 @@ public class MobileFeatureDAOTestSuite {
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String query = String query =
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM MBL_FEATURE WHERE CODE = ?"; "SELECT FEATURE_ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM AD_FEATURE WHERE CODE = ?";
preparedStatement = conn.prepareStatement(query); preparedStatement = conn.prepareStatement(query);
preparedStatement.setString(1, MBL_FEATURE_CODE); preparedStatement.setString(1, MBL_FEATURE_CODE);
ResultSet resultSet = preparedStatement.executeQuery(); ResultSet resultSet = preparedStatement.executeQuery();
@ -174,7 +174,7 @@ public class MobileFeatureDAOTestSuite {
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String query = String query =
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM MBL_FEATURE WHERE CODE = ?"; "SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM AD_FEATURE WHERE CODE = ?";
stmt = conn.prepareStatement(query); stmt = conn.prepareStatement(query);
stmt.setString(1, MBL_FEATURE_UPDATED_CODE); stmt.setString(1, MBL_FEATURE_UPDATED_CODE);
ResultSet resultSet = stmt.executeQuery(); ResultSet resultSet = stmt.executeQuery();
@ -207,7 +207,7 @@ public class MobileFeatureDAOTestSuite {
boolean status = mblFeatureDAO.deleteMobileFeatureById(mblFeatureId); boolean status = mblFeatureDAO.deleteMobileFeatureById(mblFeatureId);
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String query = "SELECT FEATURE_ID, CODE FROM MBL_FEATURE WHERE FEATURE_ID = ?"; String query = "SELECT FEATURE_ID, CODE FROM AD_FEATURE WHERE FEATURE_ID = ?";
stmt = conn.prepareStatement(query); stmt = conn.prepareStatement(query);
stmt.setInt(1, mblFeatureId); stmt.setInt(1, mblFeatureId);
ResultSet resultSet = stmt.executeQuery(); ResultSet resultSet = stmt.executeQuery();
@ -240,7 +240,7 @@ public class MobileFeatureDAOTestSuite {
boolean status = mblFeatureDAO.deleteMobileFeatureByCode(MBL_FEATURE_CODE); boolean status = mblFeatureDAO.deleteMobileFeatureByCode(MBL_FEATURE_CODE);
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String query = "SELECT FEATURE_ID, CODE FROM MBL_FEATURE WHERE CODE = ?"; String query = "SELECT FEATURE_ID, CODE FROM AD_FEATURE WHERE CODE = ?";
preparedStatement = conn.prepareStatement(query); preparedStatement = conn.prepareStatement(query);
preparedStatement.setString(1, MBL_FEATURE_CODE); preparedStatement.setString(1, MBL_FEATURE_CODE);
ResultSet resultSet = preparedStatement.executeQuery(); ResultSet resultSet = preparedStatement.executeQuery();

@ -107,7 +107,7 @@ public class MobileFeaturePropertyDAOTestSuite {
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String query = String query =
"SELECT FEATURE_ID, PROPERTY FROM MBL_FEATURE_PROPERTY WHERE FEATURE_ID = ?"; "SELECT FEATURE_ID, PROPERTY FROM AD_FEATURE_PROPERTY WHERE FEATURE_ID = ?";
preparedStatement = conn.prepareStatement(query); preparedStatement = conn.prepareStatement(query);
preparedStatement.setInt(1, mblFeatureId); preparedStatement.setInt(1, mblFeatureId);
ResultSet resultSet = preparedStatement.executeQuery(); ResultSet resultSet = preparedStatement.executeQuery();
@ -187,7 +187,7 @@ public class MobileFeaturePropertyDAOTestSuite {
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String query = String query =
"SELECT PROPERTY, FEATURE_ID FROM MBL_FEATURE_PROPERTY WHERE PROPERTY = ?"; "SELECT PROPERTY, FEATURE_ID FROM AD_FEATURE_PROPERTY WHERE PROPERTY = ?";
preparedStatement = conn.prepareStatement(query); preparedStatement = conn.prepareStatement(query);
preparedStatement.setString(1, MBL_FEATURE_PROP_2); preparedStatement.setString(1, MBL_FEATURE_PROP_2);
ResultSet resultSet = preparedStatement.executeQuery(); ResultSet resultSet = preparedStatement.executeQuery();
@ -217,7 +217,7 @@ public class MobileFeaturePropertyDAOTestSuite {
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String query = String query =
"SELECT PROPERTY, FEATURE_ID FROM MBL_FEATURE_PROPERTY WHERE FEATURE_ID = ?"; "SELECT PROPERTY, FEATURE_ID FROM AD_FEATURE_PROPERTY WHERE FEATURE_ID = ?";
preparedStatement = conn.prepareStatement(query); preparedStatement = conn.prepareStatement(query);
preparedStatement.setInt(1, mblFeatureId); preparedStatement.setInt(1, mblFeatureId);
ResultSet resultSet = preparedStatement.executeQuery(); ResultSet resultSet = preparedStatement.executeQuery();

@ -83,7 +83,7 @@ public class MobileOperationDAOTestSuite {
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String selectDBQuery = String selectDBQuery =
"SELECT OPERATION_ID, FEATURE_CODE, CREATED_DATE FROM MBL_OPERATION WHERE OPERATION_ID = ?"; "SELECT OPERATION_ID, FEATURE_CODE, CREATED_DATE FROM AD_OPERATION WHERE OPERATION_ID = ?";
preparedStatement = conn.prepareStatement(selectDBQuery); preparedStatement = conn.prepareStatement(selectDBQuery);
preparedStatement.setInt(1, mblOperationId); preparedStatement.setInt(1, mblOperationId);
ResultSet resultSet = preparedStatement.executeQuery(); ResultSet resultSet = preparedStatement.executeQuery();
@ -133,7 +133,7 @@ public class MobileOperationDAOTestSuite {
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String selectDBQuery = String selectDBQuery =
"SELECT OPERATION_ID, FEATURE_CODE, CREATED_DATE FROM MBL_OPERATION WHERE OPERATION_ID = ?"; "SELECT OPERATION_ID, FEATURE_CODE, CREATED_DATE FROM AD_OPERATION WHERE OPERATION_ID = ?";
preparedStatement = conn.prepareStatement(selectDBQuery); preparedStatement = conn.prepareStatement(selectDBQuery);
preparedStatement.setInt(1, mblOperationId); preparedStatement.setInt(1, mblOperationId);
ResultSet resultSet = preparedStatement.executeQuery(); ResultSet resultSet = preparedStatement.executeQuery();
@ -167,7 +167,7 @@ public class MobileOperationDAOTestSuite {
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String selectDBQuery = String selectDBQuery =
"SELECT OPERATION_ID, FEATURE_CODE, CREATED_DATE FROM MBL_OPERATION WHERE OPERATION_ID = ?"; "SELECT OPERATION_ID, FEATURE_CODE, CREATED_DATE FROM AD_OPERATION WHERE OPERATION_ID = ?";
preparedStatement = conn.prepareStatement(selectDBQuery); preparedStatement = conn.prepareStatement(selectDBQuery);
preparedStatement.setInt(1, mblOperationId); preparedStatement.setInt(1, mblOperationId);
ResultSet resultSet = preparedStatement.executeQuery(); ResultSet resultSet = preparedStatement.executeQuery();

@ -111,7 +111,7 @@ public class MobileOperationPropertyDAOTestSuite {
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String selectDBQuery = String selectDBQuery =
"SELECT OPERATION_ID, PROPERTY, VALUE FROM MBL_OPERATION_PROPERTY WHERE OPERATION_ID = ?"; "SELECT OPERATION_ID, PROPERTY, VALUE FROM AD_OPERATION_PROPERTY WHERE OPERATION_ID = ?";
preparedStatement = conn.prepareStatement(selectDBQuery); preparedStatement = conn.prepareStatement(selectDBQuery);
preparedStatement.setInt(1, mblOperationId); preparedStatement.setInt(1, mblOperationId);
ResultSet resultSet = preparedStatement.executeQuery(); ResultSet resultSet = preparedStatement.executeQuery();
@ -181,7 +181,7 @@ public class MobileOperationPropertyDAOTestSuite {
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String selectDBQuery = String selectDBQuery =
"SELECT OPERATION_ID, PROPERTY, VALUE FROM MBL_OPERATION_PROPERTY WHERE" + "SELECT OPERATION_ID, PROPERTY, VALUE FROM AD_OPERATION_PROPERTY WHERE" +
" OPERATION_ID = ? AND PROPERTY = ?"; " OPERATION_ID = ? AND PROPERTY = ?";
preparedStatement = conn.prepareStatement(selectDBQuery); preparedStatement = conn.prepareStatement(selectDBQuery);
preparedStatement.setInt(1, mblOperationId); preparedStatement.setInt(1, mblOperationId);
@ -217,7 +217,7 @@ public class MobileOperationPropertyDAOTestSuite {
try { try {
conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL()); conn = DriverManager.getConnection(testDBConfiguration.getConnectionURL());
String selectDBQuery = String selectDBQuery =
"SELECT OPERATION_ID, PROPERTY, VALUE FROM MBL_OPERATION_PROPERTY WHERE" + "SELECT OPERATION_ID, PROPERTY, VALUE FROM AD_OPERATION_PROPERTY WHERE" +
" OPERATION_ID = ?"; " OPERATION_ID = ?";
preparedStatement = conn.prepareStatement(selectDBQuery); preparedStatement = conn.prepareStatement(selectDBQuery);
preparedStatement.setInt(1, mblOperationId); preparedStatement.setInt(1, mblOperationId);

@ -103,7 +103,7 @@ public class MobileDatabaseUtils {
Class.forName(testDBConf.getDriverClassName()); Class.forName(testDBConf.getDriverClassName());
conn = DriverManager.getConnection(testDBConf.getConnectionURL()); conn = DriverManager.getConnection(testDBConf.getConnectionURL());
stmt = conn.createStatement(); stmt = conn.createStatement();
stmt.executeUpdate("RUNSCRIPT FROM './src/test/resources/sql/CreateH2TestDB.sql'"); stmt.executeUpdate("RUNSCRIPT FROM './src/test/resources/sql/h2.sql'");
} finally { } finally {
cleanupResources(conn, stmt, null); cleanupResources(conn, stmt, null);
} }

@ -0,0 +1,88 @@
-- -----------------------------------------------------
-- Table `MBL_DEVICE`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `AD_DEVICE` (
`MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL ,
`PUSH_TOKEN` VARCHAR(45) NULL DEFAULT NULL ,
`IMEI` VARCHAR(45) NULL DEFAULT NULL ,
`IMSI` VARCHAR(45) NULL DEFAULT NULL ,
`OS_VERSION` VARCHAR(45) NULL DEFAULT NULL ,
`DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL ,
`VENDOR` VARCHAR(45) NULL DEFAULT NULL ,
`LATITUDE` VARCHAR(45) NULL DEFAULT NULL,
`LONGITUDE` VARCHAR(45) NULL DEFAULT NULL,
`CHALLENGE` VARCHAR(45) NULL DEFAULT NULL,
`TOKEN` VARCHAR(500) NULL DEFAULT NULL,
`UNLOCK_TOKEN` VARCHAR(500) NULL DEFAULT NULL,
`SERIAL` VARCHAR(45) NULL DEFAULT NULL,
PRIMARY KEY (`MOBILE_DEVICE_ID`) );
-- -----------------------------------------------------
-- Table `AD_FEATURE`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `AD_FEATURE` (
`FEATURE_ID` INT NOT NULL AUTO_INCREMENT ,
`CODE` VARCHAR(45) NOT NULL,
`NAME` VARCHAR(100) NULL ,
`DESCRIPTION` VARCHAR(200) NULL ,
`DEVICE_TYPE` VARCHAR(50) NULL ,
PRIMARY KEY (`FEATURE_ID`) );
-- -----------------------------------------------------
-- Table `AD_OPERATION`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `AD_OPERATION` (
`OPERATION_ID` INT NOT NULL AUTO_INCREMENT ,
`FEATURE_CODE` VARCHAR(45) NOT NULL ,
`CREATED_DATE` BIGINT NULL ,
PRIMARY KEY (`OPERATION_ID`));
-- -----------------------------------------------------
-- Table `AD_DEVICE_OPERATION_MAPPING`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `AD_DEVICE_OPERATION_MAPPING` (
`DEVICE_ID` VARCHAR(45) NOT NULL ,
`OPERATION_ID` INT NOT NULL ,
`SENT_DATE` BIGINT NULL ,
`RECEIVED_DATE` BIGINT NULL ,
`STATUS` VARCHAR(10) NOT NULL ,
PRIMARY KEY (`DEVICE_ID`, `OPERATION_ID`) ,
CONSTRAINT `fk_AD_DEVICE_OPERATION_AD_DEVICE`
FOREIGN KEY (`DEVICE_ID` )
REFERENCES `AD_DEVICE` (`MOBILE_DEVICE_ID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_AD_DEVICE_OPERATION_AD_OPERATION1`
FOREIGN KEY (`OPERATION_ID` )
REFERENCES `AD_OPERATION` (`OPERATION_ID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION);
-- -----------------------------------------------------
-- Table `AD_OPERATION_PROPERTY`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `AD_OPERATION_PROPERTY` (
`OPERATION_ID` INT NOT NULL ,
`PROPERTY` VARCHAR(45) NOT NULL ,
`VALUE` TEXT NULL ,
PRIMARY KEY (`OPERATION_ID`, `PROPERTY`) ,
CONSTRAINT `fk_AD_OPERATION_PROPERTY_AD_OPERATION1`
FOREIGN KEY (`OPERATION_ID` )
REFERENCES `AD_OPERATION` (`OPERATION_ID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION);
-- -----------------------------------------------------
-- Table `AD_FEATURE_PROPERTY`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `AD_FEATURE_PROPERTY` (
`PROPERTY` VARCHAR(45) NOT NULL ,
`FEATURE_ID` INT NOT NULL ,
PRIMARY KEY (`PROPERTY`) ,
CONSTRAINT `fk_AD_FEATURE_PROPERTY_AD_FEATURE1`
FOREIGN KEY (`FEATURE_ID` )
REFERENCES `AD_FEATURE` (`FEATURE_ID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION);

@ -0,0 +1,47 @@
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java
index 719a38b..5a63eef 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java
@@ -28,15 +28,13 @@ import java.util.List;
public abstract class AbstractMobileOperationManager implements OperationManager {
@Override
- public List<Operation> getOperations(DeviceIdentifier deviceIdentifier)
- throws OperationManagementException {
+ public List<Operation> getOperations(DeviceIdentifier deviceIdentifier) throws OperationManagementException {
return null;
}
@Override
public boolean addOperation(Operation operation,
- List<DeviceIdentifier> devices)
- throws OperationManagementException {
+ List<DeviceIdentifier> devices) throws OperationManagementException {
return true;
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/FeatureDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/FeatureDAO.java
index 17b347b..1aa3289 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/FeatureDAO.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/FeatureDAO.java
@@ -19,7 +19,6 @@
package org.wso2.carbon.device.mgt.mobile.impl.android.dao;
import org.wso2.carbon.device.mgt.common.Feature;
-import org.wso2.carbon.device.mgt.common.FeatureManagementException;
import java.util.List;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSMobileOperationManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSMobileOperationManager.java
index 38280e2..6607600 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSMobileOperationManager.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSMobileOperationManager.java
@@ -20,8 +20,6 @@ package org.wso2.carbon.device.mgt.mobile.impl.ios;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
-import org.wso2.carbon.device.mgt.common.Feature;
-import org.wso2.carbon.device.mgt.common.FeatureManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.mobile.AbstractMobileOperationManager;
Loading…
Cancel
Save