public void validate() {
SubmitButton button = getSubmitButton();
String action = button.action;
if (action!=null && Compare.equalsIgnoreCase(action, "save")) {
ActionContext ctx = ActionContext.getActionContext();
Iterator i = config.getArchiveRules().getArchiveRules().iterator();
int j = 0;
while (i.hasNext()) {
ArchiveRules.Rule ar = (ArchiveRules.Rule)i.next();
ArchiveRuleBean arb = new ArchiveRuleBean(ar);
validateRequiredField(arb.getAction(), getMessage("config.sec_rules_action_missing")+" "+j+".");
validateRequiredField(arb.getField(), getMessage("config.sec_rules_field_missing")+" "+j+".");
validateRequiredField(arb.getRegEx(), getMessage("config.sec_rules_match_crit_missing")+" "+j+".");
try {
Pattern p = Pattern.compile(arb.getRegEx());
} catch (Exception e) {
ctx.addSimpleError(getMessage("config.rules_sec_match_crit_invalid")+" "+j+".");
}
j++;
}
j = 0;
i = config.getVolumes().getVolumes().iterator();
while (i.hasNext()) {
Volume v = (Volume)i.next();
validateRequiredField(v.getPath(), getMessage("config.volume_store_path_missing")+" "+j+".");
validateRequiredField(v.getIndexPath(), getMessage("config.volume_index_path_missing")+" "+j+".");
j++;
}
// active directory
if (this.config.getAuthMethod()==Config.AuthMethod.ACTIVEDIRECTORY) {
validateRequiredField(config.getADIdentity().getKDCAddress(), getMessage("config.sec_kdc_missing"));
validateRequiredField(config.getADIdentity().getLDAPAddress(), getMessage("config.sec_ldap_missing"));
}
j = 0;
i = config.getADIdentity().getRoleMaps().iterator();
while (i.hasNext()) {
LDAPIdentity.LDAPRoleMap r = (LDAPIdentity.LDAPRoleMap)i.next();
validateRequiredField(r.getRole(), getMessage("config.sec_role_no_select")+" "+j+".");
validateRequiredField(r.getAttribute(), getMessage("config.sec_ldap_no_select")+" "+j+".");
validateRequiredField(r.getRegEx(), getMessage("config.sec_role_match_crit_invalid")+" "+j+".");
try {
Pattern p = Pattern.compile(r.getRegEx());
} catch (Exception e) {
ctx.addSimpleError(getMessage("config.sec_role_match_crit_invalid")+" "+j+".");
}
j++;
}