resolving conflicts

revert-70aa11f8
madhawap 8 years ago
commit d62a9c8b83

@ -82,16 +82,17 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
int rows; int rows;
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "UPDATE DM_DEVICE SET DESCRIPTION = ?, LAST_UPDATED_TIMESTAMP = ? " + String sql = "UPDATE DM_DEVICE SET NAME = ?, DESCRIPTION = ?, LAST_UPDATED_TIMESTAMP = ? " +
"WHERE DEVICE_TYPE_ID = (SELECT ID FROM DM_DEVICE_TYPE WHERE NAME = ? AND PROVIDER_TENANT_ID = ?) " + "WHERE DEVICE_TYPE_ID = (SELECT ID FROM DM_DEVICE_TYPE WHERE NAME = ? AND PROVIDER_TENANT_ID = ?) " +
"AND DEVICE_IDENTIFICATION = ? AND TENANT_ID = ?"; "AND DEVICE_IDENTIFICATION = ? AND TENANT_ID = ?";
stmt = conn.prepareStatement(sql, new String[] {"id"}); stmt = conn.prepareStatement(sql, new String[] {"id"});
stmt.setString(1, device.getDescription()); stmt.setString(1, device.getName());
stmt.setTimestamp(2, new Timestamp(new Date().getTime())); stmt.setString(2, device.getDescription());
stmt.setString(3, device.getType()); stmt.setTimestamp(3, new Timestamp(new Date().getTime()));
stmt.setInt(4, tenantId); stmt.setString(4, device.getType());
stmt.setString(5, device.getDeviceIdentifier()); stmt.setInt(5, tenantId);
stmt.setInt(6, tenantId); stmt.setString(6, device.getDeviceIdentifier());
stmt.setInt(7, tenantId);
rows = stmt.executeUpdate(); rows = stmt.executeUpdate();
return (rows > 0); return (rows > 0);
} catch (SQLException e) { } catch (SQLException e) {

@ -275,7 +275,9 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
Device currentDevice = deviceDAO.getDevice(deviceIdentifier, tenantId); Device currentDevice = deviceDAO.getDevice(deviceIdentifier, tenantId);
device.setId(currentDevice.getId()); device.setId(currentDevice.getId());
device.getEnrolmentInfo().setId(currentDevice.getEnrolmentInfo().getId()); device.getEnrolmentInfo().setId(currentDevice.getEnrolmentInfo().getId());
if (device.getName() == null) {
device.setName(currentDevice.getName());
}
deviceDAO.updateDevice(device, tenantId); deviceDAO.updateDevice(device, tenantId);
enrollmentDAO.updateEnrollment(device.getEnrolmentInfo()); enrollmentDAO.updateEnrollment(device.getEnrolmentInfo());
DeviceManagementDAOFactory.commitTransaction(); DeviceManagementDAOFactory.commitTransaction();

@ -35,3 +35,14 @@ window.queryEditor = CodeMirror.fromTextArea(document.getElementById('policy-def
var validatePolicyProfile = function () { var validatePolicyProfile = function () {
return true; return true;
}; };
/**
* Generates policy profile feature list which will be saved with the profile.
*
* This function will be invoked from the relevant cdmf unit at the time of policy creation.
*
* @returns {Array} profile payloads
*/
var generateGenericPayload = function () {
return window.queryEditor.getValue();
};

@ -21,6 +21,7 @@ var policy = {};
var validateInline = {}; var validateInline = {};
var clearInline = {}; var clearInline = {};
var validateStep = {}; var validateStep = {};
var hasPolicyProfileScript = false;
var enableInlineError = function (inputField, errorMsg, errorSign) { var enableInlineError = function (inputField, errorMsg, errorSign) {
var fieldIdentifier = "#" + inputField; var fieldIdentifier = "#" + inputField;
@ -157,6 +158,9 @@ stepForwardFrom["policy-platform"] = function (actionButton) {
script.type = 'text/javascript'; script.type = 'text/javascript';
script.src = context + policyOperationsScriptSrc; script.src = context + policyOperationsScriptSrc;
$(".wr-advance-operations").prepend(script); $(".wr-advance-operations").prepend(script);
hasPolicyProfileScript = true;
} else {
hasPolicyProfileScript = false;
} }
if (policyOperationsStylesSrc) { if (policyOperationsStylesSrc) {
var style = document.createElement('link'); var style = document.createElement('link');
@ -172,11 +176,14 @@ stepForwardFrom["policy-platform"] = function (actionButton) {
* Forward action of policy profile page. Generates policy profile payload. * Forward action of policy profile page. Generates policy profile payload.
*/ */
stepForwardFrom["policy-profile"] = function () { stepForwardFrom["policy-profile"] = function () {
policy["profile"] = [];
if (hasPolicyProfileScript) {
/* /*
generatePolicyProfile() function should be implemented in plugin side and should include the logic to build the generatePolicyProfile() function should be implemented in plugin side and should include the logic to build the
policy profile object. policy profile object.
*/ */
policy["profile"] = generatePolicyProfile(); policy["profile"] = generatePolicyProfile();
}
// updating next-page wizard title with selected platform // updating next-page wizard title with selected platform
$("#policy-criteria-page-wizard-title").text("ADD " + policy["platform"] + " POLICY"); $("#policy-criteria-page-wizard-title").text("ADD " + policy["platform"] + " POLICY");
}; };
@ -185,11 +192,13 @@ stepForwardFrom["policy-profile"] = function () {
* Backward action of policy profile page. Moves back to platform selection step. * Backward action of policy profile page. Moves back to platform selection step.
*/ */
stepBackFrom["policy-profile"] = function () { stepBackFrom["policy-profile"] = function () {
if (hasPolicyProfileScript) {
/* /*
resetPolicyProfile() function should be implemented in plugin side and should include the logic to reset the policy resetPolicyProfile() function should be implemented in plugin side and should include the logic to reset the policy
profile object. profile object.
*/ */
resetPolicyProfile(); resetPolicyProfile();
}
}; };
/** /**
@ -365,12 +374,14 @@ stepForwardFrom["policy-naming"] = function () {
}; };
var savePolicy = function (policy, isActive, serviceURL) { var savePolicy = function (policy, isActive, serviceURL) {
var profilePayloads;
if (hasPolicyProfileScript) {
/* /*
generateProfileFeaturesList() should be implemented in the plugin side and should include logic to build the generateProfileFeaturesList() should be implemented in the plugin side and should include logic to build the
profilePayloads array which contains objects, {featureCode:"value", deviceType:"value", content:"value"}. profilePayloads array which contains objects, {featureCode:"value", deviceType:"value", content:"value"}.
policy["profile"] object will be available for the method which returns from the generatePolicyProfile() function. policy["profile"] object will be available for the method which returns from the generatePolicyProfile() function.
*/ */
var profilePayloads = generateProfileFeaturesList(); profilePayloads = generateProfileFeaturesList();
$.each(profilePayloads, function (i, item) { $.each(profilePayloads, function (i, item) {
$.each(item.content, function (key, value) { $.each(item.content, function (key, value) {
@ -380,6 +391,9 @@ var savePolicy = function (policy, isActive, serviceURL) {
} }
}); });
}); });
} else {
profilePayloads = generateGenericPayload();
}
var payload = { var payload = {
"policyName": policy["policyName"], "policyName": policy["policyName"],

Loading…
Cancel
Save