Skip to content
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

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

mweaver-ebsco
Copy link
Collaborator

No description provided.

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;
Copy link
Collaborator Author

@mweaver-ebsco mweaver-ebsco Feb 11, 2025

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) :)

@mweaver-ebsco mweaver-ebsco force-pushed the MODFQMMGR-543-ordered-sources branch 2 times, most recently from fea67b7 to a3f53fd Compare February 12, 2025 21:33
@mweaver-ebsco mweaver-ebsco force-pushed the MODFQMMGR-543-ordered-sources branch from a3f53fd to a5b4edf Compare February 14, 2025 17:22
@@ -7,7 +7,8 @@
type: 'entity-type',
targetId: '00349126-c923-4045-a29f-3b6db4c6bea9', // simple_loan
useIdColumns: true,
essentialOnly: true
essentialOnly: true,
order: 10,
Copy link
Collaborator Author

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:

  1. 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
  2. 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)

@mweaver-ebsco mweaver-ebsco force-pushed the MODFQMMGR-543-ordered-sources branch from a5b4edf to ada3c9b Compare February 14, 2025 17:36
@mweaver-ebsco mweaver-ebsco merged commit 4e793fa into master Feb 14, 2025
4 checks passed
@mweaver-ebsco mweaver-ebsco deleted the MODFQMMGR-543-ordered-sources branch February 14, 2025 17:59
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants