harshanl 9 years ago
commit 2a6db0cdc4

@ -44,10 +44,11 @@ public class Policy implements Comparable<Policy>, Serializable {
private List<String> users; private List<String> users;
private boolean active; private boolean active;
private boolean updated; private boolean updated;
private String description;
/* Compliance data*/ /* Compliance data*/
private String Compliance; private String compliance;
/*Dynamic policy attributes*/ /*Dynamic policy attributes*/
@ -170,6 +171,14 @@ public class Policy implements Comparable<Policy>, Serializable {
this.updated = updated; this.updated = updated;
} }
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@XmlElement @XmlElement
public List<PolicyCriterion> getPolicyCriterias() { public List<PolicyCriterion> getPolicyCriterias() {
return policyCriterias; return policyCriterias;
@ -181,11 +190,11 @@ public class Policy implements Comparable<Policy>, Serializable {
@XmlElement @XmlElement
public String getCompliance() { public String getCompliance() {
return Compliance; return compliance;
} }
public void setCompliance(String compliance) { public void setCompliance(String compliance) {
Compliance = compliance; this.compliance = compliance;
} }
@XmlElement @XmlElement

@ -629,15 +629,16 @@ public class PolicyDAOImpl implements PolicyDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String query = "UPDATE DM_POLICY SET NAME = ?, PROFILE_ID = ?, PRIORITY = ?, COMPLIANCE = ?," + String query = "UPDATE DM_POLICY SET NAME = ?, PROFILE_ID = ?, PRIORITY = ?, COMPLIANCE = ?," +
" UPDATED = ? WHERE ID = ? AND TENANT_ID = ?"; " UPDATED = ?, DESCRIPTION = ? WHERE ID = ? AND TENANT_ID = ?";
stmt = conn.prepareStatement(query); stmt = conn.prepareStatement(query);
stmt.setString(1, policy.getPolicyName()); stmt.setString(1, policy.getPolicyName());
stmt.setInt(2, policy.getProfile().getProfileId()); stmt.setInt(2, policy.getProfile().getProfileId());
stmt.setInt(3, policy.getPriorityId()); stmt.setInt(3, policy.getPriorityId());
stmt.setString(4, policy.getCompliance()); stmt.setString(4, policy.getCompliance());
stmt.setInt(5, 1); stmt.setInt(5, 1);
stmt.setInt(6, policy.getId()); stmt.setString(6, policy.getDescription());
stmt.setInt(7, tenantId); stmt.setInt(7, policy.getId());
stmt.setInt(8, tenantId);
stmt.executeUpdate(); stmt.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
@ -742,6 +743,7 @@ public class PolicyDAOImpl implements PolicyDAO {
policy.setPriorityId(resultSet.getInt("PRIORITY")); policy.setPriorityId(resultSet.getInt("PRIORITY"));
policy.setProfileId(resultSet.getInt("PROFILE_ID")); policy.setProfileId(resultSet.getInt("PROFILE_ID"));
policy.setCompliance(resultSet.getString("COMPLIANCE")); policy.setCompliance(resultSet.getString("COMPLIANCE"));
policy.setDescription(resultSet.getString("DESCRIPTION"));
} }
return policy; return policy;
@ -775,6 +777,7 @@ public class PolicyDAOImpl implements PolicyDAO {
policy.setTenantId(resultSet.getInt("TENANT_ID")); policy.setTenantId(resultSet.getInt("TENANT_ID"));
policy.setPriorityId(resultSet.getInt("PRIORITY")); policy.setPriorityId(resultSet.getInt("PRIORITY"));
policy.setCompliance(resultSet.getString("COMPLIANCE")); policy.setCompliance(resultSet.getString("COMPLIANCE"));
policy.setDescription(resultSet.getString("DESCRIPTION"));
} }
return policy; return policy;
} catch (SQLException e) { } catch (SQLException e) {
@ -810,6 +813,7 @@ public class PolicyDAOImpl implements PolicyDAO {
policy.setOwnershipType(resultSet.getString("OWNERSHIP_TYPE")); policy.setOwnershipType(resultSet.getString("OWNERSHIP_TYPE"));
policy.setUpdated(PolicyManagerUtil.convertIntToBoolean(resultSet.getInt("UPDATED"))); policy.setUpdated(PolicyManagerUtil.convertIntToBoolean(resultSet.getInt("UPDATED")));
policy.setActive(PolicyManagerUtil.convertIntToBoolean(resultSet.getInt("ACTIVE"))); policy.setActive(PolicyManagerUtil.convertIntToBoolean(resultSet.getInt("ACTIVE")));
policy.setDescription(resultSet.getString("DESCRIPTION"));
policies.add(policy); policies.add(policy);
} }
return policies; return policies;
@ -1185,8 +1189,7 @@ public class PolicyDAOImpl implements PolicyDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String query = "INSERT INTO DM_POLICY (NAME, PROFILE_ID, TENANT_ID, PRIORITY, COMPLIANCE, OWNERSHIP_TYPE," + String query = "INSERT INTO DM_POLICY (NAME, PROFILE_ID, TENANT_ID, PRIORITY, COMPLIANCE, OWNERSHIP_TYPE," +
" " + "UPDATED, ACTIVE, DESCRIPTION) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
"UPDATED, ACTIVE) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(query, PreparedStatement.RETURN_GENERATED_KEYS); stmt = conn.prepareStatement(query, PreparedStatement.RETURN_GENERATED_KEYS);
stmt.setString(1, policy.getPolicyName()); stmt.setString(1, policy.getPolicyName());
@ -1197,6 +1200,7 @@ public class PolicyDAOImpl implements PolicyDAO {
stmt.setString(6, policy.getOwnershipType()); stmt.setString(6, policy.getOwnershipType());
stmt.setInt(7, 0); stmt.setInt(7, 0);
stmt.setInt(8, 0); stmt.setInt(8, 0);
stmt.setString(9, policy.getDescription());
int affectedRows = stmt.executeUpdate(); int affectedRows = stmt.executeUpdate();

@ -39,6 +39,7 @@ public class PolicyCreator {
policy.setUsers(users); policy.setUsers(users);
policy.setCompliance("NOTIFY"); policy.setCompliance("NOTIFY");
policy.setOwnershipType("COPE"); policy.setOwnershipType("COPE");
policy.setDescription("This is the first policy.");
return policy; return policy;
} }
@ -87,6 +88,7 @@ public class PolicyCreator {
policy.setOwnershipType("COPE"); policy.setOwnershipType("COPE");
policy.setPolicyCriterias(criteria); policy.setPolicyCriterias(criteria);
policy.setDescription("This is the second policy.");
return policy; return policy;
@ -126,7 +128,7 @@ public class PolicyCreator {
criteria.add(criterion); criteria.add(criterion);
policy.setPolicyCriterias(criteria); policy.setPolicyCriterias(criteria);
policy.setDescription("This is the third policy.");
return policy; return policy;
} }
@ -175,6 +177,8 @@ public class PolicyCreator {
policy.setPolicyCriterias(criteria); policy.setPolicyCriterias(criteria);
policy.setDescription("This is the fourth policy.");
return policy; return policy;
} }

