Added OS build date

revert-dabc3590
Chatura Dilan 9 years ago
parent 971185decf
commit bedb171eb7

@ -339,7 +339,7 @@ public class AndroidAPIUtils {
app.setVersion(element.getAsJsonObject().get(AndroidConstants.ApplicationProperties.VERSION).getAsString()); app.setVersion(element.getAsJsonObject().get(AndroidConstants.ApplicationProperties.VERSION).getAsString());
} }
if (element.getAsJsonObject().get(AndroidConstants.ApplicationProperties.IS_ACTIVE) != null) { if (element.getAsJsonObject().get(AndroidConstants.ApplicationProperties.IS_ACTIVE) != null) {
app.setActive(element.getAsJsonObject().get(AndroidConstants.ApplicationProperties.VERSION).getAsBoolean()); app.setActive(element.getAsJsonObject().get(AndroidConstants.ApplicationProperties.IS_ACTIVE).getAsBoolean());
} }
applications.add(app); applications.add(app);
} }
@ -396,6 +396,8 @@ public class AndroidAPIUtils {
deviceInfo.getDeviceDetailsMap().put("mac", prop.getValue()); deviceInfo.getDeviceDetailsMap().put("mac", prop.getValue());
} else if (prop.getName().equalsIgnoreCase("SERIAL")) { } else if (prop.getName().equalsIgnoreCase("SERIAL")) {
deviceInfo.getDeviceDetailsMap().put("serial", prop.getValue()); deviceInfo.getDeviceDetailsMap().put("serial", prop.getValue());
} else if (prop.getName().equalsIgnoreCase("OS_BUILD_DATE")) {
deviceInfo.setOsBuildDate(prop.getValue());
} }
} else { } else {
if (prop.getName().equalsIgnoreCase("CPU_INFO")) { if (prop.getName().equalsIgnoreCase("CPU_INFO")) {

@ -128,7 +128,7 @@ public final class AndroidConstants {
public static final String USS = "USS"; public static final String USS = "USS";
public static final String VERSION = "version"; public static final String VERSION = "version";
public static final String ICON = "icon"; public static final String ICON = "icon";
public static final String IS_ACTIVE = "is_active"; public static final String IS_ACTIVE = "isActive";
} }
} }

