From 2fad9bc3c514ae6fb665b71abbd78447ee3bbf24 Mon Sep 17 00:00:00 2001 From: Laney McGlohon Date: Fri, 26 Jan 2018 12:56:02 -0500 Subject: [PATCH] Remove hard-coded ArchivesSpace versions 2.1 and 2.2 --- src/org/archiviststoolkit/plugin/dbCopyFrame.java | 6 +++--- .../plugin/utils/aspace/ASpaceCopyUtil.java | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/org/archiviststoolkit/plugin/dbCopyFrame.java b/src/org/archiviststoolkit/plugin/dbCopyFrame.java index 6f307ff..fff9cfa 100644 --- a/src/org/archiviststoolkit/plugin/dbCopyFrame.java +++ b/src/org/archiviststoolkit/plugin/dbCopyFrame.java @@ -320,14 +320,14 @@ public void run() { // check the current aspace version to make sure String aspaceVersion = ascopy.getASpaceVersion(); + double aspaceVersionDouble = new Double(aspaceVersion.replaceAll("[^0-9.]", "")); //Check if working System.out.println("Version: " + aspaceVersion); if (aspaceVersion.isEmpty()) ascopy.setCopyAssessments(); - if (!aspaceVersion.isEmpty() && !ASpaceCopyUtil.SUPPORTED_ASPACE_VERSION.contains(aspaceVersion)) { - String message = "Unsupported Archivesspace Version\nSupport Versions: " + - ASpaceCopyUtil.SUPPORTED_ASPACE_VERSION + " ...\n"; + if (!aspaceVersion.isEmpty() && aspaceVersionDouble < 2.1) { + String message = "Unsupported Archivesspace Version\nSupport Versions: v2.1 and higher ...\n"; consoleTextArea.append(message); reEnableCopyButtons(); diff --git a/src/org/archiviststoolkit/plugin/utils/aspace/ASpaceCopyUtil.java b/src/org/archiviststoolkit/plugin/utils/aspace/ASpaceCopyUtil.java index 8d57a0c..79ad3b8 100644 --- a/src/org/archiviststoolkit/plugin/utils/aspace/ASpaceCopyUtil.java +++ b/src/org/archiviststoolkit/plugin/utils/aspace/ASpaceCopyUtil.java @@ -26,8 +26,6 @@ */ public class ASpaceCopyUtil { - public static final String SUPPORTED_ASPACE_VERSION = "v2.1 & v2.2"; - // used to get session from the source and destination databases private RemoteDBConnectDialogLight sourceRCD; @@ -491,7 +489,7 @@ private void setASpaceVersion() { public void setCopyAssessments() { if (aspaceVersion.isEmpty()) { String message = "Cannot determine your version of ArchivesSpace. Do you want to attempt to\n" + - "copy assessments to ArchivesSpace? (This will only work with version 2.2.)"; + "copy assessments to ArchivesSpace? (This will only work with versions starting with 2.2.)"; while (copyAssessments == null) { int result = JOptionPane.showConfirmDialog(null, message, "Copy assessments?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); @@ -1064,7 +1062,9 @@ public void addAssessments() throws Exception { if (!recordsToCopy.contains("Assessments")) return; // first figure out if the version of ASpace allows for assessments - if (aspaceVersion.contains("2.2")) { + double aspaceVersionDouble = new Double(aspaceVersion.replaceAll("[^0-9.]", "")); + + if (aspaceVersionDouble >= 2.2) { System.out.println("Copying assessments ..."); } else if (aspaceVersion.isEmpty()) { if (copyAssessments == null) setCopyAssessments();