-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge in WALTZ/waltz from WALTZ/waltz-dw:wrel-159 to db-feature/waltz-7032-flow-classifications-add-directionality * commit 'e32f88c785cb394241604b6a230a8ba6cd4a5caf': Flow Classifications becoming inbound rule aware Flow Classifications becoming inbound rule aware Licences - search for licences from navbar Licences - search for licences from navbar Licences - search for licences from navbar Report Grids: entity stats have view options Survey instance shows the contact email Delete .github/workflows/meetings.yml since deprecated
- Loading branch information
Showing
20 changed files
with
506 additions
and
124 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
20 changes: 20 additions & 0 deletions
20
waltz-common/src/test/java/org/finos/waltz/common/ListUtilities_distinct.java
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,20 @@ | ||
package org.finos.waltz.common; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.List; | ||
|
||
import static org.finos.waltz.common.ListUtilities.asList; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class ListUtilities_distinct { | ||
|
||
@Test | ||
public void distinctDedupesListsButPreservesInitialOrder() { | ||
List<String> xs = asList("a", "b", "c", "c", "b", "c", "d"); | ||
List<String> uniq = ListUtilities.distinct(xs); | ||
assertEquals(asList("a", "b", "c", "d"), uniq); | ||
} | ||
|
||
|
||
} |
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
66 changes: 66 additions & 0 deletions
66
waltz-data/src/main/java/org/finos/waltz/data/licence/search/LicenceSearchDao.java
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,66 @@ | ||
package org.finos.waltz.data.licence.search; | ||
|
||
import org.finos.waltz.common.ListUtilities; | ||
import org.finos.waltz.data.SearchDao; | ||
import org.finos.waltz.data.licence.LicenceDao; | ||
import org.finos.waltz.model.entity_search.EntitySearchOptions; | ||
import org.finos.waltz.model.licence.Licence; | ||
import org.jooq.Condition; | ||
import org.jooq.DSLContext; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
import static java.util.Collections.emptyList; | ||
import static org.finos.waltz.common.ListUtilities.concat; | ||
import static org.finos.waltz.data.JooqUtilities.mkBasicTermSearch; | ||
import static org.finos.waltz.data.JooqUtilities.mkStartsWithTermSearch; | ||
import static org.finos.waltz.data.SearchUtilities.mkTerms; | ||
import static org.finos.waltz.schema.Tables.LICENCE; | ||
|
||
@Repository | ||
public class LicenceSearchDao implements SearchDao<Licence> { | ||
|
||
private final DSLContext dsl; | ||
|
||
|
||
@Autowired | ||
public LicenceSearchDao(DSLContext dsl) { | ||
this.dsl = dsl; | ||
} | ||
|
||
|
||
/** | ||
* Searches by <code>name</code> and <code>external_id</code> | ||
* @param options | ||
* @return List of matching legal entities, | ||
* matches on name are given precedence over external_id matches | ||
*/ | ||
@Override | ||
public List<Licence> search(EntitySearchOptions options) { | ||
List<String> terms = mkTerms(options.searchQuery()); | ||
if (terms.isEmpty()) { | ||
return emptyList(); | ||
} | ||
|
||
Condition nameCondition = mkBasicTermSearch(LICENCE.NAME, terms); | ||
Condition externalIdCondition = mkStartsWithTermSearch(LICENCE.EXTERNAL_ID, terms); | ||
|
||
return ListUtilities.distinct(concat( | ||
mkQuery(nameCondition, options), | ||
mkQuery(externalIdCondition, options))); | ||
} | ||
|
||
|
||
private List<Licence> mkQuery(Condition nameCondition, EntitySearchOptions options) { | ||
return dsl | ||
.select(LICENCE.fields()) | ||
.from(LICENCE) | ||
.where(nameCondition) | ||
.orderBy(LICENCE.NAME) | ||
.limit(options.limit()) | ||
.fetch(LicenceDao.TO_DOMAIN_MAPPER); | ||
} | ||
|
||
} |
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.