GSOC'17:swagger and swagger UI integration on fineract-provider
This commit is contained in:
@@ -3,4 +3,5 @@
|
||||
*.war
|
||||
*.ear
|
||||
.gradle
|
||||
.idea
|
||||
build
|
||||
|
||||
@@ -109,7 +109,9 @@ rat {
|
||||
'**/*.iml',
|
||||
//Notice files
|
||||
'**/NOTICE_RELEASE',
|
||||
'**/NOTICE_SOURCE',
|
||||
'**/NOTICE_SOURCE',
|
||||
// Swagger License
|
||||
'**/fineract-provider/src/main/resources/swagger-ui/*.*',
|
||||
// gradle
|
||||
'**/.gradle/**',
|
||||
'**/gradlew',
|
||||
|
||||
@@ -91,10 +91,12 @@ dependencies {
|
||||
[group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.3.5'],
|
||||
// Once we've switched to Java 8 this dep can be removed.
|
||||
//[group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0']
|
||||
|
||||
[group: 'io.swagger', name: 'swagger-jersey-jaxrs', version: '1.5.15'],
|
||||
[group: 'org.springframework', name:'spring-jms'],
|
||||
[group: 'org.apache.activemq', name: 'activemq-broker']
|
||||
)
|
||||
|
||||
)
|
||||
testCompile 'junit:junit:4.11',
|
||||
'junit:junit-dep:4.11',
|
||||
'org.mockito:mockito-core:1.9.5',
|
||||
|
||||
@@ -90,9 +90,12 @@ dependencies {
|
||||
[group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.3.5'],
|
||||
// Once we've switched to Java 8 this dep can be removed.
|
||||
//[group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0']
|
||||
|
||||
[group: 'io.swagger', name: 'swagger-jersey-jaxrs', version: '1.5.15'],
|
||||
[group: 'org.springframework', name:'spring-jms'],
|
||||
[group: 'org.apache.activemq', name: 'activemq-broker']
|
||||
)
|
||||
)
|
||||
|
||||
testCompile 'junit:junit:4.11',
|
||||
'junit:junit-dep:4.11',
|
||||
'org.mockito:mockito-core:1.9.5',
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="fineract-provider" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
+7
-1
@@ -24,6 +24,8 @@ import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
// import org.apache.fineract.accounting.accrual.swagger.runaccuralPost;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -36,6 +38,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/runaccruals")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Periodic Accrual Accounting", description = "Periodic Accrual is to accrue the loan income till the specific date or till batch job scheduled time.\n\n ")
|
||||
public class AccrualAccountingApiResource {
|
||||
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
@@ -52,7 +55,10 @@ public class AccrualAccountingApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String executePeriodicAccrualAccounting(final String jsonRequestBody) {
|
||||
@ApiOperation(value = "Executes Periodic Accrual Accounting", httpMethod = "POST", notes = "Mandatory Fields\n" + "\n" + "tillDate\n")
|
||||
@ApiImplicitParams({@ApiImplicitParam(paramType = "body", required = true, type = "body", dataTypeClass = AccrualAccountingApiResourceSwagger.PostRunaccrualsRequest.class, value = "Request Body\n" + "\n" + "Field Descriptions: \n" + "tillDate: \n" + "which specifies periodic accruals should happen till the given Date" )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "OK")})
|
||||
public String executePeriodicAccrualAccounting( @ApiParam(hidden = true) final String jsonRequestBody) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().excuteAccrualAccounting().withJson(jsonRequestBody).build();
|
||||
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.accounting.accrual.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 24/7/17.
|
||||
*/
|
||||
final class AccrualAccountingApiResourceSwagger {
|
||||
private AccrualAccountingApiResourceSwagger() {
|
||||
// don't allow to instantiate; use only for live API documentation
|
||||
}
|
||||
|
||||
@ApiModel(value = "runaccrualsRequest")
|
||||
public static final class PostRunaccrualsRequest {
|
||||
private PostRunaccrualsRequest() {
|
||||
// don't allow to instantiate; use only for live API documentation
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "dd MMMM yyyy")
|
||||
public String dateFormat;
|
||||
@ApiModelProperty(example = "04 June 2014", notes = "which specifies periodic accruals should happen till the given Date", required = true)
|
||||
public String tillDate;
|
||||
}
|
||||
|
||||
}
|
||||
+20
-5
@@ -36,6 +36,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.accounting.closure.data.GLClosureData;
|
||||
import org.apache.fineract.accounting.closure.service.GLClosureReadPlatformService;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
@@ -54,6 +55,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/glclosures")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Accounting Closure", description = "An accounting closure indicates that no more journal entries may be logged (or reversed) in the system, either manually or via the portfolio with an entry date prior to the defined closure date\n" + "\n" + "Field Descriptions\n" + "closingDate\n" + "The date for which the accounting closure is defined\n" + "officeId\n" + "The identifer of the branch for which accounting has been closed\n" + "comments\n" + "Description associated with an Accounting closure")
|
||||
public class GLClosuresApiResource {
|
||||
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "officeId", "officeName",
|
||||
@@ -85,7 +87,9 @@ public class GLClosuresApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveAllClosures(@Context final UriInfo uriInfo, @QueryParam("officeId") final Long officeId) {
|
||||
@ApiOperation(value = "List Accounting closures", notes = "Example Requests:\n" + "\n" + "glclosures")
|
||||
@ApiResponses({@ApiResponse(code = 200, response = GLClosuresApiResourceSwagger.GetGlClosureResponse.class, message = "", responseContainer = "list")})
|
||||
public String retrieveAllClosures(@Context final UriInfo uriInfo, @QueryParam("officeId") @ApiParam(value = "officeId") final Long officeId) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
||||
final List<GLClosureData> glClosureDatas = this.glClosureReadPlatformService.retrieveAllGLClosures(officeId);
|
||||
@@ -98,7 +102,9 @@ public class GLClosuresApiResource {
|
||||
@Path("{glClosureId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retreiveClosure(@PathParam("glClosureId") final Long glClosureId, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieve an Accounting Closure", notes = "Example Requests:\n" + "\n" + "glclosures/1\n" + "\n" + "\n" + "/glclosures/1?fields=officeName,closingDate")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = GLClosuresApiResourceSwagger.GetGlClosureResponse.class)})
|
||||
public String retreiveClosure(@PathParam("glClosureId") @ApiParam(value = "glClosureId") final Long glClosureId, @Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
||||
|
||||
@@ -112,10 +118,14 @@ public class GLClosuresApiResource {
|
||||
return this.apiJsonSerializerService.serialize(settings, glClosureData, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
// NOTE: proposal slight changes @Aleks
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createGLClosure(final String jsonRequestBody) {
|
||||
@ApiOperation(value = "Create an Accounting Closure", notes = "Mandatory Fields\n" + "officeId,closingDate")
|
||||
@ApiImplicitParams({@ApiImplicitParam(paramType = "body", required = true, type = "body", dataTypeClass = GLClosuresApiResourceSwagger.PostGlClosuresRequest.class, value = "Request Body")})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = GLClosuresApiResourceSwagger.PostGlClosuresResponse.class)})
|
||||
public String createGLClosure(@ApiParam(hidden = true) final String jsonRequestBody) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createGLClosure().withJson(jsonRequestBody).build();
|
||||
|
||||
@@ -128,7 +138,10 @@ public class GLClosuresApiResource {
|
||||
@Path("{glClosureId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateGLClosure(@PathParam("glClosureId") final Long glClosureId, final String jsonRequestBody) {
|
||||
@ApiOperation(value = "Update an Accounting closure", notes = "Once an accounting closure is created, only the comments associated with it may be edited")
|
||||
@ApiImplicitParams({@ApiImplicitParam(paramType = "body", value = "Request body", dataType = "body", dataTypeClass = GLClosuresApiResourceSwagger.PutGlClosuresRequest.class, required = true)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = GLClosuresApiResourceSwagger.PutGlClosuresResponse.class)})
|
||||
public String updateGLClosure(@PathParam("glClosureId") @ApiParam(value = "glClosureId") final Long glClosureId, @ApiParam(hidden = true) final String jsonRequestBody) {
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateGLClosure(glClosureId).withJson(jsonRequestBody).build();
|
||||
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
@@ -140,7 +153,9 @@ public class GLClosuresApiResource {
|
||||
@Path("{glClosureId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String deleteGLClosure(@PathParam("glClosureId") final Long glClosureId) {
|
||||
@ApiOperation(value = "Delete an accounting closure", notes = "Note: Only the latest accounting closure associated with a branch may be deleted.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = GLClosuresApiResourceSwagger.DeleteGlClosuresResponse.class)})
|
||||
public String deleteGLClosure(@PathParam("glClosureId") @ApiParam(value = "glclosureId") final Long glClosureId) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteGLClosure(glClosureId).build();
|
||||
|
||||
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.accounting.closure.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
|
||||
final class GLClosuresApiResourceSwagger {
|
||||
private GLClosuresApiResourceSwagger() {
|
||||
// don't allow to instantiate; use only for live API documentation
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: describe where this belongs: {@link GLClosuresApiResource }
|
||||
* {@Link GLClosuresApiResource}
|
||||
*/
|
||||
// Check !!
|
||||
|
||||
@ApiModel(value = "GetGLClosureResponse")
|
||||
public static final class GetGlClosureResponse {
|
||||
private GetGlClosureResponse() {
|
||||
// dont allow to initiatiate
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "7")
|
||||
public Long id;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "Head Office")
|
||||
public String officeName;
|
||||
@ApiModelProperty(example = "2013,1,2")
|
||||
public LocalDate closingDate;
|
||||
@ApiModelProperty(example = "false")
|
||||
public boolean deleted;
|
||||
@ApiModelProperty(example = "2013,1,3")
|
||||
public LocalDate createdDate;
|
||||
@ApiModelProperty(example = "2013,1,3")
|
||||
public LocalDate lastUpdatedDate;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long createdByUserId;
|
||||
@ApiModelProperty(example = "mifos")
|
||||
public String createdByUsername;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long lastUpdatedByUserId;
|
||||
@ApiModelProperty(example = "mifos")
|
||||
public String lastUpdatedByUsername;
|
||||
@ApiModelProperty(example = "closed")
|
||||
public String comments;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostGLCLosuresRequest")
|
||||
public static final class PostGlClosuresRequest {
|
||||
private PostGlClosuresRequest() {
|
||||
// don't allow to instantiate; use only for live API documentation
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "06 December 2012")
|
||||
public LocalDate closingDate;
|
||||
@ApiModelProperty(example = "The accountants are heading for a carribean vacation")
|
||||
public String comments;
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "dd MMMM yyyy")
|
||||
public String dateFormat;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostGlClosuresResponse")
|
||||
public static final class PostGlClosuresResponse {
|
||||
private PostGlClosuresResponse() {
|
||||
// don't allow to instantiate; use only for live API documentation
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "9")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutGlClosuresRequest")
|
||||
public static final class PutGlClosuresRequest {
|
||||
private PutGlClosuresRequest() {
|
||||
// don't allow to instantiate; use only for live API documentation
|
||||
}
|
||||
@ApiModelProperty(example = "All transactions verified by Johnny Cash")
|
||||
public String comments;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutGlClosuresResponse")
|
||||
public static final class PutGlClosuresResponse{
|
||||
private PutGlClosuresResponse() {
|
||||
// don't allow to instantiate; use only for live API documentation
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "9")
|
||||
public Long resourceId;
|
||||
@ApiModelProperty(example = "All transactions verified by Johnny Cash")
|
||||
public String comments;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteGlClosuresResponse")
|
||||
public static final class DeleteGlClosuresResponse{
|
||||
private DeleteGlClosuresResponse(){
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "9")
|
||||
public Long resourceId;
|
||||
}
|
||||
}
|
||||
+19
-4
@@ -32,7 +32,9 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.data.FinancialActivityAccountData;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.data.FinancialActivityData;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.service.FinancialActivityAccountReadPlatformService;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
@@ -49,6 +51,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/financialactivityaccounts")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Mapping Financial Activities to Accounts", description = "Organization Level Financial Activities like Asset and Liability Transfer can be mapped to GL Account. Integrated accounting takes these accounts into consideration when an Account transfer is made between a savings to loan/savings account and vice-versa\n" + "\n" +"\nField Descriptions\n" +"financialActivityId\n" +"The identifier of the Financial Activity\n" +"glAccountId\n" +"The identifier of a GL Account ( Ledger Account) which shall be used as the default account for the selected Financial Activity")
|
||||
public class FinancialActivityAccountsApiResource {
|
||||
|
||||
private final FinancialActivityAccountReadPlatformService financialActivityAccountReadPlatformService;
|
||||
@@ -89,6 +92,8 @@ public class FinancialActivityAccountsApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "List Financial Activities to Accounts Mappings", notes = "Example Requests:\n" + "\n" + "financialactivityaccounts")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = FinancialActivityAccountsApiResourceSwagger.GetFinancialActivityAccountsResponse.class, responseContainer = "list" )})
|
||||
public String retrieveAll(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(FinancialActivityAccountsConstants.resourceNameForPermission);
|
||||
@@ -103,7 +108,9 @@ public class FinancialActivityAccountsApiResource {
|
||||
@Path("{mappingId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retreive(@PathParam("mappingId") final Long mappingId, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieve a Financial Activity to Account Mapping\n", notes = "Example Requests:\n" + "\n" + "financialactivityaccounts/1")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = FinancialActivityAccountsApiResourceSwagger.GetFinancialActivityAccountsResponse.class)})
|
||||
public String retreive(@PathParam("mappingId") @ApiParam(value = "mappingId") final Long mappingId, @Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(FinancialActivityAccountsConstants.resourceNameForPermission);
|
||||
|
||||
@@ -121,7 +128,10 @@ public class FinancialActivityAccountsApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createGLAccount(final String jsonRequestBody) {
|
||||
@ApiOperation(value = "Create a new Financial Activity to Accounts Mapping", notes = "Mandatory Fields\n" + "financialActivityId, glAccountId")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "Request body", paramType = "body", dataType = "body", dataTypeClass = FinancialActivityAccountsApiResourceSwagger.PostFinancialActivityAccountsRequest.class)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = FinancialActivityAccountsApiResourceSwagger.PostFinancialActivityAccountsResponse.class)})
|
||||
public String createGLAccount(@ApiParam(hidden = true) final String jsonRequestBody) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createOfficeToGLAccountMapping().withJson(jsonRequestBody)
|
||||
.build();
|
||||
@@ -135,7 +145,10 @@ public class FinancialActivityAccountsApiResource {
|
||||
@Path("{mappingId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateGLAccount(@PathParam("mappingId") final Long mappingId, final String jsonRequestBody) {
|
||||
@ApiOperation(value = "Update a Financial Activity to Account Mapping", notes = "the API updates the Ledger account linked to a Financial Activity \n")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "Request body", dataType = "body", paramType = "body", dataTypeClass = FinancialActivityAccountsApiResourceSwagger.PostFinancialActivityAccountsRequest.class)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = FinancialActivityAccountsApiResourceSwagger.PutFinancialActivityAccountsResponse.class)})
|
||||
public String updateGLAccount(@PathParam("mappingId") @ApiParam(value = "mappingId") final Long mappingId, @ApiParam(hidden = true) final String jsonRequestBody) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateOfficeToGLAccountMapping(mappingId)
|
||||
.withJson(jsonRequestBody).build();
|
||||
@@ -149,7 +162,9 @@ public class FinancialActivityAccountsApiResource {
|
||||
@Path("{mappingId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String deleteGLAccount(@PathParam("mappingId") final Long mappingId) {
|
||||
@ApiOperation(value = "Delete a Financial Activity to Account Mapping")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = FinancialActivityAccountsApiResourceSwagger.DeleteFinancialActivityAccountsResponse.class)})
|
||||
public String deleteGLAccount(@PathParam("mappingId") @ApiParam(value = "mappingId") final Long mappingId) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteOfficeToGLAccountMapping(mappingId).build();
|
||||
|
||||
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.accounting.financialactivityaccount.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.data.FinancialActivityData;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 24/7/17.
|
||||
*/
|
||||
final class FinancialActivityAccountsApiResourceSwagger {
|
||||
private FinancialActivityAccountsApiResourceSwagger() {
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetFinancialActivityAccountsResponse")
|
||||
public static final class GetFinancialActivityAccountsResponse{
|
||||
private GetFinancialActivityAccountsResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long id;
|
||||
public FinancialActivityData financialActivityData;
|
||||
public GLAccountData glAccountData;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostFinancialActivityAccountsRequest")
|
||||
public static final class PostFinancialActivityAccountsRequest{
|
||||
private PostFinancialActivityAccountsRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "200")
|
||||
public Long financialActivityId;
|
||||
@ApiModelProperty(example = "2")
|
||||
public Long glAccountId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostFinancialActivityAccountsResponse")
|
||||
public static final class PostFinancialActivityAccountsResponse{
|
||||
private PostFinancialActivityAccountsResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutFinancialActivityAccountsRequest")
|
||||
public static final class PutFinancialActivityAccountsRequest{
|
||||
private PutFinancialActivityAccountsRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "200")
|
||||
public Long financialActivityId;
|
||||
@ApiModelProperty(example = "3")
|
||||
public Long glAccountId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutFinancialActivityAccountsResponse")
|
||||
public static final class PutFinancialActivityAccountsResponse{
|
||||
private PutFinancialActivityAccountsResponse() {
|
||||
|
||||
}
|
||||
public final class PutFinancialActivityAccountscommentsSwagger{
|
||||
private PutFinancialActivityAccountscommentsSwagger(){}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long glAccountId;
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
public PutFinancialActivityAccountscommentsSwagger comments;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteFinancialActivityAccountsResponse")
|
||||
public static final class DeleteFinancialActivityAccountsResponse{
|
||||
private DeleteFinancialActivityAccountsResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
}
|
||||
+27
-10
@@ -37,6 +37,8 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import io.swagger.models.parameters.HeaderParameter;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants;
|
||||
import org.apache.fineract.accounting.common.AccountingDropdownReadPlatformService;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
@@ -61,6 +63,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/glaccounts")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "General Ledger Account", description = "Ledger accounts represent an Individual account within an Organizations Chart Of Accounts(COA) and are assigned a name and unique number by which they can be identified. \n" + "All transactions relating to a company's assets, liabilities, owners' equity, revenue and expenses are recorded against these accounts")
|
||||
public class GLAccountsApiResource {
|
||||
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "parentId", "glCode",
|
||||
@@ -98,7 +101,9 @@ public class GLAccountsApiResource {
|
||||
@Path("template")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveNewAccountDetails(@Context final UriInfo uriInfo, @QueryParam("type") final Integer type) {
|
||||
@ApiOperation(value = "Retrieve GL Accounts Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "glaccounts/template\n" + "glaccounts/template?type=1\n" + "\n" + "type is optional and integer value from 1 to 5.\n" + "\n" + "1.Assets \n" + "2.Liabilities \n" + "3.Equity \n" + "4.Income \n" + "5.Expenses")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = GLAccountsApiResourceSwagger.GetGLAccountsTemplateResponse.class)})
|
||||
public String retrieveNewAccountDetails(@Context final UriInfo uriInfo, @QueryParam("type") @ApiParam(value = "type") final Integer type) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
||||
|
||||
@@ -112,10 +117,12 @@ public class GLAccountsApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveAllAccounts(@Context final UriInfo uriInfo, @QueryParam("type") final Integer type,
|
||||
@QueryParam("searchParam") final String searchParam, @QueryParam("usage") final Integer usage,
|
||||
@QueryParam("manualEntriesAllowed") final Boolean manualEntriesAllowed, @QueryParam("disabled") final Boolean disabled,
|
||||
@QueryParam("fetchRunningBalance") final boolean runningBalance) {
|
||||
@ApiOperation(value = "List General Ledger Accounts", notes = "ARGUMENTS\n" + "type Integer optional manualEntriesAllowed boolean optional usage Integer optional disabled boolean optional parentId Long optional tagId Long optional\n" + "Example Requests:\n" + "\n" + "glaccounts\n" + "\n" + "\n" + "glaccounts?type=1&manualEntriesAllowed=true&usage=1&disabled=false\n" + "\n" + "glaccounts?fetchRunningBalance=true")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = GLAccountsApiResourceSwagger.GetGLAccountsResponse.class, responseContainer = "list")})
|
||||
public String retrieveAllAccounts(@Context final UriInfo uriInfo, @QueryParam("type") @ApiParam(value = "type") final Integer type,
|
||||
@QueryParam("searchParam") @ApiParam(value = "searchParam") final String searchParam, @QueryParam("usage") @ApiParam(value = "usage") final Integer usage,
|
||||
@QueryParam("manualEntriesAllowed") @ApiParam(value = "manualEntriesAllowed") final Boolean manualEntriesAllowed, @QueryParam("disabled") @ApiParam(value = "disabled") final Boolean disabled,
|
||||
@QueryParam("fetchRunningBalance") @ApiParam(value = "fetchRunningBalance") final boolean runningBalance) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
||||
JournalEntryAssociationParametersData associationParametersData = new JournalEntryAssociationParametersData(false, runningBalance);
|
||||
@@ -130,8 +137,10 @@ public class GLAccountsApiResource {
|
||||
@Path("{glAccountId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retreiveAccount(@PathParam("glAccountId") final Long glAccountId, @Context final UriInfo uriInfo,
|
||||
@QueryParam("fetchRunningBalance") final boolean runningBalance) {
|
||||
@ApiOperation(value = "Retrieve a General Ledger Account", notes = "Example Requests:\n" + "\n" + "glaccounts/1\n" + "\n" + "\n" + "glaccounts/1?template=true\n" + "\n" + "\n" + "glaccounts/1?fields=name,glCode\n" + "\n" + "\n" + "glaccounts/1?fetchRunningBalance=true")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = GLAccountsApiResourceSwagger.GetGLAccountsResponse.class)})
|
||||
public String retreiveAccount(@PathParam("glAccountId") @ApiParam(value = "glAccountId") final Long glAccountId, @Context final UriInfo uriInfo,
|
||||
@QueryParam("fetchRunningBalance") @ApiParam(value = "fetchRunningBalance") final boolean runningBalance) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
||||
|
||||
@@ -148,7 +157,10 @@ public class GLAccountsApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createGLAccount(final String jsonRequestBody) {
|
||||
@ApiOperation(value = "Create a General Ledger Account", notes = "Note: You may optionally create Hierarchical Chart of Accounts by using the \"parentId\" property of an Account\n" + "Mandatory Fields: \n" + "name, glCode, type, usage and manualEntriesAllowed")
|
||||
@ApiImplicitParams({@ApiImplicitParam(paramType = "body", value = "body", dataType = "body", dataTypeClass = GLAccountsApiResourceSwagger.PostGLAccountsRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = GLAccountsApiResourceSwagger.PostGLAccountsResponse.class)})
|
||||
public String createGLAccount(@ApiParam(hidden = true) final String jsonRequestBody) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createGLAccount().withJson(jsonRequestBody).build();
|
||||
|
||||
@@ -161,7 +173,10 @@ public class GLAccountsApiResource {
|
||||
@Path("{glAccountId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateGLAccount(@PathParam("glAccountId") final Long glAccountId, final String jsonRequestBody) {
|
||||
@ApiOperation(value = "Update an Accounting closure", notes = "Once an accounting closure is created, only the comments associated with it may be edited\n" + "\n")
|
||||
@ApiImplicitParams({@ApiImplicitParam(paramType = "body", value = "body", dataType = "body", dataTypeClass = GLAccountsApiResourceSwagger.PutGLAccountsRequest.class)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = GLAccountsApiResourceSwagger.PutGLAccountsResponse.class)})
|
||||
public String updateGLAccount(@PathParam("glAccountId") @ApiParam(value = "glAccountId") final Long glAccountId, @ApiParam(hidden = true) final String jsonRequestBody) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateGLAccount(glAccountId).withJson(jsonRequestBody).build();
|
||||
|
||||
@@ -174,7 +189,9 @@ public class GLAccountsApiResource {
|
||||
@Path("{glAccountId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String deleteGLAccount(@PathParam("glAccountId") final Long glAccountId) {
|
||||
@ApiOperation(value = "Delete an accounting closure", notes = "Note: Only the latest accounting closure associated with a branch may be deleted.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = GLAccountsApiResourceSwagger.DeleteGLAccountsRequest.class)})
|
||||
public String deleteGLAccount(@PathParam("glAccountId") @ApiParam(value = "glAccountId") final Long glAccountId) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteGLAccount(glAccountId).build();
|
||||
|
||||
|
||||
+190
@@ -0,0 +1,190 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.accounting.glaccount.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 24/7/17.
|
||||
*/
|
||||
final class GLAccountsApiResourceSwagger {
|
||||
private GLAccountsApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetGLAccountsResponse")
|
||||
public static final class GetGLAccountsResponse{
|
||||
private GetGLAccountsResponse(){
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "16")
|
||||
public Long id;
|
||||
|
||||
@ApiModelProperty(example = "Cash")
|
||||
public String name;
|
||||
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long parentId;
|
||||
|
||||
@ApiModelProperty(example = "100001")
|
||||
public String glCode;
|
||||
|
||||
@ApiModelProperty(example = "false")
|
||||
public Boolean disabled;
|
||||
|
||||
@ApiModelProperty(example = "true")
|
||||
public Boolean manualEntriesAllowed;
|
||||
|
||||
public EnumOptionData type;
|
||||
public EnumOptionData usage;
|
||||
|
||||
@ApiModelProperty(example = "Desc")
|
||||
public String description;
|
||||
|
||||
@ApiModelProperty(example = "....Cash")
|
||||
public String nameDecorated;
|
||||
|
||||
public CodeValueData tagId;
|
||||
|
||||
@ApiModelProperty(example = "118437")
|
||||
public Long organizationRunningBalance;
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetGLAccountsTemplateResponse")
|
||||
public static final class GetGLAccountsTemplateResponse{
|
||||
private GetGLAccountsTemplateResponse(){
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "false")
|
||||
public Boolean disabled;
|
||||
|
||||
@ApiModelProperty(example = "true")
|
||||
public Boolean manualEntriesAllowed;
|
||||
|
||||
public EnumOptionData type;
|
||||
public EnumOptionData usage;
|
||||
public List<EnumOptionData> accountTypeOptions;
|
||||
public List<EnumOptionData> usageOptions;
|
||||
public List<GLAccountData> assetHeaderAccountOptions;
|
||||
public List<GLAccountData> liabilityHeaderAccountOptions;
|
||||
public List<GLAccountData> equityHeaderAccountOptions;
|
||||
public List<GLAccountData> expenseHeaderAccountOptions;
|
||||
public Collection<CodeValueData> allowedAssetsTagOptions;
|
||||
public Collection<CodeValueData> allowedLiabilitiesTagOptions;
|
||||
public Collection<CodeValueData> allowedEquityTagOptions;
|
||||
public Collection<CodeValueData> allowedIncomeTagOptions;
|
||||
public Collection<CodeValueData> allowedExpensesTagOptions;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostGLAccountsRequest")
|
||||
public static final class PostGLAccountsRequest{
|
||||
private PostGLAccountsRequest(){
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "Cash at Bangalore")
|
||||
public String name;
|
||||
|
||||
@ApiModelProperty(example = "100001")
|
||||
public String glCode;
|
||||
|
||||
@ApiModelProperty(example = "true")
|
||||
public Boolean manualEntriesAllowed;
|
||||
|
||||
@ApiModelProperty(example = "1")
|
||||
public String type;
|
||||
|
||||
@ApiModelProperty(example = "10")
|
||||
public String tagId;
|
||||
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long parentId;
|
||||
|
||||
@ApiModelProperty(example = "1")
|
||||
public EnumOptionData usage;
|
||||
|
||||
@ApiModelProperty(example = "Desc")
|
||||
public String description;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostGLAccountsResponse")
|
||||
public static final class PostGLAccountsResponse{
|
||||
private PostGLAccountsResponse() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "22")
|
||||
public int resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutGLAccountsRequest")
|
||||
public static final class PutGLAccountsRequest{
|
||||
private PutGLAccountsRequest() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "Cash at Bangalore")
|
||||
public String name;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutGLAccountsResponse")
|
||||
public static final class PutGLAccountsResponse{
|
||||
private PutGLAccountsResponse() {
|
||||
|
||||
}
|
||||
@ApiModel
|
||||
public static final class PutGLAccountsResponsechangesSwagger{
|
||||
private PutGLAccountsResponsechangesSwagger(){}
|
||||
@ApiModelProperty(example = "Cash at Bangalore")
|
||||
public String name;
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public int resourceId;
|
||||
public PutGLAccountsResponsechangesSwagger changes;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteGLAccountsRequest")
|
||||
public static final class DeleteGLAccountsRequest{
|
||||
private DeleteGLAccountsRequest() {
|
||||
|
||||
}
|
||||
|
||||
private static final class DeleteGLAccountsRequestchangesSwagger{
|
||||
private DeleteGLAccountsRequestchangesSwagger(){}
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "1")
|
||||
public int resourceId;
|
||||
|
||||
private DeleteGLAccountsRequestchangesSwagger changes;
|
||||
}
|
||||
|
||||
}
|
||||
+31
-17
@@ -34,7 +34,10 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.accounting.journalentry.command.JournalEntryCommand;
|
||||
import org.apache.fineract.accounting.journalentry.command.SingleDebitOrCreditEntryCommand;
|
||||
import org.apache.fineract.accounting.journalentry.data.JournalEntryAssociationParametersData;
|
||||
import org.apache.fineract.accounting.journalentry.data.JournalEntryData;
|
||||
import org.apache.fineract.accounting.journalentry.data.OfficeOpeningBalancesData;
|
||||
@@ -58,6 +61,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/journalentries")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Journal Entries", description = "A journal entry refers to the logging of transactions against general ledger accounts. A journal entry may consist of several line items, each of which is either a \"debit\" or a \"credit\". The total amount of the debits must equal the total amount of the credits or the journal entry is said to be \"unbalanced\" \n" + "\n" + "A journal entry directly changes the account balances on the general ledger")
|
||||
public class JournalEntriesApiResource {
|
||||
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "officeId", "officeName",
|
||||
@@ -88,15 +92,17 @@ public class JournalEntriesApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("officeId") final Long officeId,
|
||||
@QueryParam("glAccountId") final Long glAccountId, @QueryParam("manualEntriesOnly") final Boolean onlyManualEntries,
|
||||
@QueryParam("fromDate") final DateParam fromDateParam, @QueryParam("toDate") final DateParam toDateParam,
|
||||
@QueryParam("transactionId") final String transactionId, @QueryParam("entityType") final Integer entityType,
|
||||
@QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit,
|
||||
@QueryParam("orderBy") final String orderBy, @QueryParam("sortOrder") final String sortOrder,
|
||||
@QueryParam("locale") final String locale, @QueryParam("dateFormat") final String dateFormat,
|
||||
@QueryParam("loanId") final Long loanId, @QueryParam("savingsId") final Long savingsId,
|
||||
@QueryParam("runningBalance") final boolean runningBalance, @QueryParam("transactionDetails") final boolean transactionDetails) {
|
||||
@ApiOperation(value = "List Journal Entries", notes = "The list capability of journal entries can support pagination and sorting.\n\n" + "Example Requests:\n" + "\n" + "journalentries\n" + "\n" + "journalentries?transactionId=PB37X8Y21EQUY4S\n" + "\n" + "journalentries?officeId=1&manualEntriesOnly=true&fromDate=1 July 2013&toDate=15 July 2013&dateFormat=dd MMMM yyyy&locale=en\n" + "\n" + "journalentries?fields=officeName,glAccountName,transactionDate\n" + "\n" + "journalentries?offset=10&limit=50\n" + "\n" + "journalentries?orderBy=transactionId&sortOrder=DESC\n" + "\n" + "journalentries?runningBalance=true\n" + "\n" + "journalentries?transactionDetails=true\n" + "\n" + "journalentries?loanId=12\n" + "\n" + "journalentries?savingsId=24")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = JournalEntryData.class, responseContainer = "list")})
|
||||
public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("officeId") @ApiParam(value = "officeId") final Long officeId,
|
||||
@QueryParam("glAccountId") @ApiParam(value = "glAccountId") final Long glAccountId, @QueryParam("manualEntriesOnly") @ApiParam(value = "manualEntriesOnly") final Boolean onlyManualEntries,
|
||||
@QueryParam("fromDate") @ApiParam(value = "fromDate") final DateParam fromDateParam, @QueryParam("toDate") @ApiParam(value = "toDate") final DateParam toDateParam,
|
||||
@QueryParam("transactionId") @ApiParam(value = "transactionId") final String transactionId, @QueryParam("entityType") @ApiParam(value = "entityType") final Integer entityType,
|
||||
@QueryParam("offset") @ApiParam(value = "offset") final Integer offset, @QueryParam("limit") @ApiParam(value = "limit") final Integer limit,
|
||||
@QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder,
|
||||
@QueryParam("locale") @ApiParam(value = "locale") final String locale, @QueryParam("dateFormat") @ApiParam(value = "dateFormat") final String dateFormat,
|
||||
@QueryParam("loanId") @ApiParam(value = "loanId") final Long loanId, @QueryParam("savingsId") @ApiParam(value = "savingsId") final Long savingsId,
|
||||
@QueryParam("runningBalance") @ApiParam(value = "runningBalance") final boolean runningBalance, @QueryParam("transactionDetails") @ApiParam(value = "transactionDetails") final boolean transactionDetails) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
||||
|
||||
@@ -124,8 +130,10 @@ public class JournalEntriesApiResource {
|
||||
@Path("{journalEntryId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retreiveJournalEntryById(@PathParam("journalEntryId") final Long journalEntryId, @Context final UriInfo uriInfo,
|
||||
@QueryParam("runningBalance") final boolean runningBalance, @QueryParam("transactionDetails") final boolean transactionDetails) {
|
||||
@ApiOperation(value = "Retrieve a single Entry", notes = "Example Requests:\n" + "\n" + "journalentries/1\n" + "\n" + "\n" + "\n" + "journalentries/1?fields=officeName,glAccountId,entryType,amount\n" + "\n" + "journalentries/1?runningBalance=true\n" + "\n" + "journalentries/1?transactionDetails=true")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = JournalEntryData.class)})
|
||||
public String retreiveJournalEntryById(@PathParam("journalEntryId") @ApiParam(value = "journalEntryId") final Long journalEntryId, @Context final UriInfo uriInfo,
|
||||
@QueryParam("runningBalance") @ApiParam(value = "runningBalance") final boolean runningBalance, @QueryParam("transactionDetails") @ApiParam(value = "transactionDetails") final boolean transactionDetails) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
||||
JournalEntryAssociationParametersData associationParametersData = new JournalEntryAssociationParametersData(transactionDetails,
|
||||
@@ -140,7 +148,10 @@ public class JournalEntriesApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createGLJournalEntry(final String jsonRequestBody, @QueryParam("command") final String commandParam) {
|
||||
@ApiOperation(value = "Create \"Balanced\" Journal Entries", notes = "Note: A Balanced (simple) Journal entry would have atleast one \"Debit\" and one \"Credit\" entry whose amounts are equal \n" + "Compound Journal entries may have \"n\" debits and \"m\" credits where both \"m\" and \"n\" are greater than 0 and the net sum or all debits and credits are equal \n\n" + "\n" + "Mandatory Fields\n" + "officeId, transactionDate\n\n" + "\ncredits- glAccountId, amount, comments\n\n " + "\ndebits- glAccountId, amount, comments\n\n " + "\n" + "Optional Fields\n" + "paymentTypeId, accountNumber, checkNumber, routingCode, receiptNumber, bankNumber")
|
||||
@ApiImplicitParams({@ApiImplicitParam(paramType = "body", value = "body", dataType = "body", dataTypeClass = JournalEntryCommand.class)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = JournalEntriesApiResourceSwagger.PostJournalEntriesResponse.class)})
|
||||
public String createGLJournalEntry(@ApiParam(hidden = true) final String jsonRequestBody, @QueryParam("command") @ApiParam(value = "command") final String commandParam) {
|
||||
|
||||
CommandProcessingResult result = null;
|
||||
if (is(commandParam, "updateRunningBalance")) {
|
||||
@@ -162,8 +173,11 @@ public class JournalEntriesApiResource {
|
||||
@Path("{transactionId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createReversalJournalEntry(final String jsonRequestBody, @PathParam("transactionId") final String transactionId,
|
||||
@QueryParam("command") final String commandParam) {
|
||||
@ApiOperation(value = "Update Running balances for Journal Entries", notes = "This API calculates the running balances for office. If office ID not provided this API calculates running balances for all offices. \n" + "Mandatory Fields\n" + "officeId")
|
||||
@ApiImplicitParams({@ApiImplicitParam(paramType = "body", value = "body", dataType = "body", dataTypeClass = JournalEntriesApiResourceSwagger.PostJournalEntriesTransactionIdRequest.class)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = JournalEntriesApiResourceSwagger.PostJournalEntriesTransactionIdResponse.class)})
|
||||
public String createReversalJournalEntry(@ApiParam(hidden = true) final String jsonRequestBody, @PathParam("transactionId") @ApiParam(value = "transactionId") final String transactionId,
|
||||
@QueryParam("command") @ApiParam(value = "command") final String commandParam) {
|
||||
CommandProcessingResult result = null;
|
||||
if (is(commandParam, "reverse")) {
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().reverseJournalEntry(transactionId).withJson(jsonRequestBody)
|
||||
@@ -187,14 +201,14 @@ public class JournalEntriesApiResource {
|
||||
SearchParameters params = SearchParameters.forPagination(offset, limit) ;
|
||||
Page<JournalEntryData> entries = this.journalEntryReadPlatformService.retrieveAll(params, null, null, null, null, transactionId, PortfolioProductType.PROVISIONING.getValue(), null) ;
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.apiJsonSerializerService.serialize(settings, entries, RESPONSE_DATA_PARAMETERS);
|
||||
return this.apiJsonSerializerService.serialize(settings, entries, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GET
|
||||
@Path("openingbalance")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Path("openingbalance")
|
||||
public String retrieveOpeningBalance(@Context final UriInfo uriInfo, @QueryParam("officeId") final Long officeId,
|
||||
@QueryParam("currencyCode") final String currencyCode) {
|
||||
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.accounting.journalentry.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 25/7/17.
|
||||
*/
|
||||
final class JournalEntriesApiResourceSwagger {
|
||||
private JournalEntriesApiResourceSwagger(){}
|
||||
|
||||
@ApiModel(value = "PostJournalEntriesResponse")
|
||||
public static final class PostJournalEntriesResponse {
|
||||
|
||||
private PostJournalEntriesResponse(){
|
||||
|
||||
}
|
||||
@ApiModelProperty(value = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(value = "RS9MCISID4WK1ZM")
|
||||
public String transactionId;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostJournalEntriesTransactionIdRequest")
|
||||
public static final class PostJournalEntriesTransactionIdRequest {
|
||||
private PostJournalEntriesTransactionIdRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(value = "1")
|
||||
public Long officeId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostJournalEntriesTransactionIdResponse")
|
||||
public static final class PostJournalEntriesTransactionIdResponse {
|
||||
private PostJournalEntriesTransactionIdResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(value = "1")
|
||||
public Long officeId;
|
||||
}
|
||||
}
|
||||
+18
-5
@@ -29,6 +29,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.accounting.provisioning.constant.ProvisioningEntriesApiConstants;
|
||||
import org.apache.fineract.accounting.provisioning.data.LoanProductProvisioningEntryData;
|
||||
import org.apache.fineract.accounting.provisioning.data.ProvisioningEntryData;
|
||||
@@ -55,6 +56,7 @@ import java.util.Set;
|
||||
@Path("/provisioningentries")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Provisioning Entries", description = "This defines the Provisioning Entries for all active loan products\n" + "\n" + "Field Descriptions\n" + "date\n" + "Date on which day provisioning entries should be created\n" + "createjournalentries\n" + "Boolean variable whether to add journal entries for generated provisioning entries\n")
|
||||
public class ProvisioningEntriesApiResource {
|
||||
|
||||
private final PlatformSecurityContext platformSecurityContext;
|
||||
@@ -84,7 +86,10 @@ public class ProvisioningEntriesApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createProvisioningEntries(final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create new Provisioning Entries", notes = "Creates a new Provisioning Entries\n" + "\n" + "Mandatory Fields\n" + "date\n" + "dateFormat\n" + "locale\n" + "Optional Fields\n" + "createjournalentries")
|
||||
@ApiImplicitParams({@ApiImplicitParam(paramType = "body", value = "body", dataType = "body", dataTypeClass = ProvisioningEntriesApiResourceSwagger.PostProvisioningEntriesRequest.class)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ProvisioningEntriesApiResourceSwagger.PostProvisioningEntriesResponse.class)})
|
||||
public String createProvisioningEntries(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
CommandWrapper commandWrapper = null;
|
||||
this.platformSecurityContext.authenticatedUser();
|
||||
commandWrapper = new CommandWrapperBuilder().createProvisioningEntries().withJson(apiRequestBodyAsJson).build();
|
||||
@@ -96,8 +101,11 @@ public class ProvisioningEntriesApiResource {
|
||||
@Path("{entryId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String modifyProvisioningEntry(@PathParam("entryId") final Long entryId, @QueryParam("command") final String commandParam,
|
||||
final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Recreates Provisioning Entry", notes = "Recreates Provisioning Entry | createjournalentry.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(paramType = "body", value = "body", dataType = "body", dataTypeClass = ProvisioningEntriesApiResourceSwagger.PutProvisioningEntriesRequest.class)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ProvisioningEntriesApiResourceSwagger.PutProvisioningEntriesResponse.class)})
|
||||
public String modifyProvisioningEntry(@PathParam("entryId") @ApiParam(value = "entryId") final Long entryId, @QueryParam("command") @ApiParam(value = "command=createjournalentry\ncommand=recreateprovisioningentry") final String commandParam,
|
||||
@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
CommandWrapper commandWrapper = null;
|
||||
this.platformSecurityContext.authenticatedUser();
|
||||
if ("createjournalentry".equals(commandParam)) {
|
||||
@@ -118,7 +126,9 @@ public class ProvisioningEntriesApiResource {
|
||||
@Path("{entryId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveProvisioningEntry(@PathParam("entryId") final Long entryId, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieves a Provisioning Entry", notes = "Returns the details of a generated Provisioning Entry.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ProvisioningEntryData.class)})
|
||||
public String retrieveProvisioningEntry(@PathParam("entryId") @ApiParam(value = "entryId") final Long entryId, @Context final UriInfo uriInfo) {
|
||||
platformSecurityContext.authenticatedUser();
|
||||
ProvisioningEntryData data = this.provisioningEntriesReadPlatformService.retrieveProvisioningEntryData(entryId);
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
@@ -129,6 +139,7 @@ public class ProvisioningEntriesApiResource {
|
||||
@Path("entries")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = LoanProductProvisioningEntryData.class)})
|
||||
public String retrieveProviioningEntries(@QueryParam("entryId") final Long entryId, @QueryParam("offset") final Integer offset,
|
||||
@QueryParam("limit") final Integer limit, @QueryParam("officeId") final Long officeId,
|
||||
@QueryParam("productId") final Long productId, @QueryParam("categoryId") final Long categoryId, @Context final UriInfo uriInfo) {
|
||||
@@ -142,7 +153,9 @@ public class ProvisioningEntriesApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveAllProvisioningEntries(@QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit,
|
||||
@ApiOperation(value = "List all Provisioning Entries")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ProvisioningEntryData.class, responseContainer = "list")})
|
||||
public String retrieveAllProvisioningEntries(@QueryParam("offset") @ApiParam(value = "offset") final Integer offset, @QueryParam("limit") @ApiParam(value = "limit") final Integer limit,
|
||||
@Context final UriInfo uriInfo) {
|
||||
platformSecurityContext.authenticatedUser();
|
||||
Page<ProvisioningEntryData> data = this.provisioningEntriesReadPlatformService.retrieveAllProvisioningEntries(offset, limit);
|
||||
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.accounting.provisioning.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 25/7/17.
|
||||
*/
|
||||
final class ProvisioningEntriesApiResourceSwagger {
|
||||
private ProvisioningEntriesApiResourceSwagger() {
|
||||
// only for Swagger Documentation
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostProvisioningEntriesRequest")
|
||||
public static final class PostProvisioningEntriesRequest {
|
||||
private PostProvisioningEntriesRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "16 October 2015")
|
||||
public String date;
|
||||
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
|
||||
@ApiModelProperty(example = "dd MMMM yyyy")
|
||||
public String dateFormat;
|
||||
|
||||
@ApiModelProperty(example = "true")
|
||||
public String createjournalentries;
|
||||
|
||||
public String provisioningentry;
|
||||
|
||||
public String entries;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostProvisioningEntriesResponse")
|
||||
public static final class PostProvisioningEntriesResponse{
|
||||
private PostProvisioningEntriesResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutProvisioningEntriesRequest")
|
||||
public static final class PutProvisioningEntriesRequest{
|
||||
private PutProvisioningEntriesRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "recreateprovisioningentry")
|
||||
public String command;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutProvisioningEntriesResponse")
|
||||
public static final class PutProvisioningEntriesResponse{
|
||||
private PutProvisioningEntriesResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
}
|
||||
+20
-4
@@ -39,6 +39,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
import org.apache.fineract.accounting.glaccount.service.GLAccountReadPlatformService;
|
||||
@@ -66,6 +67,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/accountingrules")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Accounting Rules", description = "It is typical scenario in MFI's that non accountants pass journal entries on a regular basis. For Ex: A branch office might deposit their entire cash at hand to their Bank account at the end of a working day. The branch office users might not understand enough of accounting to figure out which account needs to get credited and which account needs to be debited to represent this transaction.\n" + "\n" + "Enter accounting rules, an abstraction on top of manual Journal entires for enabling simpler data entry. An accounting rule can define any of the following abstractions\n" + "\n" + "A Simple journal entry where both the credit and debit account have been preselected\n" + "A Simple journal entry where either credit or debit accounts have been limited to a pre-selected list of accounts (Ex: Debit account should be one of \"Bank of America\" of \"JP Morgan\" and credit account should be \"Cash\")\n" + "A Compound journal entry where multiple debits and / or multiple credits may be made amongst a set of preselected list of accounts (Ex: Credit account should be either \"Bank Of America\" or \"Cash\" and debit account can be \"Employee Salary\" and/or \"Miscellenous Expenses\")\n" + "An accounting rule can also be optionally associated with a branch, so that only a particular Branch's users have access to the rule")
|
||||
public class AccountingRuleApiResource {
|
||||
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "officeId", "officeName",
|
||||
@@ -105,6 +107,8 @@ public class AccountingRuleApiResource {
|
||||
@Path("template")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve Accounting Rule Details Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "accountingrules/template")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = AccountingRuleApiResourceSwagger.GetAccountRulesTemplateResponse.class)})
|
||||
public String retrieveTemplate(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
||||
@@ -119,6 +123,8 @@ public class AccountingRuleApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve Accounting Rules", notes = "Returns the list of defined accounting rules.\n" + "\n" + "Example Requests:\n" + "\n" + "accountingrules")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = AccountingRuleApiResourceSwagger.GetAccountRulesResponse.class, responseContainer = "list")})
|
||||
public String retrieveAllAccountingRules(@Context final UriInfo uriInfo) {
|
||||
|
||||
final AppUser currentUser = this.context.authenticatedUser();
|
||||
@@ -147,7 +153,9 @@ public class AccountingRuleApiResource {
|
||||
@Path("{accountingRuleId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retreiveAccountingRule(@PathParam("accountingRuleId") final Long accountingRuleId, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieve a Accounting rule", notes = "Returns the details of a defined Accounting rule.\n" + "\n" + "Example Requests:\n" + "\n" + "accountingrules/1")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = AccountingRuleData.class)})
|
||||
public String retreiveAccountingRule(@PathParam("accountingRuleId") @ApiParam(value = "accountingRuleId") final Long accountingRuleId, @Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
@@ -163,7 +171,10 @@ public class AccountingRuleApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createAccountingRule(final String jsonRequestBody) {
|
||||
@ApiOperation(value = "Create/Define a Accounting rule", notes = "Define a new Accounting rule.\n" + "\n" + "Mandatory Fields\n" + "name, officeId,\n" + "accountToDebit OR debitTags,\n" + "accountToCredit OR creditTags.\n" + "\n" + "Optional Fields\n" + "description")
|
||||
@ApiImplicitParams({@ApiImplicitParam(paramType = "body", value = "body", dataType = "body", dataTypeClass = AccountingRuleApiResourceSwagger.PostAccountingRulesRequest.class)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = AccountingRuleApiResourceSwagger.PostAccountingRulesResponse.class)})
|
||||
public String createAccountingRule(@ApiParam(hidden = true) final String jsonRequestBody) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createAccountingRule().withJson(jsonRequestBody).build();
|
||||
|
||||
@@ -176,7 +187,10 @@ public class AccountingRuleApiResource {
|
||||
@Path("{accountingRuleId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateAccountingRule(@PathParam("accountingRuleId") final Long accountingRuleId, final String jsonRequestBody) {
|
||||
@ApiOperation(value = "Update a Accounting Rule", notes = "Updates the details of a Accounting rule.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(paramType = "body", value = "body", dataType = "body", dataTypeClass = AccountingRuleApiResourceSwagger.PutAccountingRulesRequest.class)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = AccountingRuleApiResourceSwagger.PutAccountingRulesResponse.class)})
|
||||
public String updateAccountingRule(@PathParam("accountingRuleId") @ApiParam(value = "accountingRuleId") final Long accountingRuleId,@ApiParam(hidden = true) final String jsonRequestBody) {
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateAccountingRule(accountingRuleId).withJson(jsonRequestBody)
|
||||
.build();
|
||||
|
||||
@@ -189,7 +203,9 @@ public class AccountingRuleApiResource {
|
||||
@Path("{accountingRuleId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String deleteAccountingRule(@PathParam("accountingRuleId") final Long accountingRuleId) {
|
||||
@ApiOperation(value = "Delete a Accounting Rule", notes = "Deletes a Accounting rule.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = AccountingRuleApiResourceSwagger.DeleteAccountingRulesResponse.class)})
|
||||
public String deleteAccountingRule(@PathParam("accountingRuleId") @ApiParam(value = "accountingRuleId") final Long accountingRuleId) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteAccountingRule(accountingRuleId).build();
|
||||
|
||||
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.accounting.rule.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
import org.apache.fineract.accounting.rule.data.AccountingTagRuleData;
|
||||
import org.apache.fineract.organisation.office.data.OfficeData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 26/7/17.
|
||||
*/
|
||||
final class AccountingRuleApiResourceSwagger {
|
||||
private AccountingRuleApiResourceSwagger() {
|
||||
// For Swagger Documentation
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetAccountRulesResponse")
|
||||
public static final class GetAccountRulesResponse {
|
||||
private GetAccountRulesResponse() {
|
||||
|
||||
}
|
||||
|
||||
public Long id;
|
||||
public Long officeId;
|
||||
public String officeName;
|
||||
public String name;
|
||||
public String description;
|
||||
public boolean systemDefined;
|
||||
public boolean allowMultipleDebitEntries;
|
||||
public boolean allowMultipleCreditEntries;
|
||||
public List<AccountingTagRuleData> creditTags;
|
||||
public List<AccountingTagRuleData> debitTags;
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetAccountRulesTemplateResponse")
|
||||
public static final class GetAccountRulesTemplateResponse {
|
||||
private GetAccountRulesTemplateResponse() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "false")
|
||||
public boolean systemDefined;
|
||||
public List<OfficeData> allowedOffices = new ArrayList<OfficeData>();
|
||||
public List<GLAccountData> allowedAccounts = new ArrayList<GLAccountData>();
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostAccountingRulesRequest")
|
||||
public static final class PostAccountingRulesRequest {
|
||||
private PostAccountingRulesRequest() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "test")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "21")
|
||||
public Long accountToDebit;
|
||||
@ApiModelProperty(example = "9")
|
||||
public Long accountToCredit;
|
||||
@ApiModelProperty(example = "Employee salary")
|
||||
public String description;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostAccountingRulesResponse")
|
||||
public static final class PostAccountingRulesResponse {
|
||||
private PostAccountingRulesResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutAccountingRulesRequest")
|
||||
public static final class PutAccountingRulesRequest {
|
||||
private PutAccountingRulesRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "Employee Salary posting rule")
|
||||
public String name;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutAccountingRulesResponse")
|
||||
public static final class PutAccountingRulesResponse {
|
||||
private PutAccountingRulesResponse () {
|
||||
|
||||
}
|
||||
|
||||
public class PutAccountingRulesResponsechangesSwagger {
|
||||
public PutAccountingRulesResponsechangesSwagger(){}
|
||||
@ApiModelProperty(example = "Employee Salary posting rule")
|
||||
public String name;
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
public PutAccountingRulesResponsechangesSwagger changes;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteAccountingRulesResponse")
|
||||
public static final class DeleteAccountingRulesResponse {
|
||||
private DeleteAccountingRulesResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.batch.domain.BatchRequest;
|
||||
import org.apache.fineract.batch.domain.BatchResponse;
|
||||
import org.apache.fineract.batch.serialization.BatchRequestJsonHelper;
|
||||
@@ -59,6 +60,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/batches")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Batch API", description = "The Apache Fineract Batch API enables a consumer to access significant amounts of data in a single call or to make changes to several objects at once. Batching allows a consumer to pass instructions for several operations in a single HTTP request. A consumer can also specify dependencies between related operations. Once all operations have been completed, a consolidated response will be passed back and the HTTP connection will be closed.\n" + "\n" + "The Batch API takes in an array of logical HTTP requests represented as JSON arrays - each request has a requestId (the id of a request used to specify the sequence and as a dependency between requests), a method (corresponding to HTTP method GET/PUT/POST/DELETE etc.), a relativeUrl (the portion of the URL after https://example.org/api/v2/), optional headers array (corresponding to HTTP headers), optional reference parameter if a request is dependent on another request and an optional body (for POST and PUT requests). The Batch API returns an array of logical HTTP responses represented as JSON arrays - each response has a requestId, a status code, an optional headers array and an optional body (which is a JSON encoded string).\n" + "\n" + "Batch API uses Json Path to handle dependent parameters. For example, if request '2' is referencing request '1' and in the \"body\" or in \"relativeUrl\" of request '2', there is a dependent parameter (which will look like \"$.parameter_name\"), then Batch API will internally substitute this dependent parameter from the response body of request '1'.\n" + "\n" + "Batch API is able to handle deeply nested dependent requests as well nested parameters. As shown in the example, requests are dependent on each other as, 1<--2<--6, i.e a nested dependency, where request '6' is not directly dependent on request '1' but still it is one of the nested child of request '1'. In the same way Batch API could handle a deeply nested dependent value, such as {..[..{..,$.parameter_name,..}..]}.")
|
||||
public class BatchApiResource {
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -97,8 +99,11 @@ public class BatchApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String handleBatchRequests(@DefaultValue("false") @QueryParam("enclosingTransaction") final boolean enclosingTransaction,
|
||||
final String jsonRequestString, @Context UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Batch requests in a single transaction", httpMethod = "POST", notes = "The Apache Fineract Batch API is also capable of executing all the requests in a single transaction, by setting a Query Parameter, \"enclosingTransaction=true\". So, if one or more of the requests in a batch returns an erroneous response all of the Data base transactions made by other successful requests will be rolled back.\n" + "\n" + "If there has been a rollback in a transaction then a single response will be provided, with a '400' status code and a body consisting of the error details of the first failed request.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(paramType = "body", dataType = "BatchRequest", required = true, type = "body", dataTypeClass = BatchApiResourceSwagger.PostBatchesRequest.class, value = "request body")})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "Success", response = BatchResponse.class)})
|
||||
public String handleBatchRequests(@DefaultValue("false") @QueryParam("enclosingTransaction") @ApiParam(value = "enclosingTransaction", defaultValue = "false") final boolean enclosingTransaction,
|
||||
@ApiParam(hidden = true) final String jsonRequestString, @Context UriInfo uriInfo) {
|
||||
|
||||
// Handles user authentication
|
||||
this.context.authenticatedUser();
|
||||
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.batch.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.batch.domain.Header;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 26/7/17.
|
||||
*/
|
||||
final class BatchApiResourceSwagger {
|
||||
private BatchApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostBatchesRequest")
|
||||
public static final class PostBatchesRequest{
|
||||
private PostBatchesRequest() {
|
||||
|
||||
}
|
||||
|
||||
public static final class PostBodyRequestSwagger{
|
||||
private PostBodyRequestSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "\"Petra\"")
|
||||
public String firstname;
|
||||
@ApiModelProperty(example = "\"Yton\"")
|
||||
public String lastname;
|
||||
@ApiModelProperty(example = "\"ex_externalId1\"")
|
||||
public String externalId;
|
||||
@ApiModelProperty(example = "\"dd MMMM yyyy\"")
|
||||
public String dateFormat;
|
||||
@ApiModelProperty(example = "\"en\"")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "true")
|
||||
public boolean active;
|
||||
@ApiModelProperty(example = "\"04 March 2009\"")
|
||||
public String activationDate;
|
||||
@ApiModelProperty(example = "\"04 March 2009\"")
|
||||
public String submittedOnDate;
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long requestId;
|
||||
@ApiModelProperty(example = "clients")
|
||||
public String relativeUrl;
|
||||
@ApiModelProperty(example = "POST")
|
||||
public String method;
|
||||
public Set<Header> headers;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long reference;
|
||||
public PostBodyRequestSwagger body;
|
||||
}
|
||||
}
|
||||
+20
-12
@@ -33,6 +33,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.commands.data.AuditData;
|
||||
import org.apache.fineract.commands.data.AuditSearchData;
|
||||
@@ -51,6 +52,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/audits")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Audits",description = "Every non-read Mifos API request is audited. A fully processed request can not be changed or deleted. See maker checker api for situations where an audit is not fully processed.\n" + "\n" + "Permissions: To search and look at audit entries a user needs to be attached to a role that has one of the ALL_FUNCTIONS, ALL_FUNCTIONS_READ or READ_AUDIT permissions.\n" + "\n" + "Data Scope: A user can only see audits that are within their data scope. However, 'head office' users can see all audits including those that aren't office/branch related e.g. Loan Product changes.")
|
||||
public class AuditsApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "actionName", "entityName", "resourceId",
|
||||
@@ -79,17 +81,19 @@ public class AuditsApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveAuditEntries(@Context final UriInfo uriInfo, @QueryParam("actionName") final String actionName,
|
||||
@QueryParam("entityName") final String entityName, @QueryParam("resourceId") final Long resourceId,
|
||||
@QueryParam("makerId") final Long makerId, @QueryParam("makerDateTimeFrom") final String makerDateTimeFrom,
|
||||
@QueryParam("makerDateTimeTo") final String makerDateTimeTo, @QueryParam("checkerId") final Long checkerId,
|
||||
@QueryParam("checkerDateTimeFrom") final String checkerDateTimeFrom,
|
||||
@QueryParam("checkerDateTimeTo") final String checkerDateTimeTo,
|
||||
@QueryParam("processingResult") final Integer processingResult, @QueryParam("officeId") final Integer officeId,
|
||||
@QueryParam("groupId") final Integer groupId, @QueryParam("clientId") final Integer clientId,
|
||||
@QueryParam("loanid") final Integer loanId, @QueryParam("savingsAccountId") final Integer savingsAccountId,
|
||||
@QueryParam("paged") final Boolean paged, @QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit,
|
||||
@QueryParam("orderBy") final String orderBy, @QueryParam("sortOrder") final String sortOrder) {
|
||||
@ApiOperation(value = "List Audits", notes = "Get a 200 list of audits that match the criteria supplied and sorted by audit id in descending order, and are within the requestors' data scope. Also it supports pagination and sorting\n" + "\n" + "Example Requests:\n" + "\n" + "audits\n" + "\n" + "audits?fields=madeOnDate,maker,processingResult\n" + "\n" + "audits?makerDateTimeFrom=2013-03-25 08:00:00&makerDateTimeTo=2013-04-04 18:00:00\n" + "\n" + "audits?officeId=1\n" + "\n" + "audits?officeId=1&includeJson=true")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = MakercheckersApiResourceSwagger.GetMakerCheckerResponse.class, responseContainer = "list")})
|
||||
public String retrieveAuditEntries(@Context final UriInfo uriInfo, @QueryParam("actionName") @ApiParam(value = "actionName") final String actionName,
|
||||
@QueryParam("entityName") @ApiParam(value = "entityName") final String entityName, @QueryParam("resourceId") @ApiParam(value = "resourceId") final Long resourceId,
|
||||
@QueryParam("makerId") @ApiParam(value = "makerId") final Long makerId, @QueryParam("makerDateTimeFrom") @ApiParam(value = "makerDateTimeFrom") final String makerDateTimeFrom,
|
||||
@QueryParam("makerDateTimeTo") @ApiParam(value = "makerDateTimeTo") final String makerDateTimeTo, @QueryParam("checkerId") @ApiParam(value = "checkerId") final Long checkerId,
|
||||
@QueryParam("checkerDateTimeFrom") @ApiParam(value = "checkerDateTimeFrom") final String checkerDateTimeFrom,
|
||||
@QueryParam("checkerDateTimeTo") @ApiParam(value = "checkerDateTimeTo") final String checkerDateTimeTo,
|
||||
@QueryParam("processingResult") @ApiParam(value = "processingResult") final Integer processingResult, @QueryParam("officeId") @ApiParam(value = "officeId") final Integer officeId,
|
||||
@QueryParam("groupId") @ApiParam(value = "groupId") final Integer groupId, @QueryParam("clientId") @ApiParam(value = "clientId") final Integer clientId,
|
||||
@QueryParam("loanid") @ApiParam(value = "loanid") final Integer loanId, @QueryParam("savingsAccountId") @ApiParam(value = "savingsAccountId") final Integer savingsAccountId,
|
||||
@QueryParam("paged") @ApiParam(value = "paged") final Boolean paged, @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, @QueryParam("limit") @ApiParam(value = "limit") final Integer limit,
|
||||
@QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
final PaginationParameters parameters = PaginationParameters.instance(paged, offset, limit, orderBy, sortOrder);
|
||||
@@ -114,7 +118,9 @@ public class AuditsApiResource {
|
||||
@Path("{auditId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveAuditEntry(@PathParam("auditId") final Long auditId, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieve an Audit Entry", notes = "Example Requests:\n" + "\n" + "audits/20\n" + "audits/20?fields=madeOnDate,maker,processingResult")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = MakercheckersApiResourceSwagger.GetMakerCheckerResponse.class)})
|
||||
public String retrieveAuditEntry(@PathParam("auditId") @ApiParam(value = "auditId") final Long auditId, @Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
|
||||
@@ -128,6 +134,8 @@ public class AuditsApiResource {
|
||||
@Path("/searchtemplate")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Audit Search Template", notes = "This is a convenience resource. It can be useful when building an Audit Search UI. \"appUsers\" are data scoped to the office/branch the requestor is associated with.\n" + "\n" + "Example Requests:\n" + "\n" + "audits/searchtemplate\n" + "audits/searchtemplate?fields=actionNames")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = MakercheckersApiResourceSwagger.GetMakerCheckersSearchTemplateResponse.class)})
|
||||
public String retrieveAuditSearchTemplate(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
|
||||
+18
-8
@@ -35,6 +35,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.commands.data.AuditData;
|
||||
import org.apache.fineract.commands.data.AuditSearchData;
|
||||
@@ -53,6 +54,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/makercheckers")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Maker Checker (or 4-eye) functionality")
|
||||
public class MakercheckersApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "actionName", "entityName", "resourceId",
|
||||
@@ -80,12 +82,14 @@ public class MakercheckersApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveCommands(@Context final UriInfo uriInfo, @QueryParam("actionName") final String actionName,
|
||||
@QueryParam("entityName") final String entityName, @QueryParam("resourceId") final Long resourceId,
|
||||
@QueryParam("makerId") final Long makerId, @QueryParam("makerDateTimeFrom") final String makerDateTimeFrom,
|
||||
@QueryParam("makerDateTimeTo") final String makerDateTimeTo, @QueryParam("officeId") final Integer officeId,
|
||||
@QueryParam("groupId") final Integer groupId, @QueryParam("clientId") final Integer clientId,
|
||||
@QueryParam("loanid") final Integer loanId, @QueryParam("savingsAccountId") final Integer savingsAccountId) {
|
||||
@ApiOperation(value = "List Maker Checker Entries", notes = "Get a list of entries that can be checked by the requestor that match the criteria supplied.\n" + "\n" + "Example Requests:\n" + "\n" + "makercheckers\n" + "\n" + "makercheckers?fields=madeOnDate,maker,processingResult\n" + "\n" + "makercheckers?makerDateTimeFrom=2013-03-25 08:00:00&makerDateTimeTo=2013-04-04 18:00:00\n" + "\n" + "makercheckers?officeId=1\n" + "\n" + "makercheckers?officeId=1&includeJson=true")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = MakercheckersApiResourceSwagger.GetMakerCheckerResponse.class, responseContainer = "list")})
|
||||
public String retrieveCommands(@Context final UriInfo uriInfo, @QueryParam("actionName") @ApiParam(value = "actionName") final String actionName,
|
||||
@QueryParam("entityName") @ApiParam(value = "entityName") final String entityName, @QueryParam("resourceId") @ApiParam(value = "resourceId") final Long resourceId,
|
||||
@QueryParam("makerId") @ApiParam(value = "makerId") final Long makerId, @QueryParam("makerDateTimeFrom") @ApiParam(value = "makerDateTimeFrom") final String makerDateTimeFrom,
|
||||
@QueryParam("makerDateTimeTo") @ApiParam(value = "makerDateTimeTo") final String makerDateTimeTo, @QueryParam("officeId") @ApiParam(value = "officeId") final Integer officeId,
|
||||
@QueryParam("groupId") @ApiParam(value = "groupId") final Integer groupId, @QueryParam("clientId") @ApiParam(value = "clientId") final Integer clientId,
|
||||
@QueryParam("loanid") @ApiParam(value = "loanid") final Integer loanId, @QueryParam("savingsAccountId") @ApiParam(value = "savingsAccountId") final Integer savingsAccountId) {
|
||||
|
||||
final String extraCriteria = getExtraCriteria(actionName, entityName, resourceId, makerId, makerDateTimeFrom, makerDateTimeTo,
|
||||
officeId, groupId, clientId, loanId, savingsAccountId);
|
||||
@@ -102,6 +106,8 @@ public class MakercheckersApiResource {
|
||||
@Path("/searchtemplate")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Maker Checker Search Template", notes = "This is a convenience resource. It can be useful when building a Checker Inbox UI. \"appUsers\" are data scoped to the office/branch the requestor is associated with. \"actionNames\" and \"entityNames\" returned are those that the requestor has Checker approval permissions for.\n" + "\n" + "Example Requests:\n" + "\n" + "makercheckers/searchtemplate\n" + "makercheckers/searchtemplate?fields=entityNames")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = MakercheckersApiResourceSwagger.GetMakerCheckersSearchTemplateResponse.class)})
|
||||
public String retrieveAuditSearchTemplate(@Context final UriInfo uriInfo) {
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
@@ -118,7 +124,9 @@ public class MakercheckersApiResource {
|
||||
@Path("{auditId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String approveMakerCheckerEntry(@PathParam("auditId") final Long auditId, @QueryParam("command") final String commandParam) {
|
||||
@ApiOperation(value = "Approve Maker Checker Entry | Reject Maker Checker Entry")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = MakercheckersApiResourceSwagger.PostMakerCheckersResponse.class)})
|
||||
public String approveMakerCheckerEntry(@PathParam("auditId") @ApiParam(value = "auditId") final Long auditId, @QueryParam("command") @ApiParam(value = "command") final String commandParam) {
|
||||
|
||||
CommandProcessingResult result = null;
|
||||
if (is(commandParam, "approve")) {
|
||||
@@ -140,7 +148,9 @@ public class MakercheckersApiResource {
|
||||
@Path("{auditId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String deleteMakerCheckerEntry(@PathParam("auditId") final Long auditId) {
|
||||
@ApiOperation(value = "Delete Maker Checker Entry")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = MakercheckersApiResourceSwagger.PostMakerCheckersResponse.class)})
|
||||
public String deleteMakerCheckerEntry(@PathParam("auditId") @ApiParam(value = "auditId") final Long auditId) {
|
||||
|
||||
final Long id = this.writePlatformService.deleteEntry(auditId);
|
||||
|
||||
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.commands.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.commands.data.ProcessingResultLookup;
|
||||
import org.apache.fineract.useradministration.data.AppUserData;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 27/7/17.
|
||||
*/
|
||||
final class MakercheckersApiResourceSwagger {
|
||||
private MakercheckersApiResourceSwagger() {
|
||||
// only to initialize swagger documentation
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetMakerCheckerResponse")
|
||||
public static final class GetMakerCheckerResponse{
|
||||
private GetMakerCheckerResponse() {
|
||||
|
||||
}
|
||||
public Long id;
|
||||
public String actionName;
|
||||
public String entityName;
|
||||
public Long resourceId;
|
||||
public Long subresourceId;
|
||||
public String maker;
|
||||
public DateTime madeOnDate;
|
||||
public String checker;
|
||||
public DateTime checkedOnDate;
|
||||
public String processingResult;
|
||||
public String commandAsJson;
|
||||
public String officeName;
|
||||
public String groupLevelName;
|
||||
public String groupName;
|
||||
public String clientName;
|
||||
public String loanAccountNo;
|
||||
public String savingsAccountNo;
|
||||
public Long clientId;
|
||||
public Long loanId;
|
||||
public String url;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetMakerCheckersSearchTemplateResponse")
|
||||
public static final class GetMakerCheckersSearchTemplateResponse{
|
||||
private GetMakerCheckersSearchTemplateResponse() {
|
||||
|
||||
}
|
||||
public Collection<AppUserData> appUsers;
|
||||
public List<String> actionNames;
|
||||
public List<String> entityNames;
|
||||
public Collection<ProcessingResultLookup> processingResults;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostMakerCheckersResponse")
|
||||
public static final class PostMakerCheckersResponse{
|
||||
private PostMakerCheckersResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long auditId;
|
||||
|
||||
}
|
||||
}
|
||||
+20
-4
@@ -35,6 +35,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -54,6 +55,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path(AccountNumberFormatConstants.resourceRelativeURL)
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Account number format", description = "Account number preferences are used to describe custom formats for account numbers associated with Customer, Loan and Savings accounts." )
|
||||
public class AccountNumberFormatsApiResource {
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -83,6 +85,8 @@ public class AccountNumberFormatsApiResource {
|
||||
@Path("template")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve Account number format Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "\n" + "Example Request:\n" + "\n" + "accountnumberformats/template")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = AccountNumberFormatsApiResourceSwagger.GetAccountNumberFormatsResponseTemplate.class)})
|
||||
public String retrieveTemplate(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(AccountNumberFormatConstants.ENTITY_NAME);
|
||||
@@ -98,6 +102,8 @@ public class AccountNumberFormatsApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "List Account number formats", notes = "Example Requests:\n" + "\n" + "accountnumberformats\n" + "\n" + "\n" + "accountnumberformats?fields=accountType,prefixType", responseContainer = "List")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = AccountNumberFormatsApiResourceSwagger.GetAccountNumberFormatsIdResponse.class, responseContainer = "List")})
|
||||
public String retrieveAll(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(AccountNumberFormatConstants.ENTITY_NAME);
|
||||
@@ -114,7 +120,9 @@ public class AccountNumberFormatsApiResource {
|
||||
@Path("{accountNumberFormatId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveOne(@Context final UriInfo uriInfo, @PathParam("accountNumberFormatId") final Long accountNumberFormatId) {
|
||||
@ApiOperation(value = "Retrieve an Account number format", notes = "Example Requests:\n" + "\n" + "accountnumberformats/1\n" + "\n" + "\n" + "accountnumberformats/1?template=true\n" + "\n" + "\n" + "accountnumberformats/1?fields=accountType,prefixType")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = AccountNumberFormatsApiResourceSwagger.GetAccountNumberFormatsIdResponse.class)})
|
||||
public String retrieveOne(@Context final UriInfo uriInfo, @PathParam("accountNumberFormatId") @ApiParam(value = "accountNumberFormatId") final Long accountNumberFormatId) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(AccountNumberFormatConstants.ENTITY_NAME);
|
||||
|
||||
@@ -135,7 +143,10 @@ public class AccountNumberFormatsApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String create(final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create an Account number format", notes = "Note: You may associate a single Account number format for a given account type\n" + "Mandatory Fields for Account number formats\n" + "accountType")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", paramType = "body", dataType = "body", format = "body", dataTypeClass = AccountNumberFormatsApiResourceSwagger.PostAccountNumberFormatsRequest.class)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = AccountNumberFormatsApiResourceSwagger.PostAccountNumberFormatsResponse.class)})
|
||||
public String create(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.createAccountNumberFormat() //
|
||||
@@ -151,7 +162,10 @@ public class AccountNumberFormatsApiResource {
|
||||
@Path("{accountNumberFormatId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String update(@PathParam("accountNumberFormatId") final Long accountNumberFormatId, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Update an Account number format")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true,paramType = "body", dataType = "body", format = "body", dataTypeClass = AccountNumberFormatsApiResourceSwagger.PutAccountNumberFormatsRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = AccountNumberFormatsApiResourceSwagger.PutAccountNumberFormatsResponse.class)})
|
||||
public String update(@PathParam("accountNumberFormatId") @ApiParam(value = "accountNumberFormatId") final Long accountNumberFormatId, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.updateAccountNumberFormat(accountNumberFormatId) //
|
||||
@@ -167,7 +181,9 @@ public class AccountNumberFormatsApiResource {
|
||||
@Path("{accountNumberFormatId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String delete(@PathParam("accountNumberFormatId") final Long accountNumberFormatId) {
|
||||
@ApiOperation(value = "Delete an Account number format", notes = "Note: Account numbers created while this format was active would remain unchanged.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = AccountNumberFormatsApiResourceSwagger.DeleteAccountNumberFormatsResponse.class)})
|
||||
public String delete(@PathParam("accountNumberFormatId") @ApiParam(value = "accountNumberFormatId") final Long accountNumberFormatId) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.deleteAccountNumberFormat(accountNumberFormatId) //
|
||||
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.accountnumberformat.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 28/7/17.
|
||||
*/
|
||||
final class AccountNumberFormatsApiResourceSwagger {
|
||||
private AccountNumberFormatsApiResourceSwagger() {
|
||||
// this class is only for Swagger implementation for Live Documentation
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetAccountNumberFormatsResponse")
|
||||
public static final class GetAccountNumberFormatsResponse {
|
||||
private GetAccountNumberFormatsResponse() {
|
||||
|
||||
}
|
||||
// public List<GetAccountNumberFormatsIdResponse> _;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetAccountNumberFormatsIdResponse")
|
||||
public static final class GetAccountNumberFormatsIdResponse {
|
||||
private GetAccountNumberFormatsIdResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "2")
|
||||
public Long id;
|
||||
public EnumOptionData accountType;
|
||||
|
||||
public EnumOptionData prefixType;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetAccountNumberFormatsResponseTemplate")
|
||||
public static final class GetAccountNumberFormatsResponseTemplate {
|
||||
private GetAccountNumberFormatsResponseTemplate() {
|
||||
|
||||
}
|
||||
public List<EnumOptionData> accountTypeOptions;
|
||||
public Map<String, List<EnumOptionData>> prefixTypeOptions;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostAccountNumberFormatsRequest")
|
||||
public static final class PostAccountNumberFormatsRequest {
|
||||
private PostAccountNumberFormatsRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long accountType;
|
||||
@ApiModelProperty(example = "101")
|
||||
public Long prefixType;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostAccountNumberFormatsResponse")
|
||||
public static final class PostAccountNumberFormatsResponse {
|
||||
private PostAccountNumberFormatsResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "4")
|
||||
public Long resourceId;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutAccountNumberFormatsRequest")
|
||||
public static final class PutAccountNumberFormatsRequest {
|
||||
private PutAccountNumberFormatsRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long prefixType;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutAccountNumberFormatsResponse")
|
||||
public static final class PutAccountNumberFormatsResponse {
|
||||
private PutAccountNumberFormatsResponse() {
|
||||
|
||||
}
|
||||
public static final class PutAccountNumberFormatschangesSwagger {
|
||||
private PutAccountNumberFormatschangesSwagger() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "OFFICE_NAME")
|
||||
public Long prefixType;
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "2")
|
||||
public Long resourceId;
|
||||
public PutAccountNumberFormatschangesSwagger changes;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteAccountNumberFormatsResponse")
|
||||
public static final class DeleteAccountNumberFormatsResponse {
|
||||
private DeleteAccountNumberFormatsResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "2")
|
||||
public Long resourceId;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+8
-1
@@ -32,6 +32,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -52,6 +53,7 @@ import org.springframework.stereotype.Component;
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Cache", description = "The following settings are possible for cache:\n" + "\n" + "No Caching: caching turned off\n" + "Single node: caching on for single instance deployments of platorm (works for multiple tenants but only one tomcat)\n" + "By default caching is set to No Caching. Switching between caches results in the cache been clear e.g. from Single node to No cache and back again would clear down the single node cache.")
|
||||
public class CacheApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id"));
|
||||
@@ -76,6 +78,8 @@ public class CacheApiResource {
|
||||
}
|
||||
|
||||
@GET
|
||||
@ApiOperation(value = "Retrieve Cache Types", notes = "Returns the list of caches.\n" + "\n" + "Example Requests:\n" + "\n" + "caches")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CacheApiResourceSwagger.GetCachesResponse.class, responseContainer = "list")})
|
||||
public String retrieveAll(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
@@ -87,7 +91,10 @@ public class CacheApiResource {
|
||||
}
|
||||
|
||||
@PUT
|
||||
public String switchCache(final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Switch Cache", notes = "Switches the cache to chosen one.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CacheApiResourceSwagger.PutCachesRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CacheApiResourceSwagger.PutCachesResponse.class)})
|
||||
public String switchCache(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCache().withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.cache.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 28/7/17.
|
||||
*/
|
||||
final class CacheApiResourceSwagger {
|
||||
private CacheApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetCachesResponse")
|
||||
public static final class GetCachesResponse {
|
||||
private GetCachesResponse() {
|
||||
|
||||
}
|
||||
public EnumOptionData cacheType;
|
||||
public boolean enabled;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutCachesRequest")
|
||||
public static final class PutCachesRequest {
|
||||
private PutCachesRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "2")
|
||||
public Long cacheType;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutCachesResponse")
|
||||
public static final class PutCachesResponse {
|
||||
private PutCachesResponse() {
|
||||
|
||||
}
|
||||
public static final class PutCachechangesSwagger{
|
||||
private PutCachechangesSwagger() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "2")
|
||||
public Long cacheType;
|
||||
|
||||
}
|
||||
public PutCachechangesSwagger cacheType;
|
||||
|
||||
}
|
||||
}
|
||||
+21
-3
@@ -33,6 +33,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
@@ -61,6 +62,7 @@ import com.google.gson.JsonElement;
|
||||
@Path("/smscampaigns")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "SMS Campaigns")
|
||||
public class SmsCampaignApiResource {
|
||||
|
||||
private final PlatformSecurityContext platformSecurityContext;
|
||||
@@ -96,6 +98,8 @@ public class SmsCampaignApiResource {
|
||||
|
||||
@GET
|
||||
@Path("template")
|
||||
@ApiOperation(value = "Retrieve a SMS Campaign", notes = "Example Requests:\n" + "\n" + "smscampaigns/1\n" + "\n" + "\n" + "smscampaigns/1?template=true\n" + "\n" + "\n" + "smscampaigns/template")
|
||||
@ApiResponse(code = 200, message = "", response = SmsCampaignData.class)
|
||||
public String template(@Context final UriInfo uriInfo) {
|
||||
this.platformSecurityContext.authenticatedUser().validateHasReadPermission(SmsCampaignConstants.RESOURCE_NAME);
|
||||
final SmsCampaignData smsCampaignData = this.smsCampaignReadPlatformService.retrieveTemplate(CampaignType.SMS.name());
|
||||
@@ -106,7 +110,10 @@ public class SmsCampaignApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createCampaign(final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create a SMS Campaign", notes = "Mandatory Fields\n" + "campaignName, campaignType, triggerType, providerId, runReportId, message\n" + "\n" + "Mandatory Fields for Cash based on selected report id\n" + "paramValue in json format")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass =CommandWrapper.class)})
|
||||
@ApiResponse(code = 200, message = "", response = CommandProcessingResult.class)
|
||||
public String createCampaign(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
this.platformSecurityContext.authenticatedUser();
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createSmsCampaign().withJson(apiRequestBodyAsJson).build();
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
@@ -116,6 +123,8 @@ public class SmsCampaignApiResource {
|
||||
@GET
|
||||
@Path("{resourceId}")
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve a SMS Campaign", notes = "Example Requests:\n" + "\n" + "smscampaigns/1\n")
|
||||
@ApiResponse(code = 200, message = "", response = SmsCampaignData.class)
|
||||
public String retrieveCampaign(@PathParam("resourceId") final Long resourceId, @Context final UriInfo uriInfo) {
|
||||
this.platformSecurityContext.authenticatedUser().validateHasReadPermission(SmsCampaignConstants.RESOURCE_NAME);
|
||||
SmsCampaignData smsCampaignData = this.smsCampaignReadPlatformService.retrieveOne(resourceId);
|
||||
@@ -126,6 +135,8 @@ public class SmsCampaignApiResource {
|
||||
|
||||
@GET
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "List SMS Campaigns", notes = "Example Requests:\n" + "\n" + "smscampaigns")
|
||||
@ApiResponse(code = 200, message = "", response = SmsCampaignData.class)
|
||||
public String retrieveAllCampaigns(@QueryParam("sqlSearch") final String sqlSearch,
|
||||
@QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit,
|
||||
@QueryParam("orderBy") final String orderBy, @QueryParam("sortOrder") final String sortOrder, @Context final UriInfo uriInfo) {
|
||||
@@ -140,7 +151,10 @@ public class SmsCampaignApiResource {
|
||||
@Path("{campaignId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateCampaign(@PathParam("campaignId") final Long campaignId, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Update a Campaign")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CommandWrapper.class)})
|
||||
@ApiResponse(code = 200, message = "", response = CommandProcessingResult.class)
|
||||
public String updateCampaign(@PathParam("campaignId") final Long campaignId, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateSmsCampaign(campaignId).withJson(apiRequestBodyAsJson)
|
||||
.build();
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
@@ -151,8 +165,10 @@ public class SmsCampaignApiResource {
|
||||
@Path("{campaignId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "SMS Campaign", notes = "Activates | Deactivates | Reactivates")
|
||||
@ApiResponse(code = 200, message = "", response = CommandProcessingResult.class)
|
||||
public String handleCommands(@PathParam("campaignId") final Long campaignId, @QueryParam("command") final String commandParam,
|
||||
final String apiRequestBodyAsJson) {
|
||||
@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson);
|
||||
CommandProcessingResult result = null;
|
||||
CommandWrapper commandRequest = null;
|
||||
@@ -187,6 +203,8 @@ public class SmsCampaignApiResource {
|
||||
|
||||
@DELETE
|
||||
@Path("{campaignId}")
|
||||
@ApiOperation(value = "Delete a SMS Campaign", notes = "Note: Only closed SMS Campaigns can be deleted")
|
||||
@ApiResponse(code = 200, message = "", response = CommandProcessingResult.class)
|
||||
public String delete(@PathParam("campaignId") final Long campaignId) {
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteSmsCampaign(campaignId).build();
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
|
||||
+20
-6
@@ -35,6 +35,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -54,6 +55,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/codes/{codeId}/codevalues")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Code Values", description = "Code and code values: Codes represent a specific category of data, their code values are a specific instance of that category.\n" + "\n" + "Codes are mostly system defined which means the code itself comes out of the box and cannot be modified however its code values can be. e.g. 'Customer Identifier', it defaults to a code value of 'Passport' but could be 'Drivers License, National Id' etc")
|
||||
public class CodeValuesApiResource {
|
||||
|
||||
/**
|
||||
@@ -86,7 +88,9 @@ public class CodeValuesApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveAllCodeValues(@Context final UriInfo uriInfo, @PathParam("codeId") final Long codeId) {
|
||||
@ApiOperation(value = "List Code Values", notes = "Returns the list of Code Values for a given Code\n" + "\n" + "Example Requests:\n" + "\n" + "codes/1/codevalues")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "A List of Given response", response = CodeValuesApiResourceSwagger.GetCodeValuesDataResponse.class, responseContainer = "list")})
|
||||
public String retrieveAllCodeValues(@Context final UriInfo uriInfo, @PathParam("codeId") @ApiParam(value = "codeId") final Long codeId) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
|
||||
@@ -100,7 +104,9 @@ public class CodeValuesApiResource {
|
||||
@Path("{codeValueId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveCodeValue(@Context final UriInfo uriInfo, @PathParam("codeValueId") final Long codeValueId) {
|
||||
@ApiOperation(value = "Retrieve a Code Value", notes = "Returns the details of a Code Value\n" + "\n" + "Example Requests:\n" + "\n" + "codes/1/codevalues/1")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CodeValuesApiResourceSwagger.GetCodeValuesDataResponse.class)})
|
||||
public String retrieveCodeValue(@Context final UriInfo uriInfo, @PathParam("codeValueId") @ApiParam(value = "codeValueId") final Long codeValueId) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
|
||||
@@ -113,7 +119,10 @@ public class CodeValuesApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createCodeValue(@PathParam("codeId") final Long codeId, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create a Code Value", notes = "")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CodeValuesApiResourceSwagger.PostCodeValuesDataRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CodeValuesApiResourceSwagger.PostCodeValueDataResponse.class)})
|
||||
public String createCodeValue(@PathParam("codeId") @ApiParam(value = "codeId") final Long codeId, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createCodeValue(codeId).withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
@@ -127,8 +136,11 @@ public class CodeValuesApiResource {
|
||||
@Path("{codeValueId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateCodeValue(@PathParam("codeId") final Long codeId, @PathParam("codeValueId") final Long codeValueId,
|
||||
final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Update a Code Value", notes = "Updates the details of a code value.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CodeValuesApiResourceSwagger.PutCodeValuesDataRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CodeValuesApiResourceSwagger.PutCodeValueDataResponse.class)})
|
||||
public String updateCodeValue(@PathParam("codeId") @ApiParam(value = "codeId") final Long codeId, @PathParam("codeValueId") @ApiParam(value = "codeValueId") final Long codeValueId,
|
||||
@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCodeValue(codeId, codeValueId)
|
||||
.withJson(apiRequestBodyAsJson).build();
|
||||
@@ -142,7 +154,9 @@ public class CodeValuesApiResource {
|
||||
@Path("{codeValueId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String deleteCodeValue(@PathParam("codeId") final Long codeId, @PathParam("codeValueId") final Long codeValueId) {
|
||||
@ApiOperation(value = "Delete a Code Value", notes = "Deletes a code value")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CodeValuesApiResourceSwagger.DeleteCodeValueDataResponse.class)})
|
||||
public String deleteCodeValue(@PathParam("codeId") @ApiParam(value = "codeId") final Long codeId, @PathParam("codeValueId") @ApiParam(value = "codeValueId") final Long codeValueId) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteCodeValue(codeId, codeValueId).build();
|
||||
|
||||
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.codes.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 30/7/17.
|
||||
*/
|
||||
final class CodeValuesApiResourceSwagger {
|
||||
private CodeValuesApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetCodeValuesDataResponse")
|
||||
public static final class GetCodeValuesDataResponse {
|
||||
private GetCodeValuesDataResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long id;
|
||||
@ApiModelProperty(example = "Passport")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "Passport information")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "0")
|
||||
public Integer position;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostCodeValuesDataRequest")
|
||||
public static final class PostCodeValuesDataRequest {
|
||||
private PostCodeValuesDataRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "Passport")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "Passport information")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "0")
|
||||
public Integer position;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostCodeValueDataResponse")
|
||||
public static final class PostCodeValueDataResponse {
|
||||
private PostCodeValueDataResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "4")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutCodeValuesDataRequest")
|
||||
public static final class PutCodeValuesDataRequest {
|
||||
private PutCodeValuesDataRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "Passport")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "Passport information")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "0")
|
||||
public Integer position;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutCodeValueDataResponse")
|
||||
public static final class PutCodeValueDataResponse {
|
||||
private PutCodeValueDataResponse() {
|
||||
|
||||
}
|
||||
private final class PutCodeValuechangesSwagger{
|
||||
private PutCodeValuechangesSwagger() {}
|
||||
@ApiModelProperty(example = "Passport")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "Passport information")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "0")
|
||||
public Integer position;
|
||||
}
|
||||
@ApiModelProperty(example = "4")
|
||||
public Long resourceId;
|
||||
public PutCodeValuechangesSwagger changes;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteCodeValueDataResponse")
|
||||
public static final class DeleteCodeValueDataResponse {
|
||||
private DeleteCodeValueDataResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "4")
|
||||
public Long resourceId;
|
||||
}
|
||||
}
|
||||
+18
-4
@@ -35,6 +35,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -52,6 +53,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/codes")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Codes", description = "Code and code values: Codes represent a specific category of data, their code values are a specific instance of that category.\n" + "\n" + "Codes are mostly system defined which means the code itself comes out of the box and cannot be modified however its code values can be. e.g. 'Customer Identifier', it defaults to a code value of 'Passport' but could be 'Drivers License, National Id' etc")
|
||||
public class CodesApiResource {
|
||||
|
||||
/**
|
||||
@@ -80,6 +82,8 @@ public class CodesApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve Codes", notes = "Returns the list of codes.\n" + "\n" + "Example Requests:\n" + "\n" + "codes")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CodesApiResourceSwagger.GetCodesResponse.class, responseContainer = "list")})
|
||||
public String retrieveCodes(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
@@ -93,7 +97,10 @@ public class CodesApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createCode(final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create a Code", notes = "Creates a code. Codes created through api are always 'user defined' and so system defined is marked as false.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CodesApiResourceSwagger.PostCodesRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CodesApiResourceSwagger.PostCodesResponse.class)})
|
||||
public String createCode(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createCode().withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
@@ -106,7 +113,9 @@ public class CodesApiResource {
|
||||
@Path("{codeId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveCode(@PathParam("codeId") final Long codeId, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieve a Code", notes = "Returns the details of a Code.\n" + "\n" + "Example Requests:\n" + "\n" + "codes/1")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CodesApiResourceSwagger.GetCodesResponse.class)})
|
||||
public String retrieveCode(@PathParam("codeId") @ApiParam(value = "codeId") final Long codeId, @Context final UriInfo uriInfo) {
|
||||
|
||||
final CodeData code = this.readPlatformService.retrieveCode(codeId);
|
||||
|
||||
@@ -118,7 +127,10 @@ public class CodesApiResource {
|
||||
@Path("{codeId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateCode(@PathParam("codeId") final Long codeId, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Update a Code", notes = "Updates the details of a code if it is not system defined.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CodesApiResourceSwagger.PutCodesRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CodesApiResourceSwagger.PutCodesResponse.class)})
|
||||
public String updateCode(@PathParam("codeId") @ApiParam(value = "codeId") final Long codeId, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCode(codeId).withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
@@ -131,7 +143,9 @@ public class CodesApiResource {
|
||||
@Path("{codeId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String deleteCode(@PathParam("codeId") final Long codeId) {
|
||||
@ApiOperation(value = "Delete a Code", notes = "Deletes a code if it is not system defined.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CodesApiResourceSwagger.DeleteCodesResponse.class)})
|
||||
public String deleteCode(@PathParam("codeId") @ApiParam(value = "codeId") final Long codeId) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteCode(codeId).build();
|
||||
|
||||
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.codes.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 29/7/17.
|
||||
*/
|
||||
final class CodesApiResourceSwagger {
|
||||
private CodesApiResourceSwagger() {
|
||||
// this class is only for Swagger Live Documentation
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetCodesResponse")
|
||||
public static final class GetCodesResponse {
|
||||
private GetCodesResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long id;
|
||||
@ApiModelProperty(example = "Education")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "true")
|
||||
public boolean systemDefined;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostCodesRequest")
|
||||
public static final class PostCodesRequest {
|
||||
private PostCodesRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "MyNewCode")
|
||||
public String name;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostCodesResponse")
|
||||
public static final class PostCodesResponse {
|
||||
private PostCodesResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "4")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutCodesRequest")
|
||||
public static final class PutCodesRequest {
|
||||
private PutCodesRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "MyNewCode(changed)")
|
||||
public String name;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutCodesResponse")
|
||||
public static final class PutCodesResponse {
|
||||
private PutCodesResponse() {
|
||||
|
||||
}
|
||||
private final class PutCodesApichangesSwagger{
|
||||
private PutCodesApichangesSwagger() {}
|
||||
@ApiModelProperty(example = "MyNewCode(changed)")
|
||||
public String name;
|
||||
}
|
||||
@ApiModelProperty(example = "4")
|
||||
public Long resourceId;
|
||||
public PutCodesApichangesSwagger changes;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteCodesResponse")
|
||||
public static final class DeleteCodesResponse {
|
||||
private DeleteCodesResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "4")
|
||||
public Long resourceId;
|
||||
}
|
||||
}
|
||||
+10
-2
@@ -30,6 +30,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -47,6 +48,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/externalservice")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "External Services", description = "External Services Configuration related to set of supported configurations for third party services like Amazon S3 and SMTP:\n" + "\n" + "S3 (Amazon S3):\n" + "s3_access_key -\n" + "s3_bucket_name -\n" + "s3_secret_key -\n" + "\n" + "\n" + "SMTP (Email Service):\n" + "username -\n" + "password -\n" + "host -\n" + "port -\n" + "useTLS -")
|
||||
public class ExternalServicesConfigurationApiResource {
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -75,7 +77,9 @@ public class ExternalServicesConfigurationApiResource {
|
||||
@Path("{servicename}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveOne(@PathParam("servicename") final String serviceName, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieve External Services Configuration", notes = "Returns a external Service configurations based on the Service Name.\n" + "\n" + "Service Names supported are S3 and SMTP.\n" + "\n" + "Example Requests:\n" + "\n" + "externalservice/SMTP")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ExternalServicesPropertiesData.class)})
|
||||
public String retrieveOne(@PathParam("servicename") @ApiParam(value = "servicename") final String serviceName, @Context final UriInfo uriInfo) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(ExternalServiceConfigurationApiConstant.EXTERNAL_SERVICE_RESOURCE_NAME);
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
final Collection<ExternalServicesPropertiesData> externalServiceNVPs = this.externalServicePropertiesReadPlatformService
|
||||
@@ -88,7 +92,11 @@ public class ExternalServicesConfigurationApiResource {
|
||||
@Path("{servicename}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateExternalServiceProperties(@PathParam("servicename") final String serviceName, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Update External Service", notes = "Updates the external Service Configuration for a Service Name.\n" + "\n" + "Example: \n" + "\n" + "externalservice/S3")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ExternalServicesConfigurationApiResourceSwagger.PutExternalServiceRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "")})
|
||||
public String updateExternalServiceProperties(@PathParam("servicename") @ApiParam(value = "servicename") final String serviceName,
|
||||
@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
// ExternalServicesData external =
|
||||
// this.externalServiceReadPlatformService.getExternalServiceDetailsByServiceName(serviceName);
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateExternalServiceProperties(serviceName)
|
||||
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.configuration.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 30/7/17.
|
||||
*/
|
||||
final class ExternalServicesConfigurationApiResourceSwagger {
|
||||
private ExternalServicesConfigurationApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutExternalServiceRequest")
|
||||
public static final class PutExternalServiceRequest{
|
||||
private PutExternalServiceRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "test@mifos.org")
|
||||
public String username;
|
||||
@ApiModelProperty(example = "XXXX")
|
||||
public String password;
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -27,6 +27,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -45,6 +46,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/configurations")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Global Configuration", description = "Global configuration related to set of supported enable/disable configurations:\n" + "\n" + "maker-checker - defaults to false - if true turns on maker-checker functionality\n" + "reschedule-future-repayments - defaults to false - if true reschedules repayemnts which falls on a non-working day to configured repayment rescheduling rule\n" + "allow-transactions-on-non_workingday - defaults to false - if true allows transactions on non-working days\n" + "reschedule-repayments-on-holidays - defaults to false - if true reschedules repayemnts which falls on a non-working day to defined reschedule date\n" + "allow-transactions-on-holiday - defaults to false - if true allows transactions on holidays\n" + "savings-interest-posting-current-period-end - Set it at the database level before any savings interest is posted. When set as false(default), interest will be posted on the first date of next period. If set as true, interest will be posted on last date of current period. There is no difference in the interest amount posted.\n" + "financial-year-beginning-month - Set it at the database level before any savings interest is posted. Allowed values 1 - 12 (January - December). Interest posting periods are evaluated based on this configuration.\n" + "meetings-mandatory-for-jlg-loans - if set to true, enforces all JLG loans to follow a meeting schedule belonging to either the parent group or Center.")
|
||||
public class GlobalConfigurationApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("globalConfiguration"));
|
||||
@@ -76,7 +78,9 @@ public class GlobalConfigurationApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveConfiguration(@Context final UriInfo uriInfo,@DefaultValue("false") @QueryParam("survey") final boolean survey) {
|
||||
@ApiOperation(value = "Retrieve Global Configuration | Retrieve Global Configuration for surveys", notes = "Returns the list global enable/disable configurations.\n" + "\n" + "Example Requests:\n" + "\n" + "configurations\n\n" + "\n" + "Returns the list global enable/disable survey configurations.\n" + "\n" + "Example Requests:\n" + "\n" + "configurations/survey")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "List of example \n response \nsurveys response \ngiven below", response = GlobalConfigurationApiResourceSwagger.GetGlobalConfigurationsResponse.class, responseContainer = "list")})
|
||||
public String retrieveConfiguration(@Context final UriInfo uriInfo,@DefaultValue("false") @QueryParam("survey") @ApiParam(value = "survey") final boolean survey) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
|
||||
@@ -90,7 +94,9 @@ public class GlobalConfigurationApiResource {
|
||||
@Path("{configId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveOne(@PathParam("configId") final Long configId, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieve Global Configuration", notes = "Returns a global enable/disable configurations.\n" + "\n" + "Example Requests:\n" + "\n" + "configurations/1")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = GlobalConfigurationApiResourceSwagger.GetGlobalConfigurationsResponse.class)})
|
||||
public String retrieveOne(@PathParam("configId") @ApiParam(value = "configId") final Long configId, @Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
|
||||
@@ -105,7 +111,10 @@ public class GlobalConfigurationApiResource {
|
||||
@Path("{configId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateConfiguration(@PathParam("configId") final Long configId, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Update Global Configuration", notes = "Updates an enable/disable global configuration item.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = GlobalConfigurationApiResourceSwagger.PutGlobalConfigurationsRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = GlobalConfigurationApiResourceSwagger.PutGlobalConfigurationsResponse.class)})
|
||||
public String updateConfiguration(@PathParam("configId") @ApiParam(value = "configId") final Long configId, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.updateGlobalConfiguration(configId) //
|
||||
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.configuration.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.infrastructure.configuration.data.GlobalConfigurationPropertyData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 30/7/17.
|
||||
*/
|
||||
final class GlobalConfigurationApiResourceSwagger {
|
||||
private GlobalConfigurationApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetGlobalConfigurationsResponse")
|
||||
public static final class GetGlobalConfigurationsResponse {
|
||||
private GetGlobalConfigurationsResponse(){}
|
||||
public List<GlobalConfigurationPropertyData> globalConfiguration;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutGlobalConfigurationsRequest")
|
||||
public static final class PutGlobalConfigurationsRequest {
|
||||
private PutGlobalConfigurationsRequest(){}
|
||||
@ApiModelProperty(example = "true")
|
||||
public boolean enabled;
|
||||
@ApiModelProperty(example = "2")
|
||||
public Long value;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutGlobalConfigurationsResponse")
|
||||
public static final class PutGlobalConfigurationsResponse {
|
||||
private PutGlobalConfigurationsResponse(){}
|
||||
final class PutGlobalConfigurationsResponsechangesSwagger{
|
||||
private PutGlobalConfigurationsResponsechangesSwagger() {}
|
||||
@ApiModelProperty(example = "true")
|
||||
public boolean enabled;
|
||||
}
|
||||
@ApiModelProperty(example = "4")
|
||||
public Long resourceId;
|
||||
public PutGlobalConfigurationsResponsechangesSwagger changes;
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -35,6 +35,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -58,6 +59,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/CreditBureauConfiguration")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "CreditBureau Configuration")
|
||||
public class CreditBureauConfigurationAPI {
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList("creditBureauId", "alias", "country", "creditBureauProductId", "startDate", "endDate", "isActive"));
|
||||
|
||||
+58
-20
@@ -33,6 +33,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -55,6 +56,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/datatables")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Data Tables", description = "The datatables API allows you to plug-in your own tables (MySql) that have a relationship to a Apache Fineract core table. For example, you might want to add some extra client fields and record information about each of the clients' family members. Via the API you can create, read, update and delete entries for each 'plugged-in' table. The API checks for permission and for 'data scoping' (only data within the users' office hierarchy can be managed by the user).\n" + "\n" + "The Apache Fineract Reference App uses a JQuery plug-in called stretchydatatables (which in turn uses this datatables resource) to provide a pretty flexible CRUD (Create, Read, Update, Delete) User Interface.")
|
||||
public class DatatablesApiResource {
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -79,7 +81,10 @@ public class DatatablesApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String getDatatables(@QueryParam("apptable") final String apptable, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "List Data Tables", notes = "Lists registered data tables and the Apache Fineract Core application table they are registered to.\n" + "\n" + "ARGUMENTS\n" + "\n" + "apptable - optional" + "\n"+ "The Apache Fineract core application table.\n" + "\n" + "Example Requests:\n" + "\n" + "datatables?apptable=m_client\n" + "\n" + "\n" + "datatables",
|
||||
responseContainer = "List", response = DatatablesApiResourceSwagger.GetDataTablesResponse.class)
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.GetDataTablesResponse.class, responseContainer = "list")})
|
||||
public String getDatatables(@QueryParam("apptable") @ApiParam(value = "apptable") final String apptable, @Context final UriInfo uriInfo) {
|
||||
|
||||
final List<DatatableData> result = this.readWriteNonCoreDataService.retrieveDatatableNames(apptable);
|
||||
|
||||
@@ -90,7 +95,13 @@ public class DatatablesApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createDatatable(final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create Data Table", notes = "Create a new data table and registers it with the Apache Fineract Core application table.\n" + "\n" + "Field Descriptions\n" + "\n" + "Mandatory - datatableName : \n"+ "\nThe name of the Data Table.\n" + "\n" + "Mandatory - apptableName\n" + "\n" + "Application table name. Must be one of the following:\n" + "\n" + "m_client\n" + "\n" + "m_group" +"\n" + "\n" + "m_loan" + "\n" + "\n" + "m_office" + "\n" + "\n" + "m_saving_account" + "\n" + "\n" + "m_product_loan" + "\n" + "\n" + "m_savings_product" + "\n" + "\n" + "Mandatory - columns " + "\n" + "An array of columns in the new Data Table." + "\n" + "\n" + "Optional - multiRow" + "\n" +
|
||||
"\n" + "Allows to create multiple entries in the Data Table. Optional, defaults to false. If this property is not provided Data Table will allow only one entry." + "\n" + "\n" + "Field Descriptions - columns" + "\n" + "\n" + "Mandatory - name" + "\n" + "\n" + "Name of the created column. Can contain only alphanumeric characters, underscores and spaces, but cannot start with a number. Cannot start or end with an underscore or space." + "\n" + "\n" + "Mandatory - type" + "\n" + "\n" + "Column type. Must be one of the following:" + "\n" + "\n" + "Boolean" + "\n" + "\n" + "Date" + "\n" + "\n" + "DateTime" + "\n" + "\n" + "Decimal" + "\n" + "\n" + "Dropdown" + "\n" +
|
||||
"\n" + "\n" + "Number" + "\n" + "\n" + "String" + "\n" + "\n" + "Text" + "\n" + "\n" + "Mandatory [type = Dropdown] - code" + "\n" + "\n" + "Used in Code Value fields. Column name becomes: code_cd_name. Mandatory if using type Dropdown, otherwise an error is returned." + "\n" + "\n" + "Optional - mandatory" + "\n" + "\n" +
|
||||
"Determines whether this column must have a value in every entry. Optional, defaults to false." + "\n" + "\n" + "Mandatory [type = String] - length" + "\n" + "\n" + "Length of the text field. Mandatory if type String is used, otherwise an error is returned.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = DatatablesApiResourceSwagger.PostDataTablesRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.PostDataTablesResponse.class)})
|
||||
public String createDatatable(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createDBDatatable(apiRequestBodyAsJson).build();
|
||||
|
||||
@@ -102,7 +113,10 @@ public class DatatablesApiResource {
|
||||
@Path("{datatableName}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateDatatable(@PathParam("datatableName") final String datatableName, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Update Data Table", notes = "Modifies fields of a data table. If the apptableName parameter is passed, data table is deregistered and registered with the new application table.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = DatatablesApiResourceSwagger.PutDataTablesRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.PutDataTablesResponse.class)})
|
||||
public String updateDatatable(@PathParam("datatableName") @ApiParam(value = "datatableName") final String datatableName, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateDBDatatable(datatableName, apiRequestBodyAsJson).build();
|
||||
|
||||
@@ -114,7 +128,9 @@ public class DatatablesApiResource {
|
||||
@Path("{datatableName}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String deleteDatatable(@PathParam("datatableName") final String datatableName, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Delete Data Table", notes = "Deletes a data table and deregisters it from the Apache Fineract Core application table.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.DeleteDataTablesResponse.class)})
|
||||
public String deleteDatatable(@PathParam("datatableName") @ApiParam(value = "datatableName") final String datatableName, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteDBDatatable(datatableName, apiRequestBodyAsJson).build();
|
||||
|
||||
@@ -126,8 +142,11 @@ public class DatatablesApiResource {
|
||||
@Path("register/{datatable}/{apptable}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String registerDatatable(@PathParam("datatable") final String datatable, @PathParam("apptable") final String apptable,
|
||||
final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Register Data Table", notes = "Registers a data table with the Apache Fineract Core application table. This allows the data table to be maintained through the API. In case the datatable is a PPI (survey table), a parameter category should be pass along with the request. The API currently support one category (200)")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", paramType = "body", dataType = "body", format = "body", dataTypeClass = DatatablesApiResourceSwagger.PostDataTablesRegisterDatatableAppTable.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.PutDataTablesResponse.class)})
|
||||
public String registerDatatable(@PathParam("datatable") @ApiParam(value = "datatable") final String datatable, @PathParam("apptable") @ApiParam(value = "apptable") final String apptable,
|
||||
@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().registerDBDatatable(datatable, apptable)
|
||||
.withJson(apiRequestBodyAsJson).build();
|
||||
@@ -141,7 +160,9 @@ public class DatatablesApiResource {
|
||||
@Path("deregister/{datatable}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String deregisterDatatable(@PathParam("datatable") final String datatable) {
|
||||
@ApiOperation(value = "Deregister Data Table", notes = "Deregisters a data table. It will no longer be available through the API.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.PutDataTablesResponse.class)})
|
||||
public String deregisterDatatable(@PathParam("datatable") @ApiParam(value = "datatable") final String datatable) {
|
||||
|
||||
this.readWriteNonCoreDataService.deregisterDatatable(datatable);
|
||||
|
||||
@@ -154,7 +175,9 @@ public class DatatablesApiResource {
|
||||
@Path("{datatable}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String getDatatable(@PathParam("datatable") final String datatable, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieve Data Table Details", notes = "Lists a registered data table details and the Apache Fineract Core application table they are registered to.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.GetDataTablesResponse.class)})
|
||||
public String getDatatable(@PathParam("datatable") @ApiParam(value = "datatable") final String datatable, @Context final UriInfo uriInfo) {
|
||||
|
||||
final DatatableData result = this.readWriteNonCoreDataService.retrieveDatatable(datatable);
|
||||
|
||||
@@ -166,8 +189,10 @@ public class DatatablesApiResource {
|
||||
@Path("{datatable}/{apptableId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String getDatatable(@PathParam("datatable") final String datatable, @PathParam("apptableId") final Long apptableId,
|
||||
@QueryParam("order") final String order, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieve Entry(s) from Data Table", notes = "Gets the entry (if it exists) for data tables that are one to one with the application table. \n" + "Gets the entries (if they exist) for data tables that are one to many with the application table.\n" + "\n" + "Note: The 'fields' parameter is not available for datatables.\n" + "\n" + "ARGUMENTS\n" + "orderoptional Specifies the order in which data is returned.genericResultSetoptional, defaults to false If 'true' an optimised JSON format is returned suitable for tabular display of data. This format is used by the default data tables UI functionality.\n" + "Example Requests:\n" + "\n" + "datatables/extra_client_details/1\n" + "\n" + "\n" + "datatables/extra_family_details/1?order=`Date of Birth` desc\n" + "\n" + "\n" + "datatables/extra_client_details/1?genericResultSet=true")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.GetDataTablesAppTableIdResponse.class)})
|
||||
public String getDatatable(@PathParam("datatable") @ApiParam(value = "datatable") final String datatable, @PathParam("apptableId") @ApiParam(value = "apptableId") final Long apptableId,
|
||||
@QueryParam("order") @ApiParam(value = "order") final String order, @Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasDatatableReadPermission(datatable);
|
||||
|
||||
@@ -216,8 +241,11 @@ public class DatatablesApiResource {
|
||||
@Path("{datatable}/{apptableId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createDatatableEntry(@PathParam("datatable") final String datatable, @PathParam("apptableId") final Long apptableId,
|
||||
final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create Entry in Data Table", notes = "Adds a row to the data table.\n" + "\n" + "Note that the default datatable UI functionality converts any field name containing spaces to underscores when using the API. This means the field name \"Business Description\" is considered the same as \"Business_Description\". So you shouldn't have both \"versions\" in any data table.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = DatatablesApiResourceSwagger.PostDataTablesAppTableIdRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.PostDataTablesAppTableIdResponse.class)})
|
||||
public String createDatatableEntry(@PathParam("datatable") @ApiParam(value = "datatable") final String datatable, @PathParam("apptableId") @ApiParam(value = "apptableId") final Long apptableId,
|
||||
@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.createDatatable(datatable, apptableId, null) //
|
||||
@@ -233,8 +261,11 @@ public class DatatablesApiResource {
|
||||
@Path("{datatable}/{apptableId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateDatatableEntryOnetoOne(@PathParam("datatable") final String datatable,
|
||||
@PathParam("apptableId") final Long apptableId, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Update Entry in Data Table (One to One)", notes = "Updates the row (if it exists) of the data table.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = DatatablesApiResourceSwagger.PutDataTablesAppTableIdRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.PutDataTablesAppTableIdResponse.class)})
|
||||
public String updateDatatableEntryOnetoOne(@PathParam("datatable") @ApiParam(value = "datatable") final String datatable,
|
||||
@PathParam("apptableId") @ApiParam(value = "apptableId") final Long apptableId, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.updateDatatable(datatable, apptableId, null) //
|
||||
@@ -250,9 +281,12 @@ public class DatatablesApiResource {
|
||||
@Path("{datatable}/{apptableId}/{datatableId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateDatatableEntryOneToMany(@PathParam("datatable") final String datatable,
|
||||
@PathParam("apptableId") final Long apptableId, @PathParam("datatableId") final Long datatableId,
|
||||
final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Update Entry in Data Table (One to Many)", notes = "Updates the row (if it exists) of the data table.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = DatatablesApiResourceSwagger.PutDataTablesAppTableIdDatatableIdRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.PutDataTablesAppTableIdDatatableIdResponse.class)})
|
||||
public String updateDatatableEntryOneToMany(@PathParam("datatable") @ApiParam(value = "datatable") final String datatable,
|
||||
@PathParam("apptableId") @ApiParam(value = "apptableId") final Long apptableId, @PathParam("datatableId") @ApiParam(value = "datatableId") final Long datatableId,
|
||||
@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.updateDatatable(datatable, apptableId, datatableId) //
|
||||
@@ -268,7 +302,9 @@ public class DatatablesApiResource {
|
||||
@Path("{datatable}/{apptableId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String deleteDatatableEntries(@PathParam("datatable") final String datatable, @PathParam("apptableId") final Long apptableId) {
|
||||
@ApiOperation(value = "Delete Entry(s) in Data Table", notes = "Deletes the entry (if it exists) for data tables that are one-to-one with the application table. \n" + "Deletes the entries (if they exist) for data tables that are one-to-many with the application table.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.DeleteDataTablesDatatableAppTableIdResponse.class)})
|
||||
public String deleteDatatableEntries(@PathParam("datatable") @ApiParam(value = "datatable") final String datatable, @PathParam("apptableId") @ApiParam(value = "apptableId") final Long apptableId) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.deleteDatatable(datatable, apptableId, null) //
|
||||
@@ -283,8 +319,10 @@ public class DatatablesApiResource {
|
||||
@Path("{datatable}/{apptableId}/{datatableId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String deleteDatatableEntries(@PathParam("datatable") final String datatable, @PathParam("apptableId") final Long apptableId,
|
||||
@PathParam("datatableId") final Long datatableId) {
|
||||
@ApiOperation(value = "Delete Entry in Datatable (One to Many)", notes = "Deletes the entry (if it exists) for data tables that are one to many with the application table.\n" + "\n")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = DatatablesApiResourceSwagger.DeleteDataTablesDatatableAppTableIdDatatableIdResponse.class)})
|
||||
public String deleteDatatableEntries(@PathParam("datatable") @ApiParam(value = "datatable", type = "body", example = "{}") final String datatable, @PathParam("apptableId") @ApiParam(value = "apptableId") final Long apptableId,
|
||||
@PathParam("datatableId") @ApiParam(value = "datatableId") final Long datatableId) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.deleteDatatable(datatable, apptableId, datatableId) //
|
||||
|
||||
+253
@@ -0,0 +1,253 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.dataqueries.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.GenericResultsetData;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.ResultsetColumnHeaderData;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.ResultsetRowData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 31/7/17.
|
||||
*/
|
||||
final class DatatablesApiResourceSwagger {
|
||||
private DatatablesApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetDataTablesResponse")
|
||||
public static final class GetDataTablesResponse {
|
||||
private GetDataTablesResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "m_client")
|
||||
public String appTableName;
|
||||
@ApiModelProperty(example = "extra_client_details")
|
||||
public String datatableName;
|
||||
public List<ResultsetColumnHeaderData> column;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostDataTablesRequest")
|
||||
public static final class PostDataTablesRequest{
|
||||
private PostDataTablesRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "m_client")
|
||||
public String applicationTableName;
|
||||
@ApiModelProperty(example = "extra_client_details")
|
||||
public String registeredTableName;
|
||||
@ApiModelProperty(example = "true")
|
||||
public boolean multiRow;
|
||||
public List<ResultsetColumnHeaderData> columnHeaderData;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostDataTablesResponse")
|
||||
public static final class PostDataTablesResponse{
|
||||
private PostDataTablesResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "extra_client_details")
|
||||
public String resourceIdentifier;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutDataTablesRequest")
|
||||
public static final class PutDataTablesRequest{
|
||||
private PutDataTablesRequest() {
|
||||
|
||||
}
|
||||
final class PutDataTablesRequestDropColumns {
|
||||
private PutDataTablesRequestDropColumns() {}
|
||||
@ApiModelProperty(example = "Gender_cd_Question")
|
||||
public String name;
|
||||
}
|
||||
final class PutDataTablesRequestAddColumns {
|
||||
private PutDataTablesRequestAddColumns() {
|
||||
}
|
||||
@ApiModelProperty(example = "Question")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "Dropdown")
|
||||
public String type;
|
||||
@ApiModelProperty(example = "Gender")
|
||||
public String code;
|
||||
@ApiModelProperty(example = "true")
|
||||
public boolean mandatory;
|
||||
}
|
||||
final class PutDataTablesRequestChangeColumns {
|
||||
private PutDataTablesRequestChangeColumns() {
|
||||
}
|
||||
@ApiModelProperty(example = "Question")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "Question 2")
|
||||
public String newName;
|
||||
@ApiModelProperty(example = "Gender")
|
||||
public String code;
|
||||
@ApiModelProperty(example = "Gender2")
|
||||
public String newCode;
|
||||
@ApiModelProperty(example = "true")
|
||||
public boolean mandatory;
|
||||
}
|
||||
@ApiModelProperty(example = "m_client")
|
||||
public String appTableName;
|
||||
public List<PutDataTablesRequestDropColumns> dropColumns;
|
||||
public List<PutDataTablesRequestAddColumns> addColumns;
|
||||
public List<PutDataTablesRequestChangeColumns> ChangeColumns;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutDataTablesResponse")
|
||||
public static final class PutDataTablesResponse{
|
||||
private PutDataTablesResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "extra_client_details")
|
||||
public String resourceIdentifier;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteDataTablesResponse")
|
||||
public static final class DeleteDataTablesResponse{
|
||||
private DeleteDataTablesResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "extra_client_details")
|
||||
public String resourceIdentifier;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostDataTablesRegisterDatatableAppTable")
|
||||
public static final class PostDataTablesRegisterDatatableAppTable {
|
||||
private PostDataTablesRegisterDatatableAppTable () {}
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostDataTablesAppTableIdRequest")
|
||||
public static final class PostDataTablesAppTableIdRequest{
|
||||
private PostDataTablesAppTableIdRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "Livestock sales")
|
||||
public String BusinessDescription;
|
||||
@ApiModelProperty(example = "First comment made")
|
||||
public String Comment;
|
||||
@ApiModelProperty(example = "Primary")
|
||||
public String Education_cv;
|
||||
@ApiModelProperty(example = "6")
|
||||
public Long Gender_cd;
|
||||
@ApiModelProperty(example = "8.5")
|
||||
public Double HighestRatePaid;
|
||||
@ApiModelProperty(example = "01 October 2012")
|
||||
public String NextVisit;
|
||||
@ApiModelProperty(example = "5")
|
||||
public Long YearsinBusiness;
|
||||
@ApiModelProperty(example = "dd MMMM yyyy")
|
||||
public String dateFormat;
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostDataTablesAppTableIdResponse ")
|
||||
public static final class PostDataTablesAppTableIdResponse {
|
||||
private PostDataTablesAppTableIdResponse () {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetDataTablesAppTableIdResponse")
|
||||
public static final class GetDataTablesAppTableIdResponse {
|
||||
private GetDataTablesAppTableIdResponse() {
|
||||
|
||||
}
|
||||
public List<ResultsetColumnHeaderData> columnHeaders;
|
||||
public List<ResultsetRowData> data;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutDataTablesAppTableIdRequest")
|
||||
public static final class PutDataTablesAppTableIdRequest{
|
||||
private PutDataTablesAppTableIdRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "Livestock sales updated")
|
||||
public String BusinessDescription;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutDataTablesAppTableIdResponse")
|
||||
public static final class PutDataTablesAppTableIdResponse {
|
||||
private PutDataTablesAppTableIdResponse() {
|
||||
|
||||
}
|
||||
final class PutDataTablesAppTableIdResponseChanges{
|
||||
private PutDataTablesAppTableIdResponseChanges () {}
|
||||
@ApiModelProperty(example = "Livestock sales updated")
|
||||
public String BusinessDescription;
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
public PutDataTablesAppTableIdResponseChanges changes;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutDataTablesAppTableIdDatatableIdRequest")
|
||||
public static final class PutDataTablesAppTableIdDatatableIdRequest{
|
||||
private PutDataTablesAppTableIdDatatableIdRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "01 June 1982")
|
||||
public String DateOfBirth;
|
||||
@ApiModelProperty(example = "5")
|
||||
public Long Education_cdHighest;
|
||||
@ApiModelProperty(example = "June")
|
||||
public String Name;
|
||||
@ApiModelProperty(example = "More notes")
|
||||
public String OtherNotes;
|
||||
@ApiModelProperty(example = "20")
|
||||
public Long PointsScore;
|
||||
@ApiModelProperty(example = "dd MMMM yyyy")
|
||||
public String dateFormat;
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutDataTablesAppTableIdDatatableIdResponse ")
|
||||
public static final class PutDataTablesAppTableIdDatatableIdResponse {
|
||||
private PutDataTablesAppTableIdDatatableIdResponse () {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteDataTablesDatatableAppTableIdResponse ")
|
||||
public static final class DeleteDataTablesDatatableAppTableIdResponse {
|
||||
private DeleteDataTablesDatatableAppTableIdResponse () {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteDataTablesDatatableAppTableIdDatatableIdResponse ")
|
||||
public static final class DeleteDataTablesDatatableAppTableIdDatatableIdResponse {
|
||||
private DeleteDataTablesDatatableAppTableIdDatatableIdResponse () {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
}
|
||||
+16
-5
@@ -30,6 +30,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -52,6 +53,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/entityDatatableChecks")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Entity-Datatable Checks", description = "This defines Entity-Datatable Check.")
|
||||
public class EntityDatatableChecksApiResource {
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -76,9 +78,11 @@ public class EntityDatatableChecksApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("status") final Long status,
|
||||
@QueryParam("entity") final String entity, @QueryParam("productId") final Long productId,
|
||||
@QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit) {
|
||||
@ApiOperation(value = "List Entity-Datatable Checks", notes = "The list capability of Entity-Datatable Checks can support pagination.\n" + "\n" + "OPTIONAL ARGUMENTS\n" + "offset Integer optional, defaults to 0 Indicates the result from which pagination startslimit Integer optional, defaults to 200 Restricts the size of results returned. To override the default and return all entries you must explicitly pass a non-positive integer value for limit e.g. limit=0, or limit=-1\n" + "Example Request:\n" + "\n" + "entityDatatableChecks?offset=0&limit=15")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = EntityDatatableChecksApiResourceSwagger.GetEntityDatatableChecksResponse.class, responseContainer = "list")})
|
||||
public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("status") @ApiParam(value = "status") final Long status,
|
||||
@QueryParam("entity") @ApiParam(value = "entity") final String entity, @QueryParam("productId") @ApiParam(value = "productId") final Long productId,
|
||||
@QueryParam("offset") @ApiParam(value = "offset") final Integer offset, @QueryParam("limit") @ApiParam(value = "limit") final Integer limit) {
|
||||
final SearchParameters searchParameters = SearchParameters.forPagination(offset, limit);
|
||||
final Page<EntityDataTableChecksData> result = this.readEntityDatatableChecksService.retrieveAll(searchParameters, status, entity,
|
||||
productId);
|
||||
@@ -91,6 +95,8 @@ public class EntityDatatableChecksApiResource {
|
||||
@Path("template")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve Entity-Datatable Checks Template", notes = "This is a convenience resource useful for building maintenance user interface screens for Entity-Datatable Checks applications. The template data returned consists of:\n" + "\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "entityDatatableChecks/template")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = EntityDatatableChecksApiResourceSwagger.GetEntityDatatableChecksTemplateResponse.class)})
|
||||
public String getTemplate(@Context final UriInfo uriInfo) {
|
||||
|
||||
final EntityDataTableChecksTemplateData result = this.readEntityDatatableChecksService.retrieveTemplate();
|
||||
@@ -102,7 +108,10 @@ public class EntityDatatableChecksApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createEntityDatatableCheck(final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create Entity-Datatable Checks", notes = "Mandatory Fields : \n" + "entity, status, datatableName\n" + "\n" + "Non-Mandatory Fields : \n" + "productId")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = EntityDatatableChecksApiResourceSwagger.PostEntityDatatableChecksTemplateRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = EntityDatatableChecksApiResourceSwagger.PostEntityDatatableChecksTemplateResponse.class)})
|
||||
public String createEntityDatatableCheck(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createEntityDatatableChecks(apiRequestBodyAsJson).build();
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
@@ -113,7 +122,9 @@ public class EntityDatatableChecksApiResource {
|
||||
@Path("{entityDatatableCheckId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String deleteDatatable(@PathParam("entityDatatableCheckId") final long entityDatatableCheckId, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Delete Entity-Datatable Checks", notes = "Deletes an existing Entity-Datatable Check")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = EntityDatatableChecksApiResourceSwagger.DeleteEntityDatatableChecksTemplateResponse.class)})
|
||||
public String deleteDatatable(@PathParam("entityDatatableCheckId") @ApiParam(value = "entityDatatableCheckId") final long entityDatatableCheckId, final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteEntityDatatableChecks(entityDatatableCheckId,
|
||||
apiRequestBodyAsJson).build();
|
||||
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.dataqueries.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.DatatableCheckStatusData;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.DatatableChecksData;
|
||||
import org.apache.fineract.portfolio.loanproduct.data.LoanProductData;
|
||||
import org.apache.fineract.portfolio.savings.data.SavingsProductData;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 31/7/17.
|
||||
*/
|
||||
final class EntityDatatableChecksApiResourceSwagger {
|
||||
private EntityDatatableChecksApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetEntityDatatableChecksResponse")
|
||||
public static final class GetEntityDatatableChecksResponse {
|
||||
private GetEntityDatatableChecksResponse(){}
|
||||
|
||||
public long id;
|
||||
public String entity;
|
||||
public EnumOptionData status;
|
||||
public String datatableName;
|
||||
public boolean systemDefined;
|
||||
public Long order;
|
||||
public Long productId;
|
||||
public String productName;
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetEntityDatatableChecksTemplateResponse")
|
||||
public static final class GetEntityDatatableChecksTemplateResponse {
|
||||
private GetEntityDatatableChecksTemplateResponse(){}
|
||||
|
||||
public List<String> entities;
|
||||
public List<DatatableCheckStatusData> statusClient;
|
||||
public List<DatatableCheckStatusData> statusGroup;
|
||||
public List<DatatableCheckStatusData> statusSavings;
|
||||
public List<DatatableCheckStatusData> statusLoans;
|
||||
public List<DatatableChecksData> datatables;
|
||||
public Collection<LoanProductData> loanProductDatas;
|
||||
public Collection<SavingsProductData> savingsProductDatas;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostEntityDatatableChecksTemplateRequest")
|
||||
public static final class PostEntityDatatableChecksTemplateRequest{
|
||||
private PostEntityDatatableChecksTemplateRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "m_loan")
|
||||
public String entity;
|
||||
@ApiModelProperty(example = "100")
|
||||
public Long status;
|
||||
@ApiModelProperty(example = "Additional Details")
|
||||
public String datatableName;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long productId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostEntityDatatableChecksTemplateResponse")
|
||||
public static final class PostEntityDatatableChecksTemplateResponse{
|
||||
private PostEntityDatatableChecksTemplateResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteEntityDatatableChecksTemplateResponse")
|
||||
public static final class DeleteEntityDatatableChecksTemplateResponse{
|
||||
private DeleteEntityDatatableChecksTemplateResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
}
|
||||
|
||||
+20
-4
@@ -35,6 +35,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -52,6 +53,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/reports")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Reports", description = "Non-core reports can be added, updated and deleted.")
|
||||
public class ReportsApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "reportName", "reportType", "reportSubType",
|
||||
@@ -79,6 +81,8 @@ public class ReportsApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "List Reports", notes = "Lists all reports and their parameters.\n" + "\n" + "Example Request:\n" + "\n" + "reports", responseContainer = "List", response = ReportsApiResourceSwagger.GetReportsResponse.class)
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "")})
|
||||
public String retrieveReportList(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
@@ -93,7 +97,9 @@ public class ReportsApiResource {
|
||||
@Path("{id}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveReport(@PathParam("id") final Long id, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieve a Report\n", notes = "Example Requests:\n" + "\n" + "reports/1\n" + "\n" + "\n" + "reports/1?template=true")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ReportsApiResourceSwagger.GetReportsResponse.class)})
|
||||
public String retrieveReport(@PathParam("id") @ApiParam(value = "id") final Long id, @Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
|
||||
@@ -111,6 +117,8 @@ public class ReportsApiResource {
|
||||
@Path("template")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve Report Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "\n" + "Example Request : \n" + "\n" + "reports/template")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ReportsApiResourceSwagger.GetReportsTemplateResponse.class)})
|
||||
public String retrieveOfficeTemplate(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
@@ -125,7 +133,10 @@ public class ReportsApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createReport(final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create a Report", notes = "")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ReportsApiResourceSwagger.PostRepostRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ReportsApiResourceSwagger.PostReportsResponse.class)})
|
||||
public String createReport(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createReport().withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
@@ -138,7 +149,10 @@ public class ReportsApiResource {
|
||||
@Path("{id}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateReport(@PathParam("id") final Long id, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Update a Report", notes = "Only the useReport value can be updated for core reports.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ReportsApiResourceSwagger.PutReportRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ReportsApiResourceSwagger.PutReportResponse.class)})
|
||||
public String updateReport(@PathParam("id") @ApiParam(value = "id") final Long id, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateReport(id).withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
@@ -151,7 +165,9 @@ public class ReportsApiResource {
|
||||
@Path("{id}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String deleteReport(@PathParam("id") final Long id) {
|
||||
@ApiOperation(value = "Delete a Report", notes = "Only non-core reports can be deleted.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ReportsApiResourceSwagger.DeleteReportsResponse.class)})
|
||||
public String deleteReport(@PathParam("id") @ApiParam(value = "id") final Long id) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteReport(id).build();
|
||||
|
||||
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.dataqueries.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.ReportParameterData;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 4/8/17.
|
||||
*/
|
||||
final class ReportsApiResourceSwagger {
|
||||
private ReportsApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetReportsResponse")
|
||||
public static final class GetReportsResponse {
|
||||
private GetReportsResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long id;
|
||||
@ApiModelProperty(example = "Client Listing")
|
||||
public String reportName;
|
||||
@ApiModelProperty(example = "Table")
|
||||
public String reportType;
|
||||
public String reportSubType;
|
||||
@ApiModelProperty(example = "Client")
|
||||
public String reportCategory;
|
||||
@ApiModelProperty(example = "Individual Client Report Lists the small number of defined fields on the client table. Would expect to copy this report and add any one to one additional data for specific tenant needs. Can be run for any size MFI but you expect it only to be run within a branch for larger ones. Depending on how many columns are displayed, there is probably is a limit of about 20/50k clients returned for html display (export to excel doesnt have that client browser/memory impact).")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "")
|
||||
public String reportSql;
|
||||
@ApiModelProperty(example = "true")
|
||||
public Boolean coreReport;
|
||||
@ApiModelProperty(example = "true")
|
||||
public Boolean useReport;
|
||||
public Collection<ReportParameterData> reportParameters;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetReportsTemplateResponse")
|
||||
public static final class GetReportsTemplateResponse {
|
||||
private GetReportsTemplateResponse(){
|
||||
|
||||
}
|
||||
|
||||
public List<String> allowedReportTypes;
|
||||
public List<String> allowedReportSubTypes;
|
||||
public Collection<ReportParameterData> allowedParameters;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostRepostRequest")
|
||||
public static final class PostRepostRequest {
|
||||
private PostRepostRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "Completely New Report")
|
||||
public String reportName;
|
||||
@ApiModelProperty(example = "Table")
|
||||
public String reportType;
|
||||
@ApiModelProperty(example = "")
|
||||
public String reportSubType;
|
||||
@ApiModelProperty(example = "Loan")
|
||||
public String reportCategory;
|
||||
@ApiModelProperty(example = "Just An Example")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "select 'very good sql' as AComment")
|
||||
public String reportSql;
|
||||
public Collection<ReportParameterData> reportParameters;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostReportsResponse")
|
||||
public static final class PostReportsResponse {
|
||||
private PostReportsResponse(){
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "132")
|
||||
public long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutReportRequest")
|
||||
public static final class PutReportRequest {
|
||||
private PutReportRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "Completely New Report")
|
||||
public String reportName;
|
||||
public Collection<ReportParameterData> reportParameters;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutReportResponse")
|
||||
public static final class PutReportResponse {
|
||||
private PutReportResponse() {
|
||||
|
||||
}
|
||||
final class PutReportResponseChanges{
|
||||
private PutReportResponseChanges() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "Changed New Report")
|
||||
public String reportName;
|
||||
public Collection<ReportParameterData> reportParameters;
|
||||
}
|
||||
@ApiModelProperty(example = "132")
|
||||
public long resourceId;
|
||||
public PutReportResponseChanges changes;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteReportsResponse")
|
||||
public static final class DeleteReportsResponse {
|
||||
private DeleteReportsResponse(){
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "132")
|
||||
public long resourceId;
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -36,6 +36,7 @@ import javax.ws.rs.core.Response.ResponseBuilder;
|
||||
import javax.ws.rs.core.StreamingOutput;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.infrastructure.core.api.ApiParameterHelper;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.GenericResultsetData;
|
||||
@@ -54,6 +55,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/runreports")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Run Reports", description = "")
|
||||
public class RunreportsApiResource {
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -77,7 +79,10 @@ public class RunreportsApiResource {
|
||||
@Path("{reportName}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON, "text/csv", "application/vnd.ms-excel", "application/pdf", "text/html" })
|
||||
public Response runReport(@PathParam("reportName") final String reportName, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Running a Report", notes = "This resource allows you to run and receive output from pre-defined Apache Fineract reports.\n" + "\n" + "Reports can also be used to provide data for searching and workflow functionality.\n" + "\n" + "The default output is a JSON formatted \"Generic Resultset\". The Generic Resultset contains Column Heading as well as Data information. However, you can export to CSV format by simply adding \"&exportCSV=true\" to the end of your URL.\n" + "\n" + "If Pentaho reports have been pre-defined, they can also be run through this resource. Pentaho reports can return HTML, PDF or CSV formats.\n" + "\n" + "The Apache Fineract reference application uses a JQuery plugin called stretchy reporting which, itself, uses this reports resource to provide a pretty flexible reporting User Interface (UI).\n\n" + "\n" +
|
||||
"\n" + "Example Requests:\n" + "\n" + "runreports/Client%20Listing?R_officeId=1\n" + "\n" + "\n" + "runreports/Client%20Listing?R_officeId=1&exportCSV=true\n" + "\n" + "\n" + "runreports/OfficeIdSelectOne?R_officeId=1¶meterType=true\n" + "\n" + "\n" + "runreports/OfficeIdSelectOne?R_officeId=1¶meterType=true&exportCSV=true\n" + "\n" + "\n" + "runreports/Expected%20Payments%20By%20Date%20-%20Formatted?R_endDate=2013-04-30&R_loanOfficerId=-1&R_officeId=1&R_startDate=2013-04-16&output-type=HTML&R_officeId=1\n" + "\n" + "\n" + "runreports/Expected%20Payments%20By%20Date%20-%20Formatted?R_endDate=2013-04-30&R_loanOfficerId=-1&R_officeId=1&R_startDate=2013-04-16&output-type=XLS&R_officeId=1\n" + "\n" + "\n" + "runreports/Expected%20Payments%20By%20Date%20-%20Formatted?R_endDate=2013-04-30&R_loanOfficerId=-1&R_officeId=1&R_startDate=2013-04-16&output-type=CSV&R_officeId=1\n" + "\n" + "\n" + "runreports/Expected%20Payments%20By%20Date%20-%20Formatted?R_endDate=2013-04-30&R_loanOfficerId=-1&R_officeId=1&R_startDate=2013-04-16&output-type=PDF&R_officeId=1")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = RunreportsApiResourceSwagger.GetReportNameResponse.class)})
|
||||
public Response runReport(@PathParam("reportName") @ApiParam(value = "reportName") final String reportName, @Context final UriInfo uriInfo) {
|
||||
|
||||
final MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
|
||||
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.dataqueries.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.ResultsetColumnHeaderData;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.ResultsetRowData;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 5/8/17.
|
||||
*/
|
||||
final class RunreportsApiResourceSwagger {
|
||||
private RunreportsApiResourceSwagger() {
|
||||
|
||||
}
|
||||
@ApiModel(value = "GetReportNameResponse")
|
||||
public static final class GetReportNameResponse {
|
||||
private GetReportNameResponse() {
|
||||
|
||||
}
|
||||
public ResultsetColumnHeaderData columnHeaders;
|
||||
public ResultsetRowData row;
|
||||
}
|
||||
}
|
||||
+31
-17
@@ -39,6 +39,7 @@ import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.ResponseBuilder;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
|
||||
@@ -60,6 +61,7 @@ import com.sun.jersey.multipart.FormDataParam;
|
||||
@Path("{entityType}/{entityId}/documents")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Documents", description = "Multiple Documents (a combination of a name, description and a file) may be attached to different Entities like Clients, Groups, Staff, Loans, Savings and Client Identifiers in the system\n" + "\n" + "Note: The currently allowed Entities are\n" + "\n" + "Clients: URL Pattern as clients\n" + "Staff: URL Pattern as staff\n" + "Loans: URL Pattern as loans\n" + "Savings: URL Pattern as savings\n" + "Client Identifiers: URL Pattern as client_identifiers\n" + "Groups: URL Pattern as groups")
|
||||
public class DocumentManagementApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "parentEntityType", "parentEntityId",
|
||||
@@ -87,8 +89,10 @@ public class DocumentManagementApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retreiveAllDocuments(@Context final UriInfo uriInfo, @PathParam("entityType") final String entityType,
|
||||
@PathParam("entityId") final Long entityId) {
|
||||
@ApiOperation(value = "List documents", notes = "Example Requests:\n" + "\n" + "clients/1/documents\n" + "\n" + "client_identifiers/1/documents\n" + "\n" + "loans/1/documents?fields=name,description")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = DocumentManagementApiResourceSwagger.GetEntityTypeEntityIdDocumentsResponse.class, responseContainer = "list")})
|
||||
public String retreiveAllDocuments(@Context final UriInfo uriInfo, @PathParam("entityType") @ApiParam(value = "entityType") final String entityType,
|
||||
@PathParam("entityId") @ApiParam(value = "entityId") final Long entityId) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.SystemEntityType);
|
||||
|
||||
@@ -101,10 +105,12 @@ public class DocumentManagementApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createDocument(@PathParam("entityType") final String entityType, @PathParam("entityId") final Long entityId,
|
||||
@HeaderParam("Content-Length") final Long fileSize, @FormDataParam("file") final InputStream inputStream,
|
||||
@FormDataParam("file") final FormDataContentDisposition fileDetails, @FormDataParam("file") final FormDataBodyPart bodyPart,
|
||||
@FormDataParam("name") final String name, @FormDataParam("description") final String description) {
|
||||
@ApiOperation(value = "Create a Document", notes = "Note: A document is created using a Multi-part form upload \n" + "\n" + "Body Parts\n" + "\n" + "name : \n" + "Name or summary of the document\n" + "\n" + "description : \n" + "Description of the document\n" + "\n" + "file : \n" + "The file to be uploaded\n" + "\n" + "Mandatory Fields : \n" + "file and description")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "Not Shown (multi-part form data)", response = DocumentManagementApiResourceSwagger.PostEntityTypeEntityIdDocumentsResponse.class)})
|
||||
public String createDocument(@PathParam("entityType") @ApiParam(value = "entityType") final String entityType, @PathParam("entityId") @ApiParam(value = "entityId") final Long entityId,
|
||||
@HeaderParam("Content-Length") @ApiParam(value = "Content-Length") final Long fileSize, @FormDataParam("file") @ApiParam(value = "file") final InputStream inputStream,
|
||||
@FormDataParam("file") final @ApiParam(value = "file") FormDataContentDisposition fileDetails, @FormDataParam("file") @ApiParam(value = "file") final FormDataBodyPart bodyPart,
|
||||
@FormDataParam("name") @ApiParam(value = "name") final String name, @FormDataParam("description") @ApiParam(value = "description") final String description) {
|
||||
|
||||
/**
|
||||
* TODO: also need to have a backup and stop reading from stream after
|
||||
@@ -127,11 +133,13 @@ public class DocumentManagementApiResource {
|
||||
@Path("{documentId}")
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateDocument(@PathParam("entityType") final String entityType, @PathParam("entityId") final Long entityId,
|
||||
@PathParam("documentId") final Long documentId, @HeaderParam("Content-Length") final Long fileSize,
|
||||
@FormDataParam("file") final InputStream inputStream, @FormDataParam("file") final FormDataContentDisposition fileDetails,
|
||||
@FormDataParam("file") final FormDataBodyPart bodyPart, @FormDataParam("name") final String name,
|
||||
@FormDataParam("description") final String description) {
|
||||
@ApiOperation(value = "Update a Document", notes = "Note: A document is updated using a Multi-part form upload \n" + "Body Parts\n" + "name\n" + "Name or summary of the document\n" + "description\n" + "Description of the document\n" + "file\n" + "The file to be uploaded")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "Not Shown (multi-part form data)", response = DocumentManagementApiResourceSwagger.PutEntityTypeEntityIdDocumentsResponse.class)})
|
||||
public String updateDocument(@PathParam("entityType") @ApiParam(value = "entityType") final String entityType, @PathParam("entityId") @ApiParam(value = "entityId") final Long entityId,
|
||||
@PathParam("documentId") @ApiParam(value = "documentId") final Long documentId, @HeaderParam("Content-Length") @ApiParam(value = "Content-Length") final Long fileSize,
|
||||
@FormDataParam("file") @ApiParam(value = "file") final InputStream inputStream, @FormDataParam("file") @ApiParam(value = "file") final FormDataContentDisposition fileDetails,
|
||||
@FormDataParam("file") @ApiParam(value = "file") final FormDataBodyPart bodyPart, @FormDataParam("name") @ApiParam(value = "name") final String name,
|
||||
@FormDataParam("description") @ApiParam(value = "description") final String description) {
|
||||
|
||||
final Set<String> modifiedParams = new HashSet<>();
|
||||
modifiedParams.add("name");
|
||||
@@ -166,8 +174,10 @@ public class DocumentManagementApiResource {
|
||||
@Path("{documentId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String getDocument(@PathParam("entityType") final String entityType, @PathParam("entityId") final Long entityId,
|
||||
@PathParam("documentId") final Long documentId, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieve a Document", notes = "Example Requests:\n" + "\n" + "clients/1/documents/1\n" + "\n" + "\n" + "loans/1/documents/1\n" + "\n" + "\n" + "client_identifiers/1/documents/1?fields=name,description")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = DocumentManagementApiResourceSwagger.GetEntityTypeEntityIdDocumentsResponse.class)})
|
||||
public String getDocument(@PathParam("entityType") @ApiParam(value = "entityType") final String entityType, @PathParam("entityId") @ApiParam(value = "entityId") final Long entityId,
|
||||
@PathParam("documentId") @ApiParam(value = "documentId") final Long documentId, @Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.SystemEntityType);
|
||||
|
||||
@@ -181,8 +191,10 @@ public class DocumentManagementApiResource {
|
||||
@Path("{documentId}/attachment")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_OCTET_STREAM })
|
||||
public Response downloadFile(@PathParam("entityType") final String entityType, @PathParam("entityId") final Long entityId,
|
||||
@PathParam("documentId") final Long documentId) {
|
||||
@ApiOperation(value = "Retrieve Binary File associated with Document", notes = "Request used to download the file associated with the document\n" + "\n" + "Example Requests:\n" + "\n" + "clients/1/documents/1/attachment\n" + "\n" + "\n" + "loans/1/documents/1/attachment")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "Not Shown: The corresponding Binary file")})
|
||||
public Response downloadFile(@PathParam("entityType") @ApiParam(value = "entityType") final String entityType, @PathParam("entityId") @ApiParam(value = "entityId") final Long entityId,
|
||||
@PathParam("documentId") @ApiParam(value = "documentId") final Long documentId) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.SystemEntityType);
|
||||
|
||||
@@ -198,8 +210,10 @@ public class DocumentManagementApiResource {
|
||||
@Path("{documentId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String deleteDocument(@PathParam("entityType") final String entityType, @PathParam("entityId") final Long entityId,
|
||||
@PathParam("documentId") final Long documentId) {
|
||||
@ApiOperation(value = "Remove a Document", notes = "")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = DocumentManagementApiResourceSwagger.DeleteEntityTypeEntityIdDocumentsResponse.class)})
|
||||
public String deleteDocument(@PathParam("entityType") @ApiParam(value = "entityType") final String entityType, @PathParam("entityId") @ApiParam(value = "entityId") final Long entityId,
|
||||
@PathParam("documentId") @ApiParam(value = "documentId") final Long documentId) {
|
||||
|
||||
final DocumentCommand documentCommand = new DocumentCommand(null, documentId, entityType, entityId, null, null, null, null, null,
|
||||
null);
|
||||
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.documentmanagement.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 7/8/17.
|
||||
*/
|
||||
|
||||
final class DocumentManagementApiResourceSwagger {
|
||||
private DocumentManagementApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetEntityTypeEntityIdDocumentsResponse")
|
||||
public static final class GetEntityTypeEntityIdDocumentsResponse {
|
||||
private GetEntityTypeEntityIdDocumentsResponse() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long id;
|
||||
@ApiModelProperty(example = "clients")
|
||||
public String parentEntityType;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long parentEntityId;
|
||||
@ApiModelProperty(example = "Client Details Form")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "CGAP.pdf")
|
||||
public String fileName;
|
||||
@ApiModelProperty(example = "5246719")
|
||||
public Long size;
|
||||
@ApiModelProperty(example = "application/pdf")
|
||||
public String type;
|
||||
@ApiModelProperty(example = "A signed form signed by new member")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "")
|
||||
public String location;
|
||||
@ApiModelProperty(example = "")
|
||||
public Integer storageType;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostEntityTypeEntityIdDocumentsResponse")
|
||||
public static final class PostEntityTypeEntityIdDocumentsResponse {
|
||||
private PostEntityTypeEntityIdDocumentsResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "3")
|
||||
public Long resourceId;
|
||||
@ApiModelProperty(example = "3")
|
||||
public String resourceIdentifier;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutEntityTypeEntityIdDocumentsResponse")
|
||||
public static final class PutEntityTypeEntityIdDocumentsResponse {
|
||||
private PutEntityTypeEntityIdDocumentsResponse() {
|
||||
|
||||
}
|
||||
|
||||
public final class PutEntityTypeEntityIdDocumentsResponseChangesSwagger{
|
||||
private PutEntityTypeEntityIdDocumentsResponseChangesSwagger() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "3")
|
||||
public Long resourceId;
|
||||
public PutEntityTypeEntityIdDocumentsResponseChangesSwagger changes;
|
||||
@ApiModelProperty(example = "3")
|
||||
public String resourceIdentifier;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteEntityTypeEntityIdDocumentsResponse")
|
||||
public static final class DeleteEntityTypeEntityIdDocumentsResponse {
|
||||
private DeleteEntityTypeEntityIdDocumentsResponse() {
|
||||
|
||||
}
|
||||
|
||||
public final class PutEntityTypeEntityIdDocumentsResponseChangesSwagger{
|
||||
private PutEntityTypeEntityIdDocumentsResponseChangesSwagger() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "3")
|
||||
public Long resourceId;
|
||||
public PutEntityTypeEntityIdDocumentsResponseChangesSwagger changes;
|
||||
@ApiModelProperty(example = "3")
|
||||
public String resourceIdentifier;
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -34,6 +34,7 @@ import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.ResponseBuilder;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.domain.Base64EncodedImage;
|
||||
@@ -58,6 +59,7 @@ import com.sun.jersey.multipart.FormDataParam;
|
||||
@Path("{entity}/{entityId}/images")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "DomainName//api//v1//{entity}//{entityId}//images", description = "")
|
||||
public class ImagesApiResource {
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.documentmanagement.api;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 10/8/17.
|
||||
*/
|
||||
|
||||
final class ImagesApiResourceSwagger {
|
||||
private ImagesApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -32,6 +32,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -52,6 +53,7 @@ import org.springframework.stereotype.Component;
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "DomainName/api/v1/entitytoentitymapping", description = "") // https://github.com/swagger-api/swagger-ui/issues/1655
|
||||
public class FineractEntityApiResource {
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
|
||||
+21
-5
@@ -35,6 +35,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -54,6 +55,7 @@ import org.springframework.stereotype.Component;
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Hooks", description = "Hooks are a mechanism to trigger custom code on the occurence of events.")
|
||||
public class HookApiResource {
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -77,6 +79,8 @@ public class HookApiResource {
|
||||
}
|
||||
|
||||
@GET
|
||||
@ApiOperation(value = "Retrieve Hooks", notes = "Returns the list of hooks.\n" + "\n" + "Example Requests:\n" + "\n" + "hooks", responseContainer = "List", response = HookApiResourceSwagger.GetHookResponse.class)
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = HookApiResourceSwagger.GetHookResponse.class, responseContainer = "list")})
|
||||
public String retrieveHooks(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(
|
||||
@@ -93,7 +97,9 @@ public class HookApiResource {
|
||||
|
||||
@GET
|
||||
@Path("{hookId}")
|
||||
public String retrieveHook(@PathParam("hookId") final Long hookId,
|
||||
@ApiOperation(value = "Retrieve a Hook", notes = "Returns the details of a Hook.\n" + "\n" + "Example Requests:\n" + "\n" + "hooks/1")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = HookApiResourceSwagger.GetHookResponse.class)})
|
||||
public String retrieveHook(@PathParam("hookId") @ApiParam(value = "hookId") final Long hookId,
|
||||
@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(
|
||||
@@ -116,6 +122,8 @@ public class HookApiResource {
|
||||
|
||||
@GET
|
||||
@Path("template")
|
||||
@ApiOperation(value = "Retrieve Hooks Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "hooks/template")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = HookApiResourceSwagger.GetHookTemplateResponse.class)})
|
||||
public String template(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(
|
||||
@@ -131,7 +139,10 @@ public class HookApiResource {
|
||||
}
|
||||
|
||||
@POST
|
||||
public String createHook(final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create a Hook", notes = "The following parameters can be passed for the creation of a hook :-\n" + "\n" + "name - string - Required. The name of the template that is being called. (See /hooks/template for the list of valid hook names.)\n" + "\n" + "isActive - boolean - Determines whether the hook is actually triggered.\n" + "\n" + "events - array - Determines what events the hook is triggered for.\n" + "\n" + "config - hash - Required. Key/value pairs to provide settings for this hook. These settings vary between the templates.\n" + "\n" + "templateId - Optional. The UGD template ID associated with the same entity (client or loan).")
|
||||
@ApiImplicitParams({@ApiImplicitParam(paramType = "body", dataType = "body", required = true, type = "body", dataTypeClass = HookApiResourceSwagger.PostHookRequest.class)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = HookApiResourceSwagger.PostHookResponse.class)})
|
||||
public String createHook(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder()
|
||||
.createHook().withJson(apiRequestBodyAsJson).build();
|
||||
@@ -144,8 +155,11 @@ public class HookApiResource {
|
||||
|
||||
@PUT
|
||||
@Path("{hookId}")
|
||||
public String updateHook(@PathParam("hookId") final Long hookId,
|
||||
final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Update a Hook", notes = "Updates the details of a hook.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(paramType = "body", dataType = "body", required = true, type = "body", dataTypeClass = HookApiResourceSwagger.PutHookRequest.class)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = HookApiResourceSwagger.PutHookResponse.class)})
|
||||
public String updateHook(@PathParam("hookId") @ApiParam(value = "hookId") final Long hookId,
|
||||
@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder()
|
||||
.updateHook(hookId).withJson(apiRequestBodyAsJson).build();
|
||||
@@ -158,7 +172,9 @@ public class HookApiResource {
|
||||
|
||||
@DELETE
|
||||
@Path("{hookId}")
|
||||
public String deleteHook(@PathParam("hookId") final Long hookId) {
|
||||
@ApiOperation(value = "Delete a Hook", notes = "Deletes a hook.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = HookApiResourceSwagger.DeleteHookResponse.class)})
|
||||
public String deleteHook(@PathParam("hookId") @ApiParam(value = "hookId") final Long hookId) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder()
|
||||
.deleteHook(hookId).build();
|
||||
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.hooks.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.infrastructure.hooks.data.Event;
|
||||
import org.apache.fineract.infrastructure.hooks.data.Field;
|
||||
import org.apache.fineract.infrastructure.hooks.data.Grouping;
|
||||
import org.apache.fineract.infrastructure.hooks.data.HookTemplateData;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 11/8/17.
|
||||
*/
|
||||
|
||||
final class HookApiResourceSwagger {
|
||||
private HookApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostHookRequest")
|
||||
public static final class PostHookRequest {
|
||||
private PostHookRequest () {
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "Web")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "true")
|
||||
public Boolean isActive;
|
||||
@ApiModelProperty(example = "Kremlin")
|
||||
public String displayName;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long templateId;
|
||||
public List<Event> events;
|
||||
public List<Field> config;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostHookResponse")
|
||||
public static final class PostHookResponse {
|
||||
private PostHookResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "4")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetHookResponse")
|
||||
public static final class GetHookResponse {
|
||||
private GetHookResponse() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long id;
|
||||
@ApiModelProperty(example = "Web")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "Kremlin")
|
||||
public String displayName;
|
||||
@ApiModelProperty(example = "true")
|
||||
public Boolean isActive;
|
||||
@ApiModelProperty(example = "[2014, 9, 16]")
|
||||
public LocalDate createdAt;
|
||||
@ApiModelProperty(example = "[2014, 9, 16]")
|
||||
public LocalDate updatedAt;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long templateId;
|
||||
@ApiModelProperty(example = "My UGD")
|
||||
public String templateName;
|
||||
public List<Event> events;
|
||||
public List<Field> config;
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetHookTemplateResponse")
|
||||
public static final class GetHookTemplateResponse {
|
||||
private GetHookTemplateResponse() {
|
||||
|
||||
}
|
||||
|
||||
public List<HookTemplateData> templates;
|
||||
public List<Grouping> groupings;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteHookResponse")
|
||||
public static final class DeleteHookResponse {
|
||||
private DeleteHookResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "4")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutHookRequest")
|
||||
public static final class PutHookRequest {
|
||||
private PutHookRequest () {
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "Web")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "true")
|
||||
public Boolean isActive;
|
||||
@ApiModelProperty(example = "Kremlin")
|
||||
public String displayName;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long templateId;
|
||||
public List<Event> events;
|
||||
public List<Field> config;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutHookResponse")
|
||||
public static final class PutHookResponse {
|
||||
private PutHookResponse () {
|
||||
|
||||
}
|
||||
final class PutHookResponseChangesSwagger {
|
||||
private PutHookResponseChangesSwagger() {}
|
||||
@ApiModelProperty(example = "Kremlin")
|
||||
public String displayName;
|
||||
@ApiModelProperty(example = "1")
|
||||
public List<Event> events;
|
||||
public List<Field> config;
|
||||
}
|
||||
@ApiModelProperty(example = "4")
|
||||
public Long resourceId;
|
||||
public PutHookResponseChangesSwagger changes;
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -29,6 +29,7 @@ import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
|
||||
import org.apache.fineract.infrastructure.core.exception.UnrecognizedQueryParamException;
|
||||
@@ -43,6 +44,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
@Path("/scheduler")
|
||||
@Component
|
||||
@Api(value = "Scheduler", description = "")
|
||||
public class SchedulerApiResource {
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -62,6 +64,8 @@ public class SchedulerApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve Scheduler Status", notes = "Returns the scheduler status.\n" + "\n" + "Example Requests:\n" + "\n" + "scheduler")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = SchedulerApiResourceSwagger.GetSchedulerResponse.class)})
|
||||
public String retrieveStatus(@Context final UriInfo uriInfo) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(SchedulerJobApiConstants.SCHEDULER_RESOURCE_NAME);
|
||||
final boolean isSchedulerRunning = this.jobRegisterService.isSchedulerRunning();
|
||||
@@ -74,7 +78,9 @@ public class SchedulerApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public Response changeSchedulerStatus(@QueryParam(SchedulerJobApiConstants.COMMAND) final String commandParam) {
|
||||
@ApiOperation(value = "Activate Scheduler Jobs | Suspend Scheduler Jobs", notes = "Activates the scheduler job service. | Suspends the scheduler job service.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "POST : scheduler?command=start\n\n"+"\n"+"POST : scheduler?command=stop")})
|
||||
public Response changeSchedulerStatus(@QueryParam(SchedulerJobApiConstants.COMMAND) @ApiParam(value = "command") final String commandParam) {
|
||||
// check the logged in user have permissions to update scheduler status
|
||||
final boolean hasNotPermission = this.context.authenticatedUser().hasNotPermissionForAnyOf("ALL_FUNCTIONS", "UPDATE_SCHEDULER");
|
||||
if (hasNotPermission) {
|
||||
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.jobs.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 12/8/17.
|
||||
*/
|
||||
final class SchedulerApiResourceSwagger {
|
||||
private SchedulerApiResourceSwagger(){
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetSchedulerResponse")
|
||||
public static final class GetSchedulerResponse {
|
||||
private GetSchedulerResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "true")
|
||||
public boolean active;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+20
-7
@@ -33,6 +33,7 @@ import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
@@ -57,6 +58,7 @@ import org.springframework.stereotype.Component;
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Component
|
||||
@Api(value = "MIFOSX-BATCH JOBS", description = "Batch jobs (also known as cron jobs on Unix-based systems) are a series of back-end jobs executed on a computer at a particular time defined in job's cron expression.\n" + "\n" + "At any point, you can view the list of batch jobs scheduled to run along with other details specific to each job. Manually you can execute the jobs at any point of time.\n" + "\n" + "The scheduler status can be either \"Active\" or \"Standby\". If the scheduler status is Active, it indicates that all batch jobs are running/ will run as per the specified schedule.If the scheduler status is Standby, it will ensure all scheduled batch runs are suspended.")
|
||||
public class SchedulerJobApiResource {
|
||||
|
||||
private final SchedulerJobRunnerReadService schedulerJobRunnerReadService;
|
||||
@@ -84,6 +86,8 @@ public class SchedulerJobApiResource {
|
||||
}
|
||||
|
||||
@GET
|
||||
@ApiOperation(value = "Retrieve Scheduler Jobs", notes = "Returns the list of jobs.\n" + "\n" + "Example Requests:\n" + "\n" + "jobs")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = SchedulerJobApiResourceSwagger.GetJobsResponse.class, responseContainer = "list")})
|
||||
public String retrieveAll(@Context final UriInfo uriInfo) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(SchedulerJobApiConstants.SCHEDULER_RESOURCE_NAME);
|
||||
final List<JobDetailData> jobDetailDatas = this.schedulerJobRunnerReadService.findAllJobDeatils();
|
||||
@@ -93,7 +97,9 @@ public class SchedulerJobApiResource {
|
||||
|
||||
@GET
|
||||
@Path("{" + SchedulerJobApiConstants.JOB_ID + "}")
|
||||
public String retrieveOne(@PathParam(SchedulerJobApiConstants.JOB_ID) final Long jobId, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieve a Job", notes = "Returns the details of a Job.\n" + "\n" + "Example Requests:\n" + "\n" + "jobs/5")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = SchedulerJobApiResourceSwagger.GetJobsResponse.class)})
|
||||
public String retrieveOne(@PathParam(SchedulerJobApiConstants.JOB_ID) @ApiParam(value = "jobId") final Long jobId, @Context final UriInfo uriInfo) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(SchedulerJobApiConstants.SCHEDULER_RESOURCE_NAME);
|
||||
final JobDetailData jobDetailData = this.schedulerJobRunnerReadService.retrieveOne(jobId);
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
@@ -102,9 +108,11 @@ public class SchedulerJobApiResource {
|
||||
|
||||
@GET
|
||||
@Path("{" + SchedulerJobApiConstants.JOB_ID + "}/" + SchedulerJobApiConstants.JOB_RUN_HISTORY)
|
||||
public String retrieveHistory(@Context final UriInfo uriInfo, @PathParam(SchedulerJobApiConstants.JOB_ID) final Long jobId,
|
||||
@QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit,
|
||||
@QueryParam("orderBy") final String orderBy, @QueryParam("sortOrder") final String sortOrder) {
|
||||
@ApiOperation(value = "Retrieve Job Run History", notes = "Example Requests:\n" + "\n" + "jobs/5/runhistory?offset=0&limit=200")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = SchedulerJobApiResourceSwagger.GetJobsJobIDJobRunHistoryResponse.class)})
|
||||
public String retrieveHistory(@Context final UriInfo uriInfo, @PathParam(SchedulerJobApiConstants.JOB_ID) @ApiParam(value = "jobId") final Long jobId,
|
||||
@QueryParam("offset") @ApiParam(value = "offset") final Integer offset, @QueryParam("limit") @ApiParam(value = "limit") final Integer limit,
|
||||
@QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(SchedulerJobApiConstants.SCHEDULER_RESOURCE_NAME);
|
||||
final SearchParameters searchParameters = SearchParameters.forPagination(offset, limit, orderBy, sortOrder);
|
||||
final Page<JobDetailHistoryData> jobhistoryDetailData = this.schedulerJobRunnerReadService.retrieveJobHistory(jobId,
|
||||
@@ -116,8 +124,10 @@ public class SchedulerJobApiResource {
|
||||
|
||||
@POST
|
||||
@Path("{" + SchedulerJobApiConstants.JOB_ID + "}")
|
||||
public Response executeJob(@PathParam(SchedulerJobApiConstants.JOB_ID) final Long jobId,
|
||||
@QueryParam(SchedulerJobApiConstants.COMMAND) final String commandParam) {
|
||||
@ApiOperation(value = "Run a Job", notes = "Manually Execute Specific Job.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "POST: jobs/1?command=executeJob")})
|
||||
public Response executeJob(@PathParam(SchedulerJobApiConstants.JOB_ID) @ApiParam(value = "jobId") final Long jobId,
|
||||
@QueryParam(SchedulerJobApiConstants.COMMAND) @ApiParam(value = "command") final String commandParam) {
|
||||
// check the logged in user have permissions to execute scheduler jobs
|
||||
final boolean hasNotPermission = this.context.authenticatedUser().hasNotPermissionForAnyOf("ALL_FUNCTIONS", "EXECUTEJOB_SCHEDULER");
|
||||
if (hasNotPermission) {
|
||||
@@ -136,7 +146,10 @@ public class SchedulerJobApiResource {
|
||||
|
||||
@PUT
|
||||
@Path("{" + SchedulerJobApiConstants.JOB_ID + "}")
|
||||
public String updateJobDetail(@PathParam(SchedulerJobApiConstants.JOB_ID) final Long jobId, final String jsonRequestBody) {
|
||||
@ApiOperation(value = "Update a Job", notes = "Updates the details of a job.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SchedulerJobApiResourceSwagger.PutJobsJobIDRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "")})
|
||||
public String updateJobDetail(@PathParam(SchedulerJobApiConstants.JOB_ID) @ApiParam(value = "jobId") final Long jobId, @ApiParam(hidden = true) final String jsonRequestBody) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.updateJobDetail(jobId) //
|
||||
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.jobs.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.infrastructure.jobs.data.JobDetailHistoryData;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 12/8/17.
|
||||
*/
|
||||
final class SchedulerJobApiResourceSwagger {
|
||||
private SchedulerJobApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetJobsResponse")
|
||||
public static final class GetJobsResponse {
|
||||
private GetJobsResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long jobId;
|
||||
@ApiModelProperty(example = "Update loan Summary")
|
||||
public String displayName;
|
||||
@ApiModelProperty(example = "")
|
||||
public Date nextRunTime;
|
||||
@ApiModelProperty(example = "")
|
||||
public String initializingError;
|
||||
@ApiModelProperty(example = "0 0 22 1/1 * ? *")
|
||||
public String cronExpression;
|
||||
@ApiModelProperty(example = "false")
|
||||
public boolean active;
|
||||
@ApiModelProperty(example = "false")
|
||||
public boolean currentlyRunning;
|
||||
public JobDetailHistoryData lastRunHistory;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutJobsJobsIDRequest")
|
||||
public static final class PutJobsJobIDRequest {
|
||||
private PutJobsJobIDRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "Update loan Summary")
|
||||
public String displayName;
|
||||
@ApiModelProperty(example = "0 0 22 1/1 * ? *")
|
||||
public String cronExpression;
|
||||
@ApiModelProperty(example = "false")
|
||||
public boolean active;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetJobsJobIDJobRunHistoryResponse")
|
||||
public static final class GetJobsJobIDJobRunHistoryResponse {
|
||||
private GetJobsJobIDJobRunHistoryResponse() {
|
||||
|
||||
}
|
||||
|
||||
final class JobDetailHistoryDataSwagger {
|
||||
private JobDetailHistoryDataSwagger(){}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long version;
|
||||
@ApiModelProperty(example = "Jul 16, 2013 12:00:00 PM")
|
||||
public Date jobRunStartTime;
|
||||
@ApiModelProperty(example = "Jul 16, 2013 12:00:00 PM")
|
||||
public Date jobRunEndTime;
|
||||
@ApiModelProperty(example = "success")
|
||||
public String status;
|
||||
@ApiModelProperty(example = "cron")
|
||||
public String triggerType;
|
||||
}
|
||||
@ApiModelProperty(example = "8")
|
||||
public int totalFilteredRecords;
|
||||
public List<JobDetailHistoryDataSwagger> pageItems;
|
||||
|
||||
}
|
||||
}
|
||||
+24
-7
@@ -31,6 +31,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -51,6 +52,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/" + ReportMailingJobConstants.REPORT_MAILING_JOB_RESOURCE_NAME)
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Report Mailing Jobs", description = "This resource allows you to create a scheduled job that runs a report and sents it by email to specified email addresses.\n" + "\n" + "The scheduled job can be configured to run once or on a regular basis (once a day, twice a week, etc).")
|
||||
public class ReportMailingJobApiResource {
|
||||
|
||||
private final PlatformSecurityContext platformSecurityContext;
|
||||
@@ -75,7 +77,10 @@ public class ReportMailingJobApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createReportMailingJob(final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create a Report Mailing Job", notes = "Mandatory Fields: " + "name, startDateTime, stretchyReportId, emailRecipients, emailSubject, emailMessage, emailAttachmentFileFormatId, recurrence, isActive\n" + "\n" + "Optional Fields: " + "description, stretchyReportParamMap")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ReportMailingJobApiResourceSwagger.PostReportMailingJobsRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ReportMailingJobApiResourceSwagger.PostReportMailingJobsResponse.class)})
|
||||
public String createReportMailingJob(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
final CommandWrapper commandWrapper = new CommandWrapperBuilder().
|
||||
createReportMailingJob(ReportMailingJobConstants.REPORT_MAILING_JOB_ENTITY_NAME).
|
||||
withJson(apiRequestBodyAsJson).build();
|
||||
@@ -89,7 +94,10 @@ public class ReportMailingJobApiResource {
|
||||
@Path("{entityId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateReportMailingJob(@PathParam("entityId") final Long entityId, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Update a Report Mailing Job\n", notes = "")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ReportMailingJobApiResourceSwagger.PutReportMailingJobsRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ReportMailingJobApiResourceSwagger.PutReportMailingJobsResponse.class)})
|
||||
public String updateReportMailingJob(@PathParam("entityId") @ApiParam(value = "entityId") final Long entityId, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
final CommandWrapper commandWrapper = new CommandWrapperBuilder().
|
||||
updateReportMailingJob(ReportMailingJobConstants.REPORT_MAILING_JOB_ENTITY_NAME, entityId).
|
||||
withJson(apiRequestBodyAsJson).build();
|
||||
@@ -103,7 +111,10 @@ public class ReportMailingJobApiResource {
|
||||
@Path("{entityId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String deleteReportMailingJob(@PathParam("entityId") final Long entityId, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Delete a Report Mailing Job", notes = "")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ReportMailingJobApiResourceSwagger.DeleteReportMailingJobsRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ReportMailingJobApiResourceSwagger.DeleteReportMailingJobsResponse.class)})
|
||||
public String deleteReportMailingJob(@PathParam("entityId") @ApiParam(value = "entityId") final Long entityId, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
final CommandWrapper commandWrapper = new CommandWrapperBuilder().
|
||||
deleteReportMailingJob(ReportMailingJobConstants.REPORT_MAILING_JOB_ENTITY_NAME, entityId).
|
||||
withJson(apiRequestBodyAsJson).build();
|
||||
@@ -117,7 +128,9 @@ public class ReportMailingJobApiResource {
|
||||
@Path("{entityId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveReportMailingJob(@PathParam("entityId") final Long entityId, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieve a Report Mailing Job", notes = "Example Requests:\n" + "\n" + "reportmailingjobs/1\n" + "\n" + "\n" + "reportmailingjobs/1?template=true")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ReportMailingJobApiResourceSwagger.GetReportMailingJobsResponse.class)})
|
||||
public String retrieveReportMailingJob(@PathParam("entityId") @ApiParam(value = "entityId") final Long entityId, @Context final UriInfo uriInfo) {
|
||||
this.platformSecurityContext.authenticatedUser().validateHasReadPermission(ReportMailingJobConstants.REPORT_MAILING_JOB_ENTITY_NAME);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
@@ -135,6 +148,8 @@ public class ReportMailingJobApiResource {
|
||||
@Path("template")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve Report Mailing Job Details Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for report mailing job applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "reportmailingjobs/template")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ReportMailingJobApiResourceSwagger.GetReportMailingJobsTemplate.class)})
|
||||
public String retrieveReportMailingJobTemplate(@Context final UriInfo uriInfo) {
|
||||
this.platformSecurityContext.authenticatedUser().validateHasReadPermission(ReportMailingJobConstants.REPORT_MAILING_JOB_ENTITY_NAME);
|
||||
|
||||
@@ -147,10 +162,12 @@ public class ReportMailingJobApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "List Report Mailing Jobs", notes = "Example Requests:\n" + "\n" + "reportmailingjobs")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ReportMailingJobApiResourceSwagger.GetReportMailingJobsResponse.class, responseContainer = "list")})
|
||||
public String retrieveAllReportMailingJobs(@Context final UriInfo uriInfo,
|
||||
@QueryParam("offset") final Integer offset,
|
||||
@QueryParam("limit") final Integer limit, @QueryParam("orderBy") final String orderBy,
|
||||
@QueryParam("sortOrder") final String sortOrder) {
|
||||
@QueryParam("offset") @ApiParam(value = "offset") final Integer offset,
|
||||
@QueryParam("limit") @ApiParam(value = "limit") final Integer limit, @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy,
|
||||
@QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) {
|
||||
this.platformSecurityContext.authenticatedUser().validateHasReadPermission(ReportMailingJobConstants.REPORT_MAILING_JOB_ENTITY_NAME);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.reportmailingjob.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.ReportData;
|
||||
import org.apache.fineract.infrastructure.reportmailingjob.data.ReportMailingJobTimelineData;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 13/8/17.
|
||||
*/
|
||||
final class ReportMailingJobApiResourceSwagger {
|
||||
private ReportMailingJobApiResourceSwagger(){
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetReportMailingJobsTemplate")
|
||||
public static final class GetReportMailingJobsTemplate {
|
||||
private GetReportMailingJobsTemplate(){
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "true")
|
||||
public boolean isActive;
|
||||
public List<EnumOptionData> emailAttachmentFileFormatOptions;
|
||||
public List<EnumOptionData> stretchyReportParamDateOptions;
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetReportMailingJobsResponse")
|
||||
public static final class GetReportMailingJobsResponse {
|
||||
private GetReportMailingJobsResponse(){
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long id;
|
||||
@ApiModelProperty(example = "Client Numbers Report")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "Client Numbers Report")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "1469627093000")
|
||||
public DateTime startDateTime;
|
||||
@ApiModelProperty(example = "")
|
||||
public String recurrence;
|
||||
public ReportMailingJobTimelineData timeline;
|
||||
@ApiModelProperty(example = "info@musonisystem.com")
|
||||
public String emailRecipients;
|
||||
@ApiModelProperty(example = "Client Numbers Report")
|
||||
public String emailSubject;
|
||||
@ApiModelProperty(example = "Client Numbers Report")
|
||||
public String emailMessage;
|
||||
@ApiModelProperty(example = "")
|
||||
public EnumOptionData emailAttachmentFileFormat;
|
||||
@ApiModelProperty(example = "")
|
||||
public ReportData stretchyReport;
|
||||
@ApiModelProperty(example = "{\"startDate\":\"2016-07-01\",\"endDate\":\"2016-08-02\",\"selectOffice\":\"1\",\"environementUrl\":\"environementUrl\"}")
|
||||
public String stretchyReportParamMap;
|
||||
@ApiModelProperty(example = "1469627093000")
|
||||
public DateTime nextRunDateTime;
|
||||
@ApiModelProperty(example = "0")
|
||||
public Integer numberOfRuns;
|
||||
@ApiModelProperty(example = "true")
|
||||
public boolean isActive;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long runAsUserId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostReportMailingJobsRequest")
|
||||
public static final class PostReportMailingJobsRequest {
|
||||
private PostReportMailingJobsRequest(){
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "en_GB")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "dd-MM-yyyy HH:mm:ss")
|
||||
public String dateFormat;
|
||||
@ApiModelProperty(example = "Client Numbers Report")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "Client Numbers Report")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "1469627093000")
|
||||
public DateTime startDateTime;
|
||||
@ApiModelProperty(example = "120")
|
||||
public Long stretchyReportId;
|
||||
@ApiModelProperty(example = "info@musonisystem.com")
|
||||
public String emailRecipients;
|
||||
@ApiModelProperty(example = "Client Numbers Report")
|
||||
public String emailSubject;
|
||||
@ApiModelProperty(example = "Client Numbers Report")
|
||||
public String emailMessage;
|
||||
@ApiModelProperty(example = "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE,FR")
|
||||
public String recurrence;
|
||||
@ApiModelProperty(example = "true")
|
||||
public boolean isActive;
|
||||
@ApiModelProperty(example = "{\"startDate\":\"2016-07-01\",\"endDate\":\"2016-08-02\",\"selectOffice\":\"1\",\"environementUrl\":\"environementUrl\"}")
|
||||
public String stretchyReportParamMap;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostReportMailingJobsResponse")
|
||||
public static final class PostReportMailingJobsResponse {
|
||||
private PostReportMailingJobsResponse(){
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutReportMailingJobsRequest")
|
||||
public static final class PutReportMailingJobsRequest {
|
||||
private PutReportMailingJobsRequest(){
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "en_GB")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "dd-MM-yyyy HH:mm:ss")
|
||||
public String dateFormat;
|
||||
@ApiModelProperty(example = "10-08-2016 23:30:00")
|
||||
public DateTime startDateTime;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutReportMailingJobsResponse")
|
||||
public static final class PutReportMailingJobsResponse {
|
||||
private PutReportMailingJobsResponse(){
|
||||
|
||||
}
|
||||
final class PutReportMailingJobsResponseChanges{
|
||||
private PutReportMailingJobsResponseChanges(){}
|
||||
@ApiModelProperty(example = "10-08-2016 23:30:00")
|
||||
public DateTime startDateTime;
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
public PutReportMailingJobsResponseChanges changes;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteReportMailingJobsRequest ")
|
||||
public static final class DeleteReportMailingJobsRequest {
|
||||
private DeleteReportMailingJobsRequest(){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteReportMailingJobsResponse")
|
||||
public static final class DeleteReportMailingJobsResponse {
|
||||
private DeleteReportMailingJobsResponse(){
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
}
|
||||
+10
-4
@@ -27,6 +27,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
@@ -43,6 +44,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/" + ReportMailingJobConstants.REPORT_MAILING_JOB_RUN_HISTORY_RESOURCE_NAME)
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "List Report Mailing Job History", description = "")
|
||||
public class ReportMailingJobRunHistoryApiResource {
|
||||
|
||||
private final PlatformSecurityContext platformSecurityContext;
|
||||
@@ -64,10 +66,14 @@ public class ReportMailingJobRunHistoryApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveAllByReportMailingJobId(@Context final UriInfo uriInfo,
|
||||
@QueryParam("reportMailingJobId") final Long reportMailingJobId, @QueryParam("offset") final Integer offset,
|
||||
@QueryParam("limit") final Integer limit, @QueryParam("orderBy") final String orderBy,
|
||||
@QueryParam("sortOrder") final String sortOrder) {
|
||||
@ApiOperation(value = "List Report Mailing Job History", notes = "The list capability of report mailing job history can support pagination and sorting.\n" + "\n" + "Example Requests:\n" + "\n" + "reportmailingjobrunhistory/1")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ReportMailingJobRunHistoryData.class)})
|
||||
public String retrieveAllByReportMailingJobId(@Context final UriInfo uriInfo,
|
||||
@QueryParam("reportMailingJobId") @ApiParam(value = "reportMailingJobId") final Long reportMailingJobId,
|
||||
@QueryParam("offset") @ApiParam(value = "offset") final Integer offset,
|
||||
@QueryParam("limit") @ApiParam(value = "limit") final Integer limit,
|
||||
@QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy,
|
||||
@QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) {
|
||||
this.platformSecurityContext.authenticatedUser().validateHasReadPermission(ReportMailingJobConstants.REPORT_MAILING_JOB_ENTITY_NAME);
|
||||
final SearchParameters searchParameters = SearchParameters.fromReportMailingJobRunHistory(offset, limit, orderBy, sortOrder);
|
||||
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.reportmailingjob.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 13/8/17.
|
||||
*/
|
||||
final class ReportMailingJobRunHistoryApiResourceSwagger {
|
||||
private ReportMailingJobRunHistoryApiResourceSwagger(){
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetReportMailingJobRunHistoryResponse")
|
||||
public static final class GetReportMailingJobRunHistoryResponse {
|
||||
private GetReportMailingJobRunHistoryResponse(){
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long id;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long reportMailingJobId;
|
||||
@ApiModelProperty(example = "1469627093050")
|
||||
public DateTime startDateTime;
|
||||
@ApiModelProperty(example = "1469627093050")
|
||||
public DateTime endDateTime;
|
||||
@ApiModelProperty(example = "success")
|
||||
public String status;
|
||||
@ApiModelProperty(example = "")
|
||||
public String errorMessage;
|
||||
@ApiModelProperty(example = "")
|
||||
public String errorLog;
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -28,6 +28,7 @@ import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.security.data.AuthenticatedUserData;
|
||||
@@ -51,6 +52,7 @@ import com.sun.jersey.core.util.Base64;
|
||||
@Component
|
||||
@Profile("basicauth")
|
||||
@Scope("singleton")
|
||||
@Api(value = "Authentication HTTP Basic", description = "An API capability that allows client applications to verify authentication details using HTTP Basic Authentication.")
|
||||
public class AuthenticationApiResource {
|
||||
|
||||
private final DaoAuthenticationProvider customAuthenticationProvider;
|
||||
@@ -69,7 +71,9 @@ public class AuthenticationApiResource {
|
||||
|
||||
@POST
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String authenticate(@QueryParam("username") final String username, @QueryParam("password") final String password) {
|
||||
@ApiOperation(value = "Verify authentication", notes = "Authenticates the credentials provided and returns the set roles and permissions allowed.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = AuthenticationApiResourceSwagger.PostAuthenticationResponse.class), @ApiResponse(code = 400, message = "Unauthenticated. Please login")})
|
||||
public String authenticate(@QueryParam("username") @ApiParam(value = "username") final String username, @QueryParam("password") @ApiParam(value = "password") final String password) {
|
||||
|
||||
final Authentication authentication = new UsernamePasswordAuthenticationToken(username, password);
|
||||
final Authentication authenticationCheck = this.customAuthenticationProvider.authenticate(authentication);
|
||||
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.security.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.useradministration.data.RoleData;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 13/8/17.
|
||||
*/
|
||||
final class AuthenticationApiResourceSwagger {
|
||||
private AuthenticationApiResourceSwagger(){
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostAuthenticationResponse")
|
||||
public static final class PostAuthenticationResponse {
|
||||
private PostAuthenticationResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "mifos")
|
||||
public String username;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long userId;
|
||||
@ApiModelProperty(example = "bWlmb3M6cGFzc3dvcmQ=")
|
||||
public String base64EncodedAuthenticationKey;
|
||||
@ApiModelProperty(example = "true")
|
||||
public boolean authenticated;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "Head Office")
|
||||
public String officeName;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long staffId;
|
||||
@ApiModelProperty(example = "Director, Program")
|
||||
public String staffDisplayName;
|
||||
public EnumOptionData organisationalRole;
|
||||
public Collection<RoleData> roles;
|
||||
@ApiModelProperty(example = "ALL_FUNCTIONS")
|
||||
public Collection<String> permissions;
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -28,6 +28,7 @@ import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.security.data.AuthenticatedOauthUserData;
|
||||
@@ -51,6 +52,7 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
@Profile("oauth")
|
||||
@Scope("singleton")
|
||||
@Api(value = "Fetch authenticated user details", description = "")
|
||||
public class UserDetailsApiResource {
|
||||
|
||||
private final ResourceServerTokenServices tokenServices;
|
||||
@@ -68,7 +70,9 @@ public class UserDetailsApiResource {
|
||||
|
||||
@GET
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String fetchAuthenticatedUserData(@QueryParam("access_token") final String accessToken) {
|
||||
@ApiOperation(value = "Fetch authenticated user details\n", notes = "checks the Authentication and returns the set roles and permissions allowed.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = UserDetailsApiResourceSwagger.GetUserDetailsResponse.class)})
|
||||
public String fetchAuthenticatedUserData(@QueryParam("access_token") @ApiParam(value = "access_token") final String accessToken) {
|
||||
|
||||
final Authentication authentication = this.tokenServices.loadAuthentication(accessToken);
|
||||
if (authentication.isAuthenticated()) {
|
||||
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.security.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.useradministration.data.RoleData;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 13/8/17.
|
||||
*/
|
||||
final class UserDetailsApiResourceSwagger {
|
||||
private UserDetailsApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetUserDetailsResponse")
|
||||
public static final class GetUserDetailsResponse {
|
||||
private GetUserDetailsResponse(){
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "mifos")
|
||||
public String username;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long userId;
|
||||
@ApiModelProperty(example = "bWlmb3M6cGFzc3dvcmQ=")
|
||||
public String accessToken;
|
||||
@ApiModelProperty(example = "true")
|
||||
public boolean authenticated;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "Head Office")
|
||||
public String officeName;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long staffId;
|
||||
@ApiModelProperty(example = "mifosStaffDisplayName")
|
||||
public String staffDisplayName;
|
||||
public EnumOptionData organisationalRole;
|
||||
public Collection<RoleData> roles;
|
||||
@ApiModelProperty(example = "ALL_FUNCTIONS")
|
||||
public Collection<String> permissions;
|
||||
}
|
||||
}
|
||||
+2
@@ -34,6 +34,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.fineract.accounting.journalentry.api.DateParam;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
@@ -56,6 +57,7 @@ import org.springframework.stereotype.Component;
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "SMS", description = "")
|
||||
public class SmsApiResource {
|
||||
|
||||
private final String resourceNameForPermissions = "SMS";
|
||||
|
||||
+2
@@ -28,6 +28,7 @@ import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -46,6 +47,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/likelihood")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Likelihood")
|
||||
public class LikelihoodApiResource {
|
||||
|
||||
private final DefaultToApiJsonSerializer<LikelihoodData> toApiJsonSerializer;
|
||||
|
||||
+2
@@ -25,6 +25,7 @@ import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.infrastructure.survey.data.LikeliHoodPovertyLineData;
|
||||
@@ -37,6 +38,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/povertyLine")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Poverty Line")
|
||||
public class PovertyLineApiResource {
|
||||
|
||||
private final DefaultToApiJsonSerializer<PpiPovertyLineData> toApiJsonSerializer;
|
||||
|
||||
+11
-2
@@ -30,6 +30,7 @@ import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -52,6 +53,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/survey")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Survey", description = "")
|
||||
public class SurveyApiResource {
|
||||
|
||||
private final DefaultToApiJsonSerializer<SurveyData> toApiJsonSerializer;
|
||||
@@ -78,6 +80,8 @@ public class SurveyApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve surveys", notes = "Retrieve surveys. This allows to retrieve the list of survey tables registered .")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = SurveyApiResourceSwagger.GetSurveyResponse.class, responseContainer = "List")})
|
||||
public String retrieveSurveys() {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(SurveyApiConstants.SURVEY_RESOURCE_NAME);
|
||||
@@ -90,7 +94,9 @@ public class SurveyApiResource {
|
||||
@Path("{surveyName}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveSurvey(@PathParam("surveyName") final String surveyName) {
|
||||
@ApiOperation(value = "Retrieve survey", notes = "Lists a registered survey table details and the Apache Fineract Core application table they are registered to.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = SurveyApiResourceSwagger.GetSurveyResponse.class)})
|
||||
public String retrieveSurvey(@PathParam("surveyName") @ApiParam(value = "surveyName") final String surveyName) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(SurveyApiConstants.SURVEY_RESOURCE_NAME);
|
||||
|
||||
@@ -104,7 +110,10 @@ public class SurveyApiResource {
|
||||
@Path("{surveyName}/{apptableId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createDatatableEntry(@PathParam("surveyName") final String datatable, @PathParam("apptableId") final Long apptableId,
|
||||
@ApiOperation(value = "Create an entry in the survey table", notes = "Insert and entry in a survey table (full fill the survey)." + "\n" + "\n" + "Refer Link for sample Body: [ https://demo.openmf.org/api-docs/apiLive.htm#survey_create ] ")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SurveyApiResourceSwagger.PostSurveySurveyNameApptableIdRequest.class)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = SurveyApiResourceSwagger.PostSurveySurveyNameApptableIdResponse.class)})
|
||||
public String createDatatableEntry(@PathParam("surveyName") @ApiParam(value = "surveyName") final String datatable, @PathParam("apptableId") @ApiParam(value = "apptableId") final Long apptableId,
|
||||
final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.survey.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.DatatableData;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.ResultsetColumnHeaderData;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 13/8/17.
|
||||
*/
|
||||
final class SurveyApiResourceSwagger {
|
||||
private SurveyApiResourceSwagger(){
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetSurveyResponse")
|
||||
public static final class GetSurveyResponse {
|
||||
private GetSurveyResponse(){
|
||||
|
||||
}
|
||||
final class GetSurveyResponseDatatableData {
|
||||
private GetSurveyResponseDatatableData() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "m_client")
|
||||
public String applicationTableName;
|
||||
@ApiModelProperty(example = "ppi_kenya_2005")
|
||||
public String registeredTableName;
|
||||
public List<ResultsetColumnHeaderData> columnHeaderData;
|
||||
}
|
||||
public GetSurveyResponseDatatableData datatableData;
|
||||
@ApiModelProperty(example = "false")
|
||||
public boolean enabled;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostSurveySurveyNameApptableIdRequest")
|
||||
public static final class PostSurveySurveyNameApptableIdRequest {
|
||||
private PostSurveySurveyNameApptableIdRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "167")
|
||||
public Long ppi_household_members_cd_q1_householdmembers;
|
||||
@ApiModelProperty(example = "174")
|
||||
public Long ppi_highestschool_cd_q2_highestschool;
|
||||
@ApiModelProperty(example = "180")
|
||||
public Long ppi_businessoccupation_cd_q3_businessoccupation;
|
||||
@ApiModelProperty(example = "184")
|
||||
public Long ppi_habitablerooms_cd_q4_habitablerooms;
|
||||
@ApiModelProperty(example = "188")
|
||||
public Long ppi_floortype_cd_q5_floortype;
|
||||
@ApiModelProperty(example = "190")
|
||||
public Long ppi_lightingsource_cd_q6_lightingsource;
|
||||
@ApiModelProperty(example = "193")
|
||||
public Long ppi_irons_cd_q7_irons;
|
||||
@ApiModelProperty(example = "195")
|
||||
public Long ppi_mosquitonets_cd_q8_mosquitonets;
|
||||
@ApiModelProperty(example = "198")
|
||||
public Long ppi_towels_cd_q9_towels;
|
||||
@ApiModelProperty(example = "201")
|
||||
public Long ppi_fryingpans_cd_q10_fryingpans;
|
||||
@ApiModelProperty(example = "2014-12-02 20:30:00")
|
||||
public DateTime Date;
|
||||
@ApiModelProperty(example = "Y-m-d H:i:s")
|
||||
public DateTime dateFormat;
|
||||
@ApiModelProperty(example = "en_GB")
|
||||
public String locale;
|
||||
}
|
||||
|
||||
|
||||
@ApiModel(value = "PostSurveySurveyNameApptableIdResponse")
|
||||
public static final class PostSurveySurveyNameApptableIdResponse {
|
||||
private PostSurveySurveyNameApptableIdResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "2")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "87")
|
||||
public Long clientId;
|
||||
@ApiModelProperty(example = "87")
|
||||
public Long resourceId;
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.fineract.mix.data.XBRLData;
|
||||
import org.apache.fineract.mix.service.XBRLBuilder;
|
||||
import org.apache.fineract.mix.service.XBRLResultService;
|
||||
@@ -36,6 +37,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/mixreport")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Mix Report", description = "")
|
||||
public class MixReportApiResource {
|
||||
|
||||
private final XBRLResultService xbrlResultService;
|
||||
|
||||
+2
@@ -31,6 +31,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
|
||||
@@ -44,6 +45,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/mixtaxonomy")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Mix Taxonomy", description = "")
|
||||
public class MixTaxonomyApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("taxonomyId", "name", "namespace", "dimension",
|
||||
|
||||
+2
@@ -31,6 +31,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -48,6 +49,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/mixmapping")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Mix Mapping")
|
||||
public class MixTaxonomyMappingApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("identifier", "config"));
|
||||
|
||||
+26
-9
@@ -37,6 +37,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.accounting.journalentry.api.DateParam;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
@@ -57,6 +58,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/holidays")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Holidays", description = "Some MFI's span large regions where different branch offices might observe different holidays. They need the ability to define holidays for specific branch offices and be able to set the repayment rule to follow during those holidays.\n" + "\n" + "The reschedule of repayments to repaymentsRescheduledTo date during defined holidays is turned on/off by enabling/disabling reschedule-repayments-on-holidays in Global configurations.\n" + "\n" + "Allow Repayment transactions on a defined holidays is turned on/off by enabling/disabling allow-transactions-on-holiday in Global configurations.")
|
||||
public class HolidaysApiResource {
|
||||
|
||||
private final DefaultToApiJsonSerializer<HolidayData> toApiJsonSerializer;
|
||||
@@ -80,7 +82,10 @@ public class HolidaysApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createNewHoliday(final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create a Holiday", notes = "Mandatory Fields: " + "name, description, fromDate, toDate, repaymentsRescheduledTo, offices")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = HolidaysApiResourceSwagger.PostHolidaysRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = HolidaysApiResourceSwagger.PostHolidaysResponse.class)})
|
||||
public String createNewHoliday(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createHoliday().withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
@@ -93,8 +98,11 @@ public class HolidaysApiResource {
|
||||
@Path("{holidayId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String handleCommands(@PathParam("holidayId") final Long holidayId, @QueryParam("command") final String commandParam,
|
||||
final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Activate a Holiday", notes = "Always Holidays are created in pending state. This API allows to activate a holiday.\n" + "\n" + "Only the active holidays are considered for rescheduling the loan repayment.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = HolidaysApiResourceSwagger.PostHolidaysHolidayIdRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = HolidaysApiResourceSwagger.PostHolidaysHolidayIdResponse.class)})
|
||||
public String handleCommands(@PathParam("holidayId") @ApiParam(value = "holidayId") final Long holidayId, @QueryParam("command") @ApiParam(value = "command") final String commandParam,
|
||||
@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
String jsonApiRequest = apiRequestBodyAsJson;
|
||||
if (StringUtils.isBlank(jsonApiRequest)) {
|
||||
@@ -118,7 +126,9 @@ public class HolidaysApiResource {
|
||||
@Path("{holidayId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveOne(@PathParam("holidayId") final Long holidayId, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieve a Holiday", notes = "Example Requests:\n" + "\n" + "holidays/1")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = HolidaysApiResourceSwagger.GetHolidaysResponse.class)})
|
||||
public String retrieveOne(@PathParam("holidayId") @ApiParam(value = "holidayId") final Long holidayId, @Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(HOLIDAY_RESOURCE_NAME);
|
||||
|
||||
@@ -133,7 +143,10 @@ public class HolidaysApiResource {
|
||||
@Path("{holidayId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String update(@PathParam("holidayId") final Long holidayId, final String jsonRequestBody) {
|
||||
@ApiOperation(value = "Update a Holiday", notes = "If a holiday is in pending state (created and not activated) then all fields are allowed to modify. Once holidays become active only name and descriptions are allowed to modify.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = HolidaysApiResourceSwagger.PutHolidaysHolidayIdRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = HolidaysApiResourceSwagger.PutHolidaysHolidayIdResponse.class)})
|
||||
public String update(@PathParam("holidayId") @ApiParam(value = "holidayId") final Long holidayId, @ApiParam(hidden = true) final String jsonRequestBody) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateHoliday(holidayId).withJson(jsonRequestBody).build();
|
||||
|
||||
@@ -146,7 +159,9 @@ public class HolidaysApiResource {
|
||||
@Path("{holidayId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String delete(@PathParam("holidayId") final Long holidayId) {
|
||||
@ApiOperation(value = "Delete a Holiday", notes = "This API allows to delete a holiday. This is a soft delete the deleted holiday status is marked as deleted.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = HolidaysApiResourceSwagger.DeleteHolidaysHolidayIdResponse.class)})
|
||||
public String delete(@PathParam("holidayId") @ApiParam(value = "holidayId") final Long holidayId) {
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteHoliday(holidayId).build();
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
@@ -159,9 +174,11 @@ public class HolidaysApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveAllHolidays(@Context final UriInfo uriInfo, @QueryParam("officeId") final Long officeId,
|
||||
@QueryParam("fromDate") final DateParam fromDateParam, @QueryParam("toDate") final DateParam toDateParam,
|
||||
@QueryParam("locale") final String locale, @QueryParam("dateFormat") final String dateFormat) {
|
||||
@ApiOperation(value = "List Holidays", notes = "Example Requests:\n" + "\n" + "holidays?officeId=1")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = HolidaysApiResourceSwagger.GetHolidaysResponse.class, responseContainer = "List")})
|
||||
public String retrieveAllHolidays(@Context final UriInfo uriInfo, @QueryParam("officeId") @ApiParam(value = "officeId") final Long officeId,
|
||||
@QueryParam("fromDate") @ApiParam(value = "fromDate") final DateParam fromDateParam, @QueryParam("toDate") @ApiParam(value = "toDate") final DateParam toDateParam,
|
||||
@QueryParam("locale") @ApiParam(value = "locale") final String locale, @QueryParam("dateFormat") @ApiParam(value = "dateFormat") final String dateFormat) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(HOLIDAY_RESOURCE_NAME);
|
||||
|
||||
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.organisation.holiday.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 14/8/17.
|
||||
*/
|
||||
final class HolidaysApiResourceSwagger {
|
||||
private HolidaysApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetHolidaysResponse")
|
||||
public static final class GetHolidaysResponse {
|
||||
private GetHolidaysResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long id;
|
||||
@ApiModelProperty(example = "Good Friday")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "[2013, 10, 26]")
|
||||
public LocalDate fromDate;
|
||||
@ApiModelProperty(example = "[2013, 10, 26]")
|
||||
public LocalDate toDate;
|
||||
@ApiModelProperty(example = "[2013, 10, 27]")
|
||||
public LocalDate repaymentsRescheduledTo;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
public EnumOptionData status;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostHolidaysRequest")
|
||||
public static final class PostHolidaysRequest {
|
||||
private PostHolidaysRequest(){
|
||||
|
||||
}
|
||||
final class PostHolidaysRequestOffices {
|
||||
private PostHolidaysRequestOffices(){
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
}
|
||||
@ApiModelProperty(example = "Good Friday")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "Good Friday")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "dd MMMM yyyy")
|
||||
public String dateFormat;
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "25 October 2013")
|
||||
public LocalDate fromDate;
|
||||
@ApiModelProperty(example = "25 October 2013")
|
||||
public LocalDate toDate;
|
||||
@ApiModelProperty(example = "26 October 2013")
|
||||
public LocalDate repaymentsRescheduledTo;
|
||||
public List<PostHolidaysRequestOffices> offices;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostHolidaysResponse")
|
||||
public static final class PostHolidaysResponse {
|
||||
private PostHolidaysResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostHolidaysHolidayIdRequest")
|
||||
public static final class PostHolidaysHolidayIdRequest {
|
||||
private PostHolidaysHolidayIdRequest() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostHolidaysHolidayIdResponse")
|
||||
public static final class PostHolidaysHolidayIdResponse {
|
||||
private PostHolidaysHolidayIdResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutHolidaysHolidayIdRequest")
|
||||
public static final class PutHolidaysHolidayIdRequest {
|
||||
private PutHolidaysHolidayIdRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "Independence day")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "Holiday for Independence day celebration")
|
||||
public String description;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutHolidaysHolidayIdResponse")
|
||||
public static final class PutHolidaysHolidayIdResponse {
|
||||
private PutHolidaysHolidayIdResponse() {
|
||||
|
||||
}
|
||||
final class PutHolidaysHolidayIdResponseChanges{
|
||||
private PutHolidaysHolidayIdResponseChanges(){}
|
||||
@ApiModelProperty(example = "Independence day")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "Holiday for Independence day celebration")
|
||||
public String description;
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
public PutHolidaysHolidayIdResponseChanges changes;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteHolidaysHolidayIdResponse")
|
||||
public static final class DeleteHolidaysHolidayIdResponse {
|
||||
private DeleteHolidaysHolidayIdResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
}
|
||||
+8
-1
@@ -31,6 +31,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -48,6 +49,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/currencies")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Currency", description = "Application related configuration around viewing/updating the currencies permitted for use within the MFI.")
|
||||
public class CurrenciesApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("selectedCurrencyOptions", "currencyOptions"));
|
||||
@@ -75,6 +77,8 @@ public class CurrenciesApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve Currency Configuration", notes = "Returns the list of currencies permitted for use AND the list of currencies not selected (but available for selection).\n" + "\n" + "Example Requests:\n" + "\n" + "currencies\n" + "\n" + "\n" + "currencies?fields=selectedCurrencyOptions")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CurrenciesApiResourceSwagger.GetCurrenciesResponse.class)})
|
||||
public String retrieveCurrencies(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
@@ -88,7 +92,10 @@ public class CurrenciesApiResource {
|
||||
@PUT
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateCurrencies(final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Update Currency Configuration", notes = "Updates the list of currencies permitted for use.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = CurrenciesApiResourceSwagger.PutCurrenciesRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CurrenciesApiResourceSwagger.PutCurrenciesResponse.class)})
|
||||
public String updateCurrencies(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.updateCurrencies() //
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.organisation.monetary.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.organisation.monetary.data.CurrencyData;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 14/8/17.
|
||||
*/
|
||||
final class CurrenciesApiResourceSwagger {
|
||||
private CurrenciesApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetCurrenciesResponse")
|
||||
public static final class GetCurrenciesResponse {
|
||||
private GetCurrenciesResponse(){
|
||||
|
||||
}
|
||||
public Collection<CurrencyData> selectedCurrencyOptions;
|
||||
public Collection<CurrencyData> currencyOptions;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutCurrenciesRequest")
|
||||
public static final class PutCurrenciesRequest {
|
||||
private PutCurrenciesRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "[\"KES\",\n" +
|
||||
" \"BND\",\n" +
|
||||
" \"LBP\",\n" +
|
||||
" \"GHC\",\n" +
|
||||
" \"USD\",\n" +
|
||||
" \"XOF\",\n" +
|
||||
" \"AED\",\n" +
|
||||
" \"AMD\"]")
|
||||
public String currencies;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutCurrenciesResponse")
|
||||
public static final class PutCurrenciesResponse {
|
||||
private PutCurrenciesResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "[\"KES\",\n" +
|
||||
" \"BND\",\n" +
|
||||
" \"LBP\",\n" +
|
||||
" \"GHC\",\n" +
|
||||
" \"USD\",\n" +
|
||||
" \"XOF\",\n" +
|
||||
" \"AED\",\n" +
|
||||
" \"AMD\"]")
|
||||
public String currencies;
|
||||
}
|
||||
}
|
||||
+2
@@ -34,6 +34,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -51,6 +52,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/officetransactions")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "officetransactions", description = "")
|
||||
public class OfficeTransactionsApiResource {
|
||||
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "transactionDate", "fromOfficeId",
|
||||
|
||||
+19
-5
@@ -36,6 +36,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -54,6 +55,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/offices")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Offices", description = "Offices are used to model an MFIs structure. A hierarchical representation of offices is supported. There will always be at least one office (which represents the MFI or an MFIs head office). All subsequent offices added must have a parent office.")
|
||||
public class OfficesApiResource {
|
||||
|
||||
/**
|
||||
@@ -85,9 +87,11 @@ public class OfficesApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "List Offices", notes = "Example Requests:\n" + "\n" + "offices\n" + "\n" + "\n" + "offices?fields=id,name,openingDate")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = OfficesApiResourceSwagger.GetOfficesResponse.class, responseContainer = "List")})
|
||||
public String retrieveOffices(@Context final UriInfo uriInfo,
|
||||
@DefaultValue("false") @QueryParam("includeAllOffices") final boolean onlyManualEntries,
|
||||
@QueryParam("orderBy") final String orderBy, @QueryParam("sortOrder") final String sortOrder) {
|
||||
@DefaultValue("false") @QueryParam("includeAllOffices") @ApiParam(value = "includeAllOffices") final boolean onlyManualEntries,
|
||||
@QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
|
||||
@@ -103,6 +107,8 @@ public class OfficesApiResource {
|
||||
@Path("template")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve Office Details Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "offices/template")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = OfficesApiResourceSwagger.GetOfficesTemplateResponse.class)})
|
||||
public String retrieveOfficeTemplate(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
@@ -119,7 +125,10 @@ public class OfficesApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createOffice(final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create an Office", notes = "Mandatory Fields\n" + "name, openingDate, parentId")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = OfficesApiResourceSwagger.PostOfficesRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = OfficesApiResourceSwagger.PostOfficesResponse.class)})
|
||||
public String createOffice(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.createOffice() //
|
||||
@@ -135,7 +144,9 @@ public class OfficesApiResource {
|
||||
@Path("{officeId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retreiveOffice(@PathParam("officeId") final Long officeId, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieve an Office", notes = "Example Requests:\n" + "\n" + "offices/1\n" + "\n" + "\n" + "offices/1?template=true\n" + "\n" + "\n" + "offices/1?fields=id,name,parentName")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = OfficesApiResourceSwagger.GetOfficesResponse.class)})
|
||||
public String retreiveOffice(@PathParam("officeId") @ApiParam(value = "officeId") final Long officeId, @Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
|
||||
@@ -154,7 +165,10 @@ public class OfficesApiResource {
|
||||
@Path("{officeId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateOffice(@PathParam("officeId") final Long officeId, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Update Office", notes = "")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = OfficesApiResourceSwagger.PutOfficesOfficeIdRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = OfficesApiResourceSwagger.PutOfficesOfficeIdResponse.class)})
|
||||
public String updateOffice(@PathParam("officeId") @ApiParam(value = "officeId") final Long officeId, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.updateOffice(officeId) //
|
||||
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.organisation.office.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.organisation.office.data.OfficeData;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 14/8/17.
|
||||
*/
|
||||
final class OfficesApiResourceSwagger {
|
||||
private OfficesApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetOfficesResponse")
|
||||
public static final class GetOfficesResponse {
|
||||
private GetOfficesResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long id;
|
||||
@ApiModelProperty(example = "Head Office")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "Head Office")
|
||||
public String nameDecorated;
|
||||
@ApiModelProperty(example = "1")
|
||||
public String externalId;
|
||||
@ApiModelProperty(example = "[2009, 1, 1]")
|
||||
public LocalDate openingDate;
|
||||
@ApiModelProperty(example = ".")
|
||||
public String hierarchy;
|
||||
// @ApiModelProperty(example = "")
|
||||
// public Long parentId;
|
||||
// @ApiModelProperty(example = "")
|
||||
// public String parentName;
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetOfficesTemplateResponse")
|
||||
public static final class GetOfficesTemplateResponse {
|
||||
private GetOfficesTemplateResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "[2009, 1, 1]")
|
||||
public LocalDate openingDate;
|
||||
public Collection<GetOfficesResponse> allowedParents;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostOfficesRequest")
|
||||
public static final class PostOfficesRequest {
|
||||
private PostOfficesRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "Good Friday")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "dd MMMM yyyy")
|
||||
public String dateFormat;
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "01 July 2007")
|
||||
public LocalDate openingDate;
|
||||
@ApiModelProperty(example = "2")
|
||||
public Long parentId;
|
||||
@ApiModelProperty(example = "SYS54-88")
|
||||
public String externalId;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostOfficesResponse")
|
||||
public static final class PostOfficesResponse {
|
||||
private PostOfficesResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "3")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "3")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutOfficesOfficeIdRequest")
|
||||
public static final class PutOfficesOfficeIdRequest {
|
||||
private PutOfficesOfficeIdRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "Name is updated")
|
||||
public String name;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutOfficesOfficeIdResponse")
|
||||
public static final class PutOfficesOfficeIdResponse {
|
||||
private PutOfficesOfficeIdResponse() {
|
||||
|
||||
}
|
||||
final class PutOfficesOfficeIdResponseChanges {
|
||||
private PutOfficesOfficeIdResponseChanges(){
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "Name is updated")
|
||||
public String name;
|
||||
}
|
||||
@ApiModelProperty(example = "3")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "3")
|
||||
public Long resourceId;
|
||||
public PutOfficesOfficeIdResponseChanges changes;
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -32,6 +32,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -49,6 +50,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/provisioningcategory")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Provisioning Category", description = "")
|
||||
public class ProvisioningCategoryApiResource {
|
||||
|
||||
private final PlatformSecurityContext platformSecurityContext;
|
||||
|
||||
+18
-4
@@ -35,6 +35,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -53,6 +54,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/provisioningcriteria")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Provisioning Criteria", description = "This defines the Provisioning Criteria")
|
||||
public class ProvisioningCriteriaApiResource {
|
||||
|
||||
private final PlatformSecurityContext platformSecurityContext;
|
||||
@@ -101,7 +103,9 @@ public class ProvisioningCriteriaApiResource {
|
||||
@Path("{criteriaId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveProvisioningCriteria(@PathParam("criteriaId") final Long criteriaId, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieves a Provisioning Criteria", notes = "Retrieves a Provisioning Criteria")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ProvisioningCriteriaApiResourceSwagger.GetProvisioningCriteriaCriteriaIdResponse.class)})
|
||||
public String retrieveProvisioningCriteria(@PathParam("criteriaId") @ApiParam(value = "criteriaId") final Long criteriaId, @Context final UriInfo uriInfo) {
|
||||
platformSecurityContext.authenticatedUser() ;
|
||||
ProvisioningCriteriaData criteria = this.provisioningCriteriaReadPlatformService.retrieveProvisioningCriteria(criteriaId) ;
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
@@ -114,6 +118,8 @@ public class ProvisioningCriteriaApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieves all created Provisioning Criterias", notes = "Retrieves all created Provisioning Criterias")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", responseContainer = "List",response = ProvisioningCriteriaApiResourceSwagger.GetProvisioningCriteriaResponse.class)})
|
||||
public String retrieveAllProvisioningCriterias(@Context final UriInfo uriInfo) {
|
||||
platformSecurityContext.authenticatedUser() ;
|
||||
Collection<ProvisioningCriteriaData> data = this.provisioningCriteriaReadPlatformService.retrieveAllProvisioningCriterias() ;
|
||||
@@ -124,7 +130,10 @@ public class ProvisioningCriteriaApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createProvisioningCriteria(final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create a new Provisioning Criteria", notes = "Creates a new Provisioning Criteria\n" + "\n" + "Mandatory Fields: \n" + "criteriaName\n" + "provisioningcriteria\n" + "\n" + "Optional Fields: \n" + "loanProducts")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ProvisioningCriteriaApiResourceSwagger.PostProvisioningCriteriaRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ProvisioningCriteriaApiResourceSwagger.PostProvisioningCriteriaResponse.class)})
|
||||
public String createProvisioningCriteria(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
CommandWrapper commandWrapper = null;
|
||||
this.platformSecurityContext.authenticatedUser();
|
||||
commandWrapper = new CommandWrapperBuilder().createProvisioningCriteria().withJson(apiRequestBodyAsJson).build();
|
||||
@@ -136,7 +145,10 @@ public class ProvisioningCriteriaApiResource {
|
||||
@Path("{criteriaId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateProvisioningCriteria(@PathParam("criteriaId") final Long criteriaId, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Updates a new Provisioning Criteria", notes = "Updates a new Provisioning Criteria\n" + "\n" + "Optional Fields\n" + "criteriaName, loanProducts, provisioningcriteria")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = ProvisioningCriteriaApiResourceSwagger.PutProvisioningCriteriaRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ProvisioningCriteriaApiResourceSwagger.PutProvisioningCriteriaResponse.class)})
|
||||
public String updateProvisioningCriteria(@PathParam("criteriaId") @ApiParam(value = "criteriaId") final Long criteriaId, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
this.platformSecurityContext.authenticatedUser();
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateProvisioningCriteria(criteriaId)
|
||||
.withJson(apiRequestBodyAsJson).build();
|
||||
@@ -148,7 +160,9 @@ public class ProvisioningCriteriaApiResource {
|
||||
@Path("{criteriaId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String deleteProvisioningCriteria(@PathParam("criteriaId") final Long criteriaId) {
|
||||
@ApiOperation(value = "Deletes Provisioning Criteria", notes = "Deletes Provisioning Criteria")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ProvisioningCriteriaApiResourceSwagger.DeleteProvisioningCriteriaResponse.class)})
|
||||
public String deleteProvisioningCriteria(@PathParam("criteriaId") @ApiParam(value = "criteriaId") final Long criteriaId) {
|
||||
this.platformSecurityContext.authenticatedUser();
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteProvisioningCriteria(criteriaId).build();
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.organisation.provisioning.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.organisation.provisioning.data.ProvisioningCriteriaDefinitionData;
|
||||
import org.apache.fineract.portfolio.loanproduct.data.LoanProductData;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 18/8/17.
|
||||
*/
|
||||
final class ProvisioningCriteriaApiResourceSwagger {
|
||||
private ProvisioningCriteriaApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostProvisioningCriteriaRequest")
|
||||
public static final class PostProvisioningCriteriaRequest {
|
||||
private PostProvisioningCriteriaRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "High Risk Products Criteria")
|
||||
public String criteriaName;
|
||||
public Collection<LoanProductData> loanProducts;
|
||||
public Collection<ProvisioningCriteriaDefinitionData> provisioningcriteria;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostProvisioningCriteriaResponse")
|
||||
public static final class PostProvisioningCriteriaResponse {
|
||||
private PostProvisioningCriteriaResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetProvisioningCriteriaResponse")
|
||||
public static final class GetProvisioningCriteriaResponse {
|
||||
private GetProvisioningCriteriaResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long criteriaId;
|
||||
@ApiModelProperty(example = "High Risk Products Criteria")
|
||||
public String criteriaName;
|
||||
@ApiModelProperty(example = "mifos")
|
||||
public String createdBy;
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetProvisioningCriteriaCriteriaIdResponse")
|
||||
public static final class GetProvisioningCriteriaCriteriaIdResponse {
|
||||
private GetProvisioningCriteriaCriteriaIdResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long criteriaId;
|
||||
@ApiModelProperty(example = "High Risk Products Criteria")
|
||||
public String criteriaName;
|
||||
@ApiModelProperty(example = "mifos")
|
||||
public String createdBy;
|
||||
public Collection<LoanProductData> loanProducts;
|
||||
public Collection<ProvisioningCriteriaDefinitionData> provisioningcriteria;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutProvisioningCriteriaRequest")
|
||||
public static final class PutProvisioningCriteriaRequest {
|
||||
private PutProvisioningCriteriaRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "High Risk Products Criteria")
|
||||
public String criteriaName;
|
||||
public Collection<LoanProductData> loanProducts;
|
||||
public Collection<ProvisioningCriteriaDefinitionData> provisioningcriteria;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutProvisioningCriteriaResponse")
|
||||
public static final class PutProvisioningCriteriaResponse {
|
||||
private PutProvisioningCriteriaResponse() {
|
||||
|
||||
}
|
||||
final class PutProvisioningCriteriaResponseChanges{
|
||||
private PutProvisioningCriteriaResponseChanges(){}
|
||||
@ApiModelProperty(example = "High Risk Products Criteria")
|
||||
public String criteriaName;
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
public PutProvisioningCriteriaResponseChanges changes;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteProvisioningCriteriaResponse")
|
||||
public static final class DeleteProvisioningCriteriaResponse {
|
||||
private DeleteProvisioningCriteriaResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
}
|
||||
+20
-8
@@ -36,6 +36,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -55,6 +56,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/staff")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Staff", description = "Allows you to model staff members. At present the key role of significance is whether this staff member is a loan officer or not.")
|
||||
public class StaffApiResource {
|
||||
|
||||
/**
|
||||
@@ -89,11 +91,13 @@ public class StaffApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveStaff(@Context final UriInfo uriInfo, @QueryParam("sqlSearch") final String sqlSearch,
|
||||
@QueryParam("officeId") final Long officeId,
|
||||
@DefaultValue("false") @QueryParam("staffInOfficeHierarchy") final boolean staffInOfficeHierarchy,
|
||||
@DefaultValue("false") @QueryParam("loanOfficersOnly") final boolean loanOfficersOnly,
|
||||
@DefaultValue("active") @QueryParam("status") final String status) {
|
||||
@ApiOperation(value = "Retrieve Staff", notes = "Returns the list of staff members.\n" + "\n" + "Example Requests:\n" + "\n" + "staff\n\n\n\n" + "\n" + "Retrieve a Staff by status\n" + "\n" + "Returns the details of a Staff based on status.\n" + "\n" + "By default it Returns all the ACTIVE Staff.\n" + "\n" + "If status=INACTIVE, then it returns all INACTIVE Staff.\n" + "\n" + "and for status=ALL, it Returns both ACTIVE and INACTIVE Staff.\n" + "\n" + "Example Requests:\n" + "\n" + "staff?status=active")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = StaffApiResourceSwagger.GetStaffResponse.class, responseContainer = "List"), @ApiResponse(code = 200, message = "GET https://DomainName/api/v1/staff?status={ACTIVE|INACTIVE|ALL}", response = StaffApiResourceSwagger.GetStaffResponse.class)})
|
||||
public String retrieveStaff(@Context final UriInfo uriInfo, @QueryParam("sqlSearch") @ApiParam(value = "sqlSearch") final String sqlSearch,
|
||||
@QueryParam("officeId") @ApiParam(value = "officeId") final Long officeId,
|
||||
@DefaultValue("false") @QueryParam("staffInOfficeHierarchy") @ApiParam(value = "staffInOfficeHierarchy") final boolean staffInOfficeHierarchy,
|
||||
@DefaultValue("false") @QueryParam("loanOfficersOnly") @ApiParam(value = "loanOfficersOnly") final boolean loanOfficersOnly,
|
||||
@DefaultValue("active") @QueryParam("status") @ApiParam(value = "status") final String status) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
|
||||
@@ -111,7 +115,10 @@ public class StaffApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createStaff(final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create a staff member", notes = "Creates a staff member.\n" + "\n" + "Mandatory Fields: \n" + "officeId, firstname, lastname\n" + "\n" + "Optional Fields: \n" + "isLoanOfficer, isActive")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = StaffApiResourceSwagger.PostStaffRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = StaffApiResourceSwagger.PostStaffResponse.class)})
|
||||
public String createStaff(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createStaff().withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
@@ -124,7 +131,9 @@ public class StaffApiResource {
|
||||
@Path("{staffId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retreiveStaff(@PathParam("staffId") final Long staffId, @Context final UriInfo uriInfo) {
|
||||
@ApiOperation(value = "Retrieve a Staff Member", notes = "Returns the details of a Staff Member.\n" + "\n" + "Example Requests:\n" + "\n" + "staff/1")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = StaffApiResourceSwagger.GetStaffResponse.class)})
|
||||
public String retreiveStaff(@PathParam("staffId") @ApiParam(value = "staffId") final Long staffId, @Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
|
||||
@@ -142,7 +151,10 @@ public class StaffApiResource {
|
||||
@Path("{staffId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateStaff(@PathParam("staffId") final Long staffId, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Update a Staff Member", notes = "Updates the details of a staff member.")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = StaffApiResourceSwagger.PutStaffRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = StaffApiResourceSwagger.PutStaffResponse.class)})
|
||||
public String updateStaff(@PathParam("staffId") @ApiParam(value = "staffId") final Long staffId, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateStaff(staffId).withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.organisation.staff.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 19/8/17.
|
||||
*/
|
||||
|
||||
final class StaffApiResourceSwagger {
|
||||
private StaffApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostStaffRequest")
|
||||
public static final class PostStaffRequest {
|
||||
private PostStaffRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long id;
|
||||
@ApiModelProperty(example = "John")
|
||||
public String firstname;
|
||||
@ApiModelProperty(example = "Doe")
|
||||
public String lastname;
|
||||
@ApiModelProperty(example = "true")
|
||||
public Boolean isLoanOfficer;
|
||||
@ApiModelProperty(example = "17H")
|
||||
public String externalId;
|
||||
@ApiModelProperty(example = "+353851239876")
|
||||
public String mobileNo;
|
||||
@ApiModelProperty(example = "true")
|
||||
public Boolean isActive;
|
||||
@ApiModelProperty(example = "01 January 2009")
|
||||
public LocalDate joiningDate;
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "dd MMMM yyyy")
|
||||
public String dateFormat;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostStaffResponse")
|
||||
public static final class PostStaffResponse {
|
||||
private PostStaffResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetStaffResponse")
|
||||
public static final class GetStaffResponse {
|
||||
private GetStaffResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long id;
|
||||
@ApiModelProperty(example = "John")
|
||||
public String firstname;
|
||||
@ApiModelProperty(example = "Doe")
|
||||
public String lastname;
|
||||
@ApiModelProperty(example = "Doe, John")
|
||||
public String displayName;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "Head Office")
|
||||
public String officeName;
|
||||
@ApiModelProperty(example = "true")
|
||||
public Boolean isLoanOfficer;
|
||||
@ApiModelProperty(example = "17H")
|
||||
public String externalId;
|
||||
@ApiModelProperty(example = "+353851239876")
|
||||
public Boolean isActive;
|
||||
@ApiModelProperty(example = "[2009,8,1]")
|
||||
public LocalDate joiningDate;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutStaffRequest")
|
||||
public static final class PutStaffRequest {
|
||||
private PutStaffRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "false")
|
||||
public Boolean isLoanOfficer;
|
||||
@ApiModelProperty(example = "17Hbb")
|
||||
public String externalId;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutStaffResponse")
|
||||
public static final class PutStaffResponse {
|
||||
private PutStaffResponse() {
|
||||
|
||||
}
|
||||
final class PutStaffResponseChanges {
|
||||
private PutStaffResponseChanges(){}
|
||||
@ApiModelProperty(example = "false")
|
||||
public Boolean isLoanOfficer;
|
||||
@ApiModelProperty(example = "17Hbb")
|
||||
public String externalId;
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
|
||||
}
|
||||
}
|
||||
+5
@@ -28,6 +28,10 @@ import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.organisation.teller.data.CashierData;
|
||||
import org.apache.fineract.organisation.teller.service.TellerManagementReadPlatformService;
|
||||
@@ -40,6 +44,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("cashiers")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "cashiers", description = "")
|
||||
public class CashierApiResource {
|
||||
|
||||
private final DefaultToApiJsonSerializer<CashierData> jsonSerializer;
|
||||
|
||||
+70
-32
@@ -32,6 +32,7 @@ import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -57,6 +58,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("tellers")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Teller Cash Management", description = "Teller cash management which will allow an organization to manage their cash transactions at branches or head office more effectively.")
|
||||
public class TellerApiResource {
|
||||
|
||||
private final PlatformSecurityContext securityContext;
|
||||
@@ -78,17 +80,21 @@ public class TellerApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getTellerData(@QueryParam("officeId") final Long officeId) {
|
||||
@ApiOperation(value = "List all tellers", notes = "Retrieves list tellers")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.GetTellersResponse.class, responseContainer = "List")})
|
||||
public String getTellerData(@QueryParam("officeId") @ApiParam(value = "officeId") final Long officeId) {
|
||||
final Collection<TellerData> foundTellers = this.readPlatformService.getTellers(officeId);
|
||||
|
||||
return this.jsonSerializer.serialize(foundTellers);
|
||||
}
|
||||
|
||||
@Path("{tellerId}")
|
||||
@GET
|
||||
@Path("{tellerId}")
|
||||
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String findTeller(@PathParam("tellerId") final Long tellerId) {
|
||||
@ApiOperation(value = "Retrieve tellers", notes = "")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.GetTellersResponse.class)})
|
||||
public String findTeller(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId) {
|
||||
final TellerData teller = this.readPlatformService.findTeller(tellerId);
|
||||
|
||||
return this.jsonSerializer.serialize(teller);
|
||||
@@ -97,7 +103,10 @@ public class TellerApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String createTeller(final String tellerData) {
|
||||
@ApiOperation(value = "Create teller", notes = "Mandatory Fields\n" + "Teller name, OfficeId, Description, Start Date, Status\n" + "Optional Fields\n" + "End Date")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TellerApiResourceSwagger.PostTellersRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.PostTellersResponse.class)})
|
||||
public String createTeller(@ApiParam(hidden = true) final String tellerData) {
|
||||
final CommandWrapper request = new CommandWrapperBuilder().createTeller().withJson(tellerData).build();
|
||||
|
||||
final CommandProcessingResult result = this.commandWritePlatformService.logCommandSource(request);
|
||||
@@ -105,11 +114,14 @@ public class TellerApiResource {
|
||||
return this.jsonSerializer.serialize(result);
|
||||
}
|
||||
|
||||
@Path("{tellerId}")
|
||||
@PUT
|
||||
@Path("{tellerId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String updateTeller(@PathParam("tellerId") final Long tellerId, final String tellerData) {
|
||||
@ApiOperation(value = "Update teller", notes = "")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TellerApiResourceSwagger.PutTellersRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.PutTellersResponse.class)})
|
||||
public String updateTeller(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, @ApiParam(hidden = true) final String tellerData) {
|
||||
final CommandWrapper request = new CommandWrapperBuilder().updateTeller(tellerId).withJson(tellerData).build();
|
||||
|
||||
final CommandProcessingResult result = this.commandWritePlatformService.logCommandSource(request);
|
||||
@@ -117,11 +129,11 @@ public class TellerApiResource {
|
||||
return this.jsonSerializer.serialize(result);
|
||||
}
|
||||
|
||||
@Path("{tellerId}")
|
||||
@DELETE
|
||||
@Path("{tellerId}")
|
||||
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String deleteTeller(@PathParam("tellerId") final Long tellerId) {
|
||||
public String deleteTeller(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId) {
|
||||
final CommandWrapper request = new CommandWrapperBuilder().deleteTeller(tellerId).build();
|
||||
|
||||
final CommandProcessingResult result = this.commandWritePlatformService.logCommandSource(request);
|
||||
@@ -133,8 +145,10 @@ public class TellerApiResource {
|
||||
@Path("{tellerId}/cashiers")
|
||||
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getCashierData(@PathParam("tellerId") final Long tellerId, @QueryParam("fromdate") final String fromDateStr,
|
||||
@QueryParam("todate") final String toDateStr) {
|
||||
@ApiOperation(value = "List Cashiers", notes = "")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.GetTellersTellerIdCashiersResponse.class)})
|
||||
public String getCashierData(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, @QueryParam("fromdate") @ApiParam(value = "fromdate") final String fromDateStr,
|
||||
@QueryParam("todate") @ApiParam(value = "todate") final String toDateStr) {
|
||||
final DateTimeFormatter dateFormatter = ISODateTimeFormat.basicDate();
|
||||
|
||||
final Date fromDate = (fromDateStr != null ? dateFormatter.parseDateTime(fromDateStr).toDate() : new Date());
|
||||
@@ -157,7 +171,9 @@ public class TellerApiResource {
|
||||
@Path("{tellerId}/cashiers/{cashierId}")
|
||||
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String findCashierData(@PathParam("tellerId") final Long tellerId, @PathParam("cashierId") final Long cashierId) {
|
||||
@ApiOperation(value = "Retrieve a cashier", notes = "")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.GetTellersTellerIdCashiersCashierIdResponse.class)})
|
||||
public String findCashierData(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, @PathParam("cashierId") @ApiParam(value = "cashierId") final Long cashierId) {
|
||||
final CashierData cashier = this.readPlatformService.findCashier(cashierId);
|
||||
|
||||
return this.jsonSerializer.serialize(cashier);
|
||||
@@ -167,7 +183,9 @@ public class TellerApiResource {
|
||||
@Path("{tellerId}/cashiers/template")
|
||||
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getCashierTemplate(@PathParam("tellerId") final Long tellerId) {
|
||||
@ApiOperation(value = "Find Cashiers", notes = "")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.GetTellersTellerIdCashiersTemplateResponse.class)})
|
||||
public String getCashierTemplate(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId) {
|
||||
|
||||
final TellerData teller = this.readPlatformService.findTeller(tellerId);
|
||||
Long officeId = teller.getOfficeId();
|
||||
@@ -181,7 +199,10 @@ public class TellerApiResource {
|
||||
@Path("{tellerId}/cashiers")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String createCashier(@PathParam("tellerId") final Long tellerId, final String cashierData) {
|
||||
@ApiOperation(value = "Create Cashiers", notes = "Mandatory Fields: \n" + "Cashier/staff, Fromm Date, To Date, Full Day or From time and To time\n" + "\n\n\n" + "Optional Fields: \n" + "Description/Notes")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TellerApiResourceSwagger.PostTellersTellerIdCashiersRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.PostTellersTellerIdCashiersResponse.class)})
|
||||
public String createCashier(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, @ApiParam(hidden = true) final String cashierData) {
|
||||
final CommandWrapper request = new CommandWrapperBuilder().allocateTeller(tellerId).withJson(cashierData).build();
|
||||
|
||||
final CommandProcessingResult result = this.commandWritePlatformService.logCommandSource(request);
|
||||
@@ -193,8 +214,11 @@ public class TellerApiResource {
|
||||
@Path("{tellerId}/cashiers/{cashierId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String updateCashier(@PathParam("tellerId") final Long tellerId, @PathParam("cashierId") final Long cashierId,
|
||||
final String cashierDate) {
|
||||
@ApiOperation(value = "Update Cashier", notes = "")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TellerApiResourceSwagger.PutTellersTellerIdCashiersCashierIdRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.PutTellersTellerIdCashiersCashierIdResponse.class)})
|
||||
public String updateCashier(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, @PathParam("cashierId") @ApiParam(value = "cashierId") final Long cashierId,
|
||||
@ApiParam(hidden = true) final String cashierDate) {
|
||||
final CommandWrapper request = new CommandWrapperBuilder().updateAllocationTeller(tellerId, cashierId).withJson(cashierDate)
|
||||
.build();
|
||||
|
||||
@@ -207,7 +231,9 @@ public class TellerApiResource {
|
||||
@Path("{tellerId}/cashiers/{cashierId}")
|
||||
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String deleteCashier(@PathParam("tellerId") final Long tellerId, @PathParam("cashierId") final Long cashierId) {
|
||||
@ApiOperation(value = "Delete Cashier", notes = "")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.DeleteTellersTellerIdCashiersCashierIdResponse.class)})
|
||||
public String deleteCashier(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, @PathParam("cashierId") @ApiParam(value = "cashierId") final Long cashierId) {
|
||||
final CommandWrapper request = new CommandWrapperBuilder().deleteAllocationTeller(tellerId, cashierId).build();
|
||||
|
||||
final CommandProcessingResult result = this.commandWritePlatformService.logCommandSource(request);
|
||||
@@ -219,8 +245,11 @@ public class TellerApiResource {
|
||||
@Path("{tellerId}/cashiers/{cashierId}/allocate")
|
||||
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String allocateCashToCashier(@PathParam("tellerId") final Long tellerId, @PathParam("cashierId") final Long cashierId,
|
||||
final String cashierTxnData) {
|
||||
@ApiOperation(value = "Allocate Cash To Cashier", notes = "Mandatory Fields: \n" + "Date, Amount, Currency, Notes/Comments")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TellerApiResourceSwagger.PostTellersTellerIdCashiersCashierIdAllocateRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.PostTellersTellerIdCashiersCashierIdAllocateResponse.class)})
|
||||
public String allocateCashToCashier(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, @PathParam("cashierId") @ApiParam(value = "cashierId") final Long cashierId,
|
||||
@ApiParam(hidden = true) final String cashierTxnData) {
|
||||
final CommandWrapper request = new CommandWrapperBuilder().allocateCashToCashier(tellerId, cashierId).withJson(cashierTxnData)
|
||||
.build();
|
||||
|
||||
@@ -234,8 +263,11 @@ public class TellerApiResource {
|
||||
@Path("{tellerId}/cashiers/{cashierId}/settle")
|
||||
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String settleCashFromCashier(@PathParam("tellerId") final Long tellerId, @PathParam("cashierId") final Long cashierId,
|
||||
final String cashierTxnData) {
|
||||
@ApiOperation(value = "Settle Cash From Cashier", notes = "Mandatory Fields\n" + "Date, Amount, Currency, Notes/Comments")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = TellerApiResourceSwagger.PostTellersTellerIdCashiersCashierIdSettleRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.PostTellersTellerIdCashiersCashierIdSettleResponse.class)})
|
||||
public String settleCashFromCashier(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, @PathParam("cashierId") @ApiParam(value = "cashierId") final Long cashierId,
|
||||
@ApiParam(hidden = true) final String cashierTxnData) {
|
||||
final CommandWrapper request = new CommandWrapperBuilder().settleCashFromCashier(tellerId, cashierId).withJson(cashierTxnData)
|
||||
.build();
|
||||
|
||||
@@ -249,9 +281,11 @@ public class TellerApiResource {
|
||||
@Path("{tellerId}/cashiers/{cashierId}/transactions")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getTransactionsForCashier(@PathParam("tellerId") final Long tellerId, @PathParam("cashierId") final Long cashierId,
|
||||
@QueryParam("currencyCode") final String currencyCode, @QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit,
|
||||
@QueryParam("orderBy") final String orderBy, @QueryParam("sortOrder") final String sortOrder) {
|
||||
@ApiOperation(value = "Retrieve Cashier Transaction", notes = "")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.GetTellersTellerIdCashiersCashiersIdTransactionsResponse.class, responseContainer = "List")})
|
||||
public String getTransactionsForCashier(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, @PathParam("cashierId") @ApiParam(value = "cashierId") final Long cashierId,
|
||||
@QueryParam("currencyCode") @ApiParam(value = "currencyCode") final String currencyCode, @QueryParam("offset") @ApiParam(value = "offset") final Integer offset, @QueryParam("limit") @ApiParam(value = "limit") final Integer limit,
|
||||
@QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) {
|
||||
final TellerData teller = this.readPlatformService.findTeller(tellerId);
|
||||
final CashierData cashier = this.readPlatformService.findCashier(cashierId);
|
||||
|
||||
@@ -268,10 +302,12 @@ public class TellerApiResource {
|
||||
@Path("{tellerId}/cashiers/{cashierId}/summaryandtransactions")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getTransactionsWtihSummaryForCashier(@PathParam("tellerId") final Long tellerId,
|
||||
@PathParam("cashierId") final Long cashierId, @QueryParam("currencyCode") final String currencyCode,
|
||||
@QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit,
|
||||
@QueryParam("orderBy") final String orderBy, @QueryParam("sortOrder") final String sortOrder) {
|
||||
@ApiOperation(value = "Transactions Wtih Summary For Cashier", notes = "")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.GetTellersTellerIdCashiersCashiersIdSummaryAndTransactionsResponse.class)})
|
||||
public String getTransactionsWtihSummaryForCashier(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId,
|
||||
@PathParam("cashierId") @ApiParam(value = "cashierId") final Long cashierId, @QueryParam("currencyCode") @ApiParam(value = "currencyCode") final String currencyCode,
|
||||
@QueryParam("offset") @ApiParam(value = "offset") final Integer offset, @QueryParam("limit") @ApiParam(value = "limit") final Integer limit,
|
||||
@QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy, @QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder) {
|
||||
final TellerData teller = this.readPlatformService.findTeller(tellerId);
|
||||
final CashierData cashier = this.readPlatformService.findCashier(cashierId);
|
||||
|
||||
@@ -290,7 +326,9 @@ public class TellerApiResource {
|
||||
@Path("{tellerId}/cashiers/{cashierId}/transactions/template")
|
||||
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getCashierTxnTemplate(@PathParam("tellerId") final Long tellerId, @PathParam("cashierId") final Long cashierId) {
|
||||
@ApiOperation(value = "Retrieve Cashier Transaction Template", notes = "")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = TellerApiResourceSwagger.GetTellersTellerIdCashiersCashiersIdTransactionsTemplateResponse.class)})
|
||||
public String getCashierTxnTemplate(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, @PathParam("cashierId") @ApiParam(value = "cashierId") final Long cashierId) {
|
||||
|
||||
final CashierTransactionData cashierTxnTemplate = this.readPlatformService.retrieveCashierTxnTemplate(cashierId);
|
||||
|
||||
@@ -301,7 +339,7 @@ public class TellerApiResource {
|
||||
@Path("{tellerId}/transactions")
|
||||
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getTransactionData(@PathParam("tellerId") final Long tellerId, @QueryParam("dateRange") final String dateRange) {
|
||||
public String getTransactionData(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, @QueryParam("dateRange") @ApiParam(value = "dateRange") final String dateRange) {
|
||||
final DateRange dateRangeHolder = DateRange.fromString(dateRange);
|
||||
|
||||
final Collection<TellerTransactionData> transactions = this.readPlatformService.fetchTellerTransactionsByTellerId(tellerId,
|
||||
@@ -314,7 +352,7 @@ public class TellerApiResource {
|
||||
@Path("{tellerId}/transactions/{transactionId}")
|
||||
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String findTransactionData(@PathParam("tellerId") final Long tellerid, @PathParam("transactionId") final Long transactionId) {
|
||||
public String findTransactionData(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerid, @PathParam("transactionId") @ApiParam(value = "transactionId") final Long transactionId) {
|
||||
final TellerTransactionData transaction = this.readPlatformService.findTellerTransaction(transactionId);
|
||||
|
||||
return this.jsonSerializer.serialize(transaction);
|
||||
@@ -324,8 +362,8 @@ public class TellerApiResource {
|
||||
@Path("{tellerId}/journals")
|
||||
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getJournalData(@PathParam("tellerId") final Long tellerId, @QueryParam("cashierId") final Long cashierDate,
|
||||
@QueryParam("dateRange") final String dateRange) {
|
||||
public String getJournalData(@PathParam("tellerId") @ApiParam(value = "tellerId") final Long tellerId, @QueryParam("cashierId") @ApiParam(value = "cashierId") final Long cashierDate,
|
||||
@QueryParam("dateRange") @ApiParam(value = "dateRange") final String dateRange) {
|
||||
final DateRange dateRangeHolder = DateRange.fromString(dateRange);
|
||||
|
||||
final Collection<TellerJournalData> journals = this.readPlatformService.fetchTellerJournals(tellerId, cashierDate,
|
||||
|
||||
+446
@@ -0,0 +1,446 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.organisation.teller.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.organisation.monetary.data.CurrencyData;
|
||||
import org.apache.fineract.organisation.staff.data.StaffData;
|
||||
import org.apache.fineract.organisation.teller.data.CashierData;
|
||||
import org.apache.fineract.organisation.teller.data.CashierTransactionData;
|
||||
import org.apache.fineract.organisation.teller.domain.CashierTxnType;
|
||||
import org.apache.fineract.organisation.teller.domain.TellerStatus;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 20/8/17.
|
||||
*/
|
||||
final class TellerApiResourceSwagger {
|
||||
private TellerApiResourceSwagger(){
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetTellersResponse")
|
||||
public static final class GetTellersResponse {
|
||||
private GetTellersResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "3")
|
||||
public Long id;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "0")
|
||||
public Long debitAccountId;
|
||||
@ApiModelProperty(example = "0")
|
||||
public Long creditAccountId;
|
||||
@ApiModelProperty(example = "Teller3")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "[2015,2,1]")
|
||||
public LocalDate startDate;
|
||||
@ApiModelProperty(example = "ACTIVE")
|
||||
public TellerStatus status;
|
||||
@ApiModelProperty(example = "Head Office")
|
||||
public String officeName;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostTellersRequest")
|
||||
public static final class PostTellersRequest {
|
||||
private PostTellersRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "Teller3")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "cash handling")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "ACTIVE")
|
||||
public TellerStatus status;
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "dd-MM-yyyy")
|
||||
public String dateFormat;
|
||||
@ApiModelProperty(example = "01 February 2015")
|
||||
public LocalDate startDate;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostTellersResponse")
|
||||
public static final class PostTellersResponse {
|
||||
private PostTellersResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "5")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutTellersRequest")
|
||||
public static final class PutTellersRequest {
|
||||
private PutTellersRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "Teller3")
|
||||
public String name;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "teller cash handling")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "ACTIVE")
|
||||
public TellerStatus status;
|
||||
@ApiModelProperty(example = "28 February 2015")
|
||||
public LocalDate endDate;
|
||||
@ApiModelProperty(example = "01 February 2015")
|
||||
public LocalDate startDate;
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "dd-MM-yyyy")
|
||||
public String dateFormat;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutTellersResponse")
|
||||
public static final class PutTellersResponse {
|
||||
private PutTellersResponse() {
|
||||
|
||||
}
|
||||
final class PutTellersResponseChanges {
|
||||
private PutTellersResponseChanges() {}
|
||||
@ApiModelProperty(example = "teller cash handling")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "28 February 2015")
|
||||
public LocalDate endDate;
|
||||
@ApiModelProperty(example = "01 February 2015")
|
||||
public LocalDate startDate;
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "dd-MM-yyyy")
|
||||
public String dateFormat;
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "5")
|
||||
public Long resourceId;
|
||||
public PutTellersResponseChanges changes;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetTellersTellerIdCashiersResponse")
|
||||
public static final class GetTellersTellerIdCashiersResponse {
|
||||
private GetTellersTellerIdCashiersResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long tellerId;
|
||||
@ApiModelProperty(example = "Teller1")
|
||||
public String tellerName;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "Head Office")
|
||||
public String officeName;
|
||||
public Collection<CashierData> cashiers;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostTellersTellerIdCashiersRequest")
|
||||
public static final class PostTellersTellerIdCashiersRequest {
|
||||
private PostTellersTellerIdCashiersRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "28 February 2015")
|
||||
public LocalDate endDate;
|
||||
@ApiModelProperty(example = "teller cash handling")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "true")
|
||||
public Boolean isFullDay;
|
||||
@ApiModelProperty(example = "3")
|
||||
public Long staffId;
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "dd-MM-yyyy")
|
||||
public String dateFormat;
|
||||
@ApiModelProperty(example = "01 February 2015")
|
||||
public LocalDate startDate;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostTellersTellerIdCashiersResponse")
|
||||
public static final class PostTellersTellerIdCashiersResponse {
|
||||
private PostTellersTellerIdCashiersResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
@ApiModelProperty(example = "2")
|
||||
public Long subResourceId;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetTellersTellerIdCashiersCashierIdResponse")
|
||||
public static final class GetTellersTellerIdCashiersCashierIdResponse {
|
||||
private GetTellersTellerIdCashiersCashierIdResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long id;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long tellerId;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long staffId;
|
||||
@ApiModelProperty(example = "")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "Feb 20, 2015 12:00:00 AM")
|
||||
public LocalDate startDate;
|
||||
@ApiModelProperty(example = "Feb 27, 2015 12:00:00 AM")
|
||||
public LocalDate endDate;
|
||||
@ApiModelProperty(example = "true")
|
||||
public Boolean isFullDay;
|
||||
@ApiModelProperty(example = "")
|
||||
public String startTime;
|
||||
@ApiModelProperty(example = "")
|
||||
public String endTime;
|
||||
@ApiModelProperty(example = "Teller1")
|
||||
public String tellerName;
|
||||
@ApiModelProperty(example = "Staff1, Test")
|
||||
public String staffName;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutTellersTellerIdCashiersCashierIdRequest")
|
||||
public static final class PutTellersTellerIdCashiersCashierIdRequest {
|
||||
private PutTellersTellerIdCashiersCashierIdRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "25 February 2015")
|
||||
public LocalDate endDate;
|
||||
@ApiModelProperty(example = "Cashier updated.")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "true")
|
||||
public Boolean isFullDay;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long staffId;
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "dd-MM-yyyy")
|
||||
public String dateFormat;
|
||||
@ApiModelProperty(example = "01 February 2015")
|
||||
public LocalDate startDate;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutTellersTellerIdCashiersCashierIdResponse")
|
||||
public static final class PutTellersTellerIdCashiersCashierIdResponse {
|
||||
private PutTellersTellerIdCashiersCashierIdResponse() {
|
||||
|
||||
}
|
||||
final class PutTellersTellerIdCashiersCashierIdResponseChanges {
|
||||
private PutTellersTellerIdCashiersCashierIdResponseChanges() {}
|
||||
@ApiModelProperty(example = "25 February 2015")
|
||||
public LocalDate endDate;
|
||||
@ApiModelProperty(example = "Cashier updated.")
|
||||
public String description;
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "dd-MM-yyyy")
|
||||
public String dateFormat;
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
@ApiModelProperty(example = "2")
|
||||
public Long subResourceId;
|
||||
public PutTellersTellerIdCashiersCashierIdResponseChanges changes;
|
||||
}
|
||||
|
||||
@ApiModel(value = "DeleteTellersTellerIdCashiersCashierIdResponse")
|
||||
public static final class DeleteTellersTellerIdCashiersCashierIdResponse {
|
||||
private DeleteTellersTellerIdCashiersCashierIdResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetTellersTellerIdCashiersTemplateResponse")
|
||||
public static final class GetTellersTellerIdCashiersTemplateResponse {
|
||||
private GetTellersTellerIdCashiersTemplateResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long tellerId;
|
||||
@ApiModelProperty(example = "Teller1")
|
||||
public String tellerName;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "Head Office")
|
||||
public String officeName;
|
||||
public Collection<StaffData> staffOptions;
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetTellersTellerIdCashiersCashiersIdTransactionsResponse")
|
||||
public static final class GetTellersTellerIdCashiersCashiersIdTransactionsResponse {
|
||||
private GetTellersTellerIdCashiersCashiersIdTransactionsResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "8")
|
||||
public Long id;
|
||||
@ApiModelProperty(example = "15")
|
||||
public Long cashierId;
|
||||
public CashierTxnType txnType;
|
||||
@ApiModelProperty(example = "1000")
|
||||
public BigDecimal txnAmount;
|
||||
@ApiModelProperty(example = "Feb 25, 2015 12:00:00 AM")
|
||||
public Date txnDate;
|
||||
@ApiModelProperty(example = "2")
|
||||
public Long entityId;
|
||||
@ApiModelProperty(example = "loans")
|
||||
public String entityType;
|
||||
@ApiModelProperty(example = "Disbursement, Loan:2-000000002,Client:1-Test 1")
|
||||
public String txnNote;
|
||||
@ApiModelProperty(example = "Feb 25, 2015 12:00:00 AM")
|
||||
public Date createdDate;
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long officeId;
|
||||
@ApiModelProperty(example = "Head Office")
|
||||
public String officeName;
|
||||
@ApiModelProperty(example = "0")
|
||||
public Long tellerId;
|
||||
@ApiModelProperty(example = "B, Ramesh")
|
||||
public String cashierName;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostTellersTellerIdCashiersCashierIdAllocateRequest")
|
||||
public static final class PostTellersTellerIdCashiersCashierIdAllocateRequest {
|
||||
private PostTellersTellerIdCashiersCashierIdAllocateRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "USD")
|
||||
public String currencyCode;
|
||||
@ApiModelProperty(example = "5000")
|
||||
public BigDecimal txnAmount;
|
||||
@ApiModelProperty(example = "allocating cash")
|
||||
public String txnNote;
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "dd-MM-yyyy")
|
||||
public String dateFormat;
|
||||
@ApiModelProperty(example = "01 February 2015")
|
||||
public Date txnDate;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostTellersTellerIdCashiersCashierIdAllocateResponse")
|
||||
public static final class PostTellersTellerIdCashiersCashierIdAllocateResponse {
|
||||
private PostTellersTellerIdCashiersCashierIdAllocateResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
@ApiModelProperty(example = "4")
|
||||
public Long subResourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostTellersTellerIdCashiersCashierIdSettleRequest")
|
||||
public static final class PostTellersTellerIdCashiersCashierIdSettleRequest {
|
||||
private PostTellersTellerIdCashiersCashierIdSettleRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "USD")
|
||||
public String currencyCode;
|
||||
@ApiModelProperty(example = "2000")
|
||||
public BigDecimal txnAmount;
|
||||
@ApiModelProperty(example = "cash settlement")
|
||||
public String txnNote;
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "dd-MM-yyyy")
|
||||
public String dateFormat;
|
||||
@ApiModelProperty(example = "20 February 2015")
|
||||
public Date txnDate;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "PostTellersTellerIdCashiersCashierIdSettleResponse")
|
||||
public static final class PostTellersTellerIdCashiersCashierIdSettleResponse {
|
||||
private PostTellersTellerIdCashiersCashierIdSettleResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
@ApiModelProperty(example = "5")
|
||||
public Long subResourceId;
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetTellersTellerIdCashiersCashiersIdSummaryAndTransactionsResponse")
|
||||
public static final class GetTellersTellerIdCashiersCashiersIdSummaryAndTransactionsResponse {
|
||||
private GetTellersTellerIdCashiersCashiersIdSummaryAndTransactionsResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "7000.000000")
|
||||
public BigDecimal sumCashAllocation;
|
||||
@ApiModelProperty(example = "0")
|
||||
public BigDecimal sumInwardCash;
|
||||
@ApiModelProperty(example = "0")
|
||||
public BigDecimal sumOutwardCash;
|
||||
@ApiModelProperty(example = "50.000000")
|
||||
public BigDecimal sumCashSettlement;
|
||||
@ApiModelProperty(example = "6950.000000")
|
||||
public BigDecimal netCash;
|
||||
@ApiModelProperty(example = "Head Office")
|
||||
public String officeName;
|
||||
@ApiModelProperty(example = "1")
|
||||
public long tellerId;
|
||||
@ApiModelProperty(example = "Teller1")
|
||||
public String tellerName;
|
||||
@ApiModelProperty(example = "1")
|
||||
public long cashierId;
|
||||
@ApiModelProperty(example = "Staff1, Test")
|
||||
public String cashierName;
|
||||
public Page<CashierTransactionData> cashierTransactions;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetTellersTellerIdCashiersCashiersIdTransactionsTemplateResponse")
|
||||
public static final class GetTellersTellerIdCashiersCashiersIdTransactionsTemplateResponse {
|
||||
private GetTellersTellerIdCashiersCashiersIdTransactionsTemplateResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long cashierId;
|
||||
@ApiModelProperty(example = "Head Office")
|
||||
public String officeName;
|
||||
@ApiModelProperty(example = "0")
|
||||
public Long tellerId;
|
||||
@ApiModelProperty(example = "Teller1")
|
||||
public String tellerName;
|
||||
@ApiModelProperty(example = "Staff1, Test")
|
||||
public String cashierName;
|
||||
public CashierData cashierData;
|
||||
@ApiModelProperty(example = "Feb 20, 2015 12:00:00 AM")
|
||||
public LocalDate startDate;
|
||||
@ApiModelProperty(example = "Feb 27, 2015 12:00:00 AM")
|
||||
public LocalDate endDate;
|
||||
public Collection<CurrencyData> currencyOptions;
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -27,6 +27,7 @@ import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.organisation.teller.data.TellerData;
|
||||
@@ -40,6 +41,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("cashiersjournal")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "cashiersjournal", description = "")
|
||||
public class TellerJournalApiResource {
|
||||
|
||||
private final PlatformSecurityContext securityContext;
|
||||
|
||||
+10
-1
@@ -27,6 +27,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -44,6 +45,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/workingdays")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Working days", description = "The days of the week that are workdays.\n" + "\n" + "Rescheduling of repayments when it falls on a non-working is turned on /off by enable/disable reschedule-future-repayments parameter in Global configurations.\n" + "\n" + "Allow transactions on non-working days is configurable by enabling/disbaling the allow-transactions-on-non_workingday parameter in Global configurations.")
|
||||
public class WorkingDaysApiResource {
|
||||
|
||||
private final DefaultToApiJsonSerializer<WorkingDaysData> toApiJsonSerializer;
|
||||
@@ -67,6 +69,8 @@ public class WorkingDaysApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "List Working days", notes = "Example Requests:\n" + "\n" + "workingdays")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = WorkingDaysApiResourceSwagger.GetWorkingDaysResponse.class, responseContainer = "list")})
|
||||
public String retrieveAll(@Context final UriInfo uriInfo) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(WorkingDaysApiConstants.WORKING_DAYS_RESOURCE_NAME);
|
||||
final WorkingDaysData workingDaysData = this.workingDaysReadPlatformService.retrieve();
|
||||
@@ -78,7 +82,10 @@ public class WorkingDaysApiResource {
|
||||
@PUT
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String update(final String jsonRequestBody) {
|
||||
@ApiOperation(value = "Update a Working Day", notes = "Mandatory Fields\n" + "recurrence,repaymentRescheduleType,extendTermForDailyRepayments,locale")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = WorkingDaysApiResourceSwagger.PutWorkingDaysRequest.class )})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = WorkingDaysApiResourceSwagger.PutWorkingDaysResponse.class)})
|
||||
public String update(@ApiParam(hidden = true) final String jsonRequestBody) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateWorkingDays().withJson(jsonRequestBody).build();
|
||||
|
||||
@@ -91,6 +98,8 @@ public class WorkingDaysApiResource {
|
||||
@Path("/template")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Working Days Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for working days.\n" + "\n" + "Example Request:\n" + "\n" + "workingdays/template")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = WorkingDaysApiResourceSwagger.GetWorkingDaysTemplateResponse.class )})
|
||||
public String template(@Context final UriInfo uriInfo) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(WorkingDaysApiConstants.WORKING_DAYS_RESOURCE_NAME);
|
||||
|
||||
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.organisation.workingdays.api;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 19/8/17.
|
||||
*/
|
||||
|
||||
final class WorkingDaysApiResourceSwagger {
|
||||
private WorkingDaysApiResourceSwagger() {
|
||||
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetWorkingDaysResponse")
|
||||
public static final class GetWorkingDaysResponse {
|
||||
private GetWorkingDaysResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long id;
|
||||
@ApiModelProperty(example = "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR")
|
||||
public String recurrence;
|
||||
public EnumOptionData repaymentRescheduleType;
|
||||
@ApiModelProperty(example = "true")
|
||||
public Boolean extendTermForDailyRepayments;
|
||||
}
|
||||
|
||||
@ApiModel(value = "GetWorkingDaysTemplateResponse")
|
||||
public static final class GetWorkingDaysTemplateResponse {
|
||||
private GetWorkingDaysTemplateResponse() {
|
||||
|
||||
}
|
||||
public Collection<EnumOptionData> repaymentRescheduleOptions;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutWorkingDaysRequest")
|
||||
public static final class PutWorkingDaysRequest {
|
||||
private PutWorkingDaysRequest() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR")
|
||||
public String recurrence;
|
||||
@ApiModelProperty(example = "en")
|
||||
public String locale;
|
||||
@ApiModelProperty(example = "4")
|
||||
public EnumOptionData repaymentRescheduleType;
|
||||
@ApiModelProperty(example = "true")
|
||||
public Boolean extendTermForDailyRepayments;
|
||||
}
|
||||
|
||||
@ApiModel(value = "PutWorkingDaysResponse")
|
||||
public static final class PutWorkingDaysResponse {
|
||||
private PutWorkingDaysResponse() {
|
||||
|
||||
}
|
||||
@ApiModelProperty(example = "1")
|
||||
public Long resourceId;
|
||||
}
|
||||
}
|
||||
+28
-17
@@ -35,6 +35,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -45,6 +46,8 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.portfolio.address.data.AddressData;
|
||||
import org.apache.fineract.portfolio.address.service.AddressReadPlatformServiceImpl;
|
||||
import org.apache.fineract.portfolio.client.data.ClientApiCollectionConstants;
|
||||
import org.apache.fineract.portfolio.client.data.ClientData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -52,6 +55,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/client")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Clients Address", description = "Address module is an optional module and can be configured into the system by using GlobalConfiguration setting: enable-address. In order to activate Address module, we need to enable the configuration, enable-address by setting its value to true.")
|
||||
public class ClientAddressApiResources {
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("addressId", "street",
|
||||
"addressLine1", "addressLine2", "addressLine3", "townVillage", "city", "countyDistrict", "stateProvinceId",
|
||||
@@ -93,12 +97,31 @@ public class ClientAddressApiResources {
|
||||
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/{clientid}/addresses")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Create an address for a Client", notes = "Mandatory Fields : \n" + "type and clientId")
|
||||
@ApiResponses(value = { @ApiResponse(code = 200, message = "", response = CommandProcessingResult.class) })
|
||||
public String AddClientAddress(@QueryParam("type") final long addressTypeId,
|
||||
@PathParam("clientid") final long clientid, final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().addClientAddress(clientid, addressTypeId)
|
||||
.withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{clientid}/addresses")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "List all addresses for a Client", notes = "Example Requests:\n" + "\n" +"client/1/addresses\n" + "\n" + "\n" +"clients/1/addresses?status=false,true&&type=1,2,3" )
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = AddressData.class)})
|
||||
public String getAddresses(@QueryParam("status") final String status, @QueryParam("type") final long addressTypeId,
|
||||
@PathParam("clientid") final long clientid, @Context final UriInfo uriInfo) {
|
||||
@PathParam("clientid") final long clientid, @Context final UriInfo uriInfo) {
|
||||
Collection<AddressData> address;
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
@@ -119,26 +142,14 @@ public class ClientAddressApiResources {
|
||||
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/{clientid}/addresses")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String AddClientAddress(@QueryParam("type") final long addressTypeId,
|
||||
@PathParam("clientid") final long clientid, final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().addClientAddress(clientid, addressTypeId)
|
||||
.withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
|
||||
@PUT
|
||||
@Path("/{clientid}/addresses")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String UpdateClientAddress(@PathParam("clientid") final long clientid, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "update an address for a Client", notes = "All the address fields can be updated by using update client address API\n" + "\n" + "Mandatory Fields\n" + "type and addressId")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", dataType = "body", dataTypeClass = ClientApiConstants.class)})
|
||||
@ApiResponses(value = { @ApiResponse(code = 200, message = "", response = CommandProcessingResult.class) })
|
||||
public String UpdateClientAddress(@PathParam("clientid") final long clientid, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateClientAddress(clientid)
|
||||
.withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
+15
-1
@@ -35,6 +35,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
@@ -51,7 +52,9 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
|
||||
import org.apache.fineract.portfolio.charge.data.ChargeData;
|
||||
import org.apache.fineract.portfolio.charge.service.ChargeReadPlatformService;
|
||||
import org.apache.fineract.portfolio.client.data.ClientChargeData;
|
||||
import org.apache.fineract.portfolio.client.data.ClientData;
|
||||
import org.apache.fineract.portfolio.client.data.ClientTransactionData;
|
||||
import org.apache.fineract.portfolio.client.domain.ClientCharge;
|
||||
import org.apache.fineract.portfolio.client.service.ClientChargeReadPlatformService;
|
||||
import org.apache.fineract.portfolio.client.service.ClientTransactionReadPlatformService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -60,6 +63,7 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
@Path("/clients/{clientId}/charges")
|
||||
@Component
|
||||
@Api(value = "Client Charges", description = "It is typical for MFI's to directly associate charges with an implicit Client account. These can be either fees or penalties\n" + "\n" + "Client Charges are client specific instances of Charges. Refer Charges for documentation of the various properties of a charge, Only additional properties ( specific to the context of a Charge being associated with a Client account) are described here")
|
||||
public class ClientChargesApiResource {
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -89,6 +93,8 @@ public class ClientChargesApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "List Client Charges", notes = "The list capability of client charges supports pagination." + "Example Requests:\n" + "clients/1/charges\n" + "\nclients/1/charges?offset=0&limit=5" )
|
||||
@ApiResponses(value = { @ApiResponse(code = 200, message = "", response = ClientCharge.class) })
|
||||
public String retrieveAllClientCharges(@PathParam("clientId") final Long clientId,
|
||||
@DefaultValue(ClientApiConstants.CLIENT_CHARGE_QUERY_PARAM_STATUS_VALUE_ALL) @QueryParam(ClientApiConstants.CLIENT_CHARGE_QUERY_PARAM_STATUS) final String chargeStatus,
|
||||
@QueryParam("pendingPayment") final Boolean pendingPayment, @Context final UriInfo uriInfo,
|
||||
@@ -134,6 +140,8 @@ public class ClientChargesApiResource {
|
||||
@Path("{chargeId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve a Client Charge", notes = "Example Requests:\n" + "clients/1/charges/1\n" + "\n" + "\n" + "clients/1/charges/1?fields=name,id" )
|
||||
@ApiResponses(value = { @ApiResponse(code = 200, message = "", response = ClientChargeData.class) })
|
||||
public String retrieveClientCharge(@PathParam("clientId") final Long clientId, @PathParam("chargeId") final Long chargeId,
|
||||
@Context final UriInfo uriInfo) {
|
||||
|
||||
@@ -161,7 +169,10 @@ public class ClientChargesApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String applyClientCharge(@PathParam("clientId") final Long clientId, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Add Client Charge", notes = " This API associates a Client charge with an implicit Client account\n" + "Mandatory Fields : \n" + "chargeId and dueDate \n" + "Optional Fields : \n" + "amount" )
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", dataType = "body", dataTypeClass = ClientData.class )})
|
||||
@ApiResponses(value = { @ApiResponse(code = 200, message = "", response = CommandProcessingResult.class) })
|
||||
public String applyClientCharge(@PathParam("clientId") final Long clientId, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createClientCharge(clientId).withJson(apiRequestBodyAsJson)
|
||||
.build();
|
||||
@@ -175,6 +186,7 @@ public class ClientChargesApiResource {
|
||||
@Path("{chargeId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Pay a Client Charge", notes = "Mandatory Fields\n" + "transactionDate and amount " + "" + "\"Pay either a part of or the entire due amount for a charge.(command=paycharge)\n" + "\n" + "Waive a Client Charge\n" + "\n" + "\n" + "This API provides the facility of waiving off the remaining amount on a client charge (command=waive)\n" )
|
||||
public String payOrWaiveClientCharge(@PathParam("clientId") final Long clientId, @PathParam("chargeId") final Long chargeId,
|
||||
@QueryParam("command") final String commandParam, final String apiRequestBodyAsJson) {
|
||||
|
||||
@@ -211,6 +223,8 @@ public class ClientChargesApiResource {
|
||||
@Path("{chargeId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Delete a Client Charge", notes = "Deletes a Client Charge on which no transactions have taken place (either payments or waivers). ")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CommandProcessingResult.class)})
|
||||
public String deleteClientCharge(@PathParam("clientId") final Long clientId, @PathParam("chargeId") final Long chargeId) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteClientCharge(clientId, chargeId).build();
|
||||
|
||||
+19
-2
@@ -35,6 +35,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
@@ -47,6 +48,7 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.portfolio.client.data.ClientData;
|
||||
import org.apache.fineract.portfolio.client.data.ClientIdentifierData;
|
||||
import org.apache.fineract.portfolio.client.domain.ClientIdentifier;
|
||||
import org.apache.fineract.portfolio.client.exception.DuplicateClientIdentifierException;
|
||||
import org.apache.fineract.portfolio.client.service.ClientIdentifierReadPlatformService;
|
||||
import org.apache.fineract.portfolio.client.service.ClientReadPlatformService;
|
||||
@@ -57,6 +59,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/clients/{clientId}/identifiers")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Client Identifier Api", description = "Client Identifiers refer to documents that are used to uniquely identify a customer\n" + "Ex: Drivers License, Passport, Ration card etc ")
|
||||
public class ClientIdentifiersApiResource {
|
||||
|
||||
private static final Set<String> CLIENT_IDENTIFIER_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "clientId",
|
||||
@@ -91,6 +94,8 @@ public class ClientIdentifiersApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "List all Identifiers for a Client", notes = "Example Requests:\n" + "clients/1/identifiers\n" + "\n" + "\n" + "clients/1/identifiers?fields=documentKey,documentType,description")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ClientIdentifierData.class)})
|
||||
public String retrieveAllClientIdentifiers(@Context final UriInfo uriInfo, @PathParam("clientId") final Long clientId) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
@@ -106,6 +111,8 @@ public class ClientIdentifiersApiResource {
|
||||
@Path("template")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve Client Identifier Details Template", notes = "This is a convenience resource useful for building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "\n" + " Field Defaults\n" + " Allowed Value Lists\n" + "\n\nExample Request:\n" + "clients/1/identifiers/template" )
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ClientIdentifierData.class)})
|
||||
public String newClientIdentifierDetails(@Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
@@ -120,7 +127,10 @@ public class ClientIdentifiersApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createClientIdentifier(@PathParam("clientId") final Long clientId, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create an Identifier for a Client", notes = "Mandatory Fields\n" + "documentKey, documentTypeId " )
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", dataType = "body", dataTypeClass = ClientData.class)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CommandProcessingResult.class)})
|
||||
public String createClientIdentifier(@PathParam("clientId") final Long clientId, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
try {
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createClientIdentifier(clientId)
|
||||
@@ -146,6 +156,8 @@ public class ClientIdentifiersApiResource {
|
||||
@Path("{identifierId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve a Client Identifier", notes = "Example Requests:\n" + "clients/1/identifier/2\n" + "\n" + "\n" + "clients/1/identifier/2?template=true\n" + "\n" + "clients/1/identifiers/2?fields=documentKey,documentType,description" )
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ClientIdentifierData.class)})
|
||||
public String retrieveClientIdentifiers(@PathParam("clientId") final Long clientId,
|
||||
@PathParam("identifierId") final Long clientIdentifierId, @Context final UriInfo uriInfo) {
|
||||
|
||||
@@ -167,8 +179,11 @@ public class ClientIdentifiersApiResource {
|
||||
@Path("{identifierId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Update a Client Identifier")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", dataType = "body", dataTypeClass = ClientData.class)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CommandProcessingResult.class)})
|
||||
public String updateClientIdentifer(@PathParam("clientId") final Long clientId,
|
||||
@PathParam("identifierId") final Long clientIdentifierId, final String apiRequestBodyAsJson) {
|
||||
@PathParam("identifierId") final Long clientIdentifierId, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
try {
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateClientIdentifier(clientId, clientIdentifierId)
|
||||
@@ -193,6 +208,8 @@ public class ClientIdentifiersApiResource {
|
||||
@Path("{identifierId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Delete a Client Identifier")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CommandProcessingResult.class)})
|
||||
public String deleteClientIdentifier(@PathParam("clientId") final Long clientId,
|
||||
@PathParam("identifierId") final Long clientIdentifierId) {
|
||||
|
||||
|
||||
+12
-1
@@ -29,6 +29,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
@@ -41,13 +42,16 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.portfolio.client.data.ClientData;
|
||||
import org.apache.fineract.portfolio.client.data.ClientTransactionData;
|
||||
import org.apache.fineract.portfolio.client.domain.ClientTransaction;
|
||||
import org.apache.fineract.portfolio.client.service.ClientTransactionReadPlatformService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Path("/clients/{clientId}/transactions")
|
||||
@Component
|
||||
@Api(value = "Client Transaction", description = "Client Transactions refer to transactions made directly againt a Client's internal account. Currently, these transactions are only created as a result of charge payments/waivers. You are allowed to undo a transaction, however you cannot explicitly create one. ")
|
||||
public class ClientTransactionsApiResource {
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -72,6 +76,8 @@ public class ClientTransactionsApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "List Client Transactions", notes = "The list capability of client transaction can support pagination." + "\n\nMandatory Arguments : " + "offset\n" + " Integer Mandatory, defaults to 0 \n" + " Indicates the result from which pagination starts\n" + "limit\n" + " Integer Mandatory, defaults to 200 \n" + " Restricts the size of results returned. To override the default and return all entries you must explicitly pass a non-positive integer value for limit e.g. limit=0, or limit=-1\n" + "\n" + "\n\n" + "Example Requests:\n" + "clients/189/transactions\n" + "clients/189/transactions?offset=10&limit=50" )
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ClientTransactionData.class)})
|
||||
public String retrieveAllClientTransactions(@PathParam("clientId") final Long clientId, @Context final UriInfo uriInfo,
|
||||
@QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_CHARGES_RESOURCE_NAME);
|
||||
@@ -89,6 +95,8 @@ public class ClientTransactionsApiResource {
|
||||
@Path("{transactionId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve a Client Transaction", notes = "Example Requests:\n" + "clients/1/transactions/1\n" + "\n" + "\n" + "clients/1/transactions/1?fields=id,officeName" )
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ClientTransactionData.class)})
|
||||
public String retrieveClientTransaction(@PathParam("clientId") final Long clientId,
|
||||
@PathParam("transactionId") final Long transactionId, @Context final UriInfo uriInfo) {
|
||||
|
||||
@@ -106,8 +114,11 @@ public class ClientTransactionsApiResource {
|
||||
@Path("{transactionId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Undo a Client Transaction")
|
||||
@ApiImplicitParams({@ApiImplicitParam(value = "body", dataType = "body", dataTypeClass = ClientData.class)})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = CommandProcessingResult.class)})
|
||||
public String undoClientTransaction(@PathParam("clientId") final Long clientId, @PathParam("transactionId") final Long transactionId,
|
||||
@QueryParam("command") final String commandParam, final String apiRequestBodyAsJson) {
|
||||
@QueryParam("command") final String commandParam, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
String json = "";
|
||||
if (is(commandParam, ClientApiConstants.CLIENT_TRANSACTION_COMMAND_UNDO)) {
|
||||
|
||||
+32
-5
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.client.api;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@@ -37,6 +38,7 @@ import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
@@ -62,6 +64,7 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/clients")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "Client Api", description = "Clients are people and businesses that have applied (or may apply) to an MFI for loans.\n" + "\n" + "Clients can be created in Pending or straight into Active state.")
|
||||
public class ClientsApiResource {
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -95,9 +98,11 @@ public class ClientsApiResource {
|
||||
@Path("template")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveTemplate(@Context final UriInfo uriInfo, @QueryParam("officeId") final Long officeId,
|
||||
@QueryParam("commandParam") final String commandParam,
|
||||
@DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) {
|
||||
@ApiOperation(value = "Retrieve Client Details Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" + "\n" + "Field Defaults\n" + "Allowed Value Lists" + "Example Request:\n" + "\n" + "clients/template")
|
||||
@ApiResponses(value = { @ApiResponse(code = 200, message = "", response = ClientData.class) })
|
||||
public String retrieveTemplate(@Context final UriInfo uriInfo, @ApiParam(value = "optional") @QueryParam("officeId") final Long officeId,
|
||||
@ApiParam(value = "optional If commandParam=close retrieves all closureReasons which are associated with \"ClientClosureReason\" value.", defaultValue = "false") @QueryParam("commandParam") final String commandParam,
|
||||
@DefaultValue("false") @ApiParam(value = "optional Defaults to false if not provided. If staffInSelectedOfficeOnly=true only staff who are associated with the selected branch are returned.") @QueryParam("staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||
|
||||
@@ -122,6 +127,9 @@ public class ClientsApiResource {
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "List Clients",
|
||||
notes = "Example Requests:\n" + "\n" + "clients\n" + "\n" + "clients?fields=displayName,officeName,timeline\n" + "\n" + "clients?offset=10&limit=50\n" + "\n" + "clients?orderBy=displayName&sortOrder=DESC" )
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ClientData.class)})
|
||||
public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("sqlSearch") final String sqlSearch,
|
||||
@QueryParam("officeId") final Long officeId, @QueryParam("externalId") final String externalId,
|
||||
@QueryParam("displayName") final String displayName, @QueryParam("firstName") final String firstname,
|
||||
@@ -157,6 +165,8 @@ public class ClientsApiResource {
|
||||
@Path("{clientId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve a Client", notes = "Example Requests:\n" + "\n" + "clients/1\n" +"\n" + "\n" + "clients/1?template=true\n" + "\n" + "\n" + "clients/1?fields=id,displayName,officeName" )
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = ClientData.class)})
|
||||
public String retrieveOne(@PathParam("clientId") final Long clientId, @Context final UriInfo uriInfo,
|
||||
@DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) {
|
||||
|
||||
@@ -181,7 +191,11 @@ public class ClientsApiResource {
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String create(final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Create a Client", httpMethod = "POST", notes = "Note:" + "\n" + "1. You can enter either:firstname/middlename/lastname - for a person (middlename is optional) OR fullname - for a business or organisation (or person known by one name).\n" + "\n" + "2.If address is enable(enable-address=true), then additional field called address has to be passed.", response = CommandProcessingResult.class, consumes="application/json")
|
||||
@ApiImplicitParams({@ApiImplicitParam( paramType = "body", dataType = "ClientData", required = true, type = "body", dataTypeClass = ClientData.class)})
|
||||
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successfully Client Created", response = CommandProcessingResult.class) })
|
||||
public String create(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.createClient() //
|
||||
@@ -197,7 +211,10 @@ public class ClientsApiResource {
|
||||
@Path("{clientId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String update(@PathParam("clientId") final Long clientId, final String apiRequestBodyAsJson) {
|
||||
@ApiOperation(value = "Update a Client", notes = "You can update any of the basic attributes of a client (but not its associations) using this API.\n" + "\n" + "Changing the relationship between a client and its office is not supported through this API. An API specific to handling transfers of clients between offices is available for the same.\n" + "\n" + "The relationship between a client and a group must be removed through the Groups API." )
|
||||
@ApiImplicitParams({@ApiImplicitParam( paramType = "body", dataType = "ClientData", required = true, type = "body", dataTypeClass = ClientData.class)})
|
||||
@ApiResponses(value = { @ApiResponse(code = 200, message = "", response = CommandProcessingResult.class) })
|
||||
public String update(@ApiParam(value = "ClientId") @PathParam("clientId") final Long clientId, @ApiParam(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.updateClient(clientId) //
|
||||
@@ -213,6 +230,8 @@ public class ClientsApiResource {
|
||||
@Path("{clientId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Delete a Client", notes = "If a client is in Pending state, you are allowed to Delete it. The delete is a 'hard delete' and cannot be recovered from. Once clients become active or have loans or savings associated with them, you cannot delete the client but you may Close the client if they have left the program.")
|
||||
@ApiResponses(value = {@ApiResponse(code = 200, message = "", response = CommandProcessingResult.class) })
|
||||
public String delete(@PathParam("clientId") final Long clientId) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
@@ -228,6 +247,9 @@ public class ClientsApiResource {
|
||||
@Path("{clientId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Activate a Client | Close a Client | Reject a Client | Withdraw a Client | Reactivate a Client | UndoReject a Client | UndoWithdraw a Client | Assign a Staff | Unassign a Staff | Update Default Savings Account | Propose a Client Transfer | Withdraw a Client Transfer | Reject a Client Transfer | Accept a Client Transfer | Propose and Accept a Client Transfer | ",
|
||||
notes = "\n[Reject a Client] Mandatory Fields : rejectionDate, rejectionReasonId\n" + "\n[Withdraw a Client] Mandatory Fields : withdrawalDate, withdrawalReasonId\n" + "\n[Reactivate a Client] Mandatory Fields : reactivationDate\n" + "\n[UndoReject a Client] Mandatory Fields : reopenedDate\n" + "\n[UndoWithdraw a Client]Mandatory Fields : reopenedDate\n" )
|
||||
@ApiImplicitParams({@ApiImplicitParam( paramType = "body", dataType = "body", required = true, type = "body")})
|
||||
public String activate(@PathParam("clientId") final Long clientId, @QueryParam("command") final String commandParam,
|
||||
final String apiRequestBodyAsJson) {
|
||||
|
||||
@@ -299,6 +321,11 @@ public class ClientsApiResource {
|
||||
@Path("{clientId}/accounts")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@ApiOperation(value = "Retrieve client accounts overview", notes = "An example of how a loan portfolio summary can be provided. This is requested in a specific use case of the community application.\n" + "It is quite reasonable to add resources like this to simplify User Interface development.\n" + "\n" + "Example Requests:\n " + "\n" + "clients/1/accounts\n"+ "\n" + "clients/1/accounts?fields=loanAccounts,savingsAccounts" )
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "", response = AccountSummaryCollectionData.class),
|
||||
@ApiResponse(code = 400, message = "Bad Request")
|
||||
})
|
||||
public String retrieveAssociatedAccounts(@PathParam("clientId") final Long clientId, @Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||
|
||||
+55
-1
@@ -21,6 +21,8 @@ package org.apache.fineract.portfolio.client.data;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.builder.CompareToBuilder;
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
@@ -62,17 +64,22 @@ final public class ClientData implements Comparable<ClientData> {
|
||||
private final CodeValueData gender;
|
||||
private final CodeValueData clientType;
|
||||
private final CodeValueData clientClassification;
|
||||
private final Boolean isStaff;
|
||||
private final Boolean isStaff;
|
||||
|
||||
@ApiModelProperty(required = true, hidden = false, dataType = "long")
|
||||
private final Long officeId;
|
||||
|
||||
private final String officeName;
|
||||
private final Long transferToOfficeId;
|
||||
private final String transferToOfficeName;
|
||||
|
||||
@ApiModelProperty(required = false, hidden = true)
|
||||
private final Long imageId;
|
||||
@ApiModelProperty(required = false, hidden = true)
|
||||
private final Boolean imagePresent;
|
||||
private final Long staffId;
|
||||
private final String staffName;
|
||||
@ApiModelProperty(required = false, hidden = true)
|
||||
private final ClientTimelineData timeline;
|
||||
|
||||
private final Long savingsProductId;
|
||||
@@ -421,14 +428,17 @@ final public class ClientData implements Comparable<ClientData> {
|
||||
return this.officeName;
|
||||
}
|
||||
|
||||
@ApiModelProperty(required = false, hidden = true)
|
||||
public Long getImageId() {
|
||||
return this.imageId;
|
||||
}
|
||||
|
||||
@ApiModelProperty(required = false, hidden = true)
|
||||
public Boolean getImagePresent() {
|
||||
return this.imagePresent;
|
||||
}
|
||||
|
||||
@ApiModelProperty(required = false, hidden = true)
|
||||
public ClientTimelineData getTimeline() {
|
||||
return this.timeline;
|
||||
}
|
||||
@@ -483,4 +493,48 @@ final public class ClientData implements Comparable<ClientData> {
|
||||
public Boolean getIsAddressEnabled() {
|
||||
return this.isAddressEnabled;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getFullname() {
|
||||
return fullname;
|
||||
}
|
||||
|
||||
public CodeValueData getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
@ApiModelProperty(required = false, hidden = false)
|
||||
public Boolean getStaff() {
|
||||
return isStaff;
|
||||
}
|
||||
@ApiModelProperty(required = true, hidden = false)
|
||||
public Long getOfficeId() {
|
||||
return officeId;
|
||||
}
|
||||
@ApiModelProperty(required = true, hidden = false)
|
||||
public AddressData getAddress() {
|
||||
return address;
|
||||
}
|
||||
@ApiModelProperty(required = true, hidden = false)
|
||||
public Boolean getAddressEnabled() {
|
||||
return isAddressEnabled;
|
||||
}
|
||||
|
||||
public String getAccountNo() {
|
||||
return accountNo;
|
||||
}
|
||||
@ApiModelProperty(required = true, hidden = false)
|
||||
public String getMiddlename() {
|
||||
return middlename;
|
||||
}
|
||||
@ApiModelProperty(required = true, hidden = false)
|
||||
public Boolean getActive() {
|
||||
return active;
|
||||
}
|
||||
}
|
||||
+12
-4
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.spm.api;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.spm.data.LookupTableData;
|
||||
import org.apache.fineract.spm.domain.LookupTable;
|
||||
@@ -41,6 +42,7 @@ import java.util.List;
|
||||
@Path("/surveys/{surveyId}/lookuptables")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "SPM API - LookUp Table", description = "The Apache Fineract SPM API provides the ability to create custom surveys to collect social performance measurentment data or any additional questionnaire a financial institute want to collect.")
|
||||
public class LookupTableApiResource {
|
||||
|
||||
private final PlatformSecurityContext securityContext;
|
||||
@@ -61,7 +63,9 @@ public class LookupTableApiResource {
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Transactional
|
||||
public List<LookupTableData> fetchLookupTables(@PathParam("surveyId") final Long surveyId) {
|
||||
@ApiOperation(value = "List all Lookup Table entries", notes = "List all Lookup Table entries for a survey.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = LookupTableData.class, responseContainer = "list")})
|
||||
public List<LookupTableData> fetchLookupTables(@PathParam("surveyId") @ApiParam(value = "Enter surveyId") final Long surveyId) {
|
||||
this.securityContext.authenticatedUser();
|
||||
|
||||
final Survey survey = findSurvey(surveyId);
|
||||
@@ -80,8 +84,10 @@ public class LookupTableApiResource {
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Transactional
|
||||
public LookupTableData findLookupTable(@PathParam("surveyId") final Long surveyId,
|
||||
@PathParam("key") final String key) {
|
||||
@ApiOperation(value = "Retrieve a Lookup Table entry", notes = "Retrieve a Lookup Table entry for a survey.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = LookupTableData.class)})
|
||||
public LookupTableData findLookupTable(@PathParam("surveyId") @ApiParam(value = "Enter surveyId") final Long surveyId,
|
||||
@PathParam("key") @ApiParam(value = "Enter key") final String key) {
|
||||
this.securityContext.authenticatedUser();
|
||||
|
||||
findSurvey(surveyId);
|
||||
@@ -99,7 +105,9 @@ public class LookupTableApiResource {
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Transactional
|
||||
public void createLookupTable(@PathParam("surveyId") final Long surveyId,
|
||||
@ApiOperation(value = "Create a Lookup Table entry", notes = "Add a new netry to a survey.\n" + "\n" + "Mandatory Fields\n" + "key, score, validFrom, validTo")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "OK")})
|
||||
public void createLookupTable(@PathParam("surveyId") @ApiParam(value = "Enter surveyId") final Long surveyId,
|
||||
final LookupTableData lookupTableData) {
|
||||
this.securityContext.authenticatedUser();
|
||||
|
||||
|
||||
+10
-4
@@ -29,6 +29,7 @@ import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
|
||||
@@ -48,6 +49,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Path("/surveys/{surveyId}/scorecards")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "SPM - Scorecards", description = " ")
|
||||
public class ScorecardApiResource {
|
||||
|
||||
private final PlatformSecurityContext securityContext;
|
||||
@@ -69,7 +71,9 @@ public class ScorecardApiResource {
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Transactional
|
||||
public List<ScorecardData> findBySurvey(@PathParam("surveyId") final Long surveyId) {
|
||||
@ApiOperation(value = "List all Scorecard entries", notes = "List all Scorecard entries for a survey.")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = Scorecard.class, responseContainer = "list")})
|
||||
public List<ScorecardData> findBySurvey(@PathParam("surveyId") @ApiParam(value = "Enter surveyId") final Long surveyId) {
|
||||
this.securityContext.authenticatedUser();
|
||||
|
||||
final Survey survey = findSurvey(surveyId);
|
||||
@@ -87,7 +91,9 @@ public class ScorecardApiResource {
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Transactional
|
||||
public void createScorecard(@PathParam("surveyId") final Long surveyId, final ScorecardData scorecardData) {
|
||||
@ApiOperation(value = "Create a Scorecard entry", notes = "Add a new netry to a survey.\n" + "\n" + "Mandatory Fields\n" + "clientId, createdOn, questionId, responseId, staffId")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "OK")})
|
||||
public void createScorecard(@PathParam("surveyId") @ApiParam(value = "Enter surveyId") final Long surveyId, @ApiParam(format = "body", type = "body") final ScorecardData scorecardData) {
|
||||
final AppUser appUser = this.securityContext.authenticatedUser();
|
||||
final Survey survey = findSurvey(surveyId);
|
||||
final Client client = this.clientRepositoryWrapper.findOneWithNotFoundDetection(scorecardData.getClientId());
|
||||
@@ -99,8 +105,8 @@ public class ScorecardApiResource {
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Transactional
|
||||
public List<ScorecardData> findBySurveyClient(@PathParam("surveyId") final Long surveyId,
|
||||
@PathParam("clientId") final Long clientId) {
|
||||
public List<ScorecardData> findBySurveyClient(@PathParam("surveyId") @ApiParam(value = "Enter surveyId") final Long surveyId,
|
||||
@PathParam("clientId") @ApiParam(value = "Enter clientId") final Long clientId) {
|
||||
this.securityContext.authenticatedUser();
|
||||
final Survey survey = findSurvey(surveyId);
|
||||
final Client client = this.clientRepositoryWrapper.findOneWithNotFoundDetection(clientId);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.spm.api;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.spm.data.SurveyData;
|
||||
import org.apache.fineract.spm.domain.Survey;
|
||||
@@ -37,6 +38,7 @@ import java.util.List;
|
||||
@Path("/surveys")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Api(value = "SPM - Serveys", description = "")
|
||||
public class SpmApiResource {
|
||||
|
||||
private final PlatformSecurityContext securityContext;
|
||||
@@ -53,6 +55,8 @@ public class SpmApiResource {
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Transactional
|
||||
@ApiOperation(value = "List all Surveys", notes = "")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = SurveyData.class, responseContainer = "list")})
|
||||
public List<SurveyData> fetchActiveSurveys() {
|
||||
this.securityContext.authenticatedUser();
|
||||
|
||||
@@ -74,7 +78,9 @@ public class SpmApiResource {
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Transactional
|
||||
public SurveyData findSurvey(@PathParam("id") final Long id) {
|
||||
@ApiOperation(value = "Retrieve a Survey", notes = "")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "", response = SurveyData.class)})
|
||||
public SurveyData findSurvey(@PathParam("id") @ApiParam(value = "Enter id") final Long id) {
|
||||
this.securityContext.authenticatedUser();
|
||||
|
||||
final Survey survey = this.spmService.findById(id);
|
||||
@@ -90,7 +96,9 @@ public class SpmApiResource {
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Transactional
|
||||
public void createSurvey(final SurveyData surveyData) {
|
||||
@ApiOperation(value = "Create a Survey", notes = "Adds a new survey to collect client related data.\n" + "\n" + "Mandatory Fields\n" + "\n" + "countryCode, key, name, questions, responses, sequenceNo, text, value")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "OK")})
|
||||
public void createSurvey(@ApiParam(value = "Create survey") final SurveyData surveyData) {
|
||||
this.securityContext.authenticatedUser();
|
||||
|
||||
final Survey survey = SurveyMapper.map(surveyData);
|
||||
@@ -103,7 +111,9 @@ public class SpmApiResource {
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Transactional
|
||||
public void deactivateSurvey(@PathParam("id") final Long id) {
|
||||
@ApiOperation(value = "Deactivate Survey", notes = "")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "OK")})
|
||||
public void deactivateSurvey(@PathParam("id") @ApiParam(value = "Enter id") final Long id) {
|
||||
this.securityContext.authenticatedUser();
|
||||
|
||||
this.spmService.deactivateSurvey(id);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user