private ParsedFormData isValid(FormData formData) { ParsedFormData result; result = new ParsedFormData(ParsedFormData.Status.ERROR); if (!isValidName(formData.getName()) || !isValidPckg(formData.getPckg()) || !isValidDescription(formData.getDescription())) { return result; } Project project = new Project(); project.setName(formData.getName()); project.setDescription(formData.getDescription()); project.setPckg(formData.getPckg()); result.setProject(project); VCSConfiguration vcsConfig; try { vcsConfig = getVCSConfig(formData); } catch (IllegalArgumentException ex) { return result; } result.setVcsConfiguration(vcsConfig); CIConfiguration ciConfig; try { ciConfig = getCIConfig(formData); } catch (IllegalArgumentException ex) { return result; } result.setCiConfiguration(ciConfig); JiraConfiguration jiraConfig; try { jiraConfig = getJiraConfig(formData); } catch (IllegalArgumentException ex) { return result; } result.setJiraConfiguration(jiraConfig); if (isValidGroupName(formData.getJiraGroupName()) != null) { return result; } result.setJiraGroupName(formData.getJiraGroupName()); if (!isValidJiraPermissionScheme(jiraConfig, formData.getJiraPermissionScheme())) { return result; } result.setJiraPermissionScheme(formData.getJiraPermissionScheme()); if (isValidJIRAProjectKey(formData.getJiraConfigName(), formData.getJiraProjectKey()) != null) { return result; } result.setJiraProjectKey(formData.getJiraProjectKey()); if (formData.getUsers().isEmpty()) { return result; } result.setJiraUsers(formData.getUsers()); CatalogEntry scaffold; try { scaffold = getScaffold(formData); } catch (IllegalArgumentException ex) { return result; } result.setScaffold(scaffold); if (isRequiredContextFilledIn(scaffold, formData)) { result.setContext(formData.getContextParameters()); result.setStatus(ParsedFormData.Status.OK); } return result; }
@JavaScriptMethod public boolean isValidPckg(String value) { return Project.isValidPackage(value); }
@JavaScriptMethod public boolean isValidDescription(String value) { return Project.isValidDescription(value); }
/* * ############################ * Form events * ############################ */ @JavaScriptMethod public boolean isValidName(String value) { return Project.isValidName(value); }