-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MODFQMMGR-543 Add support for ordering ET sources in composites #626
Conversation
src/main/java/org/folio/fqm/service/EntityTypeFlatteningService.java
Outdated
Show resolved
Hide resolved
EntityTypeSource newSource = SourceUtils.copySource(sourceFromParent, source, renamedAliases); | ||
flattenedEntityType.addSourcesItem(newSource); | ||
// Sort the sources, so that the resulting columns end up sorted appropriately | ||
Iterable<EntityTypeSource> orderedSources = originalEntityType.getSources().stream().sorted(sourceComparator())::iterator; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun trick that probably shouldn't be done very often: Using Stream::iterator
as an Iterable
, so that you can use an enhanced for-loop with streams (instead of .forEach()
, which brings some limitations) :)
fea67b7
to
a3f53fd
Compare
a3f53fd
to
a5b4edf
Compare
@@ -7,7 +7,8 @@ | |||
type: 'entity-type', | |||
targetId: '00349126-c923-4045-a29f-3b6db4c6bea9', // simple_loan | |||
useIdColumns: true, | |||
essentialOnly: true | |||
essentialOnly: true, | |||
order: 10, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to set the orders in increments of 10 for 2 reasons:
- It provides the ability to shuffle things around and add new sources later on with fewer changes later. It just seems like a useful pattern without any real downside that I see
- Since this is the first ET with a set order, it doubles as some light documentation. By spacing the orders out, it subtly provides some insight into what does and doesn't work (if you want to space them out later, you don't need to go look up code to see if it works when you've already got an example of it working right off the bat)
a5b4edf
to
ada3c9b
Compare
|
This commit makes it so columns within a composite are grouped together in an order defined by the new "order" property on ET sources. Within each group, the columns are sorted by labelAlias. One major result of this is that in all cases, the columns in a flattened entity type are always sorted list this; before they were only sorted in some cases.
No description provided.