Skip to content

Commit

Permalink
Merge pull request #697 from motech-implementations/kilkari-csv-impor…
Browse files Browse the repository at this point in the history
…t-fix

Added Last_Update_date to mapping of csvReader
  • Loading branch information
sripooja authored Oct 5, 2016
2 parents 3faa539 + 8f61d8e commit 00b8da3
Show file tree
Hide file tree
Showing 15 changed files with 176 additions and 89 deletions.
4 changes: 2 additions & 2 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<artifactId>nms</artifactId>
<groupId>org.motechproject.nms</groupId>
<version>1.0.21</version>
<version>1.0.22</version>
<relativePath>../</relativePath>
</parent>

<artifactId>api</artifactId>
<version>1.0.21</version>
<version>1.0.22</version>
<packaging>bundle</packaging>
<name>API module</name>

Expand Down
4 changes: 2 additions & 2 deletions csv/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<artifactId>nms</artifactId>
<groupId>org.motechproject.nms</groupId>
<version>1.0.21</version>
<version>1.0.22</version>
<relativePath>../</relativePath>
</parent>

<artifactId>csv</artifactId>
<version>1.0.21</version>
<version>1.0.22</version>
<packaging>bundle</packaging>
<name>CSV Module</name>

Expand Down
4 changes: 2 additions & 2 deletions flw/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<artifactId>nms</artifactId>
<groupId>org.motechproject.nms</groupId>
<version>1.0.21</version>
<version>1.0.22</version>
<relativePath>../</relativePath>
</parent>

<artifactId>flw</artifactId>
<version>1.0.21</version>
<version>1.0.22</version>
<packaging>bundle</packaging>
<name>FLW module</name>

Expand Down
4 changes: 2 additions & 2 deletions flwUpdate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<parent>
<artifactId>nms</artifactId>
<groupId>org.motechproject.nms</groupId>
<version>1.0.21</version>
<version>1.0.22</version>
<relativePath>../</relativePath>
</parent>

<artifactId>flwUpdate</artifactId>
<version>1.0.21</version>
<version>1.0.22</version>
<packaging>bundle</packaging>
<name>FLW Update Module</name>

Expand Down
4 changes: 2 additions & 2 deletions imi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<parent>
<artifactId>nms</artifactId>
<groupId>org.motechproject.nms</groupId>
<version>1.0.21</version>
<version>1.0.22</version>
<relativePath>../</relativePath>
</parent>

<artifactId>imi</artifactId>
<version>1.0.21</version>
<version>1.0.22</version>
<packaging>bundle</packaging>
<name>IMI module</name>

Expand Down
4 changes: 2 additions & 2 deletions kilkari/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<artifactId>nms</artifactId>
<groupId>org.motechproject.nms</groupId>
<version>1.0.21</version>
<version>1.0.22</version>
<relativePath>../</relativePath>
</parent>

<artifactId>kilkari</artifactId>
<version>1.0.21</version>
<version>1.0.22</version>
<packaging>bundle</packaging>
<name>Kilkari module</name>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ public boolean importMotherRecord(Map<String, Object> record) {

//validate if it's an updated record compared to one from database
if (mother.getUpdatedDateNic() != null && (mctsUpdatedDateNic == null || mother.getUpdatedDateNic().isAfter(mctsUpdatedDateNic))) {
subscriptionErrorDataService.create(new SubscriptionError(msisdn, mother.getBeneficiaryId(),
SubscriptionRejectionReason.ALREADY_SUBSCRIBED, SubscriptionPackType.PREGNANCY, "Updated Record exits"));
return false;
}

Expand Down Expand Up @@ -267,6 +269,8 @@ public boolean importChildRecord(Map<String, Object> record) {

//validate if it's an updated record compared to one from database
if (child.getUpdatedDateNic() != null && (mctsUpdatedDateNic == null || child.getUpdatedDateNic().isAfter(mctsUpdatedDateNic))) {
subscriptionErrorDataService.create(new SubscriptionError(msisdn, child.getBeneficiaryId(),
SubscriptionRejectionReason.ALREADY_SUBSCRIBED, SubscriptionPackType.CHILD, "Updated Record exits"));
return false;
}

Expand Down Expand Up @@ -419,7 +423,12 @@ public Boolean retrieve(String value) {
return mctsBeneficiaryValueProcessor.getDeathFromString(value);
}
}));

mapping.put(KilkariConstants.LAST_UPDATE_DATE, new Optional(new GetInstanceByString<LocalDate>() {
@Override
public LocalDate retrieve(String value) {
return (LocalDate) mctsBeneficiaryValueProcessor.getDateByString(value).toLocalDate();
}
}));
return mapping;
}

Expand Down Expand Up @@ -459,7 +468,12 @@ public Boolean retrieve(String value) {
return mctsBeneficiaryValueProcessor.getDeathFromString(value);
}
}));

mapping.put(KilkariConstants.LAST_UPDATE_DATE, new Optional(new GetInstanceByString<LocalDate>() {
@Override
public LocalDate retrieve(String value) {
return (LocalDate) mctsBeneficiaryValueProcessor.getDateByString(value).toLocalDate();
}
}));
return mapping;
}
}
4 changes: 2 additions & 2 deletions mcts/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<parent>
<artifactId>nms</artifactId>
<groupId>org.motechproject.nms</groupId>
<version>1.0.21</version>
<version>1.0.22</version>
<relativePath>../</relativePath>
</parent>

<artifactId>mcts</artifactId>
<version>1.0.21</version>
<version>1.0.22</version>
<packaging>bundle</packaging>
<name>Mother Children Tracking Service</name>

Expand Down
4 changes: 2 additions & 2 deletions mobile-academy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<artifactId>nms</artifactId>
<groupId>org.motechproject.nms</groupId>
<version>1.0.21</version>
<version>1.0.22</version>
<relativePath>../</relativePath>
</parent>

<artifactId>mobile-academy</artifactId>
<version>1.0.21</version>
<version>1.0.22</version>
<packaging>bundle</packaging>
<name>Mobile Academy module</name>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<artifactId>nms</artifactId>
<groupId>org.motechproject.nms</groupId>
<version>1.0.21</version>
<version>1.0.22</version>
<packaging>pom</packaging>
<name>National Motech System</name>

Expand Down
4 changes: 2 additions & 2 deletions props/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<artifactId>nms</artifactId>
<groupId>org.motechproject.nms</groupId>
<version>1.0.21</version>
<version>1.0.22</version>
<relativePath>../</relativePath>
</parent>

<artifactId>props</artifactId>
<version>1.0.21</version>
<version>1.0.22</version>
<packaging>bundle</packaging>
<name>Properties module</name>

Expand Down
4 changes: 2 additions & 2 deletions region/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<artifactId>nms</artifactId>
<groupId>org.motechproject.nms</groupId>
<version>1.0.21</version>
<version>1.0.22</version>
<relativePath>../</relativePath>
</parent>

<artifactId>region</artifactId>
<version>1.0.21</version>
<version>1.0.22</version>
<packaging>bundle</packaging>
<name>Region Module</name>

Expand Down
4 changes: 2 additions & 2 deletions testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<parent>
<artifactId>nms</artifactId>
<groupId>org.motechproject.nms</groupId>
<version>1.0.21</version>
<version>1.0.22</version>
<relativePath>../</relativePath>
</parent>

<artifactId>testing</artifactId>
<version>1.0.21</version>
<version>1.0.22</version>
<packaging>bundle</packaging>
<name>Testing module</name>

Expand Down
Loading

0 comments on commit 00b8da3

Please sign in to comment.