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; }
private void setupMixin(Project project) { final ProjectConfigDto projectConfig = appContext.getCurrentProject().getRootProject(); List<String> mixins = projectConfig.getMixins(); if (!mixins.contains(OPENSHIFT_PROJECT_TYPE_ID)) { mixins.add(OPENSHIFT_PROJECT_TYPE_ID); } Map<String, List<String>> attributes = projectConfig.getAttributes(); attributes.put(OPENSHIFT_APPLICATION_VARIABLE_NAME, newArrayList(osAppName)); attributes.put( OPENSHIFT_NAMESPACE_VARIABLE_NAME, newArrayList(project.getMetadata().getName())); projectService .updateProject(appContext.getWorkspaceId(), projectConfig.getPath(), projectConfig) .then( new Operation<ProjectConfigDto>() { @Override public void apply(ProjectConfigDto project) throws OperationException { eventBus.fireEvent(new ProjectUpdatedEvent(projectConfig.getPath(), project)); notificationManager.notify( locale.linkProjectWithExistingSuccess(projectConfig.getName(), osAppName), SUCCESS, true); } }) .catchError( new Operation<PromiseError>() { @Override public void apply(PromiseError arg) throws OperationException { final ServiceError serviceError = dtoFactory.createDtoFromJson(arg.getMessage(), ServiceError.class); notificationManager.notify(serviceError.getMessage(), FAIL, true); } }); }