|
|
@ -26,6 +26,7 @@ import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.dao.MobileFeatureDAO;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.dao.MobileFeatureDAO;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.dto.MobileFeature;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.dto.MobileFeature;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.AndroidDAOFactory;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.AndroidFeatureManagementDAOException;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.AndroidFeatureManagementDAOException;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.impl.android.util.AndroidPluginConstants;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.impl.android.util.AndroidPluginConstants;
|
|
|
|
|
|
|
|
|
|
|
@ -42,6 +43,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
|
|
|
|
private static final Log log = LogFactory.getLog(AndroidFeatureDAOImpl.class);
|
|
|
|
private static final Log log = LogFactory.getLog(AndroidFeatureDAOImpl.class);
|
|
|
|
|
|
|
|
|
|
|
|
public AndroidFeatureDAOImpl() {
|
|
|
|
public AndroidFeatureDAOImpl() {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -51,7 +53,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
|
|
|
|
boolean status = false;
|
|
|
|
boolean status = false;
|
|
|
|
Connection conn = null;
|
|
|
|
Connection conn = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = MobileDeviceManagementDAOFactory.getConnection();
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
|
String sql = "INSERT INTO AD_FEATURE(CODE, NAME, DESCRIPTION) VALUES (?, ?, ?)";
|
|
|
|
String sql = "INSERT INTO AD_FEATURE(CODE, NAME, DESCRIPTION) VALUES (?, ?, ?)";
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt.setString(1, mobileFeature.getCode());
|
|
|
|
stmt.setString(1, mobileFeature.getCode());
|
|
|
@ -76,7 +78,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
|
|
|
|
Connection conn = null;
|
|
|
|
Connection conn = null;
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = MobileDeviceManagementDAOFactory.getConnection();
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
|
String updateDBQuery =
|
|
|
|
String updateDBQuery =
|
|
|
|
"UPDATE AD_FEATURE SET NAME = ?, DESCRIPTION = ?" +
|
|
|
|
"UPDATE AD_FEATURE SET NAME = ?, DESCRIPTION = ?" +
|
|
|
|
"WHERE CODE = ?";
|
|
|
|
"WHERE CODE = ?";
|
|
|
@ -112,7 +114,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
|
|
|
|
boolean status = false;
|
|
|
|
boolean status = false;
|
|
|
|
Connection conn = null;
|
|
|
|
Connection conn = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = MobileDeviceManagementDAOFactory.getConnection();
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
|
String sql = "DELETE FROM AD_FEATURE WHERE ID = ?";
|
|
|
|
String sql = "DELETE FROM AD_FEATURE WHERE ID = ?";
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt.setInt(1, mblFeatureId);
|
|
|
|
stmt.setInt(1, mblFeatureId);
|
|
|
@ -135,7 +137,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
|
|
|
|
boolean status = false;
|
|
|
|
boolean status = false;
|
|
|
|
Connection conn = null;
|
|
|
|
Connection conn = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = MobileDeviceManagementDAOFactory.getConnection();
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
|
String sql = "DELETE FROM AD_FEATURE WHERE CODE = ?";
|
|
|
|
String sql = "DELETE FROM AD_FEATURE WHERE CODE = ?";
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt.setString(1, mblFeatureCode);
|
|
|
|
stmt.setString(1, mblFeatureCode);
|
|
|
@ -158,7 +160,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
|
|
|
|
ResultSet rs = null;
|
|
|
|
ResultSet rs = null;
|
|
|
|
Connection conn = null;
|
|
|
|
Connection conn = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = MobileDeviceManagementDAOFactory.getConnection();
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
|
String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM AD_FEATURE WHERE ID = ?";
|
|
|
|
String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM AD_FEATURE WHERE ID = ?";
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt.setInt(1, mblFeatureId);
|
|
|
|
stmt.setInt(1, mblFeatureId);
|
|
|
@ -182,7 +184,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
|
|
|
|
mblFeatureId + "' from the Android database.", e);
|
|
|
|
mblFeatureId + "' from the Android database.", e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
MobileDeviceManagementDAOFactory.closeConnection();
|
|
|
|
AndroidDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -194,7 +196,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
|
|
|
|
Connection conn = null;
|
|
|
|
Connection conn = null;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = MobileDeviceManagementDAOFactory.getConnection();
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
|
String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM AD_FEATURE WHERE CODE = ?";
|
|
|
|
String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM AD_FEATURE WHERE CODE = ?";
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt.setString(1, mblFeatureCode);
|
|
|
|
stmt.setString(1, mblFeatureCode);
|
|
|
@ -218,7 +220,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
|
|
|
|
mblFeatureCode + "' from the Android database.", e);
|
|
|
|
mblFeatureCode + "' from the Android database.", e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
MobileDeviceManagementDAOFactory.closeConnection();
|
|
|
|
AndroidDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -237,7 +239,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
|
|
|
|
List<MobileFeature> features = new ArrayList<MobileFeature>();
|
|
|
|
List<MobileFeature> features = new ArrayList<MobileFeature>();
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = MobileDeviceManagementDAOFactory.getConnection();
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
|
String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM AD_FEATURE";
|
|
|
|
String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM AD_FEATURE";
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
stmt = conn.prepareStatement(sql);
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
rs = stmt.executeQuery();
|
|
|
@ -260,7 +262,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
|
|
|
|
"android features from the android database.", e);
|
|
|
|
"android features from the android database.", e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
MobileDeviceManagementDAOFactory.closeConnection();
|
|
|
|
AndroidDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|