Search in sources :

Example 16 with CommandWrapperBuilder

use of org.apache.fineract.commands.service.CommandWrapperBuilder in project fineract by apache.

the class NotesApiResource method deleteNote.

@DELETE
@Path("{noteId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Delete a Resource Note", description = "Deletes a Resource Note")
@ApiResponses({ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = NotesApiResourceSwagger.DeleteResourceTypeResourceIdNotesNoteIdResponse.class))) })
public String deleteNote(@PathParam("resourceType") @Parameter(description = "resourceType") final String resourceType, @PathParam("resourceId") @Parameter(description = "resourceId") final Long resourceId, @PathParam("noteId") @Parameter(description = "noteId") final Long noteId) {
    final NoteType noteType = NoteType.fromApiUrl(resourceType);
    if (noteType == null) {
        throw new NoteResourceNotSupportedException(resourceType);
    }
    final CommandWrapper resourceDetails = getResourceDetails(noteType, resourceId);
    final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteNote(resourceDetails, resourceType, resourceId, noteId).build();
    final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
    return this.toApiJsonSerializer.serialize(result);
}
Also used : NoteResourceNotSupportedException(org.apache.fineract.portfolio.note.exception.NoteResourceNotSupportedException) NoteType(org.apache.fineract.portfolio.note.domain.NoteType) CommandWrapperBuilder(org.apache.fineract.commands.service.CommandWrapperBuilder) CommandWrapper(org.apache.fineract.commands.domain.CommandWrapper) CommandProcessingResult(org.apache.fineract.infrastructure.core.data.CommandProcessingResult) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Example 17 with CommandWrapperBuilder

use of org.apache.fineract.commands.service.CommandWrapperBuilder in project fineract by apache.

the class NotesApiResource method updateNote.

@PUT
@Path("{noteId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Update a Resource Note", description = "Updates a Resource Note")
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = NotesApiResourceSwagger.PutResourceTypeResourceIdNotesNoteIdRequest.class)))
@ApiResponses({ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = NotesApiResourceSwagger.PutResourceTypeResourceIdNotesNoteIdResponse.class))) })
public String updateNote(@PathParam("resourceType") @Parameter(description = "resourceType") final String resourceType, @PathParam("resourceId") @Parameter(description = "resourceId") final Long resourceId, @PathParam("noteId") @Parameter(description = "noteId") final Long noteId, @Parameter(hidden = true) final String apiRequestBodyAsJson) {
    final NoteType noteType = NoteType.fromApiUrl(resourceType);
    if (noteType == null) {
        throw new NoteResourceNotSupportedException(resourceType);
    }
    final CommandWrapper resourceDetails = getResourceDetails(noteType, resourceId);
    final CommandWrapper commandRequest = new CommandWrapperBuilder().updateNote(resourceDetails, resourceType, resourceId, noteId).withJson(apiRequestBodyAsJson).build();
    final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
    return this.toApiJsonSerializer.serialize(result);
}
Also used : NoteResourceNotSupportedException(org.apache.fineract.portfolio.note.exception.NoteResourceNotSupportedException) NoteType(org.apache.fineract.portfolio.note.domain.NoteType) CommandWrapperBuilder(org.apache.fineract.commands.service.CommandWrapperBuilder) CommandWrapper(org.apache.fineract.commands.domain.CommandWrapper) CommandProcessingResult(org.apache.fineract.infrastructure.core.data.CommandProcessingResult) Path(javax.ws.rs.Path) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) Operation(io.swagger.v3.oas.annotations.Operation) PUT(javax.ws.rs.PUT) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses) RequestBody(io.swagger.v3.oas.annotations.parameters.RequestBody)

Example 18 with CommandWrapperBuilder

use of org.apache.fineract.commands.service.CommandWrapperBuilder in project fineract by apache.

the class TaxGroupApiResource method updateTaxGroup.

