Fixing policy descriptions

revert-70aa11f8
geethkokila 9 years ago
parent 9fca18ae90
commit d52df2474e

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

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

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

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

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

Loading…
Cancel
Save