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

[MODEXPW-528] Generate EDI file for claims #601

Merged
merged 17 commits into from
Dec 9, 2024
Merged

[MODEXPW-528] Generate EDI file for claims #601

merged 17 commits into from
Dec 9, 2024

Conversation

Saba-Zedginidze-EPAM
Copy link
Contributor

@Saba-Zedginidze-EPAM Saba-Zedginidze-EPAM commented Dec 4, 2024

Purpose

[MODEXPW-528] Generate EDI file for claims

Approach

  • Add Piece and PieceCollection for fetching Claims to folio-export-common submodule
  • Split existing edifact generator tasklet to 2: one for order and other for claims
  • Update config to create new tasklets and separate jobs for each export type
  • Add feign client for pieces and method to OrderService to fetch pieces
  • Modify composite order and order line converters to include pieces with logic: If pieces are empty, then export is for orders, otherwise it is for claims and need to include required fields
  • Add streamex and update EDI writer library
  • Add QueryUtils from mod-orders to work with cql easily
  • Update existing tasklet tests to reuse orders edifact export job
  • Split existing edifact export job tests into to, make existing one abstract with common tests for both
  • Make MappingOrdersToEdifactTest simpler by removing @SpringBootTest and add new Claims edi file validation tests

Learning

When writing special characters - ., ?, :, ' they will always be escaped with ?. So if we write abc?12:3 the output will be abc??12?:3.
To avoid this we need to user binary writer instead of string:
.writeStartElementBinary().writeBinaryData(ByteBuffer.wrap(data.getBytes()))

@Saba-Zedginidze-EPAM Saba-Zedginidze-EPAM requested a review from a team December 6, 2024 14:24
Comment on lines 99 to 110
private String fieldInListFilter(String fieldName, List<?> list) {
return String.format(" AND %s==%s", fieldName,
list.stream()
.map(item -> String.format("\"%s\"", item.toString()))
.collect(Collectors.joining(" OR ", "(", ")")));
}

private static String fieldNotInListFilter(String fieldName, Collection<?> list) {
return String.format(" AND cql.allRecords=1 NOT %s==%s", fieldName,
list.stream()
.map(item -> String.format("\"%s\"", item.toString()))
.collect(Collectors.joining(" OR ", "(", ")")));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reused existing util methods instead of these, both are removed

@BKadirkhodjaev
Copy link

Looks good to me, but is that NOSONAR tag really needed?

@Saba-Zedginidze-EPAM
Copy link
Contributor Author

Looks good to me, but is that NOSONAR tag really needed?

Yes I remember sonar was alarming about some security issue with the regex provided in this mod-orders PR

Copy link

sonarqubecloud bot commented Dec 9, 2024

@SerhiiNosko SerhiiNosko merged commit 85950a1 into master Dec 9, 2024
6 checks passed
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.

4 participants