forked from openMF/android-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes openMF#2035 : Fineract SDK Implementation : client, center, gro…
…up list (openMF#2037) * Implemented client, center,group list using sdk * Unit test for viewmodels, staff and offlice sdk implementation
- Loading branch information
1 parent
beece85
commit 5f0ff47
Showing
23 changed files
with
698 additions
and
22 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
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
42 changes: 42 additions & 0 deletions
42
mifosng-android/src/main/java/com/mifos/mappers/centers/CenterMapper.kt
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,42 @@ | ||
package com.mifos.mappers.centers | ||
|
||
import com.mifos.objects.client.Status | ||
import com.mifos.objects.group.Center | ||
import org.apache.fineract.client.models.GetCentersPageItems | ||
import org.apache.fineract.client.models.GetCentersStatus | ||
import org.mifos.core.data.AbstractMapper | ||
|
||
object CenterMapper : AbstractMapper<GetCentersPageItems, Center>() { | ||
|
||
override fun mapFromEntity(entity: GetCentersPageItems): Center { | ||
return Center().apply { | ||
id = entity.id | ||
active = entity.active | ||
name = entity.name | ||
officeName = entity.officeName | ||
officeId = entity.officeId | ||
hierarchy = entity.hierarchy | ||
status = Status().apply { | ||
id = entity.status?.id!! | ||
code = entity.status?.code | ||
value = entity.status?.description | ||
} | ||
} | ||
} | ||
|
||
override fun mapToEntity(domainModel: Center): GetCentersPageItems { | ||
return GetCentersPageItems().apply { | ||
id = domainModel.id | ||
active = domainModel.active | ||
name = domainModel.name | ||
officeName = domainModel.officeName | ||
officeId = domainModel.officeId | ||
hierarchy = domainModel.hierarchy | ||
status = GetCentersStatus().apply { | ||
id = domainModel.status?.id!! | ||
code = domainModel.status?.code | ||
description = domainModel.status?.value | ||
} | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
mifosng-android/src/main/java/com/mifos/mappers/centers/GetCentersResponseMapper.kt
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,23 @@ | ||
package com.mifos.mappers.centers | ||
|
||
import com.mifos.objects.client.Page | ||
import com.mifos.objects.group.Center | ||
import org.apache.fineract.client.models.GetCentersResponse | ||
import org.mifos.core.data.AbstractMapper | ||
|
||
object GetCentersResponseMapper : AbstractMapper<GetCentersResponse, Page<Center>>() { | ||
|
||
override fun mapFromEntity(entity: GetCentersResponse): Page<Center> { | ||
return Page<Center>().apply { | ||
totalFilteredRecords = entity.totalFilteredRecords!! | ||
pageItems = CenterMapper.mapFromEntityList(entity.pageItems!!) | ||
} | ||
} | ||
|
||
override fun mapToEntity(domainModel: Page<Center>): GetCentersResponse { | ||
return GetCentersResponse().apply { | ||
totalFilteredRecords = domainModel.totalFilteredRecords | ||
pageItems = CenterMapper.mapToEntityList(domainModel.pageItems) | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
mifosng-android/src/main/java/com/mifos/mappers/clients/ClientMapper.kt
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,47 @@ | ||
package com.mifos.mappers.clients | ||
|
||
import com.mifos.objects.client.Client | ||
import com.mifos.objects.client.Status | ||
import org.apache.fineract.client.models.GetClientStatus | ||
import org.apache.fineract.client.models.GetClientsPageItemsResponse | ||
import org.mifos.core.data.AbstractMapper | ||
|
||
object ClientMapper : AbstractMapper<GetClientsPageItemsResponse, Client>() { | ||
|
||
override fun mapFromEntity(entity: GetClientsPageItemsResponse): Client { | ||
return Client().apply { | ||
id = entity.id!! | ||
accountNo = entity.accountNo | ||
fullname = entity.fullname | ||
firstname = entity.displayName!!.split(" ")[0] | ||
lastname = | ||
if (entity.displayName!!.split(" ").size >= 2) entity.displayName!!.split(" ")[1] else "" | ||
displayName = entity.displayName | ||
officeId = entity.officeId!! | ||
officeName = entity.officeName | ||
active = entity.active!! | ||
status = Status().apply { | ||
id = entity.status?.id!! | ||
code = entity.status?.code | ||
value = entity.status?.description | ||
} | ||
} | ||
} | ||
|
||
override fun mapToEntity(domainModel: Client): GetClientsPageItemsResponse { | ||
return GetClientsPageItemsResponse().apply { | ||
id = domainModel.id | ||
accountNo = domainModel.accountNo | ||
fullname = domainModel.fullname | ||
displayName = domainModel.displayName | ||
officeId = domainModel.officeId | ||
officeName = domainModel.officeName | ||
active = domainModel.active | ||
status = GetClientStatus().apply { | ||
id = domainModel.status?.id | ||
code = domainModel.status?.code | ||
description = domainModel.status?.value | ||
} | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
mifosng-android/src/main/java/com/mifos/mappers/clients/GetClientResponseMapper.kt
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,23 @@ | ||
package com.mifos.mappers.clients | ||
|
||
import com.mifos.objects.client.Client | ||
import com.mifos.objects.client.Page | ||
import org.apache.fineract.client.models.GetClientsResponse | ||
import org.mifos.core.data.AbstractMapper | ||
|
||
object GetClientResponseMapper : AbstractMapper<GetClientsResponse, Page<Client>>() { | ||
|
||
override fun mapFromEntity(entity: GetClientsResponse): Page<Client> { | ||
return Page<Client>().apply { | ||
totalFilteredRecords = entity.totalFilteredRecords!! | ||
pageItems = ClientMapper.mapFromEntityList(entity.pageItems!!) | ||
} | ||
} | ||
|
||
override fun mapToEntity(domainModel: Page<Client>): GetClientsResponse { | ||
return GetClientsResponse().apply { | ||
totalFilteredRecords = domainModel.totalFilteredRecords | ||
pageItems = ClientMapper.mapToEntityList(domainModel.pageItems) | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
mifosng-android/src/main/java/com/mifos/mappers/groups/GetGroupsResponseMapper.kt
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,23 @@ | ||
package com.mifos.mappers.groups | ||
|
||
import com.mifos.objects.client.Page | ||
import com.mifos.objects.group.Group | ||
import org.apache.fineract.client.models.GetGroupsResponse | ||
import org.mifos.core.data.AbstractMapper | ||
|
||
object GetGroupsResponseMapper : AbstractMapper<GetGroupsResponse, Page<Group>>() { | ||
|
||
override fun mapFromEntity(entity: GetGroupsResponse): Page<Group> { | ||
return Page<Group>().apply { | ||
totalFilteredRecords = entity.totalFilteredRecords!! | ||
pageItems = GroupMapper.mapFromEntityList(entity.pageItems!!) | ||
} | ||
} | ||
|
||
override fun mapToEntity(domainModel: Page<Group>): GetGroupsResponse { | ||
return GetGroupsResponse().apply { | ||
totalFilteredRecords = domainModel.totalFilteredRecords | ||
pageItems = GroupMapper.mapToEntityList(domainModel.pageItems) | ||
} | ||
} | ||
} |
Oops, something went wrong.