@ -139,6 +139,7 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE (
CREATE TABLE IF NOT EXISTS DM_POLICY ( CREATE TABLE IF NOT EXISTS DM_POLICY (
ID INT(11) NOT NULL AUTO_INCREMENT , ID INT(11) NOT NULL AUTO_INCREMENT ,
NAME VARCHAR(45) NULL DEFAULT NULL , NAME VARCHAR(45) NULL DEFAULT NULL ,
DESCRIPTION VARCHAR(1000) NULL,
TENANT_ID INT(11) NOT NULL , TENANT_ID INT(11) NOT NULL ,
PROFILE_ID INT(11) NOT NULL , PROFILE_ID INT(11) NOT NULL ,
OWNERSHIP_TYPE VARCHAR(45) NULL, OWNERSHIP_TYPE VARCHAR(45) NULL,

@ -124,6 +124,7 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE (
CREATE TABLE IF NOT EXISTS DM_POLICY ( CREATE TABLE IF NOT EXISTS DM_POLICY (
ID INT(11) NOT NULL AUTO_INCREMENT , ID INT(11) NOT NULL AUTO_INCREMENT ,
NAME VARCHAR(45) DEFAULT NULL , NAME VARCHAR(45) DEFAULT NULL ,
DESCRIPTION VARCHAR(1000) NULL,
TENANT_ID INT(11) NOT NULL , TENANT_ID INT(11) NOT NULL ,
PROFILE_ID INT(11) NOT NULL , PROFILE_ID INT(11) NOT NULL ,
OWNERSHIP_TYPE VARCHAR(45) NULL, OWNERSHIP_TYPE VARCHAR(45) NULL,

Loading…
Cancel
Save