revert-70aa11f8
milanperera 10 years ago
parent 7ec10d670c
commit 5b2e0c8989

@ -77,7 +77,7 @@ public class EnrolmentDAOImpl implements EnrolmentDAO {
stmt.setString(1, enrolmentInfo.getOwnership().toString()); stmt.setString(1, enrolmentInfo.getOwnership().toString());
stmt.setString(2, enrolmentInfo.getStatus().toString()); stmt.setString(2, enrolmentInfo.getStatus().toString());
stmt.setTimestamp(3, new Timestamp(enrolmentInfo.getDateOfEnrolment())); stmt.setTimestamp(3, new Timestamp(enrolmentInfo.getDateOfEnrolment()));
stmt.setTimestamp(4, new Timestamp(enrolmentInfo.getDateOfLastUpdate())); stmt.setTimestamp(4, new Timestamp(new Date().getTime()));
stmt.setInt(5, deviceId); stmt.setInt(5, deviceId);
stmt.setString(6, enrolmentInfo.getOwner()); stmt.setString(6, enrolmentInfo.getOwner());
stmt.setInt(7, tenantId); stmt.setInt(7, tenantId);
@ -156,9 +156,9 @@ public class EnrolmentDAOImpl implements EnrolmentDAO {
conn = this.getConnection(); conn = this.getConnection();
String sql = "SELECT STATUS FROM DM_ENROLMENT WHERE DEVICE_ID = ? AND OWNER = ? AND TENANT_ID = ?"; String sql = "SELECT STATUS FROM DM_ENROLMENT WHERE DEVICE_ID = ? AND OWNER = ? AND TENANT_ID = ?";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setInt(2, deviceId); stmt.setInt(1, deviceId);
stmt.setString(3, currentOwner); stmt.setString(2, currentOwner);
stmt.setInt(4, tenantId); stmt.setInt(3, tenantId);
rs = stmt.executeQuery(); rs = stmt.executeQuery();
if (rs.next()) { if (rs.next()) {
status = EnrolmentInfo.Status.valueOf(rs.getString("STATUS")); status = EnrolmentInfo.Status.valueOf(rs.getString("STATUS"));

@ -138,6 +138,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
EnrolmentInfo newEnrolmentInfo = device.getEnrolmentInfo(); EnrolmentInfo newEnrolmentInfo = device.getEnrolmentInfo();
if (existingEnrolmentInfo != null && newEnrolmentInfo != null) { if (existingEnrolmentInfo != null && newEnrolmentInfo != null) {
if (existingEnrolmentInfo.equals(newEnrolmentInfo)) { if (existingEnrolmentInfo.equals(newEnrolmentInfo)) {
device.getEnrolmentInfo().setDateOfEnrolment(existingEnrolmentInfo.getDateOfEnrolment());
this.modifyEnrollment(device); this.modifyEnrollment(device);
status = true; status = true;
} else { } else {

@ -1245,10 +1245,11 @@ public class PolicyDAOImpl implements PolicyDAO {
stmt.setInt(1, deviceId); stmt.setInt(1, deviceId);
resultSet = stmt.executeQuery(); resultSet = stmt.executeQuery();
ByteArrayInputStream bais = null; ByteArrayInputStream bais = null;
ObjectInputStream ois = null; ObjectInputStream ois = null;
byte[] contentBytes; byte[] contentBytes;
while (resultSet.next()) {
try { try {
contentBytes = (byte[]) resultSet.getBytes("POLICY_CONTENT"); contentBytes = (byte[]) resultSet.getBytes("POLICY_CONTENT");
bais = new ByteArrayInputStream(contentBytes); bais = new ByteArrayInputStream(contentBytes);
@ -1270,6 +1271,7 @@ public class PolicyDAOImpl implements PolicyDAO {
} }
} }
} }
}
} catch (SQLException e) { } catch (SQLException e) {
String msg = "Error occurred while getting the applied policy."; String msg = "Error occurred while getting the applied policy.";

@ -322,6 +322,37 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
DM_APPLICATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION DM_APPLICATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
); );
CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
ID INT NOT NULL AUTO_INCREMENT,
DEVICE_ID INT NOT NULL,
POLICY_ID INT NOT NULL,
STATUS INT NULL,
LAST_SUCCESS_TIME TIMESTAMP NULL,
LAST_REQUESTED_TIME TIMESTAMP NULL,
LAST_FAILED_TIME TIMESTAMP NULL,
ATTEMPTS INT NULL,
PRIMARY KEY (ID),
CONSTRAINT FK_POLICY_COMPLIANCE_STATUS_POLICY
FOREIGN KEY (POLICY_ID)
REFERENCES DM_POLICY (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES (
ID INT NOT NULL AUTO_INCREMENT,
COMPLIANCE_STATUS_ID INT NOT NULL,
FEATURE_CODE INT NOT NULL,
STATUS INT NULL,
PRIMARY KEY (ID),
CONSTRAINT FK_COMPLIANCE_FEATURES_STATUS
FOREIGN KEY (COMPLIANCE_STATUS_ID)
REFERENCES DM_POLICY_COMPLIANCE_STATUS (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
-- POLICY RELATED TABLES FINISHED -- -- POLICY RELATED TABLES FINISHED --

Loading…
Cancel
Save