Skip to content

Commit 86c7c2d

Browse files
authored
Merge pull request #12 from archivesspace/fix-for-future-versions
Remove hard-coded ArchivesSpace versions 2.1 and 2.2
2 parents 976c589 + 2fad9bc commit 86c7c2d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/org/archiviststoolkit/plugin/dbCopyFrame.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,14 @@ public void run() {
320320

321321
// check the current aspace version to make sure
322322
String aspaceVersion = ascopy.getASpaceVersion();
323+
double aspaceVersionDouble = new Double(aspaceVersion.replaceAll("[^0-9.]", ""));
323324

324325
//Check if working
325326
System.out.println("Version: " + aspaceVersion);
326327

327328
if (aspaceVersion.isEmpty()) ascopy.setCopyAssessments();
328-
if (!aspaceVersion.isEmpty() && !ASpaceCopyUtil.SUPPORTED_ASPACE_VERSION.contains(aspaceVersion)) {
329-
String message = "Unsupported Archivesspace Version\nSupport Versions: " +
330-
ASpaceCopyUtil.SUPPORTED_ASPACE_VERSION + " ...\n";
329+
if (!aspaceVersion.isEmpty() && aspaceVersionDouble < 2.1) {
330+
String message = "Unsupported Archivesspace Version\nSupport Versions: v2.1 and higher ...\n";
331331

332332
consoleTextArea.append(message);
333333
reEnableCopyButtons();

src/org/archiviststoolkit/plugin/utils/aspace/ASpaceCopyUtil.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
*/
2727
public class ASpaceCopyUtil {
2828

29-
public static final String SUPPORTED_ASPACE_VERSION = "v2.1 & v2.2";
30-
3129
// used to get session from the source and destination databases
3230
private RemoteDBConnectDialogLight sourceRCD;
3331

@@ -491,7 +489,7 @@ private void setASpaceVersion() {
491489
public void setCopyAssessments() {
492490
if (aspaceVersion.isEmpty()) {
493491
String message = "Cannot determine your version of ArchivesSpace. Do you want to attempt to\n" +
494-
"copy assessments to ArchivesSpace? (This will only work with version 2.2.)";
492+
"copy assessments to ArchivesSpace? (This will only work with versions starting with 2.2.)";
495493
while (copyAssessments == null) {
496494
int result = JOptionPane.showConfirmDialog(null, message, "Copy assessments?",
497495
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
@@ -1064,7 +1062,9 @@ public void addAssessments() throws Exception {
10641062
if (!recordsToCopy.contains("Assessments")) return;
10651063

10661064
// first figure out if the version of ASpace allows for assessments
1067-
if (aspaceVersion.contains("2.2")) {
1065+
double aspaceVersionDouble = new Double(aspaceVersion.replaceAll("[^0-9.]", ""));
1066+
1067+
if (aspaceVersionDouble >= 2.2) {
10681068
System.out.println("Copying assessments ...");
10691069
} else if (aspaceVersion.isEmpty()) {
10701070
if (copyAssessments == null) setCopyAssessments();

0 commit comments

Comments
 (0)