private void validateExistingProjectHasValidStateForImport( final BackupProject backupProject, final BackupSystemInformation backupSystemInformation, final Project existingProject, final I18nHelper i18n, final MessageSet messageSet) { final String projectKey = backupProject.getProject().getKey(); // Verify that the project has no existing issues final long issueCount = issueManager.getIssueCountForProject(existingProject.getId()); if (issueCount != 0) { messageSet.addErrorMessage( getText( i18n, "admin.error.project.import.project.contains.issues", projectKey, String.valueOf(issueCount))); } // Verify that the project has no existing versions final long versionCount = versionManager.getVersions(existingProject.getId()).size(); if (versionCount != 0) { messageSet.addErrorMessage( getText( i18n, "admin.error.project.import.project.contains.versions", projectKey, String.valueOf(versionCount))); } // Verify that the project has no existing components final long componentCount = projectComponentManager.findAllForProject(existingProject.getId()).size(); if (componentCount != 0) { messageSet.addErrorMessage( getText( i18n, "admin.error.project.import.project.contains.components", projectKey, String.valueOf(componentCount))); } // Verify that if the project has a default assignee of Unassigned that the current instance of // JIRA supports unassigned issues if (projectHasDefaultAssigneeUnassigned(backupProject, backupSystemInformation)) { // We want this instance of JIRA to allow unassigned issues. final boolean allowUnassigned = applicationProperties.getOption(APKeys.JIRA_OPTION_ALLOWUNASSIGNED); if (!allowUnassigned) { messageSet.addErrorMessage( getText( i18n, "admin.error.project.import.project.default.assignee.not.allowed", backupProject.getProject().getName())); } } }
public List<String> getIdsFromName(final String name) { notNull("name", name); Collection<Version> versions = versionManager.getVersionsByName(name); Function<Version, String> function = new Function<Version, String>() { public String get(final Version input) { return input.getId().toString(); } }; return CollectionUtil.transform(versions, function); }
/// CLOVER:OFF public Collection<Version> getAll() { return versionManager.getAllVersions(); }
public Version get(final Long id) { return versionManager.getVersion(id); }
public boolean idExists(final Long id) { notNull("id", id); return versionManager.getVersion(id) != null; }
public boolean nameExists(final String name) { notNull("name", name); Collection<Version> versions = versionManager.getVersionsByName(name); return !versions.isEmpty(); }