Skip to content

Commit

Permalink
Move domain specific code from service to domain object
Browse files Browse the repository at this point in the history
RISDEV-0000
  • Loading branch information
SebastianRossa committed Jan 14, 2025
1 parent d8f2d6a commit 4b80cec
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public List<Norm> loadTargetNormsAffectedByAnnouncement(
.orElseThrow(() -> new NormNotFoundException(query.eli().toString()));

return amendingNorm
.targetLawElis()
.getTargetLawElis()
.stream()
.map(eli ->
loadNormPort
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,14 @@ public List<Mod> getMods() {
.map(Mod::new)
.toList();
}

/**
* Checks weather the {@link Article} refers to a Geltungszeitregel (which would define when a law e.g. enters
* into force)
*
* @return {@link Boolean}
*/
public Boolean isGeltungszeitregel() {
return getRefersTo().orElse("").equals("geltungszeitregel");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,10 @@ public List<Article> getArticles() {
*
* @return The list of target norm elis
*/
public List<ExpressionEli> targetLawElis() {
return getNodesFromExpression("//body//article[not(ancestor-or-self::mod)]", document)
public List<ExpressionEli> getTargetLawElis() {
return getArticles()
.stream()
.map(Article::new)
.filter(article ->
article.getRefersTo().isPresent() &&
!article.getRefersTo().get().equals("geltungszeitregel")
)
.filter(article -> !article.isGeltungszeitregel())
.map(Article::getMandatoryAffectedDocumentEli)
.toList();
}
Expand Down

0 comments on commit 4b80cec

Please sign in to comment.