handle client resource and sub resources for notes and loanaccount summaries.

This commit is contained in:
Keith Woodlock
2012-05-15 16:45:16 +01:00
parent dc1c39c5ec
commit 04d4fbaf85
32 changed files with 1324 additions and 1695 deletions
@@ -2,27 +2,18 @@ package org.mifosng.ui;
import java.util.Collection;
import org.mifosng.data.ClientData;
import org.mifosng.data.ClientDataWithAccountsData;
import org.mifosng.data.EntityIdentifier;
import org.mifosng.data.EnumOptionReadModel;
import org.mifosng.data.LoanAccountData;
import org.mifosng.data.LoanProductData;
import org.mifosng.data.LoanRepaymentData;
import org.mifosng.data.LoanSchedule;
import org.mifosng.data.NewLoanWorkflowStepOneData;
import org.mifosng.data.NoteData;
import org.mifosng.data.PermissionData;
import org.mifosng.data.command.AdjustLoanTransactionCommand;
import org.mifosng.data.command.CalculateLoanScheduleCommand;
import org.mifosng.data.command.EnrollClientCommand;
import org.mifosng.data.command.LoanStateTransitionCommand;
import org.mifosng.data.command.LoanTransactionCommand;
import org.mifosng.data.command.NoteCommand;
import org.mifosng.data.command.SubmitLoanApplicationCommand;
import org.mifosng.data.command.UndoLoanApprovalCommand;
import org.mifosng.data.command.UndoLoanDisbursalCommand;
import org.mifosng.data.command.UserCommand;
import org.springframework.security.oauth.consumer.ProtectedResourceDetails;
public interface CommonRestOperations {
@@ -31,18 +22,11 @@ public interface CommonRestOperations {
void updateProtectedResource(ProtectedResourceDetails loadProtectedResourceDetailsById);
Collection<PermissionData> retrieveAllPermissions();
Collection<EnumOptionReadModel> retrieveAllPermissionGroups();
Collection<ClientData> retrieveAllIndividualClients();
Collection<LoanProductData> retrieveAllLoanProducts();
LoanSchedule calculateLoanSchedule(CalculateLoanScheduleCommand command);
NewLoanWorkflowStepOneData retrieveNewLoanApplicationStepOneDetails(
Long clientId);
NewLoanWorkflowStepOneData retrieveNewLoanApplicationStepOneDetails(Long clientId);
Long submitLoanApplication(SubmitLoanApplicationCommand command);
@@ -72,26 +56,5 @@ public interface CommonRestOperations {
EntityIdentifier waiveLoanAmount(LoanTransactionCommand command);
EntityIdentifier updateCurrentUserDetails(UserCommand command);
ClientData retrieveNewIndividualClient();
ClientData retrieveClientDetails(Long clientId);
EntityIdentifier enrollClient(EnrollClientCommand command);
EntityIdentifier addNote(NoteCommand command);
EntityIdentifier updateNote(NoteCommand command);
NoteData retrieveClientNote(Long clientId, Long noteId);
Collection<NoteData> retrieveClientNotes(Long clientId);
ClientDataWithAccountsData retrieveClientAccount(Long clientId);
LoanAccountData retrieveLoanAccount(Long loanId);
NewLoanWorkflowStepOneData retrieveNewLoanApplicationDetails(Long clientId,
Long productId);
NewLoanWorkflowStepOneData retrieveNewLoanApplicationDetails(Long clientId, Long productId);
}
@@ -6,34 +6,22 @@ import java.util.Collection;
import java.util.List;
import org.mifosng.configuration.ApplicationConfigurationService;
import org.mifosng.data.ClientData;
import org.mifosng.data.ClientDataWithAccountsData;
import org.mifosng.data.ClientList;
import org.mifosng.data.EntityIdentifier;
import org.mifosng.data.EnumOptionList;
import org.mifosng.data.EnumOptionReadModel;
import org.mifosng.data.ErrorResponse;
import org.mifosng.data.ErrorResponseList;
import org.mifosng.data.LoanAccountData;
import org.mifosng.data.LoanProductData;
import org.mifosng.data.LoanProductList;
import org.mifosng.data.LoanRepaymentData;
import org.mifosng.data.LoanSchedule;
import org.mifosng.data.NewLoanWorkflowStepOneData;
import org.mifosng.data.NoteData;
import org.mifosng.data.NoteDataList;
import org.mifosng.data.PermissionData;
import org.mifosng.data.PermissionList;
import org.mifosng.data.command.AdjustLoanTransactionCommand;
import org.mifosng.data.command.CalculateLoanScheduleCommand;
import org.mifosng.data.command.EnrollClientCommand;
import org.mifosng.data.command.LoanStateTransitionCommand;
import org.mifosng.data.command.LoanTransactionCommand;
import org.mifosng.data.command.NoteCommand;
import org.mifosng.data.command.SubmitLoanApplicationCommand;
import org.mifosng.data.command.UndoLoanApprovalCommand;
import org.mifosng.data.command.UndoLoanDisbursalCommand;
import org.mifosng.data.command.UserCommand;
import org.mifosng.ui.loanproduct.ClientValidationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
@@ -94,17 +82,6 @@ public class CommonRestOperationsImpl implements CommonRestOperations {
return requestEntity;
}
@Override
public Collection<ClientData> retrieveAllIndividualClients() {
URI restUri = URI.create(getBaseServerUrl().concat(
"api/protected/client/all"));
ResponseEntity<ClientList> s = this.oauthRestServiceTemplate.exchange(
restUri, HttpMethod.GET, emptyRequest(), ClientList.class);
return s.getBody().getClients();
}
@Override
public Collection<LoanProductData> retrieveAllLoanProducts() {
URI restUri = URI.create(getBaseServerUrl().concat(
@@ -524,234 +501,4 @@ public class CommonRestOperationsImpl implements CommonRestOperations {
return new HttpEntity<CalculateLoanScheduleCommand>(command,
requestHeaders);
}
@Override
public EntityIdentifier updateCurrentUserDetails(UserCommand command) {
try {
URI restUri = URI.create(getBaseServerUrl().concat(
"api/protected/admin/user/current"));
ResponseEntity<EntityIdentifier> s = this.oauthRestServiceTemplate
.postForEntity(restUri, createUserRequest(command),
EntityIdentifier.class);
return s.getBody();
} catch (HttpStatusCodeException e) {
ErrorResponseList errorList = parseErrors(e);
throw new ClientValidationException(errorList.getErrors());
}
}
private HttpEntity<UserCommand> createUserRequest(final UserCommand command) {
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.set("Accept", "application/xml");
requestHeaders.set("Content-Type", "application/xml");
HttpEntity<UserCommand> requestEntity = new HttpEntity<UserCommand>(
command, requestHeaders);
return requestEntity;
}
@Override
public Collection<PermissionData> retrieveAllPermissions() {
URI restUri = URI.create(getBaseServerUrl().concat(
"api/protected/admin/permissions/all"));
ResponseEntity<PermissionList> s = this.oauthRestServiceTemplate
.exchange(restUri, HttpMethod.GET, emptyRequest(),
PermissionList.class);
return s.getBody().getPermissions();
}
@Override
public Collection<EnumOptionReadModel> retrieveAllPermissionGroups() {
try {
URI restUri = URI.create(getBaseServerUrl().concat(
"api/protected/admin/permissiongroup/all"));
ResponseEntity<EnumOptionList> s = this.oauthRestServiceTemplate
.exchange(restUri, HttpMethod.GET, emptyRequest(),
EnumOptionList.class);
return s.getBody().getOptions();
} catch (HttpStatusCodeException e) {
ErrorResponseList errorList = parseErrors(e);
throw new ClientValidationException(errorList.getErrors());
}
}
@Override
public ClientData retrieveNewIndividualClient() {
URI restUri = URI.create(getBaseServerUrl().concat(
"api/protected/client/new"));
ResponseEntity<ClientData> s = this.oauthRestServiceTemplate.exchange(
restUri, HttpMethod.GET, emptyRequest(), ClientData.class);
return s.getBody();
}
@Override
public ClientData retrieveClientDetails(Long clientId) {
try {
URI restUri = URI.create(getBaseServerUrl().concat(
"api/protected/client/").concat(clientId.toString()));
ResponseEntity<ClientData> s = this.oauthRestServiceTemplate
.exchange(restUri, HttpMethod.GET, emptyRequest(),
ClientData.class);
return s.getBody();
} catch (HttpStatusCodeException e) {
ErrorResponseList errorList = parseErrors(e);
throw new ClientValidationException(errorList.getErrors());
}
}
@Override
public EntityIdentifier enrollClient(EnrollClientCommand command) {
try {
URI restUri = URI.create(getBaseServerUrl().concat(
"api/protected/client/new"));
ResponseEntity<EntityIdentifier> s = this.oauthRestServiceTemplate
.postForEntity(restUri, enrollClientRequest(command),
EntityIdentifier.class);
return s.getBody();
} catch (HttpStatusCodeException e) {
ErrorResponseList errorList = parseErrors(e);
throw new ClientValidationException(errorList.getErrors());
}
}
private HttpEntity<EnrollClientCommand> enrollClientRequest(
final EnrollClientCommand command) {
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.set("Accept", "application/xml");
requestHeaders.set("Content-Type", "application/xml");
return new HttpEntity<EnrollClientCommand>(command, requestHeaders);
}
@Override
public EntityIdentifier addNote(NoteCommand command) {
try {
URI restUri = URI.create(getBaseServerUrl()
.concat("api/protected/client/")
.concat(command.getClientId().toString())
.concat("/note/new"));
ResponseEntity<EntityIdentifier> s = this.oauthRestServiceTemplate
.postForEntity(restUri, noteRequest(command),
EntityIdentifier.class);
return s.getBody();
} catch (HttpStatusCodeException e) {
ErrorResponseList errorList = parseErrors(e);
throw new ClientValidationException(errorList.getErrors());
}
}
@Override
public EntityIdentifier updateNote(NoteCommand command) {
try {
URI restUri = URI.create(getBaseServerUrl().concat(
"api/protected/note/").concat(command.getId().toString()));
ResponseEntity<EntityIdentifier> s = this.oauthRestServiceTemplate
.postForEntity(restUri, noteRequest(command),
EntityIdentifier.class);
return s.getBody();
} catch (HttpStatusCodeException e) {
ErrorResponseList errorList = parseErrors(e);
throw new ClientValidationException(errorList.getErrors());
}
}
@Override
public NoteData retrieveClientNote(Long clientId, Long noteId) {
try {
URI restUri = URI.create(getBaseServerUrl()
.concat("api/protected/client/")
.concat(clientId.toString()).concat("/note/")
.concat(noteId.toString()));
ResponseEntity<NoteData> s = this.oauthRestServiceTemplate
.exchange(restUri, HttpMethod.GET, emptyRequest(),
NoteData.class);
return s.getBody();
} catch (HttpStatusCodeException e) {
ErrorResponseList errorList = parseErrors(e);
throw new ClientValidationException(errorList.getErrors());
}
}
@Override
public Collection<NoteData> retrieveClientNotes(Long clientId) {
try {
URI restUri = URI.create(getBaseServerUrl()
.concat("api/protected/client/")
.concat(clientId.toString()).concat("/note/all"));
ResponseEntity<NoteDataList> s = this.oauthRestServiceTemplate
.exchange(restUri, HttpMethod.GET, emptyRequest(),
NoteDataList.class);
return s.getBody().getNotes();
} catch (HttpStatusCodeException e) {
ErrorResponseList errorList = parseErrors(e);
throw new ClientValidationException(errorList.getErrors());
}
}
private HttpEntity<NoteCommand> noteRequest(final NoteCommand command) {
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.set("Accept", "application/xml");
requestHeaders.set("Content-Type", "application/xml");
return new HttpEntity<NoteCommand>(command, requestHeaders);
}
@Override
public ClientDataWithAccountsData retrieveClientAccount(Long clientId) {
try {
URI restUri = URI.create(getBaseServerUrl()
.concat("api/protected/client/")
.concat(clientId.toString()).concat("/withaccounts"));
ResponseEntity<ClientDataWithAccountsData> s = this.oauthRestServiceTemplate
.exchange(restUri, HttpMethod.GET, emptyRequest(),
ClientDataWithAccountsData.class);
return s.getBody();
} catch (HttpStatusCodeException e) {
ErrorResponseList errorList = parseErrors(e);
throw new ClientValidationException(errorList.getErrors());
}
}
@Override
public LoanAccountData retrieveLoanAccount(Long loanId) {
try {
URI restUri = URI.create(getBaseServerUrl().concat(
"api/protected/loan/" + loanId));
ResponseEntity<LoanAccountData> s = this.oauthRestServiceTemplate
.exchange(restUri, HttpMethod.GET, emptyRequest(),
LoanAccountData.class);
return s.getBody();
} catch (HttpStatusCodeException e) {
ErrorResponseList errorList = parseErrors(e);
throw new ClientValidationException(errorList.getErrors());
}
}
}
@@ -1,50 +0,0 @@
package org.mifosng.ui.admin;
import java.util.Collection;
import javax.servlet.http.HttpServletResponse;
import org.mifosng.data.ErrorResponse;
import org.mifosng.ui.loanproduct.ClientValidationException;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* Controller for user and organisation administration functions.
*/
@Controller
public class AdministrationController {
@ExceptionHandler(AccessDeniedException.class)
public String accessDeniedException() {
return "unAuthorizedAction";
}
@ExceptionHandler(ClientValidationException.class)
public @ResponseBody Collection<ErrorResponse> validationException(ClientValidationException ex, HttpServletResponse response) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.setContentType("application/json");
return ex.getValidationErrors();
}
@RequestMapping(value = "/org/admin", method = RequestMethod.GET)
public String organisationAdminScreen() {
return "admin/orghome";
}
@RequestMapping(value = "/org/admin/user", method = RequestMethod.GET)
public String userAdminScreen() {
return "admin/userhome";
}
@RequestMapping(value = "/org/admin/settings", method = RequestMethod.GET)
public String userSettingsScreen() {
return "admin/accountsettings";
}
}
@@ -0,0 +1,74 @@
package org.mifosng.ui.admin;
import org.mifosng.ui.reporting.ReportingRestOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
/**
* Controller responsible for routing requests on client application to correct jsp page.
*/
@Controller
public class ApplicationPagesRoutesController {
private final ReportingRestOperations reportingRestOperations;
@Autowired
public ApplicationPagesRoutesController(final ReportingRestOperations reportingRestOperations) {
this.reportingRestOperations = reportingRestOperations;
}
@ExceptionHandler(AccessDeniedException.class)
public String accessDeniedException() {
return "unAuthorizedAction";
}
@RequestMapping(value="/forceOAuth", method = RequestMethod.GET)
public String forceOAuth() {
this.reportingRestOperations.hackToForceAuthentication();
return "redirect:/home";
}
@RequestMapping(value="/", method = RequestMethod.GET)
public String redirectToIndexPage() {
return "redirect:/home";
}
@RequestMapping(value = "/home", method = RequestMethod.GET)
public ModelAndView showIndividualClientsOnHomePage() {
return new ModelAndView("/home");
}
@RequestMapping(value="/switchToClient", method = RequestMethod.POST)
public String switchToClientView(@RequestParam("client") final Long client) {
return "redirect:/portfolio/client/" + client;
}
@RequestMapping(value = "/portfolio/client/{clientId}", method = RequestMethod.GET)
public String viewClientAccount(final Model model, @PathVariable("clientId") final Long clientId) {
model.addAttribute("clientId", clientId);
return "client/viewClientAccount";
}
@RequestMapping(value = "/org/admin", method = RequestMethod.GET)
public String organisationAdminScreen() {
return "admin/orghome";
}
@RequestMapping(value = "/org/admin/user", method = RequestMethod.GET)
public String userAdminScreen() {
return "admin/userhome";
}
@RequestMapping(value = "/org/admin/settings", method = RequestMethod.GET)
public String userSettingsScreen() {
return "admin/accountsettings";
}
}
@@ -1,180 +0,0 @@
package org.mifosng.ui.client;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.joda.time.LocalDate;
import org.joda.time.format.DateTimeFormat;
import org.mifosng.data.ClientData;
import org.mifosng.data.ClientDataWithAccountsData;
import org.mifosng.data.ClientList;
import org.mifosng.data.EntityIdentifier;
import org.mifosng.data.ErrorResponse;
import org.mifosng.data.LoanAccountData;
import org.mifosng.data.NoteData;
import org.mifosng.data.command.EnrollClientCommand;
import org.mifosng.data.command.NoteCommand;
import org.mifosng.ui.CommonRestOperations;
import org.mifosng.ui.loanproduct.ClientValidationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
@Controller
public class ClientController {
private final CommonRestOperations commonRestOperations;
@Autowired
public ClientController(final CommonRestOperations commonRestOperations) {
this.commonRestOperations = commonRestOperations;
}
@ExceptionHandler(AccessDeniedException.class)
public String accessDeniedException() {
return "unAuthorizedAction";
}
@ExceptionHandler(ClientValidationException.class)
public @ResponseBody Collection<ErrorResponse> validationException(ClientValidationException ex, HttpServletResponse response) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.setContentType("application/json");
return ex.getValidationErrors();
}
private LocalDate parseStringToLocalDate(String eventDate, String dateFieldIdentifier) {
LocalDate eventLocalDate = null;
if (StringUtils.isNotBlank(eventDate)) {
try {
Locale locale = LocaleContextHolder.getLocale();
eventLocalDate = DateTimeFormat.forPattern("dd MMMM yyyy").withLocale(locale).parseLocalDate(eventDate.toLowerCase(locale));
} catch (IllegalArgumentException e) {
List<ErrorResponse> validationErrors = new ArrayList<ErrorResponse>();
validationErrors.add(new ErrorResponse("validation.msg.invalid.date.format", dateFieldIdentifier, eventDate));
throw new ClientValidationException(validationErrors);
}
}
return eventLocalDate;
}
@RequestMapping(consumes="application/json", produces="application/json", value = "/portfolio/client/{clientId}/note/all", method = RequestMethod.GET)
public @ResponseBody List<NoteData> retrieveClientNotes(@PathVariable("clientId") Long clientId) {
Collection<NoteData> clientNotes = this.commonRestOperations.retrieveClientNotes(clientId);
return new ArrayList<NoteData>(clientNotes);
}
@RequestMapping(consumes="application/json", produces="application/json", value = "/portfolio/client/{clientId}/note/new", method = RequestMethod.GET)
public @ResponseBody NoteData retrieveNewNoteDetails(@PathVariable("clientId") Long clientId) {
NoteData noteData = new NoteData();
noteData.setClientId(clientId);
return noteData;
}
@RequestMapping(consumes="application/x-www-form-urlencoded", produces="application/json", value = "/portfolio/client/{clientId}/note/new", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)
public @ResponseBody EntityIdentifier addClientNote(@PathVariable("clientId") Long clientId,
@RequestParam(value="note", required=false) String note) {
NoteCommand command = new NoteCommand();
command.setClientId(clientId);
command.setNote(note);
return this.commonRestOperations.addNote(command);
}
@RequestMapping(consumes="application/json", produces="application/json", value = "/portfolio/client/{clientId}/note/{noteId}", method = RequestMethod.GET)
public @ResponseBody NoteData retrieveExistingNoteDetails(@PathVariable("clientId") Long clientId, @PathVariable("noteId") Long noteId) {
return this.commonRestOperations.retrieveClientNote(clientId, noteId);
}
@RequestMapping(consumes="application/x-www-form-urlencoded", produces="application/json", value = "/portfolio/client/{clientId}/note/{noteId}", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)
public @ResponseBody EntityIdentifier updateClientNote(@PathVariable("clientId") Long clientId, @PathVariable("noteId") Long noteId,
@RequestParam(value="note", required=false) String note) {
NoteCommand command = new NoteCommand();
command.setId(noteId);
command.setClientId(clientId);
command.setNote(note);
return this.commonRestOperations.updateNote(command);
}
@RequestMapping(consumes="application/json", produces="application/json", value = "/portfolio/client/all", method = RequestMethod.GET)
public @ResponseBody ClientList viewAllClients() {
return new ClientList(this.commonRestOperations.retrieveAllIndividualClients());
}
@RequestMapping(consumes="application/json", produces="application/json", value = "/portfolio/client/new", method = RequestMethod.GET)
public @ResponseBody ClientData newIndividualClientDetails() {
ClientData clientData = this.commonRestOperations.retrieveNewIndividualClient();
return clientData;
}
@RequestMapping(consumes="application/x-www-form-urlencoded", produces="application/json", value = "/portfolio/client/new", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)
public @ResponseBody EntityIdentifier createClient(HttpServletRequest request,
@RequestParam(value="office", required=false) Long officeId,
@RequestParam(value="firstname", required=false) String firstname,
@RequestParam(value="lastname", required=false) String lastname,
@RequestParam(value="fullname", required=false) String fullname,
@RequestParam(value="joiningDate", required=false) String joiningDate,
@RequestParam(value="externalId", required=false) String externalId) {
LocalDate joiningLocalDate = parseStringToLocalDate(joiningDate, "joiningDate");
EnrollClientCommand command = new EnrollClientCommand(firstname, lastname, fullname, officeId, joiningLocalDate);
return this.commonRestOperations.enrollClient(command);
}
@RequestMapping(consumes="application/json", produces="application/json", value = "/portfolio/client/{clientId}", method = RequestMethod.GET)
public @ResponseBody ClientDataWithAccountsData viewClientAccountData(@PathVariable("clientId") Long clientId) {
return this.commonRestOperations.retrieveClientAccount(clientId);
}
@RequestMapping(consumes="application/json", produces="application/json", value = "/portfolio/loan/{loanId}", method = RequestMethod.GET)
public @ResponseBody LoanAccountData viewLoanAccountData(@PathVariable("loanId") Long loanId) {
return this.commonRestOperations.retrieveLoanAccount(loanId);
}
@RequestMapping(value = "/portfolio/client/{clientId}", method = RequestMethod.GET)
public String viewClientAccount(final Model model, @PathVariable("clientId") final Long clientId) {
ClientData clientData = this.commonRestOperations.retrieveClientDetails(clientId);
model.addAttribute("clientId", clientId);
model.addAttribute("clientDisplayName", clientData.getDisplayName());
return "client/viewClientAccount";
}
}
@@ -1,30 +0,0 @@
package org.mifosng.ui.client;
public class DropdownOption {
private String label;
private String value;
public static DropdownOption of(String label, String value) {
DropdownOption option = new DropdownOption();
option.setLabel(label);
option.setValue(value);
return option;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
@@ -1,18 +0,0 @@
package org.mifosng.ui.client;
import org.joda.time.DateTime;
import org.springframework.format.annotation.DateTimeFormat;
public class PayoffFormBean {
@DateTimeFormat(pattern = "yyyy-MM-dd")
private DateTime payoffDate = new DateTime();
public DateTime getPayoffDate() {
return this.payoffDate;
}
public void setPayoffDate(final DateTime payoffDate) {
this.payoffDate = payoffDate;
}
}
@@ -1,43 +0,0 @@
package org.mifosng.ui.home;
import org.mifosng.ui.reporting.ReportingRestOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class HomeController {
private final ReportingRestOperations reportingRestOperations;
@Autowired
public HomeController(final ReportingRestOperations reportingRestOperations) {
this.reportingRestOperations = reportingRestOperations;
}
@RequestMapping(value="/forceOAuth", method = RequestMethod.GET)
public String forceOAuth() {
this.reportingRestOperations.hackToForceAuthentication();
return "redirect:/home";
}
@RequestMapping(value="/", method = RequestMethod.GET)
public String redirectToIndexPage() {
return "redirect:/home";
}
@RequestMapping(value = "/home", method = RequestMethod.GET)
public ModelAndView showIndividualClientsOnHomePage() {
return new ModelAndView("/home");
}
@RequestMapping(value="/switchToClient", method = RequestMethod.POST)
public String switchToClientView(@RequestParam("client") final Long client) {
return "redirect:/portfolio/client/" + client;
}
}