private boolean isLabelListValid() { List<KeyValue> labels = view.getLabels(); if (labels.isEmpty()) { view.hideLabelsError(); return true; } for (KeyValue keyValue : labels) { if (!OpenshiftValidator.isLabelNameValid(keyValue.getKey()) || !OpenshiftValidator.isLabelValueValid(keyValue.getValue())) { view.showLabelsError(locale.invalidLabelsError(), locale.invalidLabelsDetailError()); return false; } } view.hideLabelsError(); return true; }
private boolean isApplicationNameValid() { if (!OpenshiftValidator.isApplicationNameValid(osAppName)) { view.showApplicationNameError( locale.invalidApplicationNameError(), locale.invalidApplicationNameDetailError()); return false; } if (view.getMode() == CREATE_NEW_PROJECT) { for (Pair<String, String> pair : osApplications) { if (pair.getFirst().equals(view.getOpenShiftProjectName()) && pair.getSecond().equals(osAppName)) { view.showApplicationNameError(locale.existingApplicationNameError(), null); return false; } } } else if (view.getMode() == SELECT_EXISTING_PROJECT && view.getOpenShiftSelectedProject() != null) { for (Pair<String, String> pair : osApplications) { if (pair.getFirst().equals(view.getOpenShiftSelectedProject().getMetadata().getName()) && pair.getSecond().equals(osAppName)) { view.showApplicationNameError(locale.existingApplicationNameError(), null); return false; } } } view.hideApplicationNameError(); return true; }
private boolean isVariablesListValid() { List<KeyValue> variables = view.getEnvironmentVariables(); if (variables.isEmpty()) { view.hideVariablesError(); return true; } for (KeyValue keyValue : variables) { if (!OpenshiftValidator.isEnvironmentVariableNameValid(keyValue.getKey())) { view.showVariablesError(locale.invalidVariablesError()); return false; } } view.hideVariablesError(); return true; }
private boolean isProjectNameValid() { String osProjectName = view.getOpenShiftProjectName(); if (view.getMode() == CREATE_NEW_PROJECT) { if (!OpenshiftValidator.isProjectNameValid(osProjectName)) { view.showProjectNameError( locale.invalidProjectNameError(), locale.invalidProjectNameDetailError()); return false; } for (Project project : osProjects) { if (project.getMetadata().getName().equals(osProjectName)) { view.showProjectNameError(locale.existingProjectNameError(), null); return false; } } } else if (view.getMode() == SELECT_EXISTING_PROJECT) { if (view.getOpenShiftSelectedProject() == null) { return false; } } view.hideProjectNameError(); return true; }