Skip to content

Commit 045e1af

Browse files
committed
Merge branch 'ST6RI-682' into ST6RI-178
2 parents 1d4668c + 1fa3199 commit 045e1af

2 files changed

Lines changed: 14 additions & 16 deletions

File tree

org.omg.sysml.interactive/src/org/omg/sysml/interactive/SysMLInteractive.java

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,6 @@ public String loadByName(String projectName, String branchName, List<String> hel
444444
}
445445

446446
ProjectRepository repository = new ProjectRepository(apiBasePath);
447-
448-
System.out.println("Locating model");
449447
RemoteProject repositoryProject = repository.getProjectByName(projectName);
450448

451449
if (repositoryProject == null) {
@@ -461,8 +459,6 @@ public String loadById(String projectId, String branchId, List<String> help) {
461459
}
462460

463461
ProjectRepository repository = new ProjectRepository(apiBasePath);
464-
465-
System.out.println("Locating model");
466462
RemoteProject remoteProject = repository.getPRojectById(UUID.fromString(projectId));
467463

468464
if (remoteProject == null) {
@@ -498,14 +494,10 @@ private String load(RemoteProject remoteProject, UUID branchId) {
498494
}
499495

500496
private String load(RemoteBranch branch) {
501-
RemoteProject remoteProject = branch.getRemoteProject();
502-
Revision headRevision = branch.getHeadRevision();
503-
APIModel model = headRevision.fetchRemote();
504-
505497
System.out.println("Selected branch " + branch.getName());
506498

507-
System.out.println("Collecting UUIDs...");
508499
if (!tracker.isLibraryTracked()) {
500+
System.out.println("Caching library UUIDs...");
509501
tracker.trackLibraryUUIDs(getLibraryResources());
510502
}
511503

@@ -514,13 +506,16 @@ private String load(RemoteBranch branch) {
514506
//UUIDS coming from resources that were added later in time will shadow previous ones
515507
tracker.trackLocalUUIDs(inputResources);
516508

517-
EMFModelRefresher modelRefresher = new EMFModelRefresher(model, tracker);
518-
519509
System.out.println("Downloading model...");
510+
511+
RemoteProject remoteProject = branch.getRemoteProject();
512+
Revision headRevision = branch.getHeadRevision();
513+
APIModel model = headRevision.fetchRemote();
514+
515+
EMFModelRefresher modelRefresher = new EMFModelRefresher(model, tracker);
520516
EMFModelDelta delta = modelRefresher.create();
521517
modelRefresher.getIssues().forEach(System.out::println);
522518

523-
System.out.println("Adding model to index");
524519
delta.getProjectRoots().forEach((eObject, dto) -> {
525520
next(SYSMLX_EXTENSION);
526521
Resource xmiResource = getResource();
@@ -534,7 +529,7 @@ private String load(RemoteBranch branch) {
534529
addResourceToIndex(xmiResource);
535530
});
536531

537-
return "Project loaded: " + remoteProject.getProjectName() + ", " + remoteProject.getRemoteId().toString();
532+
return "Loaded Project " + remoteProject.getProjectName() + " (" + remoteProject.getRemoteId().toString() + ")";
538533
}
539534

540535
protected String download(String name) {
@@ -543,14 +538,17 @@ protected String download(String name) {
543538
loadByName(name, null, Collections.emptyList());
544539
}
545540

546-
public String listPublications(List<String> help) {
541+
public String projects(List<String> help) {
547542
if (help != null && !help.isEmpty()) {
548543
return SysMLInteractiveHelp.getProjectsHelp();
549544
}
550545
ProjectRepository projectRepository = new ProjectRepository(apiBasePath);
546+
547+
String apiBasePathString = "API base path: " + apiBasePath;
551548
List<RemoteProject> repositoryProjects = projectRepository.getProjects();
552-
return repositoryProjects.stream().map(p -> String.format("name=%s, id=%s", p.getProjectName(), p.getRemoteId()))
549+
String projectsListString = repositoryProjects.stream().map(p -> String.format("Project %s (%s)", p.getProjectName(), p.getRemoteId()))
553550
.collect(Collectors.joining("\n"));
551+
return apiBasePathString + "\n\n" + projectsListString;
554552
}
555553

556554
protected ApiElementProcessingFacade getApiElementProcessingFacade(String modelName, String branchName, boolean includeDerived) {

org.omg.sysml.jupyter.kernel/src/main/java/org/omg/sysml/jupyter/kernel/magic/Projects.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ public class Projects {
3838
public static String projects(List<String> args) {
3939
Map<String, List<String>> vals = SHOW_ARGS.parse(args);
4040
List<String> help = vals.get("help");
41-
return ISysML.getKernelInstance().getInteractive().listPublications(help);
41+
return ISysML.getKernelInstance().getInteractive().projects(help);
4242
}
4343
}

0 commit comments

Comments
 (0)