generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #967 from CDCgov/story/650/results-metadata
Added metadata
- Loading branch information
Showing
27 changed files
with
507 additions
and
148 deletions.
There are no files selected for viewing
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
59 changes: 59 additions & 0 deletions
59
etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/messages/SendMessageHelper.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,59 @@ | ||
package gov.hhs.cdc.trustedintermediary.etor.messages; | ||
|
||
import gov.hhs.cdc.trustedintermediary.etor.metadata.partner.PartnerMetadataException; | ||
import gov.hhs.cdc.trustedintermediary.etor.metadata.partner.PartnerMetadataMessageType; | ||
import gov.hhs.cdc.trustedintermediary.etor.metadata.partner.PartnerMetadataOrchestrator; | ||
import gov.hhs.cdc.trustedintermediary.wrappers.Logger; | ||
import javax.inject.Inject; | ||
|
||
public class SendMessageHelper { | ||
private static final SendMessageHelper INSTANCE = new SendMessageHelper(); | ||
|
||
public static SendMessageHelper getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
@Inject Logger logger; | ||
|
||
@Inject PartnerMetadataOrchestrator partnerMetadataOrchestrator; | ||
|
||
private SendMessageHelper() {} | ||
|
||
public void savePartnerMetadataForReceivedMessage( | ||
String receivedSubmissionId, int messageHash, PartnerMetadataMessageType messageType) { | ||
if (receivedSubmissionId == null) { | ||
logger.logWarning( | ||
"Received submissionId is null so not saving metadata for received message"); | ||
return; | ||
} | ||
try { | ||
String stringMessageHash = String.valueOf(messageHash); | ||
|
||
partnerMetadataOrchestrator.updateMetadataForReceivedMessage( | ||
receivedSubmissionId, stringMessageHash, messageType); | ||
} catch (PartnerMetadataException e) { | ||
logger.logError( | ||
"Unable to save metadata for receivedSubmissionId " + receivedSubmissionId, e); | ||
} | ||
} | ||
|
||
public void saveSentMessageSubmissionId(String receivedSubmissionId, String sentSubmissionId) { | ||
if (sentSubmissionId == null || receivedSubmissionId == null) { | ||
logger.logWarning( | ||
"Received and/or sent submissionId is null so not saving metadata for sent result"); | ||
return; | ||
} | ||
|
||
try { | ||
partnerMetadataOrchestrator.updateMetadataForSentMessage( | ||
receivedSubmissionId, sentSubmissionId); | ||
} catch (PartnerMetadataException e) { | ||
logger.logError( | ||
"Unable to update metadata for received submissionId " | ||
+ receivedSubmissionId | ||
+ " and sent submissionId " | ||
+ sentSubmissionId, | ||
e); | ||
} | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
...ava/gov/hhs/cdc/trustedintermediary/etor/metadata/partner/PartnerMetadataMessageType.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,7 @@ | ||
package gov.hhs.cdc.trustedintermediary.etor.metadata.partner; | ||
|
||
/** Enum for tracking the message type */ | ||
public enum PartnerMetadataMessageType { | ||
RESULT, | ||
ORDER | ||
} |
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.