policy.setName(rb.getString("newpolicy") + "_" + new Integer(policy.getId()).toString());
policy.setLevel(activeLevel);
switch(activeLevel) {
case A:
actions = dbModel.getAActions();
policy.setAction(new ActionModel(actions, "-1"));
if(dbModel.addAPolicy(policy)) {
PolicyUtilities.setPolicyRanks(dbModel.getAPolicies(), true);
dbModel.setCurrentPolicy(policy);
policyAPoliciesLst.setModel(dbModel.getAPoliciesAsListModel());
currentPolicy.addPropertyChangeListener((ChangeListModel) policyAPoliciesLst.getModel());
}
break;
case C:
actions = dbModel.getCActions();
policy.setAction(new ActionModel(actions, "-1"));
if(dbModel.addCPolicy(policy)) {
PolicyUtilities.setPolicyRanks(dbModel.getCPolicies(), true);
dbModel.setCurrentPolicy(policy);
policyCPoliciesLst.setModel(dbModel.getCPoliciesAsListModel());
currentPolicy.addPropertyChangeListener((ChangeListModel) policyCPoliciesLst.getModel());
}
break;
case I:
policy.setRank(policyIPoliciesLst.getModel().getSize()+1);
actions = dbModel.getIActions();
policy.setAction(new ActionModel(actions, "-1"));
if(dbModel.addIPolicy(policy)) {
PolicyUtilities.setPolicyRanks(dbModel.getIPolicies(), true);
dbModel.setCurrentPolicy(policy);
policyIPoliciesLst.setModel(dbModel.getIPoliciesAsListModel());
currentPolicy.addPropertyChangeListener((ChangeListModel) policyIPoliciesLst.getModel());