Skip to content

Commit

Permalink
GT-3222 - review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonmacher committed Oct 17, 2019
1 parent d90f340 commit c2f2a41
Show file tree
Hide file tree
Showing 7 changed files with 1,081 additions and 297 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,29 +69,13 @@ public DataTypeUrl(String url) throws IllegalArgumentException {

String dtmId = matcher.group(1);
String dtId = matcher.group(2);
dataTypeName = matcher.group(3);

if (dtmId.isBlank()) {
throw new IllegalArgumentException("Data Type Manager ID cannot be blank");
}

if (dtId.isBlank()) {
throw new IllegalArgumentException("Data Type ID cannot be blank");
}
dataTypeManagerId = new UniversalID(Long.parseLong(dtmId));

try {
dataTypeManagerId = new UniversalID(Long.parseLong(dtmId));
}
catch (NumberFormatException e) {
throw new IllegalArgumentException("Exception parsing Data Type Manager ID: ", e);
}

try {
if (!dtId.isBlank()) {
dataTypeId = new UniversalID(Long.parseLong(dtId));
}
catch (NumberFormatException e) {
throw new IllegalArgumentException("Exception parsing Data Type ID: ", e);
}
dataTypeName = matcher.group(3);
}

public UniversalID getDataTypeManagerId() {
Expand All @@ -102,6 +86,10 @@ public UniversalID getDataTypeId() {
return dataTypeId;
}

public String getDataTypeName() {
return dataTypeName;
}

/**
* Uses the given service and its {@link DataTypeManager}s to find the data type
* represented by this url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ private static File getTempDir() throws IOException {
}

// copies the default test archive into a local version
static File createArchive(String filename) throws Exception {
public static File createArchive(String filename) throws Exception {
return createLocalArchiveFromExistingArchive(filename, "TestArchive.gdt");
}

// copies the archive from the given filename to a local version
static File copyArchive(String filename) throws Exception {
public static File copyArchive(String filename) throws Exception {
return createLocalArchiveFromExistingArchive(filename, filename);
}

Expand Down Expand Up @@ -93,8 +93,8 @@ private static File createLocalArchiveFromExistingArchive(String filename,
return scratchFile;
}

static ArchiveNode openArchive(String archiveDirPath, String archiveName, boolean checkout,
DataTypeManagerPlugin plugin) throws Exception {
public static ArchiveNode openArchive(String archiveDirPath, String archiveName,
boolean checkout, DataTypeManagerPlugin plugin) throws Exception {

File file = new File(archiveDirPath, archiveName);
DataTypeManagerHandler dataTypeManagerHandler = plugin.getDataTypeManagerHandler();
Expand All @@ -108,7 +108,7 @@ static ArchiveNode openArchive(String archiveDirPath, String archiveName, boolea
return (ArchiveNode) rootNode.getChild(trimFullArchiveName(archiveName));
}

static ArchiveNode openArchive(String archiveName, boolean checkout,
public static ArchiveNode openArchive(String archiveName, boolean checkout,
DataTypeManagerPlugin plugin) throws Exception {
ArchiveNode openArchive = openArchive(archiveName, checkout, false, plugin);
waitForTree(plugin);
Expand All @@ -128,8 +128,8 @@ private static void waitForTree(DataTypeManagerPlugin plugin) {
AbstractGenericTest.waitForPostedSwingRunnables();
}

static ArchiveNode openArchive(String archiveName, boolean checkout, boolean isUserAction,
DataTypeManagerPlugin plugin) throws Exception {
public static ArchiveNode openArchive(String archiveName, boolean checkout,
boolean isUserAction, DataTypeManagerPlugin plugin) throws Exception {

File tempDir = getTempDir();
File file = new File(tempDir, archiveName);
Expand All @@ -144,7 +144,7 @@ static ArchiveNode openArchive(String archiveName, boolean checkout, boolean isU
return (ArchiveNode) rootNode.getChild(trimFullArchiveName(archiveName));
}

static void closeArchive(final ArchiveNode archiveNode, final boolean deleteFile)
public static void closeArchive(final ArchiveNode archiveNode, final boolean deleteFile)
throws Exception {

Exception exception = Swing.runNow(() -> {
Expand Down Expand Up @@ -190,8 +190,8 @@ private static void doCloseArchive(ArchiveNode archiveNode, boolean deleteFile)
* @return The archive node associated with the open archive
* @throws Exception If there is any problem finding or opening the archive for the given name
*/
static ArchiveNode checkOutArchive(String archiveName, final DataTypeManagerPlugin plugin)
throws Exception {
public static ArchiveNode checkOutArchive(String archiveName,
final DataTypeManagerPlugin plugin) throws Exception {

String archiveNodeName = trimFullArchiveName(archiveName);
GTree tree = plugin.getProvider().getGTree();
Expand Down Expand Up @@ -221,14 +221,14 @@ private static String trimFullArchiveName(String archiveName) {
return archiveName;
}

static ArchiveNode createOpenAndCheckoutArchive(String archiveName,
public static ArchiveNode createOpenAndCheckoutArchive(String archiveName,
DataTypeManagerPlugin plugin) throws Exception {
createArchive(archiveName);
return openArchive(archiveName, true, plugin);
}

static ArchiveNode copyOpenAndCheckoutArchive(String archiveName, DataTypeManagerPlugin plugin)
throws Exception {
public static ArchiveNode copyOpenAndCheckoutArchive(String archiveName,
DataTypeManagerPlugin plugin) throws Exception {
copyArchive(archiveName);
return openArchive(archiveName, true, plugin);
}
Expand All @@ -237,7 +237,8 @@ public static void performAction(DockingActionIf action, Program program, GTree
performAction(action, program, tree, true);
}

static void performAction(DockingActionIf action, Program program, GTree tree, boolean wait) {
public static void performAction(DockingActionIf action, Program program, GTree tree,
boolean wait) {
AbstractGenericTest.runSwing(() -> {
ActionContext context =
new DataTypesActionContext(null, program, (DataTypeArchiveGTree) tree, null, true);
Expand Down Expand Up @@ -265,7 +266,7 @@ public static void performAction(DockingActionIf action, GTree tree, boolean wai
}
}

static void createCategory(Category parent, String categoryName) throws Exception {
public static void createCategory(Category parent, String categoryName) throws Exception {
DataTypeManager dtm = parent.getDataTypeManager();
int id = dtm.startTransaction("create category");
try {
Expand Down
Loading

0 comments on commit c2f2a41

Please sign in to comment.