public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
if (resourceName != null && isCommiting()) {
ActionErrors errs = new ActionErrors();
AbstractWizardSequence seq = getWizardSequence(request);
if (resourceName.equals("")) {
errs.add(Globals.ERROR_KEY, new BundleActionMessage(seq.getCurrentPageForm().getResourceBundle(), seq
.getCurrentPageForm().getResourcePrefix()
+ ".error.noResourceName"));
}
if (resourceName.length() > Resource.MAX_RESOURCE_NAME_LENGTH) {
errs.add(Globals.ERROR_KEY, new BundleActionMessage(seq.getCurrentPageForm().getResourceBundle(), seq
.getCurrentPageForm().getResourcePrefix()
+ ".error.resourceNameTooLong", String.valueOf(Resource.MAX_RESOURCE_NAME_LENGTH)));
}
if (resourceDescription.equals("")) {
errs.add(Globals.ERROR_KEY, new BundleActionMessage(seq.getCurrentPageForm().getResourceBundle(), seq
.getCurrentPageForm().getResourcePrefix()
+ ".error.noResourceDescription"));
}
try {
if (this.getResourceTypeForAccessRights().getResourceByName(getResourceName(), seq.getSession()) != null) {
errs.add(Globals.ERROR_KEY, new BundleActionMessage(seq.getCurrentPageForm().getResourceBundle(), seq
.getCurrentPageForm().getResourcePrefix()
+ ".error.duplicateName", getResourceName()));
}
} catch (Exception e) {
log.error("Failed to check if named resource already exists.", e);
errs.add(Globals.ERROR_KEY, new BundleActionMessage(seq.getCurrentPageForm().getResourceBundle(), seq
.getCurrentPageForm().getResourcePrefix()
+ ".error.failedToCheckForName", e.getMessage()));
}
return errs;
}