-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add additional Contention Classification database table columns #2187
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
114df77
minor change
chengjie8 16619b2
refactor and populate new fields using faker
chengjie8 2321592
added backend code change
chengjie8 c13a767
WIP
chengjie8 291c5bc
refactor
chengjie8 2b93c19
merge from develop
chengjie8 c257841
added BieMessageUtils to simplify process of populating java object u…
chengjie8 0ceb82b
minor field and data type updates
chengjie8 8df10f6
mionr change and resolve some lint issues
chengjie8 6e6f0d0
Merge branch 'develop' into chengjie8/issue-2085
chengjie8 2b79bf4
Merge branch 'develop' of https://github.com/department-of-veterans-a…
chengjie8 19b060b
fix minor issues and added kafka script for local docker build
chengjie8 16c2d30
added in missing env variables for local kafka integration test
chengjie8 651b8ec
added null check
chengjie8 b93a974
Merge branch 'develop' into chengjie8/issue-2085
chengjie8 da8461f
Merge branch 'develop' into chengjie8/issue-2085
chengjie8 8eadff8
fix file name
chengjie8 dd464c4
Merge branch 'develop' of https://github.com/department-of-veterans-a…
chengjie8 06a163e
Merge branch 'develop' into chengjie8/issue-2085
c0866dc
minor change
chengjie8 c6ee69b
Merge branch 'chengjie8/issue-2085' of https://github.com/department-…
chengjie8 880a063
Merge branch 'develop' into chengjie8/issue-2085
chengjie8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
.../main/resources/database/migrations/V1.4__BIE_Contention_Event_Add_additional_Columns.sql
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,15 @@ | ||
ALTER TABLE "bie_contention_event" | ||
ADD COLUMN "date_added" TIMESTAMP, | ||
ADD COLUMN "date_completed" TIMESTAMP, | ||
ADD COLUMN "date_updated" TIMESTAMP, | ||
ADD COLUMN "actor_station" VARCHAR(255), | ||
ADD COLUMN "automation_indicator" boolean, | ||
ADD COLUMN "benefit_claim_type_code" VARCHAR(255), | ||
ADD COLUMN "contention_status_type_code" VARCHAR(255), | ||
ADD COLUMN "current_lifecycle_status" VARCHAR(255), | ||
ADD COLUMN "clmnt_txt" VARCHAR(255), | ||
ADD COLUMN "details" VARCHAR(255), | ||
ADD COLUMN "event_time" TIMESTAMP, | ||
ADD COLUMN "journal_status_type_code" VARCHAR(255), | ||
ADD COLUMN "veteran_participant_id" VARCHAR(255), | ||
ADD COLUMN "event_details" JSON; |
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
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,10 @@ | ||
#!/bin/bash | ||
|
||
export COMPOSE_PROFILES='kafka' | ||
source scripts/setenv.sh | ||
|
||
./gradlew docker | ||
./gradlew :dockerComposeUp | ||
./gradlew app:dockerComposeUp | ||
./gradlew -p mocks docker | ||
./gradlew -p mocks :dockerComposeUp |
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
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
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
63 changes: 63 additions & 0 deletions
63
svc-bie-kafka/src/main/java/gov/va/vro/services/bie/utils/BieMessageUtils.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,63 @@ | ||
package gov.va.vro.services.bie.utils; | ||
|
||
import gov.va.vro.model.biekafka.BieMessagePayload; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.avro.generic.GenericRecord; | ||
import org.springframework.util.StringUtils; | ||
|
||
import java.lang.reflect.Field; | ||
import java.lang.reflect.Method; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
@Slf4j | ||
public class BieMessageUtils { | ||
private static final Set<String> IGNORED_FIELDS = new HashSet<>(); | ||
|
||
static { | ||
// Add the names of fields to be ignored | ||
IGNORED_FIELDS.add("status"); | ||
IGNORED_FIELDS.add("statusMessage"); | ||
IGNORED_FIELDS.add("eventType"); | ||
IGNORED_FIELDS.add("notifiedAt"); | ||
} | ||
|
||
public static BieMessagePayload processBieMessagePayloadFields(GenericRecord genericRecord) { | ||
BieMessagePayload payload = BieMessagePayload.builder().status(200).build(); | ||
|
||
for (Field field : BieMessagePayload.class.getDeclaredFields()) { | ||
String fieldName = field.getName(); | ||
|
||
// Skip the field if it's in the ignored list | ||
if (IGNORED_FIELDS.contains(fieldName)) { | ||
continue; | ||
} | ||
|
||
String capitalizedFieldName = StringUtils.capitalize(fieldName); | ||
Object value = genericRecord.get(capitalizedFieldName); | ||
|
||
if (value == null) { | ||
continue; // Skip setting the field if the value is null | ||
} | ||
|
||
try { | ||
String setterMethodName = "set" + capitalizedFieldName; | ||
Method setterMethod = BieMessagePayload.class.getMethod(setterMethodName, field.getType()); | ||
|
||
if (field.getType().isAssignableFrom(value.getClass())) { | ||
setterMethod.invoke(payload, value); | ||
} else { | ||
log.warn( | ||
"Type mismatch for field '{}'. Expected type: '{}', Actual value: '{}'", | ||
fieldName, | ||
field.getType().getSimpleName(), | ||
value); | ||
} | ||
} catch (Exception e) { | ||
log.error("Error setting value for field '{}': {}", fieldName, e.getMessage(), e); | ||
} | ||
} | ||
|
||
return payload; | ||
} | ||
} |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we not chain these set statements? that is
contentionEventEntity.setOccurredAt(...) .setDateAdded(...) . . .