support offices in resource-oriented way, add better error handling support for unauthenticated user use case.
This commit is contained in:
@@ -34,7 +34,7 @@ import org.mifosng.platform.client.domain.Client;
|
|||||||
import org.mifosng.platform.client.domain.ClientRepository;
|
import org.mifosng.platform.client.domain.ClientRepository;
|
||||||
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
||||||
import org.mifosng.platform.currency.domain.Money;
|
import org.mifosng.platform.currency.domain.Money;
|
||||||
import org.mifosng.platform.exceptions.ClientNotAuthenticatedException;
|
import org.mifosng.platform.exceptions.UnAuthenticatedUserException;
|
||||||
import org.mifosng.platform.loan.domain.AmortizationMethod;
|
import org.mifosng.platform.loan.domain.AmortizationMethod;
|
||||||
import org.mifosng.platform.loan.domain.DefaultLoanLifecycleStateMachine;
|
import org.mifosng.platform.loan.domain.DefaultLoanLifecycleStateMachine;
|
||||||
import org.mifosng.platform.loan.domain.InterestCalculationPeriodMethod;
|
import org.mifosng.platform.loan.domain.InterestCalculationPeriodMethod;
|
||||||
@@ -99,7 +99,7 @@ public class ImportPlatformServiceImpl implements ImportPlatformService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentUser == null) {
|
if (currentUser == null) {
|
||||||
throw new ClientNotAuthenticatedException();
|
throw new UnAuthenticatedUserException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return currentUser;
|
return currentUser;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ import org.mifosng.platform.currency.domain.ApplicationCurrency;
|
|||||||
import org.mifosng.platform.currency.domain.ApplicationCurrencyRepository;
|
import org.mifosng.platform.currency.domain.ApplicationCurrencyRepository;
|
||||||
import org.mifosng.platform.currency.domain.Money;
|
import org.mifosng.platform.currency.domain.Money;
|
||||||
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
||||||
import org.mifosng.platform.exceptions.ClientNotAuthenticatedException;
|
import org.mifosng.platform.exceptions.UnAuthenticatedUserException;
|
||||||
import org.mifosng.platform.loan.domain.AmortizationMethod;
|
import org.mifosng.platform.loan.domain.AmortizationMethod;
|
||||||
import org.mifosng.platform.loan.domain.Loan;
|
import org.mifosng.platform.loan.domain.Loan;
|
||||||
import org.mifosng.platform.loan.domain.LoanRepository;
|
import org.mifosng.platform.loan.domain.LoanRepository;
|
||||||
@@ -122,7 +122,7 @@ public class ReadPlatformServiceImpl implements ReadPlatformService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentUser == null) {
|
if (currentUser == null) {
|
||||||
throw new ClientNotAuthenticatedException();
|
throw new UnAuthenticatedUserException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return currentUser;
|
return currentUser;
|
||||||
|
|||||||
+2
-2
@@ -44,7 +44,7 @@ import org.mifosng.platform.currency.domain.ApplicationCurrencyRepository;
|
|||||||
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
||||||
import org.mifosng.platform.currency.domain.Money;
|
import org.mifosng.platform.currency.domain.Money;
|
||||||
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
||||||
import org.mifosng.platform.exceptions.ClientNotAuthenticatedException;
|
import org.mifosng.platform.exceptions.UnAuthenticatedUserException;
|
||||||
import org.mifosng.platform.exceptions.InvalidSignupException;
|
import org.mifosng.platform.exceptions.InvalidSignupException;
|
||||||
import org.mifosng.platform.exceptions.NewDataValidationException;
|
import org.mifosng.platform.exceptions.NewDataValidationException;
|
||||||
import org.mifosng.platform.exceptions.NoAuthorizationException;
|
import org.mifosng.platform.exceptions.NoAuthorizationException;
|
||||||
@@ -601,7 +601,7 @@ public class WritePlatformServiceJpaRepositoryImpl implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentUser == null) {
|
if (currentUser == null) {
|
||||||
throw new ClientNotAuthenticatedException();
|
throw new UnAuthenticatedUserException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return currentUser;
|
return currentUser;
|
||||||
|
|||||||
+3
-40
@@ -9,8 +9,6 @@ import java.util.Set;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.HeaderParam;
|
|
||||||
import javax.ws.rs.OPTIONS;
|
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
@@ -19,7 +17,6 @@ import javax.ws.rs.core.Context;
|
|||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.MultivaluedMap;
|
import javax.ws.rs.core.MultivaluedMap;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.Response.ResponseBuilder;
|
|
||||||
import javax.ws.rs.core.Response.Status;
|
import javax.ws.rs.core.Response.Status;
|
||||||
import javax.ws.rs.core.UriInfo;
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
|
||||||
@@ -28,7 +25,7 @@ import org.mifosng.data.ErrorResponseList;
|
|||||||
import org.mifosng.data.reports.GenericResultset;
|
import org.mifosng.data.reports.GenericResultset;
|
||||||
import org.mifosng.platform.ReadPlatformService;
|
import org.mifosng.platform.ReadPlatformService;
|
||||||
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
||||||
import org.mifosng.platform.exceptions.ClientNotAuthenticatedException;
|
import org.mifosng.platform.exceptions.UnAuthenticatedUserException;
|
||||||
import org.mifosng.platform.exceptions.NewDataValidationException;
|
import org.mifosng.platform.exceptions.NewDataValidationException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -47,34 +44,6 @@ public class FlexibleReportingApiResource {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ReadPlatformService readPlatformService;
|
private ReadPlatformService readPlatformService;
|
||||||
|
|
||||||
private String _corsHeaders;
|
|
||||||
|
|
||||||
private Response makeCORS(ResponseBuilder req, String returnMethod) {
|
|
||||||
ResponseBuilder rb = req
|
|
||||||
.header("Access-Control-Allow-Origin", "*")
|
|
||||||
.header("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
|
|
||||||
|
|
||||||
if (!"".equals(returnMethod)) {
|
|
||||||
rb.header("Access-Control-Allow-Headers", returnMethod);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rb.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Response makeCORS(ResponseBuilder req) {
|
|
||||||
return makeCORS(req, _corsHeaders);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This OPTIONS request/response is necessary
|
|
||||||
// if you consumes other format than text/plain or
|
|
||||||
// if you use other HTTP verbs than GET and POST
|
|
||||||
@OPTIONS
|
|
||||||
@Path("/flexireport")
|
|
||||||
public Response corsMyResource(@HeaderParam("Access-Control-Request-Headers") String requestH) {
|
|
||||||
_corsHeaders = requestH;
|
|
||||||
return makeCORS(Response.ok(), requestH);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("flexireport")
|
@Path("flexireport")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||||
@@ -107,7 +76,7 @@ public class FlexibleReportingApiResource {
|
|||||||
// JSONWithPadding paddedResult = new JSONWithPadding(result,
|
// JSONWithPadding paddedResult = new JSONWithPadding(result,
|
||||||
// callbackName);
|
// callbackName);
|
||||||
|
|
||||||
return makeCORS(Response.ok().entity(result));
|
return Response.ok().entity(result).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -134,7 +103,7 @@ public class FlexibleReportingApiResource {
|
|||||||
GenericResultset result = this.readPlatformService.retrieveGenericResultset(rptDB, name, type, extractedQueryParams);
|
GenericResultset result = this.readPlatformService.retrieveGenericResultset(rptDB, name, type, extractedQueryParams);
|
||||||
|
|
||||||
return Response.ok().entity(result).build();
|
return Response.ok().entity(result).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -146,10 +115,4 @@ public class FlexibleReportingApiResource {
|
|||||||
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getValidationErrors())).build());
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getValidationErrors())).build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
|
||||||
@Path("forceauth")
|
|
||||||
public Response hackToForceAuthentication() {
|
|
||||||
return Response.ok().build();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+131
-132
@@ -25,7 +25,6 @@ import org.mifosng.data.command.UpdateLoanProductCommand;
|
|||||||
import org.mifosng.platform.ReadPlatformService;
|
import org.mifosng.platform.ReadPlatformService;
|
||||||
import org.mifosng.platform.WritePlatformService;
|
import org.mifosng.platform.WritePlatformService;
|
||||||
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
||||||
import org.mifosng.platform.exceptions.ClientNotAuthenticatedException;
|
|
||||||
import org.mifosng.platform.exceptions.NewDataValidationException;
|
import org.mifosng.platform.exceptions.NewDataValidationException;
|
||||||
import org.mifosng.platform.user.domain.AppUser;
|
import org.mifosng.platform.user.domain.AppUser;
|
||||||
import org.mifosng.platform.user.domain.AppUserRepository;
|
import org.mifosng.platform.user.domain.AppUserRepository;
|
||||||
@@ -53,8 +52,12 @@ import org.springframework.stereotype.Component;
|
|||||||
* 4. Only 'produce'ing JSON by limiting to @Produces({MediaType.APPLICATION_JSON})
|
* 4. Only 'produce'ing JSON by limiting to @Produces({MediaType.APPLICATION_JSON})
|
||||||
* 5. The java object returned is LoanProductData and LoanProductList when list of products returned.
|
* 5. The java object returned is LoanProductData and LoanProductList when list of products returned.
|
||||||
* These java objects are annotated with @XmlRootElement so JAXB reader/writers will automatically translate to JSON format.
|
* These java objects are annotated with @XmlRootElement so JAXB reader/writers will automatically translate to JSON format.
|
||||||
* 6. @GET /loanproducts/{productId} results in loan product of that identifier or appropiate error response
|
* 6. @GET /loanproducts/{productId} results in loan product of that identifier or appropriate error response
|
||||||
|
* 7. @POST /loanproducts with correct request body creates new loan product
|
||||||
|
* 8. @PUT /loanproducts/{productId} updates loan product of that identifier
|
||||||
|
* 9. Using /resource/template pattern for UI specific function of get 'data with defaults' for new resource.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Path("/v1/loanproducts")
|
@Path("/v1/loanproducts")
|
||||||
@Component
|
@Component
|
||||||
@Scope("singleton")
|
@Scope("singleton")
|
||||||
@@ -76,109 +79,13 @@ public class LoanProductApiResource {
|
|||||||
SecurityContext context = SecurityContextHolder.getContext();
|
SecurityContext context = SecurityContextHolder.getContext();
|
||||||
context.setAuthentication(auth);
|
context.setAuthentication(auth);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
// example POST request
|
||||||
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
// http://localhost:8085/mifosng-provider/api/v1/loanproducts/
|
||||||
@Produces({MediaType.APPLICATION_JSON})
|
// Content-Type: application/json
|
||||||
public Response retrieveAllLoanProducts() {
|
|
||||||
|
|
||||||
try {
|
|
||||||
hardcodeUserIntoSecurityContext();
|
|
||||||
|
|
||||||
Collection<LoanProductData> products = this.readPlatformService.retrieveAllLoanProducts();
|
|
||||||
|
|
||||||
return Response.ok().entity(new LoanProductList(products)).build();
|
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
|
||||||
} catch (AccessDeniedException e) {
|
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
|
||||||
ErrorResponseList list = new ErrorResponseList(Arrays.asList(errorResponse));
|
|
||||||
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(list).build());
|
|
||||||
} catch (ApplicationDomainRuleException e) {
|
|
||||||
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getErrors())).build());
|
|
||||||
} catch (NewDataValidationException e) {
|
|
||||||
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getValidationErrors())).build());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GET
|
|
||||||
@Path("{productId}")
|
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
|
||||||
@Produces({ MediaType.APPLICATION_JSON})
|
|
||||||
public Response retrieveLoanProductDetails(@PathParam("productId") final Long productId) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
hardcodeUserIntoSecurityContext();
|
|
||||||
|
|
||||||
LoanProductData loanProduct = this.readPlatformService.retrieveLoanProduct(productId);
|
|
||||||
|
|
||||||
return Response.ok().entity(loanProduct).build();
|
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
|
||||||
} catch (AccessDeniedException e) {
|
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
|
||||||
ErrorResponseList list = new ErrorResponseList(Arrays.asList(errorResponse));
|
|
||||||
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(list).build());
|
|
||||||
} catch (ApplicationDomainRuleException e) {
|
|
||||||
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getErrors())).build());
|
|
||||||
} catch (NewDataValidationException e) {
|
|
||||||
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getValidationErrors())).build());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// example POST request
|
|
||||||
// http://localhost:8085/mifosng-provider/api/v1/loanproducts/
|
|
||||||
// Content-Type: application/json
|
|
||||||
// {
|
|
||||||
// "name": "test",
|
|
||||||
// "description": "test",
|
|
||||||
// "commonLoanProperties": {
|
|
||||||
// "currencyCode": "USD",
|
|
||||||
// "digitsAfterDecimal": 2,
|
|
||||||
// "principal": 100000,
|
|
||||||
// "repaymentEvery": 1,
|
|
||||||
// "repaymentFrequency": 2,
|
|
||||||
// "numberOfRepayments": 12,
|
|
||||||
// "amortizationMethod": 1,
|
|
||||||
// "inArrearsToleranceAmount": 1000,
|
|
||||||
// "interestRatePerPeriod": 2,
|
|
||||||
// "interestRateFrequencyMethod": 2,
|
|
||||||
// "interestMethod": 0,
|
|
||||||
// "interestCalculationPeriodMethod": 1
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
@POST
|
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
|
||||||
@Produces({ MediaType.APPLICATION_JSON})
|
|
||||||
public Response createLoanProduct(CreateLoanProductCommand command) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
hardcodeUserIntoSecurityContext();
|
|
||||||
|
|
||||||
EntityIdentifier entityIdentifier = this.writePlatformService.createLoanProduct(command);
|
|
||||||
|
|
||||||
return Response.ok().entity(entityIdentifier).build();
|
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
|
||||||
} catch (AccessDeniedException e) {
|
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
|
||||||
ErrorResponseList list = new ErrorResponseList(Arrays.asList(errorResponse));
|
|
||||||
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(list).build());
|
|
||||||
} catch (ApplicationDomainRuleException e) {
|
|
||||||
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getErrors())).build());
|
|
||||||
} catch (NewDataValidationException e) {
|
|
||||||
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getValidationErrors())).build());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// example PUT request
|
|
||||||
// http://localhost:8085/mifosng-provider/api/v1/loanproducts/
|
|
||||||
// Content-Type: application/json
|
|
||||||
// {
|
// {
|
||||||
// "id": 7,
|
|
||||||
// "name": "test",
|
// "name": "test",
|
||||||
// "description": "test",
|
// "description": "test",
|
||||||
// "externalId": "",
|
|
||||||
// "commonLoanProperties": {
|
// "commonLoanProperties": {
|
||||||
// "currencyCode": "USD",
|
// "currencyCode": "USD",
|
||||||
// "digitsAfterDecimal": 2,
|
// "digitsAfterDecimal": 2,
|
||||||
@@ -194,19 +101,18 @@ public class LoanProductApiResource {
|
|||||||
// "interestCalculationPeriodMethod": 1
|
// "interestCalculationPeriodMethod": 1
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
@PUT
|
@POST
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON})
|
||||||
public Response updateLoanProduct(final UpdateLoanProductCommand command) {
|
public Response createLoanProduct(CreateLoanProductCommand command) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// TODO - move CreateLoanProductCommand and UpdateLoanProductCommand into one.
|
||||||
hardcodeUserIntoSecurityContext();
|
hardcodeUserIntoSecurityContext();
|
||||||
|
|
||||||
EntityIdentifier entityIdentifier = this.writePlatformService.updateLoanProduct(command);
|
EntityIdentifier entityIdentifier = this.writePlatformService.createLoanProduct(command);
|
||||||
|
|
||||||
return Response.ok().entity(entityIdentifier).build();
|
return Response.ok().entity(entityIdentifier).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
ErrorResponseList list = new ErrorResponseList(Arrays.asList(errorResponse));
|
ErrorResponseList list = new ErrorResponseList(Arrays.asList(errorResponse));
|
||||||
@@ -218,27 +124,120 @@ public class LoanProductApiResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
@GET
|
||||||
// @GET
|
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
// @Path("empty")
|
@Produces({MediaType.APPLICATION_JSON})
|
||||||
// @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
public Response retrieveAllLoanProducts() {
|
||||||
// @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
|
||||||
// public Response retrieveNewLoanProductDetails() {
|
try {
|
||||||
//
|
hardcodeUserIntoSecurityContext();
|
||||||
// try {
|
|
||||||
// LoanProductData loanProduct = this.readPlatformService.retrieveNewLoanProductDetails();
|
Collection<LoanProductData> products = this.readPlatformService.retrieveAllLoanProducts();
|
||||||
//
|
|
||||||
// return Response.ok().entity(loanProduct).build();
|
return Response.ok().entity(new LoanProductList(products)).build();
|
||||||
// } catch (ClientNotAuthenticatedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
// throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
// } catch (AccessDeniedException e) {
|
ErrorResponseList list = new ErrorResponseList(Arrays.asList(errorResponse));
|
||||||
// ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(list).build());
|
||||||
// ErrorResponseList list = new ErrorResponseList(Arrays.asList(errorResponse));
|
} catch (ApplicationDomainRuleException e) {
|
||||||
// throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(list).build());
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getErrors())).build());
|
||||||
// } catch (ApplicationDomainRuleException e) {
|
} catch (NewDataValidationException e) {
|
||||||
// throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getErrors())).build());
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getValidationErrors())).build());
|
||||||
// } catch (NewDataValidationException e) {
|
}
|
||||||
// throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getValidationErrors())).build());
|
}
|
||||||
// }
|
|
||||||
// }
|
/*
|
||||||
|
* see http://stackoverflow.com/questions/5250074/what-uri-can-be-used-to-request-a-default-resource
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("template")
|
||||||
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
|
@Produces({ MediaType.APPLICATION_JSON})
|
||||||
|
public Response retrieveNewLoanProductDetails() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
hardcodeUserIntoSecurityContext();
|
||||||
|
|
||||||
|
LoanProductData loanProduct = this.readPlatformService.retrieveNewLoanProductDetails();
|
||||||
|
|
||||||
|
return Response.ok().entity(loanProduct).build();
|
||||||
|
} catch (AccessDeniedException e) {
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
|
ErrorResponseList list = new ErrorResponseList(Arrays.asList(errorResponse));
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(list).build());
|
||||||
|
} catch (ApplicationDomainRuleException e) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getErrors())).build());
|
||||||
|
} catch (NewDataValidationException e) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getValidationErrors())).build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("{productId}")
|
||||||
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
|
@Produces({ MediaType.APPLICATION_JSON})
|
||||||
|
public Response retrieveLoanProductDetails(@PathParam("productId") final Long productId) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
hardcodeUserIntoSecurityContext();
|
||||||
|
|
||||||
|
LoanProductData loanProduct = this.readPlatformService.retrieveLoanProduct(productId);
|
||||||
|
|
||||||
|
return Response.ok().entity(loanProduct).build();
|
||||||
|
} catch (AccessDeniedException e) {
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
|
ErrorResponseList list = new ErrorResponseList(Arrays.asList(errorResponse));
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(list).build());
|
||||||
|
} catch (ApplicationDomainRuleException e) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getErrors())).build());
|
||||||
|
} catch (NewDataValidationException e) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getValidationErrors())).build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// example PUT request
|
||||||
|
// http://localhost:8085/mifosng-provider/api/v1/loanproducts/
|
||||||
|
// Content-Type: application/json
|
||||||
|
// {
|
||||||
|
// "id": 7,
|
||||||
|
// "name": "test",
|
||||||
|
// "description": "test",
|
||||||
|
// "externalId": "",
|
||||||
|
// "commonLoanProperties": {
|
||||||
|
// "currencyCode": "USD",
|
||||||
|
// "digitsAfterDecimal": 2,
|
||||||
|
// "principal": 100000,
|
||||||
|
// "repaymentEvery": 1,
|
||||||
|
// "repaymentFrequency": 2,
|
||||||
|
// "numberOfRepayments": 12,
|
||||||
|
// "amortizationMethod": 1,
|
||||||
|
// "inArrearsToleranceAmount": 1000,
|
||||||
|
// "interestRatePerPeriod": 2,
|
||||||
|
// "interestRateFrequencyMethod": 2,
|
||||||
|
// "interestMethod": 0,
|
||||||
|
// "interestCalculationPeriodMethod": 1
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
@PUT
|
||||||
|
@Path("{productId}")
|
||||||
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
|
public Response updateLoanProduct(@PathParam("productId") final Long productId, final UpdateLoanProductCommand command) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
hardcodeUserIntoSecurityContext();
|
||||||
|
|
||||||
|
EntityIdentifier entityIdentifier = this.writePlatformService.updateLoanProduct(command);
|
||||||
|
|
||||||
|
return Response.ok().entity(entityIdentifier).build();
|
||||||
|
} catch (AccessDeniedException e) {
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
|
ErrorResponseList list = new ErrorResponseList(Arrays.asList(errorResponse));
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(list).build());
|
||||||
|
} catch (ApplicationDomainRuleException e) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getErrors())).build());
|
||||||
|
} catch (NewDataValidationException e) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getValidationErrors())).build());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
package org.mifosng.platform.api;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.PUT;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.PathParam;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.WebApplicationException;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.Response.Status;
|
||||||
|
|
||||||
|
import org.mifosng.data.EntityIdentifier;
|
||||||
|
import org.mifosng.data.ErrorResponse;
|
||||||
|
import org.mifosng.data.ErrorResponseList;
|
||||||
|
import org.mifosng.data.OfficeData;
|
||||||
|
import org.mifosng.data.OfficeList;
|
||||||
|
import org.mifosng.data.command.OfficeCommand;
|
||||||
|
import org.mifosng.platform.ReadPlatformService;
|
||||||
|
import org.mifosng.platform.WritePlatformService;
|
||||||
|
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
||||||
|
import org.mifosng.platform.exceptions.NewDataValidationException;
|
||||||
|
import org.mifosng.platform.user.domain.AppUser;
|
||||||
|
import org.mifosng.platform.user.domain.AppUserRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.security.access.AccessDeniedException;
|
||||||
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.core.context.SecurityContext;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Path("/v1/offices")
|
||||||
|
@Component
|
||||||
|
@Scope("singleton")
|
||||||
|
public class OfficeApiResource {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReadPlatformService readPlatformService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WritePlatformService writePlatformService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AppUserRepository appUserRepository;
|
||||||
|
|
||||||
|
private void hardcodeUserIntoSecurityContext() {
|
||||||
|
AppUser currentUser = this.appUserRepository.findOne(Long.valueOf(1));
|
||||||
|
|
||||||
|
Authentication auth = new UsernamePasswordAuthenticationToken(currentUser, currentUser, currentUser.getAuthorities());
|
||||||
|
SecurityContext context = SecurityContextHolder.getContext();
|
||||||
|
context.setAuthentication(auth);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
|
@Produces({MediaType.APPLICATION_JSON})
|
||||||
|
public Response retrieveOffices() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
hardcodeUserIntoSecurityContext();
|
||||||
|
|
||||||
|
Collection<OfficeData> offices = this.readPlatformService.retrieveAllOffices();
|
||||||
|
|
||||||
|
return Response.ok().entity(new OfficeList(offices)).build();
|
||||||
|
} catch (AccessDeniedException e) {
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
|
ErrorResponseList list = new ErrorResponseList(Arrays.asList(errorResponse));
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(list).build());
|
||||||
|
} catch (ApplicationDomainRuleException e) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getErrors())).build());
|
||||||
|
} catch (NewDataValidationException e) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getValidationErrors())).build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
|
@Produces({ MediaType.APPLICATION_JSON})
|
||||||
|
public Response createOffice(final OfficeCommand command) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
hardcodeUserIntoSecurityContext();
|
||||||
|
|
||||||
|
Long officeId = this.writePlatformService.createOffice(command);
|
||||||
|
|
||||||
|
return Response.ok().entity(new EntityIdentifier(officeId)).build();
|
||||||
|
} catch (AccessDeniedException e) {
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
|
ErrorResponseList list = new ErrorResponseList(Arrays.asList(errorResponse));
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(list).build());
|
||||||
|
} catch (ApplicationDomainRuleException e) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getErrors())).build());
|
||||||
|
} catch (NewDataValidationException e) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getValidationErrors())).build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("{officeId}")
|
||||||
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
|
@Produces({ MediaType.APPLICATION_JSON})
|
||||||
|
public Response retreiveOffice(@PathParam("officeId") final Long officeId) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
hardcodeUserIntoSecurityContext();
|
||||||
|
|
||||||
|
OfficeData office = this.readPlatformService.retrieveOffice(officeId);
|
||||||
|
|
||||||
|
return Response.ok().entity(office).build();
|
||||||
|
} catch (AccessDeniedException e) {
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
|
ErrorResponseList list = new ErrorResponseList(Arrays.asList(errorResponse));
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(list).build());
|
||||||
|
} catch (ApplicationDomainRuleException e) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getErrors())).build());
|
||||||
|
} catch (NewDataValidationException e) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getValidationErrors())).build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PUT
|
||||||
|
@Path("{officeId}")
|
||||||
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
|
@Produces({ MediaType.APPLICATION_JSON})
|
||||||
|
public Response updateOffice(@PathParam("officeId") final Long officeId, final OfficeCommand command) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
hardcodeUserIntoSecurityContext();
|
||||||
|
|
||||||
|
command.setId(officeId);
|
||||||
|
Long entityId = this.writePlatformService.updateOffice(command);
|
||||||
|
|
||||||
|
return Response.ok().entity(new EntityIdentifier(entityId)).build();
|
||||||
|
} catch (AccessDeniedException e) {
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
|
ErrorResponseList list = new ErrorResponseList(Arrays.asList(errorResponse));
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(list).build());
|
||||||
|
} catch (ApplicationDomainRuleException e) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getErrors())).build());
|
||||||
|
} catch (NewDataValidationException e) {
|
||||||
|
throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new ErrorResponseList(e.getValidationErrors())).build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
package org.mifosng.platform.api.errorhandling;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.Response.Status;
|
||||||
|
import javax.ws.rs.ext.ExceptionMapper;
|
||||||
|
import javax.ws.rs.ext.Provider;
|
||||||
|
|
||||||
|
import org.mifosng.data.ErrorResponse;
|
||||||
|
import org.mifosng.data.ErrorResponseList;
|
||||||
|
import org.mifosng.platform.exceptions.UnAuthenticatedUserException;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An {@link ExceptionMapper} to map {@link UnAuthenticatedUserException} thrown by platform into a HTTP API friendly format.
|
||||||
|
*/
|
||||||
|
@Provider
|
||||||
|
@Component
|
||||||
|
@Scope("singleton")
|
||||||
|
public class UnAuthenticatedUserExceptionMapper implements ExceptionMapper<UnAuthenticatedUserException> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response toResponse(UnAuthenticatedUserException exception) {
|
||||||
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.not.authorized", "id");
|
||||||
|
ErrorResponseList list = new ErrorResponseList(Arrays.asList(errorResponse));
|
||||||
|
|
||||||
|
return Response.status(Status.UNAUTHORIZED).entity(list).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
package org.mifosng.platform.exceptions;
|
|
||||||
|
|
||||||
public class ClientNotAuthenticatedException extends RuntimeException {
|
|
||||||
// no added behaviour
|
|
||||||
}
|
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package org.mifosng.platform.exceptions;
|
||||||
|
|
||||||
|
import org.springframework.security.core.context.SecurityContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link RuntimeException} that is thrown in the case where no authenticated user exists within the platform {@link SecurityContext}.
|
||||||
|
*/
|
||||||
|
public class UnAuthenticatedUserException extends RuntimeException {
|
||||||
|
// no added behaviour
|
||||||
|
}
|
||||||
+7
-7
@@ -23,7 +23,7 @@ import org.mifosng.data.command.UpdateOrganisationCurrencyCommand;
|
|||||||
import org.mifosng.platform.ReadPlatformService;
|
import org.mifosng.platform.ReadPlatformService;
|
||||||
import org.mifosng.platform.WritePlatformService;
|
import org.mifosng.platform.WritePlatformService;
|
||||||
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
||||||
import org.mifosng.platform.exceptions.ClientNotAuthenticatedException;
|
import org.mifosng.platform.exceptions.UnAuthenticatedUserException;
|
||||||
import org.mifosng.platform.exceptions.NewDataValidationException;
|
import org.mifosng.platform.exceptions.NewDataValidationException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
@@ -63,7 +63,7 @@ public class ApplicationConfigurationResource {
|
|||||||
this.writePlatformService.updateOrganisationCurrencies(command);
|
this.writePlatformService.updateOrganisationCurrencies(command);
|
||||||
|
|
||||||
return Response.ok().entity(command).build();
|
return Response.ok().entity(command).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -87,7 +87,7 @@ public class ApplicationConfigurationResource {
|
|||||||
.retrieveAllPlatformCurrencies();
|
.retrieveAllPlatformCurrencies();
|
||||||
|
|
||||||
return Response.ok().entity(new CurrencyList(currencyOptions)).build();
|
return Response.ok().entity(new CurrencyList(currencyOptions)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -111,7 +111,7 @@ public class ApplicationConfigurationResource {
|
|||||||
.retrieveLoanAmortizationMethodOptions();
|
.retrieveLoanAmortizationMethodOptions();
|
||||||
|
|
||||||
return Response.ok().entity(new EnumOptionList(options)).build();
|
return Response.ok().entity(new EnumOptionList(options)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -135,7 +135,7 @@ public class ApplicationConfigurationResource {
|
|||||||
.retrieveLoanInterestMethodOptions();
|
.retrieveLoanInterestMethodOptions();
|
||||||
|
|
||||||
return Response.ok().entity(new EnumOptionList(options)).build();
|
return Response.ok().entity(new EnumOptionList(options)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -159,7 +159,7 @@ public class ApplicationConfigurationResource {
|
|||||||
.retrieveRepaymentFrequencyOptions();
|
.retrieveRepaymentFrequencyOptions();
|
||||||
|
|
||||||
return Response.ok().entity(new EnumOptionList(options)).build();
|
return Response.ok().entity(new EnumOptionList(options)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -182,7 +182,7 @@ public class ApplicationConfigurationResource {
|
|||||||
List<EnumOptionReadModel> options = this.readPlatformService.retrieveInterestFrequencyOptions();
|
List<EnumOptionReadModel> options = this.readPlatformService.retrieveInterestFrequencyOptions();
|
||||||
|
|
||||||
return Response.ok().entity(new EnumOptionList(options)).build();
|
return Response.ok().entity(new EnumOptionList(options)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import org.mifosng.data.command.NoteCommand;
|
|||||||
import org.mifosng.platform.ReadPlatformService;
|
import org.mifosng.platform.ReadPlatformService;
|
||||||
import org.mifosng.platform.WritePlatformService;
|
import org.mifosng.platform.WritePlatformService;
|
||||||
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
||||||
import org.mifosng.platform.exceptions.ClientNotAuthenticatedException;
|
import org.mifosng.platform.exceptions.UnAuthenticatedUserException;
|
||||||
import org.mifosng.platform.exceptions.NewDataValidationException;
|
import org.mifosng.platform.exceptions.NewDataValidationException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
@@ -55,7 +55,7 @@ public class ClientResource {
|
|||||||
Collection<ClientData> clients = this.readPlatformService.retrieveAllIndividualClients();
|
Collection<ClientData> clients = this.readPlatformService.retrieveAllIndividualClients();
|
||||||
|
|
||||||
return Response.ok().entity(new ClientList(clients)).build();
|
return Response.ok().entity(new ClientList(clients)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -78,7 +78,7 @@ public class ClientResource {
|
|||||||
ClientData clientData = this.readPlatformService.retrieveNewClientDetails();
|
ClientData clientData = this.readPlatformService.retrieveNewClientDetails();
|
||||||
|
|
||||||
return Response.ok().entity(clientData).build();
|
return Response.ok().entity(clientData).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -101,7 +101,7 @@ public class ClientResource {
|
|||||||
Long clientId = this.writePlatformService.enrollClient(command);
|
Long clientId = this.writePlatformService.enrollClient(command);
|
||||||
|
|
||||||
return Response.ok().entity(new EntityIdentifier(clientId)).build();
|
return Response.ok().entity(new EntityIdentifier(clientId)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -124,7 +124,7 @@ public class ClientResource {
|
|||||||
ClientData clientData = this.readPlatformService.retrieveIndividualClient(clientId);
|
ClientData clientData = this.readPlatformService.retrieveIndividualClient(clientId);
|
||||||
|
|
||||||
return Response.ok().entity(clientData).build();
|
return Response.ok().entity(clientData).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -148,7 +148,7 @@ public class ClientResource {
|
|||||||
.retrieveClientAccountDetails(clientId);
|
.retrieveClientAccountDetails(clientId);
|
||||||
|
|
||||||
return Response.ok().entity(clientAccount).build();
|
return Response.ok().entity(clientAccount).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -171,7 +171,7 @@ public class ClientResource {
|
|||||||
EntityIdentifier identifier = this.writePlatformService.addClientNote(command);
|
EntityIdentifier identifier = this.writePlatformService.addClientNote(command);
|
||||||
|
|
||||||
return Response.ok().entity(identifier).build();
|
return Response.ok().entity(identifier).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -194,7 +194,7 @@ public class ClientResource {
|
|||||||
Collection<NoteData> notes = this.readPlatformService.retrieveAllClientNotes(clientId);
|
Collection<NoteData> notes = this.readPlatformService.retrieveAllClientNotes(clientId);
|
||||||
|
|
||||||
return Response.ok().entity(new NoteDataList(notes)).build();
|
return Response.ok().entity(new NoteDataList(notes)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -217,7 +217,7 @@ public class ClientResource {
|
|||||||
NoteData note = this.readPlatformService.retrieveClientNote(clientId, noteId);
|
NoteData note = this.readPlatformService.retrieveClientNote(clientId, noteId);
|
||||||
|
|
||||||
return Response.ok().entity(note).build();
|
return Response.ok().entity(note).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import org.mifosng.data.command.ImportClientCommand;
|
|||||||
import org.mifosng.data.command.ImportLoanCommand;
|
import org.mifosng.data.command.ImportLoanCommand;
|
||||||
import org.mifosng.data.command.ImportLoanRepaymentsCommand;
|
import org.mifosng.data.command.ImportLoanRepaymentsCommand;
|
||||||
import org.mifosng.platform.ImportPlatformService;
|
import org.mifosng.platform.ImportPlatformService;
|
||||||
import org.mifosng.platform.exceptions.ClientNotAuthenticatedException;
|
import org.mifosng.platform.exceptions.UnAuthenticatedUserException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -36,7 +36,7 @@ public class ImportResource {
|
|||||||
this.importPlatformService.importClients(command);
|
this.importPlatformService.importClients(command);
|
||||||
|
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
ErrorResponse err = new ErrorResponse("client.not.authenticated",
|
ErrorResponse err = new ErrorResponse("client.not.authenticated",
|
||||||
"authentication", "");
|
"authentication", "");
|
||||||
throw new WebApplicationException(Response
|
throw new WebApplicationException(Response
|
||||||
@@ -53,7 +53,7 @@ public class ImportResource {
|
|||||||
this.importPlatformService.importLoans(command);
|
this.importPlatformService.importLoans(command);
|
||||||
|
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
ErrorResponse err = new ErrorResponse("client.not.authenticated",
|
ErrorResponse err = new ErrorResponse("client.not.authenticated",
|
||||||
"authentication", "");
|
"authentication", "");
|
||||||
throw new WebApplicationException(Response
|
throw new WebApplicationException(Response
|
||||||
@@ -70,7 +70,7 @@ public class ImportResource {
|
|||||||
this.importPlatformService.importLoanRepayments(command);
|
this.importPlatformService.importLoanRepayments(command);
|
||||||
|
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
ErrorResponse err = new ErrorResponse("client.not.authenticated",
|
ErrorResponse err = new ErrorResponse("client.not.authenticated",
|
||||||
"authentication", "");
|
"authentication", "");
|
||||||
throw new WebApplicationException(Response
|
throw new WebApplicationException(Response
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import org.mifosng.data.command.UpdateLoanProductCommand;
|
|||||||
import org.mifosng.platform.ReadPlatformService;
|
import org.mifosng.platform.ReadPlatformService;
|
||||||
import org.mifosng.platform.WritePlatformService;
|
import org.mifosng.platform.WritePlatformService;
|
||||||
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
||||||
import org.mifosng.platform.exceptions.ClientNotAuthenticatedException;
|
import org.mifosng.platform.exceptions.UnAuthenticatedUserException;
|
||||||
import org.mifosng.platform.exceptions.NewDataValidationException;
|
import org.mifosng.platform.exceptions.NewDataValidationException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
@@ -64,7 +64,7 @@ public class LoanProductResource {
|
|||||||
EntityIdentifier entityIdentifier = this.writePlatformService.createLoanProduct(command);
|
EntityIdentifier entityIdentifier = this.writePlatformService.createLoanProduct(command);
|
||||||
|
|
||||||
return Response.ok().entity(entityIdentifier).build();
|
return Response.ok().entity(entityIdentifier).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -86,7 +86,7 @@ public class LoanProductResource {
|
|||||||
try {
|
try {
|
||||||
EntityIdentifier entityIdentifier = this.writePlatformService.updateLoanProduct(command);
|
EntityIdentifier entityIdentifier = this.writePlatformService.updateLoanProduct(command);
|
||||||
return Response.ok().entity(entityIdentifier).build();
|
return Response.ok().entity(entityIdentifier).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -109,7 +109,7 @@ public class LoanProductResource {
|
|||||||
LoanProductData loanProduct = this.readPlatformService.retrieveLoanProduct(productId);
|
LoanProductData loanProduct = this.readPlatformService.retrieveLoanProduct(productId);
|
||||||
|
|
||||||
return Response.ok().entity(loanProduct).build();
|
return Response.ok().entity(loanProduct).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -132,7 +132,7 @@ public class LoanProductResource {
|
|||||||
LoanProductData loanProduct = this.readPlatformService.retrieveNewLoanProductDetails();
|
LoanProductData loanProduct = this.readPlatformService.retrieveNewLoanProductDetails();
|
||||||
|
|
||||||
return Response.ok().entity(loanProduct).build();
|
return Response.ok().entity(loanProduct).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import org.mifosng.platform.ReadPlatformService;
|
|||||||
import org.mifosng.platform.ReadPlatformServiceImpl;
|
import org.mifosng.platform.ReadPlatformServiceImpl;
|
||||||
import org.mifosng.platform.WritePlatformService;
|
import org.mifosng.platform.WritePlatformService;
|
||||||
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
||||||
import org.mifosng.platform.exceptions.ClientNotAuthenticatedException;
|
import org.mifosng.platform.exceptions.UnAuthenticatedUserException;
|
||||||
import org.mifosng.platform.exceptions.NewDataValidationException;
|
import org.mifosng.platform.exceptions.NewDataValidationException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -71,7 +71,7 @@ public class LoanResource {
|
|||||||
NewLoanWorkflowStepOneData workflowData = this.readPlatformService.retrieveClientAndProductDetails(clientId, null);
|
NewLoanWorkflowStepOneData workflowData = this.readPlatformService.retrieveClientAndProductDetails(clientId, null);
|
||||||
|
|
||||||
return Response.ok().entity(workflowData).build();
|
return Response.ok().entity(workflowData).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -94,7 +94,7 @@ public class LoanResource {
|
|||||||
NewLoanWorkflowStepOneData workflowData = this.readPlatformService.retrieveClientAndProductDetails(clientId, productId);
|
NewLoanWorkflowStepOneData workflowData = this.readPlatformService.retrieveClientAndProductDetails(clientId, productId);
|
||||||
|
|
||||||
return Response.ok().entity(workflowData).build();
|
return Response.ok().entity(workflowData).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -117,7 +117,7 @@ public class LoanResource {
|
|||||||
LoanSchedule loanSchedule = this.calculationPlatformService.calculateLoanSchedule(command);
|
LoanSchedule loanSchedule = this.calculationPlatformService.calculateLoanSchedule(command);
|
||||||
|
|
||||||
return Response.ok().entity(loanSchedule).build();
|
return Response.ok().entity(loanSchedule).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -140,7 +140,7 @@ public class LoanResource {
|
|||||||
EntityIdentifier identifier = this.writePlatformService.submitLoanApplication(command);
|
EntityIdentifier identifier = this.writePlatformService.submitLoanApplication(command);
|
||||||
|
|
||||||
return Response.ok().entity(identifier).build();
|
return Response.ok().entity(identifier).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -163,7 +163,7 @@ public class LoanResource {
|
|||||||
LoanAccountData loanAccount = this.readPlatformService.retrieveLoanAccountDetails(loanId);
|
LoanAccountData loanAccount = this.readPlatformService.retrieveLoanAccountDetails(loanId);
|
||||||
|
|
||||||
return Response.ok().entity(loanAccount).build();
|
return Response.ok().entity(loanAccount).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -194,7 +194,7 @@ public class LoanResource {
|
|||||||
EntityIdentifier identifier = this.writePlatformService.deleteLoan(loanId);
|
EntityIdentifier identifier = this.writePlatformService.deleteLoan(loanId);
|
||||||
|
|
||||||
return Response.ok().entity(identifier).build();
|
return Response.ok().entity(identifier).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -225,7 +225,7 @@ public class LoanResource {
|
|||||||
EntityIdentifier identifier = this.writePlatformService.approveLoanApplication(command);
|
EntityIdentifier identifier = this.writePlatformService.approveLoanApplication(command);
|
||||||
|
|
||||||
return Response.ok().entity(identifier).build();
|
return Response.ok().entity(identifier).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -248,7 +248,7 @@ public class LoanResource {
|
|||||||
EntityIdentifier identifier = this.writePlatformService.undoLoanApproval(command);
|
EntityIdentifier identifier = this.writePlatformService.undoLoanApproval(command);
|
||||||
|
|
||||||
return Response.ok().entity(identifier).build();
|
return Response.ok().entity(identifier).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -271,7 +271,7 @@ public class LoanResource {
|
|||||||
EntityIdentifier identifier = this.writePlatformService.rejectLoan(command);
|
EntityIdentifier identifier = this.writePlatformService.rejectLoan(command);
|
||||||
|
|
||||||
return Response.ok().entity(identifier).build();
|
return Response.ok().entity(identifier).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -294,7 +294,7 @@ public class LoanResource {
|
|||||||
EntityIdentifier identifier = this.writePlatformService.withdrawLoan(command);
|
EntityIdentifier identifier = this.writePlatformService.withdrawLoan(command);
|
||||||
|
|
||||||
return Response.ok().entity(identifier).build();
|
return Response.ok().entity(identifier).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -317,7 +317,7 @@ public class LoanResource {
|
|||||||
EntityIdentifier identifier = this.writePlatformService.disburseLoan(command);
|
EntityIdentifier identifier = this.writePlatformService.disburseLoan(command);
|
||||||
|
|
||||||
return Response.ok().entity(identifier).build();
|
return Response.ok().entity(identifier).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -340,7 +340,7 @@ public class LoanResource {
|
|||||||
EntityIdentifier identifier = this.writePlatformService.undloLoanDisbursal(command);
|
EntityIdentifier identifier = this.writePlatformService.undloLoanDisbursal(command);
|
||||||
|
|
||||||
return Response.ok().entity(identifier).build();
|
return Response.ok().entity(identifier).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -363,7 +363,7 @@ public class LoanResource {
|
|||||||
LoanRepaymentData loanRepaymentData = this.readPlatformService.retrieveNewLoanRepaymentDetails(loanId);
|
LoanRepaymentData loanRepaymentData = this.readPlatformService.retrieveNewLoanRepaymentDetails(loanId);
|
||||||
|
|
||||||
return Response.ok().entity(loanRepaymentData).build();
|
return Response.ok().entity(loanRepaymentData).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -386,7 +386,7 @@ public class LoanResource {
|
|||||||
LoanRepaymentData loanRepaymentData = this.readPlatformService.retrieveLoanRepaymentDetails(loanId, repaymentId);
|
LoanRepaymentData loanRepaymentData = this.readPlatformService.retrieveLoanRepaymentDetails(loanId, repaymentId);
|
||||||
|
|
||||||
return Response.ok().entity(loanRepaymentData).build();
|
return Response.ok().entity(loanRepaymentData).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -409,7 +409,7 @@ public class LoanResource {
|
|||||||
EntityIdentifier identifier = this.writePlatformService.makeLoanRepayment(command);
|
EntityIdentifier identifier = this.writePlatformService.makeLoanRepayment(command);
|
||||||
|
|
||||||
return Response.ok().entity(identifier).build();
|
return Response.ok().entity(identifier).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -443,7 +443,7 @@ public class LoanResource {
|
|||||||
EntityIdentifier identifier = this.writePlatformService.adjustLoanTransaction(command);
|
EntityIdentifier identifier = this.writePlatformService.adjustLoanTransaction(command);
|
||||||
|
|
||||||
return Response.ok().entity(identifier).build();
|
return Response.ok().entity(identifier).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -477,7 +477,7 @@ public class LoanResource {
|
|||||||
LoanRepaymentData loanRepaymentData = this.readPlatformService.retrieveNewLoanWaiverDetails(loanId);
|
LoanRepaymentData loanRepaymentData = this.readPlatformService.retrieveNewLoanWaiverDetails(loanId);
|
||||||
|
|
||||||
return Response.ok().entity(loanRepaymentData).build();
|
return Response.ok().entity(loanRepaymentData).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -500,7 +500,7 @@ public class LoanResource {
|
|||||||
EntityIdentifier identifier = this.writePlatformService.waiveLoanAmount(command);
|
EntityIdentifier identifier = this.writePlatformService.waiveLoanAmount(command);
|
||||||
|
|
||||||
return Response.ok().entity(identifier).build();
|
return Response.ok().entity(identifier).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import org.mifosng.data.command.OfficeCommand;
|
|||||||
import org.mifosng.platform.ReadPlatformService;
|
import org.mifosng.platform.ReadPlatformService;
|
||||||
import org.mifosng.platform.WritePlatformService;
|
import org.mifosng.platform.WritePlatformService;
|
||||||
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
||||||
import org.mifosng.platform.exceptions.ClientNotAuthenticatedException;
|
import org.mifosng.platform.exceptions.UnAuthenticatedUserException;
|
||||||
import org.mifosng.platform.exceptions.NewDataValidationException;
|
import org.mifosng.platform.exceptions.NewDataValidationException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
@@ -51,7 +51,7 @@ public class OfficeResource {
|
|||||||
Collection<OfficeData> offices = this.readPlatformService.retrieveAllOffices();
|
Collection<OfficeData> offices = this.readPlatformService.retrieveAllOffices();
|
||||||
|
|
||||||
return Response.ok().entity(new OfficeList(offices)).build();
|
return Response.ok().entity(new OfficeList(offices)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -74,7 +74,7 @@ public class OfficeResource {
|
|||||||
OfficeData office = this.readPlatformService.retrieveOffice(officeId);
|
OfficeData office = this.readPlatformService.retrieveOffice(officeId);
|
||||||
|
|
||||||
return Response.ok().entity(office).build();
|
return Response.ok().entity(office).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -97,7 +97,7 @@ public class OfficeResource {
|
|||||||
Long officeId = this.writePlatformService.createOffice(command);
|
Long officeId = this.writePlatformService.createOffice(command);
|
||||||
|
|
||||||
return Response.ok().entity(new EntityIdentifier(officeId)).build();
|
return Response.ok().entity(new EntityIdentifier(officeId)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -120,7 +120,7 @@ public class OfficeResource {
|
|||||||
Long officeId = this.writePlatformService.updateOffice(command);
|
Long officeId = this.writePlatformService.updateOffice(command);
|
||||||
|
|
||||||
return Response.ok().entity(new EntityIdentifier(officeId)).build();
|
return Response.ok().entity(new EntityIdentifier(officeId)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
|
|||||||
+2
-2
@@ -28,7 +28,7 @@ import org.mifosng.data.ErrorResponseList;
|
|||||||
import org.mifosng.data.reports.GenericResultset;
|
import org.mifosng.data.reports.GenericResultset;
|
||||||
import org.mifosng.platform.ReadPlatformService;
|
import org.mifosng.platform.ReadPlatformService;
|
||||||
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
||||||
import org.mifosng.platform.exceptions.ClientNotAuthenticatedException;
|
import org.mifosng.platform.exceptions.UnAuthenticatedUserException;
|
||||||
import org.mifosng.platform.exceptions.NewDataValidationException;
|
import org.mifosng.platform.exceptions.NewDataValidationException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -134,7 +134,7 @@ public class ProtectedFlexibleReportingResource {
|
|||||||
GenericResultset result = this.readPlatformService.retrieveGenericResultset(rptDB, name, type, extractedQueryParams);
|
GenericResultset result = this.readPlatformService.retrieveGenericResultset(rptDB, name, type, extractedQueryParams);
|
||||||
|
|
||||||
return Response.ok().entity(result).build();
|
return Response.ok().entity(result).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
|
|||||||
+17
-17
@@ -34,7 +34,7 @@ import org.mifosng.data.command.UserCommand;
|
|||||||
import org.mifosng.platform.ReadPlatformService;
|
import org.mifosng.platform.ReadPlatformService;
|
||||||
import org.mifosng.platform.WritePlatformService;
|
import org.mifosng.platform.WritePlatformService;
|
||||||
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
import org.mifosng.platform.exceptions.ApplicationDomainRuleException;
|
||||||
import org.mifosng.platform.exceptions.ClientNotAuthenticatedException;
|
import org.mifosng.platform.exceptions.UnAuthenticatedUserException;
|
||||||
import org.mifosng.platform.exceptions.NewDataValidationException;
|
import org.mifosng.platform.exceptions.NewDataValidationException;
|
||||||
import org.mifosng.platform.infrastructure.PlatformEmailSendException;
|
import org.mifosng.platform.infrastructure.PlatformEmailSendException;
|
||||||
import org.mifosng.platform.infrastructure.UsernameAlreadyExistsException;
|
import org.mifosng.platform.infrastructure.UsernameAlreadyExistsException;
|
||||||
@@ -65,7 +65,7 @@ public class UserAdmistrationResource {
|
|||||||
Collection<AppUserData> users = this.readPlatformService.retrieveAllUsers();
|
Collection<AppUserData> users = this.readPlatformService.retrieveAllUsers();
|
||||||
|
|
||||||
return Response.ok().entity(new UserList(users)).build();
|
return Response.ok().entity(new UserList(users)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -88,7 +88,7 @@ public class UserAdmistrationResource {
|
|||||||
AppUserData newUser = this.readPlatformService.retrieveNewUserDetails();
|
AppUserData newUser = this.readPlatformService.retrieveNewUserDetails();
|
||||||
|
|
||||||
return Response.ok().entity(newUser).build();
|
return Response.ok().entity(newUser).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -125,7 +125,7 @@ public class UserAdmistrationResource {
|
|||||||
throw new WebApplicationException(Response
|
throw new WebApplicationException(Response
|
||||||
.status(Status.BAD_REQUEST)
|
.status(Status.BAD_REQUEST)
|
||||||
.entity(new ErrorResponseList(allErrors)).build());
|
.entity(new ErrorResponseList(allErrors)).build());
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -148,7 +148,7 @@ public class UserAdmistrationResource {
|
|||||||
this.writePlatformService.deleteUser(userId);
|
this.writePlatformService.deleteUser(userId);
|
||||||
|
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -171,7 +171,7 @@ public class UserAdmistrationResource {
|
|||||||
AppUserData user = this.readPlatformService.retrieveUser(userId);
|
AppUserData user = this.readPlatformService.retrieveUser(userId);
|
||||||
|
|
||||||
return Response.ok().entity(user).build();
|
return Response.ok().entity(user).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -194,7 +194,7 @@ public class UserAdmistrationResource {
|
|||||||
Long userId = this.writePlatformService.updateUser(command);
|
Long userId = this.writePlatformService.updateUser(command);
|
||||||
|
|
||||||
return Response.ok().entity(new EntityIdentifier(userId)).build();
|
return Response.ok().entity(new EntityIdentifier(userId)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -217,7 +217,7 @@ public class UserAdmistrationResource {
|
|||||||
AppUserData user = this.readPlatformService.retrieveCurrentUser();
|
AppUserData user = this.readPlatformService.retrieveCurrentUser();
|
||||||
|
|
||||||
return Response.ok().entity(user).build();
|
return Response.ok().entity(user).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -240,7 +240,7 @@ public class UserAdmistrationResource {
|
|||||||
Long userId = this.writePlatformService.updateCurrentUser(command);
|
Long userId = this.writePlatformService.updateCurrentUser(command);
|
||||||
|
|
||||||
return Response.ok().entity(new EntityIdentifier(userId)).build();
|
return Response.ok().entity(new EntityIdentifier(userId)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -267,7 +267,7 @@ public class UserAdmistrationResource {
|
|||||||
Long userId = this.writePlatformService.updateCurrentUserPassword(command);
|
Long userId = this.writePlatformService.updateCurrentUserPassword(command);
|
||||||
|
|
||||||
return Response.ok().entity(new EntityIdentifier(userId)).build();
|
return Response.ok().entity(new EntityIdentifier(userId)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -289,7 +289,7 @@ public class UserAdmistrationResource {
|
|||||||
try {
|
try {
|
||||||
Collection<RoleData> roles = this.readPlatformService.retrieveAllRoles();
|
Collection<RoleData> roles = this.readPlatformService.retrieveAllRoles();
|
||||||
return Response.ok().entity(new RoleList(roles)).build();
|
return Response.ok().entity(new RoleList(roles)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -315,7 +315,7 @@ public class UserAdmistrationResource {
|
|||||||
role.setAvailablePermissions(allPermissions);
|
role.setAvailablePermissions(allPermissions);
|
||||||
|
|
||||||
return Response.ok().entity(role).build();
|
return Response.ok().entity(role).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -344,7 +344,7 @@ public class UserAdmistrationResource {
|
|||||||
role.setAvailablePermissions(availablePermissions);
|
role.setAvailablePermissions(availablePermissions);
|
||||||
|
|
||||||
return Response.ok().entity(role).build();
|
return Response.ok().entity(role).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -368,7 +368,7 @@ public class UserAdmistrationResource {
|
|||||||
this.writePlatformService.updateRole(command);
|
this.writePlatformService.updateRole(command);
|
||||||
return Response.ok().entity(new EntityIdentifier(roleId)).build();
|
return Response.ok().entity(new EntityIdentifier(roleId)).build();
|
||||||
|
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -391,7 +391,7 @@ public class UserAdmistrationResource {
|
|||||||
Long roleId = this.writePlatformService.createRole(command);
|
Long roleId = this.writePlatformService.createRole(command);
|
||||||
return Response.ok().entity(new EntityIdentifier(roleId)).build();
|
return Response.ok().entity(new EntityIdentifier(roleId)).build();
|
||||||
|
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -418,7 +418,7 @@ public class UserAdmistrationResource {
|
|||||||
.ok()
|
.ok()
|
||||||
.entity(new EnumOptionList(new ArrayList<EnumOptionReadModel>(
|
.entity(new EnumOptionList(new ArrayList<EnumOptionReadModel>(
|
||||||
options))).build();
|
options))).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
@@ -441,7 +441,7 @@ public class UserAdmistrationResource {
|
|||||||
Collection<PermissionData> permissions = this.readPlatformService.retrieveAllPermissions();
|
Collection<PermissionData> permissions = this.readPlatformService.retrieveAllPermissions();
|
||||||
|
|
||||||
return Response.ok().entity(new PermissionList(permissions)).build();
|
return Response.ok().entity(new PermissionList(permissions)).build();
|
||||||
} catch (ClientNotAuthenticatedException e) {
|
} catch (UnAuthenticatedUserException e) {
|
||||||
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
throw new WebApplicationException(Response.status(Status.UNAUTHORIZED).build());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
ErrorResponse errorResponse = new ErrorResponse("error.msg.no.permission", "id");
|
||||||
|
|||||||
Reference in New Issue
Block a user