This repository was archived by the owner on Nov 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix for group showing as "null" in report [#52] and wrong group color…
…s in report [#54]
- Loading branch information
Showing
16 changed files
with
183 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package de.bonndan.nivio.input; | ||
|
||
import de.bonndan.nivio.input.dto.LandscapeDescription; | ||
import de.bonndan.nivio.model.Group; | ||
import de.bonndan.nivio.model.GroupItem; | ||
import de.bonndan.nivio.model.Groups; | ||
import de.bonndan.nivio.model.LandscapeImpl; | ||
import org.springframework.util.StringUtils; | ||
|
||
/** | ||
* Resolves the groups. | ||
*/ | ||
public class GroupResolver { | ||
|
||
private final ProcessLog log; | ||
|
||
public GroupResolver(ProcessLog log) { | ||
this.log = log; | ||
} | ||
|
||
public void process(LandscapeDescription input, LandscapeImpl landscape) { | ||
input.getGroups().forEach((identifier, groupItem) -> { | ||
Group g = getGroup(identifier, groupItem); | ||
|
||
log.info("Adding or updating group " + g.getIdentifier()); | ||
landscape.addGroup(g); | ||
}); | ||
|
||
input.getItemDescriptions().forEach(itemDescription -> { | ||
|
||
String group = itemDescription.getGroup(); | ||
if (StringUtils.isEmpty(itemDescription.getGroup())) { | ||
group = Group.COMMON; | ||
} | ||
|
||
landscape.getGroups().computeIfAbsent(group, s -> getGroup(s, null)); | ||
}); | ||
} | ||
|
||
private Group getGroup(String identifier, GroupItem groupItem) { | ||
Group g = new Group(identifier); | ||
Groups.merge(g, groupItem); | ||
return g; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.