Skip to content

Commit

Permalink
Adds some code to deal with old workspaces, or those created by third…
Browse files Browse the repository at this point in the history
… party tooling that are missing view `order` properties.
  • Loading branch information
simonbrowndotje committed Mar 15, 2024
1 parent b3fd678 commit 5ae28b0
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,12 @@ void documentation() throws Exception {
{"configuration":{},"description":"Description","documentation":{"sections":[{"content":"## Heading 1","format":"Markdown","order":1,"title":""}]},"id":0,"model":{},"name":"Name","views":{"configuration":{"branding":{},"styles":{},"terminology":{}}}}""", WorkspaceUtils.toJson(workspace, false));
}

@Test
void viewsWithoutOrderProperties() throws Exception {
File file = new File(PATH_TO_WORKSPACE_FILES, "views-without-order.json");
Workspace workspace = WorkspaceUtils.loadWorkspaceFromJson(file);

assertEquals(2, workspace.getViews().getSystemLandscapeViews().size());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"description" : "Description",
"id" : 0,
"model" : {
"people" : [ {
"id" : "1",
"name" : "User",
"tags" : "Element,Person"
} ]
},
"name" : "Name",
"views" : {
"systemLandscapeViews" : [ {
"elements" : [ {
"id" : "1"
} ],
"enterpriseBoundaryVisible" : true,
"key" : "SystemLandscape-001"
}, {
"elements" : [ {
"id" : "1"
} ],
"enterpriseBoundaryVisible" : true,
"key" : "SystemLandscape-002"
} ]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,12 @@ void setProperties(Map<String, String> properties) {

@Override
public int compareTo(View view) {
return getOrder() - view.getOrder();
int result = getOrder() - view.getOrder();
if (result == 0) {
result = getKey().compareToIgnoreCase(view.getKey());
}

return result;
}

}

0 comments on commit 5ae28b0

Please sign in to comment.