@ -53,7 +53,7 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
conn = AndroidDAOFactory.getConnection(); conn = AndroidDAOFactory.getConnection();
String selectDBQuery = String selectDBQuery =
"SELECT DEVICE_ID, GCM_TOKEN, DEVICE_INFO, DEVICE_MODEL, SERIAL, " + "SELECT DEVICE_ID, GCM_TOKEN, DEVICE_INFO, DEVICE_MODEL, SERIAL, " +
"VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, OS_VERSION" + "VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, OS_VERSION, OS_BUILD_DATE" +
" FROM AD_DEVICE WHERE DEVICE_ID = ?"; " FROM AD_DEVICE WHERE DEVICE_ID = ?";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, mblDeviceId); stmt.setString(1, mblDeviceId);
@ -70,6 +70,7 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
mobileDevice.setImei(rs.getString(AndroidPluginConstants.IMEI)); mobileDevice.setImei(rs.getString(AndroidPluginConstants.IMEI));
mobileDevice.setImsi(rs.getString(AndroidPluginConstants.IMSI)); mobileDevice.setImsi(rs.getString(AndroidPluginConstants.IMSI));
mobileDevice.setOsVersion(rs.getString(AndroidPluginConstants.OS_VERSION)); mobileDevice.setOsVersion(rs.getString(AndroidPluginConstants.OS_VERSION));
mobileDevice.setOsBuildDate(rs.getString(AndroidPluginConstants.OS_BUILD_DATE));
Map<String, String> propertyMap = new HashMap<String, String>(); Map<String, String> propertyMap = new HashMap<String, String>();
propertyMap.put(AndroidPluginConstants.GCM_TOKEN, rs.getString(AndroidPluginConstants.GCM_TOKEN)); propertyMap.put(AndroidPluginConstants.GCM_TOKEN, rs.getString(AndroidPluginConstants.GCM_TOKEN));
@ -104,7 +105,7 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
String createDBQuery = String createDBQuery =
"INSERT INTO AD_DEVICE(DEVICE_ID, GCM_TOKEN, DEVICE_INFO, SERIAL, " + "INSERT INTO AD_DEVICE(DEVICE_ID, GCM_TOKEN, DEVICE_INFO, SERIAL, " +
"VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, " + "VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, " +
"OS_VERSION, DEVICE_MODEL) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; "OS_VERSION, DEVICE_MODEL, OS_BUILD_DATE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(createDBQuery); stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, mobileDevice.getMobileDeviceId()); stmt.setString(1, mobileDevice.getMobileDeviceId());
@ -122,6 +123,7 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
stmt.setString(11, mobileDevice.getImsi()); stmt.setString(11, mobileDevice.getImsi());
stmt.setString(12, mobileDevice.getOsVersion()); stmt.setString(12, mobileDevice.getOsVersion());
stmt.setString(13, mobileDevice.getModel()); stmt.setString(13, mobileDevice.getModel());
stmt.setString(14, mobileDevice.getOsBuildDate());
int rows = stmt.executeUpdate(); int rows = stmt.executeUpdate();
if (rows > 0) { if (rows > 0) {
status = true; status = true;
@ -149,7 +151,7 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
String updateDBQuery = String updateDBQuery =
"UPDATE AD_DEVICE SET GCM_TOKEN = ?, DEVICE_INFO = ?, SERIAL = ?, VENDOR = ?, " + "UPDATE AD_DEVICE SET GCM_TOKEN = ?, DEVICE_INFO = ?, SERIAL = ?, VENDOR = ?, " +
"MAC_ADDRESS = ?, DEVICE_NAME = ?, LATITUDE = ?, LONGITUDE = ?, IMEI = ?, " + "MAC_ADDRESS = ?, DEVICE_NAME = ?, LATITUDE = ?, LONGITUDE = ?, IMEI = ?, " +
"IMSI = ?, OS_VERSION = ?, DEVICE_MODEL = ? WHERE DEVICE_ID = ?"; "IMSI = ?, OS_VERSION = ?, DEVICE_MODEL = ?, OS_BUILD_DATE = ? WHERE DEVICE_ID = ?";
stmt = conn.prepareStatement(updateDBQuery); stmt = conn.prepareStatement(updateDBQuery);
Map<String, String> properties = mobileDevice.getDeviceProperties(); Map<String, String> properties = mobileDevice.getDeviceProperties();
@ -166,6 +168,7 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
stmt.setString(11, mobileDevice.getOsVersion()); stmt.setString(11, mobileDevice.getOsVersion());
stmt.setString(12, mobileDevice.getModel()); stmt.setString(12, mobileDevice.getModel());
stmt.setString(13, mobileDevice.getMobileDeviceId()); stmt.setString(13, mobileDevice.getMobileDeviceId());
stmt.setString(14, mobileDevice.getOsBuildDate());
int rows = stmt.executeUpdate(); int rows = stmt.executeUpdate();
if (rows > 0) { if (rows > 0) {
status = true; status = true;
@ -225,7 +228,7 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
conn = AndroidDAOFactory.getConnection(); conn = AndroidDAOFactory.getConnection();
String selectDBQuery = String selectDBQuery =
"SELECT DEVICE_ID, GCM_TOKEN, DEVICE_INFO, DEVICE_MODEL, SERIAL, " + "SELECT DEVICE_ID, GCM_TOKEN, DEVICE_INFO, DEVICE_MODEL, SERIAL, " +
"VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, OS_VERSION " + "VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, OS_VERSION, OS_BUILD_DATE " +
"FROM AD_DEVICE"; "FROM AD_DEVICE";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
rs = stmt.executeQuery(); rs = stmt.executeQuery();
@ -241,6 +244,7 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
mobileDevice.setImei(rs.getString(AndroidPluginConstants.IMEI)); mobileDevice.setImei(rs.getString(AndroidPluginConstants.IMEI));
mobileDevice.setImsi(rs.getString(AndroidPluginConstants.IMSI)); mobileDevice.setImsi(rs.getString(AndroidPluginConstants.IMSI));
mobileDevice.setOsVersion(rs.getString(AndroidPluginConstants.OS_VERSION)); mobileDevice.setOsVersion(rs.getString(AndroidPluginConstants.OS_VERSION));
mobileDevice.setOsBuildDate(rs.getString(AndroidPluginConstants.OS_BUILD_DATE));
Map<String, String> propertyMap = new HashMap<>(); Map<String, String> propertyMap = new HashMap<>();
propertyMap.put(AndroidPluginConstants.GCM_TOKEN, rs.getString(AndroidPluginConstants.GCM_TOKEN)); propertyMap.put(AndroidPluginConstants.GCM_TOKEN, rs.getString(AndroidPluginConstants.GCM_TOKEN));

@ -36,6 +36,7 @@ public class AndroidPluginConstants {
public static final String IMSI = "IMSI"; public static final String IMSI = "IMSI";
public static final String VENDOR = "VENDOR"; public static final String VENDOR = "VENDOR";
public static final String OS_VERSION = "OS_VERSION"; public static final String OS_VERSION = "OS_VERSION";
public static final String OS_BUILD_DATE = "OS_BUILD_DATE";
public static final String MAC_ADDRESS = "MAC_ADDRESS"; public static final String MAC_ADDRESS = "MAC_ADDRESS";
//Properties related to AD_FEATURE table //Properties related to AD_FEATURE table

@ -19,6 +19,7 @@
package org.wso2.carbon.device.mgt.mobile.dto; package org.wso2.carbon.device.mgt.mobile.dto;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -36,6 +37,8 @@ public class MobileDevice implements Serializable {
private String imei; private String imei;
private String imsi; private String imsi;
private String serial; private String serial;
private String osBuildDate;
private Map<String, String> deviceProperties; private Map<String, String> deviceProperties;
public MobileDevice() { public MobileDevice() {
@ -122,4 +125,11 @@ public class MobileDevice implements Serializable {
this.deviceProperties = deviceProperties; this.deviceProperties = deviceProperties;
} }
public String getOsBuildDate() {
return osBuildDate;
}
public void setOsBuildDate(String osBuildDate) {
this.osBuildDate = osBuildDate;
}
} }

@ -38,6 +38,9 @@ import org.wso2.carbon.registry.core.Registry;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File; import java.io.File;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
/** /**
@ -54,6 +57,7 @@ public class MobileDeviceManagementUtil {
private static final String MOBILE_DEVICE_LATITUDE = "LATITUDE"; private static final String MOBILE_DEVICE_LATITUDE = "LATITUDE";
private static final String MOBILE_DEVICE_LONGITUDE = "LONGITUDE"; private static final String MOBILE_DEVICE_LONGITUDE = "LONGITUDE";
private static final String MOBILE_DEVICE_SERIAL = "SERIAL"; private static final String MOBILE_DEVICE_SERIAL = "SERIAL";
private static final String MOBILE_DEVICE_OS_BUILD_DATE = "OS_BUILD_DATE";
public static Document convertToDocument(File file) throws DeviceManagementException { public static Document convertToDocument(File file) throws DeviceManagementException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
@ -100,6 +104,7 @@ public class MobileDeviceManagementUtil {
mobileDevice.setLatitude(getPropertyValue(device, MOBILE_DEVICE_LATITUDE)); mobileDevice.setLatitude(getPropertyValue(device, MOBILE_DEVICE_LATITUDE));
mobileDevice.setLongitude(getPropertyValue(device, MOBILE_DEVICE_LONGITUDE)); mobileDevice.setLongitude(getPropertyValue(device, MOBILE_DEVICE_LONGITUDE));
mobileDevice.setSerial(getPropertyValue(device, MOBILE_DEVICE_SERIAL)); mobileDevice.setSerial(getPropertyValue(device, MOBILE_DEVICE_SERIAL));
mobileDevice.setOsBuildDate(getPropertyValue(device, MOBILE_DEVICE_OS_BUILD_DATE));
if (device.getProperties() != null) { if (device.getProperties() != null) {
Map<String, String> deviceProperties = new HashMap<String, String>(); Map<String, String> deviceProperties = new HashMap<String, String>();
@ -124,6 +129,7 @@ public class MobileDeviceManagementUtil {
propertyList.add(getProperty(MOBILE_DEVICE_IMSI, mobileDevice.getImsi())); propertyList.add(getProperty(MOBILE_DEVICE_IMSI, mobileDevice.getImsi()));
propertyList.add(getProperty(MOBILE_DEVICE_MODEL, mobileDevice.getModel())); propertyList.add(getProperty(MOBILE_DEVICE_MODEL, mobileDevice.getModel()));
propertyList.add(getProperty(MOBILE_DEVICE_OS_VERSION, mobileDevice.getOsVersion())); propertyList.add(getProperty(MOBILE_DEVICE_OS_VERSION, mobileDevice.getOsVersion()));
propertyList.add(getProperty(MOBILE_DEVICE_OS_BUILD_DATE, mobileDevice.getOsBuildDate()));
propertyList.add(getProperty(MOBILE_DEVICE_VENDOR, mobileDevice.getVendor())); propertyList.add(getProperty(MOBILE_DEVICE_VENDOR, mobileDevice.getVendor()));
if(mobileDevice.getLatitude() != null) { if(mobileDevice.getLatitude() != null) {
propertyList.add(getProperty(MOBILE_DEVICE_LATITUDE, mobileDevice.getLatitude())); propertyList.add(getProperty(MOBILE_DEVICE_LATITUDE, mobileDevice.getLatitude()));

@ -16,6 +16,7 @@ CREATE TABLE IF NOT EXISTS `AD_DEVICE` (
`TOKEN` VARCHAR(500) NULL DEFAULT NULL, `TOKEN` VARCHAR(500) NULL DEFAULT NULL,
`UNLOCK_TOKEN` VARCHAR(500) NULL DEFAULT NULL, `UNLOCK_TOKEN` VARCHAR(500) NULL DEFAULT NULL,
`SERIAL` VARCHAR(45) NULL DEFAULT NULL, `SERIAL` VARCHAR(45) NULL DEFAULT NULL,
`OS_BUILD_DATE` VARCHAR(45) NULL DEFAULT NULL,
PRIMARY KEY (`DEVICE_ID`) ); PRIMARY KEY (`DEVICE_ID`) );

@ -16,6 +16,7 @@ CREATE TABLE IF NOT EXISTS `AD_DEVICE` (
`SERIAL` VARCHAR(45) NULL DEFAULT NULL, `SERIAL` VARCHAR(45) NULL DEFAULT NULL,
`MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL, `MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL,
`DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL, `DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL,
`OS_BUILD_DATE` VARCHAR(100) NULL DEFAULT NULL,
PRIMARY KEY (`DEVICE_ID`)); PRIMARY KEY (`DEVICE_ID`));
-- ----------------------------------------------------- -- -----------------------------------------------------

@ -15,6 +15,7 @@ CREATE TABLE AD_DEVICE (
SERIAL VARCHAR(45) NULL DEFAULT NULL, SERIAL VARCHAR(45) NULL DEFAULT NULL,
MAC_ADDRESS VARCHAR(45) NULL DEFAULT NULL, MAC_ADDRESS VARCHAR(45) NULL DEFAULT NULL,
DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL, DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL,
OS_BUILD_DATE VARCHAR(100) NULL DEFAULT NULL,
PRIMARY KEY (DEVICE_ID)); PRIMARY KEY (DEVICE_ID));
-- ----------------------------------------------------- -- -----------------------------------------------------

@ -15,6 +15,7 @@ CREATE TABLE IF NOT EXISTS `AD_DEVICE` (
`SERIAL` VARCHAR(45) NULL DEFAULT NULL, `SERIAL` VARCHAR(45) NULL DEFAULT NULL,
`MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL, `MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL,
`DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL, `DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL,
`OS_BUILD_DATE` VARCHAR(100) NULL DEFAULT NULL,
PRIMARY KEY (`DEVICE_ID`)) PRIMARY KEY (`DEVICE_ID`))
ENGINE = InnoDB; ENGINE = InnoDB;

@ -15,6 +15,7 @@ CREATE TABLE AD_DEVICE (
SERIAL VARCHAR(45) DEFAULT NULL, SERIAL VARCHAR(45) DEFAULT NULL,
MAC_ADDRESS VARCHAR(45) DEFAULT NULL, MAC_ADDRESS VARCHAR(45) DEFAULT NULL,
DEVICE_NAME VARCHAR(100) DEFAULT NULL, DEVICE_NAME VARCHAR(100) DEFAULT NULL,
OS_BUILD_DATE VARCHAR(100) DEFAULT NULL,
CONSTRAINT PK_AD_DEVICE PRIMARY KEY (DEVICE_ID) CONSTRAINT PK_AD_DEVICE PRIMARY KEY (DEVICE_ID)
) )
/ /

@ -15,6 +15,7 @@ CREATE TABLE IF NOT EXISTS AD_DEVICE (
SERIAL VARCHAR(45) NULL DEFAULT NULL, SERIAL VARCHAR(45) NULL DEFAULT NULL,
MAC_ADDRESS VARCHAR(45) NULL DEFAULT NULL, MAC_ADDRESS VARCHAR(45) NULL DEFAULT NULL,
DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL, DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL,
OS_BUILD_DATE VARCHAR(100) NULL DEFAULT NULL,
PRIMARY KEY (DEVICE_ID) PRIMARY KEY (DEVICE_ID)
); );

@ -16,6 +16,7 @@ CREATE TABLE IF NOT EXISTS `AD_DEVICE` (
`SERIAL` VARCHAR(45) NULL DEFAULT NULL, `SERIAL` VARCHAR(45) NULL DEFAULT NULL,
`MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL, `MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL,
`DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL, `DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL,
`OS_BUILD_DATE` VARCHAR(100) NULL DEFAULT NULL,
PRIMARY KEY (`DEVICE_ID`)); PRIMARY KEY (`DEVICE_ID`));
-- ----------------------------------------------------- -- -----------------------------------------------------

@ -15,6 +15,7 @@ CREATE TABLE AD_DEVICE (
SERIAL VARCHAR(45) NULL DEFAULT NULL, SERIAL VARCHAR(45) NULL DEFAULT NULL,
MAC_ADDRESS VARCHAR(45) NULL DEFAULT NULL, MAC_ADDRESS VARCHAR(45) NULL DEFAULT NULL,
DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL, DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL,
OS_BUILD_DATE VARCHAR(100) NULL DEFAULT NULL,
PRIMARY KEY (DEVICE_ID)); PRIMARY KEY (DEVICE_ID));
-- ----------------------------------------------------- -- -----------------------------------------------------

@ -15,6 +15,7 @@ CREATE TABLE IF NOT EXISTS `AD_DEVICE` (
`SERIAL` VARCHAR(45) NULL DEFAULT NULL, `SERIAL` VARCHAR(45) NULL DEFAULT NULL,
`MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL, `MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL,
`DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL, `DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL,
`OS_BUILD_DATE` VARCHAR(100) NULL DEFAULT NULL,
PRIMARY KEY (`DEVICE_ID`)) PRIMARY KEY (`DEVICE_ID`))
ENGINE = InnoDB; ENGINE = InnoDB;

@ -15,6 +15,7 @@ CREATE TABLE AD_DEVICE (
SERIAL VARCHAR(45) DEFAULT NULL, SERIAL VARCHAR(45) DEFAULT NULL,
MAC_ADDRESS VARCHAR(45) DEFAULT NULL, MAC_ADDRESS VARCHAR(45) DEFAULT NULL,
DEVICE_NAME VARCHAR(100) DEFAULT NULL, DEVICE_NAME VARCHAR(100) DEFAULT NULL,
OS_BUILD_DATE VARCHAR(100) DEFAULT NULL,
CONSTRAINT PK_AD_DEVICE PRIMARY KEY (DEVICE_ID) CONSTRAINT PK_AD_DEVICE PRIMARY KEY (DEVICE_ID)
) )
/ /

@ -15,6 +15,7 @@ CREATE TABLE IF NOT EXISTS AD_DEVICE (
SERIAL VARCHAR(45) NULL DEFAULT NULL, SERIAL VARCHAR(45) NULL DEFAULT NULL,
MAC_ADDRESS VARCHAR(45) NULL DEFAULT NULL, MAC_ADDRESS VARCHAR(45) NULL DEFAULT NULL,
DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL, DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL,
OS_BUILD_DATE VARCHAR(100) NULL DEFAULT NULL,
PRIMARY KEY (DEVICE_ID) PRIMARY KEY (DEVICE_ID)
); );

Loading…
Cancel
Save