filtering - rest of client gets
This commit is contained in:
@@ -13,7 +13,7 @@ import org.joda.time.Days;
|
|||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
|
|
||||||
@XmlRootElement(name = "client")
|
@XmlRootElement(name = "client")
|
||||||
@JsonIgnoreProperties({ "organisationId","organisationName" })
|
@JsonIgnoreProperties({ "organisationId", "organisationName" })
|
||||||
@JsonFilter("myFilter")
|
@JsonFilter("myFilter")
|
||||||
public class ClientData implements Serializable {
|
public class ClientData implements Serializable {
|
||||||
|
|
||||||
@@ -27,18 +27,17 @@ public class ClientData implements Serializable {
|
|||||||
private String displayName;
|
private String displayName;
|
||||||
private String externalId;
|
private String externalId;
|
||||||
private LocalDate joinedDate;
|
private LocalDate joinedDate;
|
||||||
|
|
||||||
private List<OfficeLookup> allowedOffices = new ArrayList<OfficeLookup>();
|
private List<OfficeLookup> allowedOffices = new ArrayList<OfficeLookup>();
|
||||||
|
|
||||||
public ClientData() {
|
public ClientData() {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClientData(final Long organisationId,
|
public ClientData(final Long organisationId, final String organisationName,
|
||||||
final String organisationName, final Long officeId,
|
final Long officeId, final String officeName, final Long id,
|
||||||
final String officeName, final Long id, final String firstname,
|
final String firstname, final String lastname,
|
||||||
final String lastname, final String externalId,
|
final String externalId, final LocalDate joinedDate) {
|
||||||
final LocalDate joinedDate) {
|
|
||||||
this.organisationId = organisationId;
|
this.organisationId = organisationId;
|
||||||
this.organisationName = organisationName;
|
this.organisationName = organisationName;
|
||||||
this.officeId = officeId;
|
this.officeId = officeId;
|
||||||
@@ -46,15 +45,15 @@ public class ClientData implements Serializable {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
this.firstname = firstname;
|
this.firstname = firstname;
|
||||||
this.lastname = lastname;
|
this.lastname = lastname;
|
||||||
this.displayName = new StringBuilder(this.firstname).append(' ').append(this.lastname).toString();
|
this.displayName = new StringBuilder(this.firstname).append(' ')
|
||||||
|
.append(this.lastname).toString();
|
||||||
this.externalId = externalId;
|
this.externalId = externalId;
|
||||||
this.joinedDate = joinedDate;
|
this.joinedDate = joinedDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxJoinedOnOffsetFromToday() {
|
public int getMaxJoinedOnOffsetFromToday() {
|
||||||
return Days.daysBetween(new DateTime(),
|
return Days.daysBetween(new DateTime(),
|
||||||
this.getJoinedDate().toDateMidnight().toDateTime())
|
this.getJoinedDate().toDateMidnight().toDateTime()).getDays();
|
||||||
.getDays();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
|
|||||||
+3
@@ -5,7 +5,10 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import org.codehaus.jackson.map.annotate.JsonFilter;
|
||||||
|
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
|
@JsonFilter("myFilter")
|
||||||
public class ClientLoanAccountSummaryCollectionData {
|
public class ClientLoanAccountSummaryCollectionData {
|
||||||
|
|
||||||
private List<ClientLoanAccountSummaryData> pendingApprovalLoans = new ArrayList<ClientLoanAccountSummaryData>();
|
private List<ClientLoanAccountSummaryData> pendingApprovalLoans = new ArrayList<ClientLoanAccountSummaryData>();
|
||||||
|
|||||||
@@ -19,19 +19,19 @@ public class ClientLoanAccountSummaryData implements Serializable {
|
|||||||
private boolean waitingForDisbursal;
|
private boolean waitingForDisbursal;
|
||||||
private boolean open;
|
private boolean open;
|
||||||
private boolean closed;
|
private boolean closed;
|
||||||
|
|
||||||
private String lifeCycleStatusText;
|
private String lifeCycleStatusText;
|
||||||
private LocalDate lifeCycleStatusDate;
|
private LocalDate lifeCycleStatusDate;
|
||||||
|
|
||||||
// private LocalDate submittedOnDate;
|
// private LocalDate submittedOnDate;
|
||||||
// private LocalDate approvedOnDate;
|
// private LocalDate approvedOnDate;
|
||||||
// private LocalDate expectedDisbursementDate;
|
// private LocalDate expectedDisbursementDate;
|
||||||
// private LocalDate actualDisbursementDate;
|
// private LocalDate actualDisbursementDate;
|
||||||
// private LocalDate expectedFirstRepaymentOnDate;
|
// private LocalDate expectedFirstRepaymentOnDate;
|
||||||
// private LocalDate interestCalculatedFromDate;
|
// private LocalDate interestCalculatedFromDate;
|
||||||
// private LocalDate expectedMaturityDate;
|
// private LocalDate expectedMaturityDate;
|
||||||
// private LocalDate closedOnDate;
|
// private LocalDate closedOnDate;
|
||||||
|
|
||||||
public ClientLoanAccountSummaryData() {
|
public ClientLoanAccountSummaryData() {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ package org.mifosng.data;
|
|||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import org.codehaus.jackson.map.annotate.JsonFilter;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
@XmlRootElement(name = "note")
|
@XmlRootElement(name = "note")
|
||||||
|
@JsonFilter("myFilter")
|
||||||
public class NoteData {
|
public class NoteData {
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
package org.mifosng.data;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
@XmlRootElement
|
|
||||||
public class NoteDataList {
|
|
||||||
|
|
||||||
private Collection<NoteData> notes = new ArrayList<NoteData>();
|
|
||||||
|
|
||||||
public NoteDataList() {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
public NoteDataList(final Collection<NoteData> notes) {
|
|
||||||
this.notes = notes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<NoteData> getNotes() {
|
|
||||||
return notes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNotes(Collection<NoteData> notes) {
|
|
||||||
this.notes = notes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -21,7 +21,6 @@ import org.mifosng.data.ClientData;
|
|||||||
import org.mifosng.data.ClientLoanAccountSummaryCollectionData;
|
import org.mifosng.data.ClientLoanAccountSummaryCollectionData;
|
||||||
import org.mifosng.data.EntityIdentifier;
|
import org.mifosng.data.EntityIdentifier;
|
||||||
import org.mifosng.data.NoteData;
|
import org.mifosng.data.NoteData;
|
||||||
import org.mifosng.data.NoteDataList;
|
|
||||||
import org.mifosng.data.OfficeLookup;
|
import org.mifosng.data.OfficeLookup;
|
||||||
import org.mifosng.data.command.ClientCommand;
|
import org.mifosng.data.command.ClientCommand;
|
||||||
import org.mifosng.data.command.NoteCommand;
|
import org.mifosng.data.command.NoteCommand;
|
||||||
@@ -146,26 +145,31 @@ public class ClientApiResource {
|
|||||||
@Path("{clientId}/loans")
|
@Path("{clientId}/loans")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public Response retrieveClientAccount(
|
public String retrieveClientAccount(
|
||||||
@PathParam("clientId") final Long clientId) {
|
@PathParam("clientId") final Long clientId, @Context UriInfo uriInfo) {
|
||||||
|
|
||||||
ClientLoanAccountSummaryCollectionData clientAccount = this.clientReadPlatformService
|
ClientLoanAccountSummaryCollectionData clientAccount = this.clientReadPlatformService
|
||||||
.retrieveClientAccountDetails(clientId);
|
.retrieveClientAccountDetails(clientId);
|
||||||
|
|
||||||
return Response.ok().entity(clientAccount).build();
|
String selectedFields = "";
|
||||||
|
return this.jsonFormattingService.convertRequest(clientAccount,
|
||||||
|
filterName, allowedFieldList, selectedFields,
|
||||||
|
uriInfo.getQueryParameters());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{clientId}/notes")
|
@Path("{clientId}/notes")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public Response retrieveAllClientNotes(
|
public String retrieveAllClientNotes(
|
||||||
@PathParam("clientId") final Long clientId) {
|
@PathParam("clientId") final Long clientId, @Context UriInfo uriInfo) {
|
||||||
|
|
||||||
Collection<NoteData> notes = this.clientReadPlatformService
|
Collection<NoteData> notes = this.clientReadPlatformService
|
||||||
.retrieveAllClientNotes(clientId);
|
.retrieveAllClientNotes(clientId);
|
||||||
|
|
||||||
return Response.ok().entity(new NoteDataList(notes)).build();
|
String selectedFields = "";
|
||||||
|
return this.jsonFormattingService.convertRequest(notes, filterName,
|
||||||
|
allowedFieldList, selectedFields, uriInfo.getQueryParameters());
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@@ -188,14 +192,16 @@ public class ClientApiResource {
|
|||||||
@Path("{clientId}/notes/{noteId}")
|
@Path("{clientId}/notes/{noteId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public Response retrieveClientNote(
|
public String retrieveClientNote(
|
||||||
@PathParam("clientId") final Long clientId,
|
@PathParam("clientId") final Long clientId,
|
||||||
@PathParam("noteId") final Long noteId) {
|
@PathParam("noteId") final Long noteId, @Context UriInfo uriInfo) {
|
||||||
|
|
||||||
NoteData note = this.clientReadPlatformService.retrieveClientNote(
|
NoteData note = this.clientReadPlatformService.retrieveClientNote(
|
||||||
clientId, noteId);
|
clientId, noteId);
|
||||||
|
|
||||||
return Response.ok().entity(note).build();
|
String selectedFields = "";
|
||||||
|
return this.jsonFormattingService.convertRequest(note, filterName,
|
||||||
|
allowedFieldList, selectedFields, uriInfo.getQueryParameters());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
|
|||||||
Reference in New Issue
Block a user