Skip to content

Commit 9de144a

Browse files
authored
Merge pull request #870 from b2ihealthcare/issue/mrcm_import_branch
MRCM import branch
2 parents 1c8e1f7 + 01d5e6e commit 9de144a

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/io/MrcmImportExportTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void _01_importTest() throws Exception {
5555
final Path path = PlatformUtil.toAbsolutePath(MrcmImportExportTest.class, "mrcm_import_test.json");
5656

5757
try (final InputStream stream = Files.newInputStream(path, StandardOpenOption.READ)) {
58-
Services.service(MrcmImporter.class).doImport(Services.getAuthorizationToken(), RestExtensions.USER, stream);
58+
Services.service(MrcmImporter.class).doImport(Services.getAuthorizationToken(), RestExtensions.USER, IBranchPath.MAIN_BRANCH, stream);
5959
}
6060

6161
// verify content

snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/mrcm/io/MrcmCommand.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ private static final class ImportCommand extends Command {
7171
@Parameters(paramLabel = "FILE", description = "The JSON file with MRCM rules to import")
7272
String file;
7373

74+
@Parameters(paramLabel = "BRANCH", description = "The branch to import MRCM rules to")
75+
String branch;
76+
7477
@Override
7578
public void run(CommandLineStream out) {
7679
final User user = out.authenticate(getBus());
@@ -81,7 +84,7 @@ public void run(CommandLineStream out) {
8184
}
8285

8386
try (final InputStream content = Files.newInputStream(Paths.get(file), StandardOpenOption.READ)) {
84-
ApplicationContext.getServiceForClass(MrcmImporter.class).doImport(user, content);
87+
ApplicationContext.getServiceForClass(MrcmImporter.class).doImport(user, branch, content);
8588
} catch (IOException e) {
8689
out.println("Failed to import MRCM JSON file: " + file);
8790
}

snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/mrcm/io/MrcmImporter.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public interface MrcmImporter {
3131
* @param user - the author of the import
3232
* @param source - the MRCM file to process and import.
3333
*/
34-
void doImport(User user, InputStream source);
34+
void doImport(User user, String branch, InputStream source);
3535

36-
void doImport(String authorizationToken, String username, InputStream source);
36+
void doImport(String authorizationToken, String username, String branch, InputStream source);
3737

3838
}

snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/mrcm/io/MrcmJsonImporter.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ public MrcmJsonImporter(Provider<IEventBus> bus) {
5252
}
5353

5454
@Override
55-
public void doImport(String authorizationToken, String username, InputStream source) {
55+
public void doImport(String authorizationToken, String username, String branch, InputStream source) {
5656

57-
final String branch = Branch.MAIN_PATH;
5857
ObjectMapper mapper = ApplicationContext.getServiceForClass(ObjectMapper.class);
5958

6059
final IEventBus bus = new AuthorizedEventBus(this.bus.get(), ImmutableMap.of(AuthorizedRequest.AUTHORIZATION_HEADER, authorizationToken));
@@ -95,9 +94,9 @@ public void doImport(String authorizationToken, String username, InputStream sou
9594
}
9695

9796
@Override
98-
public void doImport(User user, InputStream source) {
97+
public void doImport(User user, String branch, InputStream source) {
9998
String authorizationToken = ApplicationContext.getServiceForClass(JWTGenerator.class).generate(user);
100-
doImport(authorizationToken, user.getUsername(), source);
99+
doImport(authorizationToken, user.getUsername(), branch, source);
101100
}
102101

103102
}

0 commit comments

Comments
 (0)