@PUT
@Path("{taxGroupId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Update Tax Group", description = "Updates Tax Group. Only end date can be up-datable and can insert new tax components.")
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = TaxGroupApiResourceSwagger.PutTaxesGroupTaxGroupIdRequest.class)))
@ApiResponses({ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = TaxGroupApiResourceSwagger.PutTaxesGroupTaxGroupIdResponse.class))) })
public String updateTaxGroup(@PathParam("taxGroupId") @Parameter(description = "taxGroupId") final Long taxGroupId, @Parameter(hidden = true) final String apiRequestBodyAsJson) {
    final CommandWrapper commandRequest = new CommandWrapperBuilder().updateTaxGroup(taxGroupId).withJson(apiRequestBodyAsJson).build();
    final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
    return this.toApiJsonSerializer.serialize(result);
}
Also used : CommandWrapperBuilder(org.apache.fineract.commands.service.CommandWrapperBuilder) CommandWrapper(org.apache.fineract.commands.domain.CommandWrapper) CommandProcessingResult(org.apache.fineract.infrastructure.core.data.CommandProcessingResult) Path(javax.ws.rs.Path) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) Operation(io.swagger.v3.oas.annotations.Operation) PUT(javax.ws.rs.PUT) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses) RequestBody(io.swagger.v3.oas.annotations.parameters.RequestBody)

Example 19 with CommandWrapperBuilder

use of org.apache.fineract.commands.service.CommandWrapperBuilder in project fineract by apache.

the class TwoFactorConfigurationApiResource method updateConfiguration.

@PUT
public String updateConfiguration(final String apiRequestBodyAsJson) {
    final CommandWrapper commandRequest = new CommandWrapperBuilder().updateTwoFactorConfiguration().withJson(apiRequestBodyAsJson).build();
    final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
    return this.toApiJsonSerializer.serialize(result);
}
Also used : CommandWrapperBuilder(org.apache.fineract.commands.service.CommandWrapperBuilder) CommandWrapper(org.apache.fineract.commands.domain.CommandWrapper) CommandProcessingResult(org.apache.fineract.infrastructure.core.data.CommandProcessingResult) PUT(javax.ws.rs.PUT)

Example 20 with CommandWrapperBuilder

use of org.apache.fineract.commands.service.CommandWrapperBuilder in project fineract by apache.

the class SmsApiResource method create.

@POST
public String create(final String apiRequestBodyAsJson) {
    final CommandWrapper commandRequest = new CommandWrapperBuilder().createSms().withJson(apiRequestBodyAsJson).build();
    final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
    return this.toApiJsonSerializer.serialize(result);
}
Also used : CommandWrapperBuilder(org.apache.fineract.commands.service.CommandWrapperBuilder) CommandWrapper(org.apache.fineract.commands.domain.CommandWrapper) CommandProcessingResult(org.apache.fineract.infrastructure.core.data.CommandProcessingResult) POST(javax.ws.rs.POST)

Aggregations

CommandWrapperBuilder (org.apache.fineract.commands.service.CommandWrapperBuilder)309 CommandWrapper (org.apache.fineract.commands.domain.CommandWrapper)307 CommandProcessingResult (org.apache.fineract.infrastructure.core.data.CommandProcessingResult)299 Produces (javax.ws.rs.Produces)253 Consumes (javax.ws.rs.Consumes)251 Operation (io.swagger.v3.oas.annotations.Operation)199 ApiResponses (io.swagger.v3.oas.annotations.responses.ApiResponses)193 Path (javax.ws.rs.Path)184 RequestBody (io.swagger.v3.oas.annotations.parameters.RequestBody)152 POST (javax.ws.rs.POST)121 PUT (javax.ws.rs.PUT)89 DELETE (javax.ws.rs.DELETE)61 GsonBuilder (com.google.gson.GsonBuilder)31 DateSerializer (org.apache.fineract.infrastructure.bulkimport.importhandler.helper.DateSerializer)30 UnrecognizedQueryParamException (org.apache.fineract.infrastructure.core.exception.UnrecognizedQueryParamException)28 Cell (org.apache.poi.ss.usermodel.Cell)13 Sheet (org.apache.poi.ss.usermodel.Sheet)13 JsonObject (com.google.gson.JsonObject)11 JsonElement (com.google.gson.JsonElement)10 ApiRequestJsonSerializationSettings (org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings)7