Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -360,16 +360,34 @@ protected void initSND()

protected void createSNDCategories() throws CommandException, IOException
{
InsertRowsCommand command = new InsertRowsCommand("snd", "PkgCategories");
SelectRowsCommand selectCommand = new SelectRowsCommand("snd", "PkgCategories");
selectCommand.setColumns(List.of("Description"));
SelectRowsResponse response = selectCommand.execute(createDefaultConnection(), getProjectName());

List<String> existingCategories = new ArrayList<>();
for (Map<String, Object> row : response.getRows())
{
Object description = row.get("Description");
if (description != null)
existingCategories.add(String.valueOf(description));
}

InsertRowsCommand insertCommand = new InsertRowsCommand("snd", "PkgCategories");
boolean hasNewCategories = false;
for (String category : SND_CATEGORIES)
{
command.addRow(new HashMap<>(Maps.of(
if (existingCategories.contains(category))
continue;

insertCommand.addRow(new HashMap<>(Maps.of(
"Description", category,
"Active", true
)));
hasNewCategories = true;
}

command.execute(createDefaultConnection(), getProjectName());
if (hasNewCategories)
insertCommand.execute(createDefaultConnection(), getProjectName());
}

protected void createSNDPackages() throws Exception
Expand Down Expand Up @@ -624,7 +642,7 @@ protected void deleteRoomRecords() throws CommandException, IOException
@Override
protected void populateInitialData()
{
beginAt(WebTestHelper.getBaseURL() + "/SNPRC_EHR/" + getContainerPath() + "/populateData.view");
beginAt(WebTestHelper.buildURL("SNPRC_EHR", getContainerPath(), "populateData"));

repopulate("Lookup Sets");
repopulate("All");
Expand Down