Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/motech-implementations/nms
Browse files Browse the repository at this point in the history
…into rch_parallel_import
  • Loading branch information
sree21go committed Jul 23, 2018
2 parents 4358f76 + 65fa89d commit 725866f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public MctsImportAudit saveImportedMothersData(MothersDataSet mothersDataSet, St
MotherImportRejection motherImportRejection;
for (Map<String, Object> record : rejectedMotherRecords) {
action = (String) record.get(KilkariConstants.ACTION);
LOGGER.error("Existing Mother Record with same MSISDN in the data set");
LOGGER.debug("Existing Mother Record with same MSISDN in the data set");
motherImportRejection = motherRejectionMcts(convertMapToMother(record), false, RejectionReasons.DUPLICATE_MOBILE_NUMBER_IN_DATASET.toString(), action);
rejectedMothers.put(motherImportRejection.getIdNo(), motherImportRejection);
rejectionStatus.put(motherImportRejection.getIdNo(), motherImportRejection.getAccepted());
Expand Down Expand Up @@ -593,7 +593,7 @@ private MctsImportAudit saveImportedAnmAshaData(AnmAshaDataSet anmAshaDataSet, S
for (AnmAshaRecord record : rejectedAshaRecords) {
record.setStateId(stateCode);
action = this.flwActionFinder(record);
LOGGER.error("Existing Asha Record with same MSISDN in the data set");
LOGGER.debug("Existing Asha Record with same MSISDN in the data set");
flwRejectionService.createUpdate(flwRejectionMcts(record, false, RejectionReasons.DUPLICATE_MOBILE_NUMBER_IN_DATASET.toString(), action));
rejected++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public class RchWebServiceFacadeImpl implements RchWebServiceFacade {
private static final String LOCAL_RESPONSE_DIR = "rch.local_response_dir";
private static final String REMOTE_RESPONSE_DIR = "rch.remote_response_dir";
private static final String REMOTE_RESPONSE_DIR_CSV = "rch.remote_response_dir_csv";
private static final String REMOTE_RESPONSE_DIR_XML = "rch.remote_response_dir_xml";
private static final String LOC_UPDATE_DIR_RCH = "rch.loc_update_dir";
private static final String REMOTE_RESPONSE_DIR_LOCATION = "rch.remote_response_dir_locations";
private static final String NULL = "NULL";
Expand Down Expand Up @@ -615,7 +616,7 @@ private RchImportAudit saveImportedMothersData(RchMothersDataSet mothersDataSet,

This comment has been minimized.

Copy link
@gudipatiharitha

gudipatiharitha Jul 23, 2018

Contributor

Better not merge and better to create separate pull request form master

for (Map<String, Object> record : rejectedRchMothers) {
action = (String) record.get(KilkariConstants.ACTION);
LOGGER.error("Existing Mother Record with same MSISDN in the data set");
LOGGER.debug("Existing Mother Record with same MSISDN in the data set");
motherImportRejection = motherRejectionRch(convertMapToRchMother(record), false, RejectionReasons.DUPLICATE_MOBILE_NUMBER_IN_DATASET.toString(), action);
rejectedMothers.put(motherImportRejection.getRegistrationNo(), motherImportRejection);
rejectionStatus.put(motherImportRejection.getRegistrationNo(), motherImportRejection.getAccepted());
Expand Down Expand Up @@ -847,7 +848,7 @@ private RchImportAudit saveImportedAshaData(RchAnmAshaDataSet anmAshaDataSet, St
String action = "";
for (RchAnmAshaRecord record : rejectedRchAshas) {
action = this.rchFlwActionFinder(record);
LOGGER.error("Existing Asha Record with same MSISDN in the data set");
LOGGER.debug("Existing Asha Record with same MSISDN in the data set");
flwRejectionService.createUpdate(flwRejectionRch(record, false, RejectionReasons.DUPLICATE_MOBILE_NUMBER_IN_DATASET.toString(), action));
}
List<RchAnmAshaRecord> acceptedRchAshas = rchAshaRecordsSet.get(1);
Expand Down Expand Up @@ -884,7 +885,7 @@ private RchImportAudit saveImportedAshaData(RchAnmAshaDataSet anmAshaDataSet, St
flwRejectionService.createUpdate(flwRejectionRch(record, false, RejectionReasons.INVALID_LOCATION.toString(), action));
rejected++;
} catch (FlwImportException e) {
LOGGER.error("Existing FLW with same MSISDN but different RCH ID", e);
LOGGER.debug("Existing FLW with same MSISDN but different RCH ID", e);
flwRejectionService.createUpdate(flwRejectionRch(record, false, RejectionReasons.MOBILE_NUMBER_ALREADY_IN_USE.toString(), action));
rejected++;
} catch (FlwExistingRecordException e) {
Expand Down Expand Up @@ -1093,6 +1094,10 @@ private File fileForLocUpdate(String fileName) {
return new File(remoteResponseFile(fileName));
}

private File fileForXmlLocUpdate(String fileName) {
return new File(remoteResponseFileForXml(fileName));
}

public String localResponseFile(String file) {
String localFile = settingsFacade.getProperty(LOCAL_RESPONSE_DIR);
localFile += localFile.endsWith("/") ? "" : "/";
Expand All @@ -1107,6 +1112,13 @@ public String remoteResponseFile(String file) {
return remoteFile;
}

public String remoteResponseFileForXml(String file) {
String remoteFile = settingsFacade.getProperty(REMOTE_RESPONSE_DIR_XML);
remoteFile += remoteFile.endsWith("/") ? "" : "/";
remoteFile += file;
return remoteFile;
}

private Long getScpTimeout() {
try {
return Long.parseLong(settingsFacade.getProperty(SCP_TIMEOUT_SETTING));
Expand Down Expand Up @@ -1247,7 +1259,7 @@ public int compare(RchImportFacilitator m1, RchImportFacilitator m2) {

for (RchImportFacilitator rchImportFile : rchImportFiles
) {
File remoteResponseFile = fileForLocUpdate(rchImportFile.getFileName());
File remoteResponseFile = fileForXmlLocUpdate(rchImportFile.getFileName());

if (remoteResponseFile.exists() && !remoteResponseFile.isDirectory()) {

Expand Down
3 changes: 3 additions & 0 deletions rch/src/main/resources/rch.properties
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ rch.local_response_dir=/usr/local/RCH/rch-records-local
#remote directory where RCH response file should be copied to
rch.remote_response_dir=/usr/local/RCH/rch-records-remote

#remote directory where RCH response file should be copied to
rch.remote_response_dir_xml =/usr/local/RCH/rch-records-remote/xml

#remote directory where RCH response file should be copied to
rch.remote_response_dir_csv =/usr/local/RCH/rch-records-remote/csv

Expand Down

0 comments on commit 725866f

Please sign in to comment.