Skip to content

Commit

Permalink
Merge pull request #12 from archivesspace/fix-for-future-versions
Browse files Browse the repository at this point in the history
Remove hard-coded ArchivesSpace versions 2.1 and 2.2
  • Loading branch information
lmcglohon authored Jan 29, 2018
2 parents 976c589 + 2fad9bc commit 86c7c2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/org/archiviststoolkit/plugin/dbCopyFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 86c7c2d

Please sign in to comment.