FINERACT-1724: Minor cleanup
This commit is contained in:
committed by
Arnold Gálovics
parent
e95eba3e8a
commit
0b7a484cff
+13
-31
@@ -47,14 +47,12 @@ import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
|||||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||||
import org.apache.fineract.infrastructure.sms.data.SmsData;
|
import org.apache.fineract.infrastructure.sms.data.SmsData;
|
||||||
import org.apache.fineract.infrastructure.sms.service.SmsReadPlatformService;
|
import org.apache.fineract.infrastructure.sms.service.SmsReadPlatformService;
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Path("/sms")
|
@Path("/sms")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Component
|
@Component
|
||||||
@Scope("singleton")
|
|
||||||
@Tag(name = "SMS", description = "")
|
@Tag(name = "SMS", description = "")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class SmsApiResource {
|
public class SmsApiResource {
|
||||||
@@ -69,33 +67,25 @@ public class SmsApiResource {
|
|||||||
|
|
||||||
@GET
|
@GET
|
||||||
public String retrieveAll(@Context final UriInfo uriInfo) {
|
public String retrieveAll(@Context final UriInfo uriInfo) {
|
||||||
|
context.authenticatedUser().validateHasReadPermission(resourceNameForPermissions);
|
||||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
final Collection<SmsData> smsMessages = readPlatformService.retrieveAll();
|
||||||
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
final Collection<SmsData> smsMessages = this.readPlatformService.retrieveAll();
|
return toApiJsonSerializer.serialize(settings, smsMessages);
|
||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
|
||||||
return this.toApiJsonSerializer.serialize(settings, smsMessages);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
public String create(final String apiRequestBodyAsJson) {
|
public String create(final String apiRequestBodyAsJson) {
|
||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createSms().withJson(apiRequestBodyAsJson).build();
|
final CommandWrapper commandRequest = new CommandWrapperBuilder().createSms().withJson(apiRequestBodyAsJson).build();
|
||||||
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
return toApiJsonSerializer.serialize(result);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{resourceId}")
|
@Path("{resourceId}")
|
||||||
public String retrieveOne(@PathParam("resourceId") final Long resourceId, @Context final UriInfo uriInfo) {
|
public String retrieveOne(@PathParam("resourceId") final Long resourceId, @Context final UriInfo uriInfo) {
|
||||||
|
final SmsData smsMessage = readPlatformService.retrieveOne(resourceId);
|
||||||
final SmsData smsMessage = this.readPlatformService.retrieveOne(resourceId);
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
|
return toApiJsonSerializer.serialize(settings, smsMessage);
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
|
||||||
return this.toApiJsonSerializer.serialize(settings, smsMessage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -106,9 +96,7 @@ public class SmsApiResource {
|
|||||||
@QueryParam("dateFormat") final String dateFormat, @QueryParam("sqlSearch") final String sqlSearch,
|
@QueryParam("dateFormat") final String dateFormat, @QueryParam("sqlSearch") final String sqlSearch,
|
||||||
@QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit,
|
@QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit,
|
||||||
@QueryParam("orderBy") final String orderBy, @QueryParam("sortOrder") final String sortOrder) {
|
@QueryParam("orderBy") final String orderBy, @QueryParam("sortOrder") final String sortOrder) {
|
||||||
|
|
||||||
context.authenticatedUser().validateHasReadPermission(resourceNameForPermissions);
|
context.authenticatedUser().validateHasReadPermission(resourceNameForPermissions);
|
||||||
|
|
||||||
final SearchParameters searchParameters = SearchParameters.forSMSCampaign(sqlSearch, offset, limit, orderBy, sortOrder);
|
final SearchParameters searchParameters = SearchParameters.forSMSCampaign(sqlSearch, offset, limit, orderBy, sortOrder);
|
||||||
|
|
||||||
LocalDate fromDate = null;
|
LocalDate fromDate = null;
|
||||||
@@ -130,22 +118,16 @@ public class SmsApiResource {
|
|||||||
@PUT
|
@PUT
|
||||||
@Path("{resourceId}")
|
@Path("{resourceId}")
|
||||||
public String update(@PathParam("resourceId") final Long resourceId, final String apiRequestBodyAsJson) {
|
public String update(@PathParam("resourceId") final Long resourceId, final String apiRequestBodyAsJson) {
|
||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateSms(resourceId).withJson(apiRequestBodyAsJson).build();
|
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateSms(resourceId).withJson(apiRequestBodyAsJson).build();
|
||||||
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
return toApiJsonSerializer.serialize(result);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("{resourceId}")
|
@Path("{resourceId}")
|
||||||
public String delete(@PathParam("resourceId") final Long resourceId) {
|
public String delete(@PathParam("resourceId") final Long resourceId) {
|
||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteSms(resourceId).build();
|
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteSms(resourceId).build();
|
||||||
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
return toApiJsonSerializer.serialize(result);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-15
@@ -49,47 +49,41 @@ import org.apache.fineract.portfolio.group.domain.Group;
|
|||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class SmsMessage extends AbstractPersistableCustom {
|
public class SmsMessage extends AbstractPersistableCustom {
|
||||||
|
|
||||||
@Column(name = "external_id", nullable = true)
|
@Column(name = "external_id")
|
||||||
private String externalId;
|
private String externalId;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "group_id", nullable = true)
|
@JoinColumn(name = "group_id")
|
||||||
private Group group;
|
private Group group;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "client_id", nullable = true)
|
@JoinColumn(name = "client_id")
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "staff_id", nullable = true)
|
@JoinColumn(name = "staff_id")
|
||||||
private Staff staff;
|
private Staff staff;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "campaign_id", nullable = true)
|
@JoinColumn(name = "campaign_id")
|
||||||
private SmsCampaign smsCampaign;
|
private SmsCampaign smsCampaign;
|
||||||
|
|
||||||
@Column(name = "status_enum", nullable = false)
|
@Column(name = "status_enum", nullable = false)
|
||||||
private Integer statusType;
|
private Integer statusType;
|
||||||
|
|
||||||
@Column(name = "mobile_no", nullable = true, length = 50)
|
@Column(name = "mobile_no", length = 50)
|
||||||
private String mobileNo;
|
private String mobileNo;
|
||||||
|
|
||||||
@Column(name = "message", nullable = false)
|
@Column(name = "message", nullable = false)
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
// @Column(name = "provider_id", nullable = true)
|
@Column(name = "submittedon_date")
|
||||||
// private Long providerId;
|
|
||||||
//
|
|
||||||
// @Column(name = "campaign_name", nullable = true)
|
|
||||||
// private String campaignName;
|
|
||||||
|
|
||||||
@Column(name = "submittedon_date", nullable = true)
|
|
||||||
private LocalDate submittedOnDate;
|
private LocalDate submittedOnDate;
|
||||||
|
|
||||||
@Column(name = "delivered_on_date", nullable = true)
|
@Column(name = "delivered_on_date")
|
||||||
private LocalDateTime deliveredOnDate;
|
private LocalDateTime deliveredOnDate;
|
||||||
|
|
||||||
@Column(name = "is_notification", nullable = true)
|
@Column(name = "is_notification")
|
||||||
private boolean isNotification;
|
private boolean isNotification;
|
||||||
|
|
||||||
public static SmsMessage pendingSms(final String externalId, final Group group, final Client client, final Staff staff,
|
public static SmsMessage pendingSms(final String externalId, final Group group, final Client client, final Staff staff,
|
||||||
|
|||||||
-1
@@ -124,7 +124,6 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
|
|||||||
public SmsData retrieveOne(final Long resourceId) {
|
public SmsData retrieveOne(final Long resourceId) {
|
||||||
try {
|
try {
|
||||||
final String sql = "select " + this.smsRowMapper.schema() + " where smo.id = ?";
|
final String sql = "select " + this.smsRowMapper.schema() + " where smo.id = ?";
|
||||||
|
|
||||||
return this.jdbcTemplate.queryForObject(sql, this.smsRowMapper, new Object[] { resourceId }); // NOSONAR
|
return this.jdbcTemplate.queryForObject(sql, this.smsRowMapper, new Object[] { resourceId }); // NOSONAR
|
||||||
} catch (final EmptyResultDataAccessException e) {
|
} catch (final EmptyResultDataAccessException e) {
|
||||||
throw new SmsNotFoundException(resourceId, e);
|
throw new SmsNotFoundException(resourceId, e);
|
||||||
|
|||||||
+24
-58
@@ -45,6 +45,7 @@ import javax.ws.rs.core.Context;
|
|||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.UriInfo;
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||||
@@ -62,14 +63,12 @@ import org.apache.fineract.organisation.office.data.OfficeData;
|
|||||||
import org.apache.fineract.organisation.office.service.OfficeReadPlatformService;
|
import org.apache.fineract.organisation.office.service.OfficeReadPlatformService;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Path("/offices")
|
@Path("/offices")
|
||||||
@Component
|
@Component
|
||||||
@Scope("singleton")
|
|
||||||
@Tag(name = "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.")
|
@Tag(name = "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.")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class OfficesApiResource {
|
public class OfficesApiResource {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,21 +87,6 @@ public class OfficesApiResource {
|
|||||||
private final BulkImportWorkbookService bulkImportWorkbookService;
|
private final BulkImportWorkbookService bulkImportWorkbookService;
|
||||||
private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService;
|
private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public OfficesApiResource(final PlatformSecurityContext context, final OfficeReadPlatformService readPlatformService,
|
|
||||||
final DefaultToApiJsonSerializer<OfficeData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
|
|
||||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
|
|
||||||
final BulkImportWorkbookService bulkImportWorkbookService,
|
|
||||||
final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService) {
|
|
||||||
this.context = context;
|
|
||||||
this.readPlatformService = readPlatformService;
|
|
||||||
this.toApiJsonSerializer = toApiJsonSerializer;
|
|
||||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
|
||||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
|
||||||
this.bulkImportWorkbookService = bulkImportWorkbookService;
|
|
||||||
this.bulkImportWorkbookPopulatorService = bulkImportWorkbookPopulatorService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@@ -114,15 +98,11 @@ public class OfficesApiResource {
|
|||||||
@DefaultValue("false") @QueryParam("includeAllOffices") @Parameter(description = "includeAllOffices") final boolean onlyManualEntries,
|
@DefaultValue("false") @QueryParam("includeAllOffices") @Parameter(description = "includeAllOffices") final boolean onlyManualEntries,
|
||||||
@QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy,
|
@QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy,
|
||||||
@QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) {
|
@QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) {
|
||||||
|
context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
||||||
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
|
||||||
|
|
||||||
final SearchParameters searchParameters = SearchParameters.forOffices(orderBy, sortOrder);
|
final SearchParameters searchParameters = SearchParameters.forOffices(orderBy, sortOrder);
|
||||||
|
final Collection<OfficeData> offices = readPlatformService.retrieveAllOffices(onlyManualEntries, searchParameters);
|
||||||
final Collection<OfficeData> offices = this.readPlatformService.retrieveAllOffices(onlyManualEntries, searchParameters);
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
|
return toApiJsonSerializer.serialize(settings, offices, RESPONSE_DATA_PARAMETERS);
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
|
||||||
return this.toApiJsonSerializer.serialize(settings, offices, RESPONSE_DATA_PARAMETERS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -134,16 +114,12 @@ public class OfficesApiResource {
|
|||||||
@ApiResponses({
|
@ApiResponses({
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = OfficesApiResourceSwagger.GetOfficesTemplateResponse.class))) })
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = OfficesApiResourceSwagger.GetOfficesTemplateResponse.class))) })
|
||||||
public String retrieveOfficeTemplate(@Context final UriInfo uriInfo) {
|
public String retrieveOfficeTemplate(@Context final UriInfo uriInfo) {
|
||||||
|
context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
||||||
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
OfficeData office = readPlatformService.retrieveNewOfficeTemplate();
|
||||||
|
final Collection<OfficeData> allowedParents = readPlatformService.retrieveAllOfficesForDropdown();
|
||||||
OfficeData office = this.readPlatformService.retrieveNewOfficeTemplate();
|
|
||||||
|
|
||||||
final Collection<OfficeData> allowedParents = this.readPlatformService.retrieveAllOfficesForDropdown();
|
|
||||||
office = OfficeData.appendedTemplate(office, allowedParents);
|
office = OfficeData.appendedTemplate(office, allowedParents);
|
||||||
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
return toApiJsonSerializer.serialize(settings, office, RESPONSE_DATA_PARAMETERS);
|
||||||
return this.toApiJsonSerializer.serialize(settings, office, RESPONSE_DATA_PARAMETERS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@@ -154,15 +130,12 @@ public class OfficesApiResource {
|
|||||||
@ApiResponses({
|
@ApiResponses({
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = OfficesApiResourceSwagger.PostOfficesResponse.class))) })
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = OfficesApiResourceSwagger.PostOfficesResponse.class))) })
|
||||||
public String createOffice(@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
public String createOffice(@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||||
.createOffice() //
|
.createOffice() //
|
||||||
.withJson(apiRequestBodyAsJson) //
|
.withJson(apiRequestBodyAsJson) //
|
||||||
.build();
|
.build();
|
||||||
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
return toApiJsonSerializer.serialize(result);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -173,20 +146,16 @@ public class OfficesApiResource {
|
|||||||
+ "offices/1?template=true\n" + "\n" + "\n" + "offices/1?fields=id,name,parentName")
|
+ "offices/1?template=true\n" + "\n" + "\n" + "offices/1?fields=id,name,parentName")
|
||||||
@ApiResponses({
|
@ApiResponses({
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = OfficesApiResourceSwagger.GetOfficesResponse.class))) })
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = OfficesApiResourceSwagger.GetOfficesResponse.class))) })
|
||||||
public String retreiveOffice(@PathParam("officeId") @Parameter(description = "officeId") final Long officeId,
|
public String retrieveOffice(@PathParam("officeId") @Parameter(description = "officeId") final Long officeId,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
||||||
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
|
OfficeData office = readPlatformService.retrieveOffice(officeId);
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
|
||||||
|
|
||||||
OfficeData office = this.readPlatformService.retrieveOffice(officeId);
|
|
||||||
if (settings.isTemplate()) {
|
if (settings.isTemplate()) {
|
||||||
final Collection<OfficeData> allowedParents = this.readPlatformService.retrieveAllowedParents(officeId);
|
final Collection<OfficeData> allowedParents = readPlatformService.retrieveAllowedParents(officeId);
|
||||||
office = OfficeData.appendedTemplate(office, allowedParents);
|
office = OfficeData.appendedTemplate(office, allowedParents);
|
||||||
}
|
}
|
||||||
|
return toApiJsonSerializer.serialize(settings, office, RESPONSE_DATA_PARAMETERS);
|
||||||
return this.toApiJsonSerializer.serialize(settings, office, RESPONSE_DATA_PARAMETERS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@@ -199,15 +168,12 @@ public class OfficesApiResource {
|
|||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = OfficesApiResourceSwagger.PutOfficesOfficeIdResponse.class))) })
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = OfficesApiResourceSwagger.PutOfficesOfficeIdResponse.class))) })
|
||||||
public String updateOffice(@PathParam("officeId") @Parameter(description = "officeId") final Long officeId,
|
public String updateOffice(@PathParam("officeId") @Parameter(description = "officeId") final Long officeId,
|
||||||
@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||||
.updateOffice(officeId) //
|
.updateOffice(officeId) //
|
||||||
.withJson(apiRequestBodyAsJson) //
|
.withJson(apiRequestBodyAsJson) //
|
||||||
.build();
|
.build();
|
||||||
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
return toApiJsonSerializer.serialize(result);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -225,8 +191,8 @@ public class OfficesApiResource {
|
|||||||
public String postOfficeTemplate(@FormDataParam("file") InputStream uploadedInputStream,
|
public String postOfficeTemplate(@FormDataParam("file") InputStream uploadedInputStream,
|
||||||
@FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("locale") final String locale,
|
@FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("locale") final String locale,
|
||||||
@FormDataParam("dateFormat") final String dateFormat) {
|
@FormDataParam("dateFormat") final String dateFormat) {
|
||||||
final Long importDocumentId = this.bulkImportWorkbookService.importWorkbook(GlobalEntityType.OFFICES.toString(),
|
final Long importDocumentId = bulkImportWorkbookService.importWorkbook(GlobalEntityType.OFFICES.toString(), uploadedInputStream,
|
||||||
uploadedInputStream, fileDetail, locale, dateFormat);
|
fileDetail, locale, dateFormat);
|
||||||
return this.toApiJsonSerializer.serialize(importDocumentId);
|
return toApiJsonSerializer.serialize(importDocumentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ public class Office extends AbstractPersistableCustom implements Serializable {
|
|||||||
@Column(name = "name", nullable = false, length = 100)
|
@Column(name = "name", nullable = false, length = 100)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Column(name = "hierarchy", nullable = true, length = 50)
|
@Column(name = "hierarchy", length = 50)
|
||||||
private String hierarchy;
|
private String hierarchy;
|
||||||
|
|
||||||
@Column(name = "opening_date", nullable = false)
|
@Column(name = "opening_date", nullable = false)
|
||||||
|
|||||||
+18
-48
@@ -45,6 +45,7 @@ import javax.ws.rs.core.Context;
|
|||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.UriInfo;
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||||
@@ -63,14 +64,12 @@ import org.apache.fineract.organisation.staff.data.StaffData;
|
|||||||
import org.apache.fineract.organisation.staff.service.StaffReadPlatformService;
|
import org.apache.fineract.organisation.staff.service.StaffReadPlatformService;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Path("/staff")
|
@Path("/staff")
|
||||||
@Component
|
@Component
|
||||||
@Scope("singleton")
|
|
||||||
@Tag(name = "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.")
|
@Tag(name = "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.")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class StaffApiResource {
|
public class StaffApiResource {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,23 +89,6 @@ public class StaffApiResource {
|
|||||||
private final BulkImportWorkbookService bulkImportWorkbookService;
|
private final BulkImportWorkbookService bulkImportWorkbookService;
|
||||||
private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService;
|
private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public StaffApiResource(final PlatformSecurityContext context, final StaffReadPlatformService readPlatformService,
|
|
||||||
final OfficeReadPlatformService officeReadPlatformService, final DefaultToApiJsonSerializer<StaffData> toApiJsonSerializer,
|
|
||||||
final ApiRequestParameterHelper apiRequestParameterHelper,
|
|
||||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
|
|
||||||
final BulkImportWorkbookService bulkImportWorkbookService,
|
|
||||||
final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService) {
|
|
||||||
this.context = context;
|
|
||||||
this.readPlatformService = readPlatformService;
|
|
||||||
this.officeReadPlatformService = officeReadPlatformService;
|
|
||||||
this.toApiJsonSerializer = toApiJsonSerializer;
|
|
||||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
|
||||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
|
||||||
this.bulkImportWorkbookService = bulkImportWorkbookService;
|
|
||||||
this.bulkImportWorkbookPopulatorService = bulkImportWorkbookPopulatorService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@@ -122,18 +104,15 @@ public class StaffApiResource {
|
|||||||
@DefaultValue("false") @QueryParam("staffInOfficeHierarchy") @Parameter(description = "staffInOfficeHierarchy") final boolean staffInOfficeHierarchy,
|
@DefaultValue("false") @QueryParam("staffInOfficeHierarchy") @Parameter(description = "staffInOfficeHierarchy") final boolean staffInOfficeHierarchy,
|
||||||
@DefaultValue("false") @QueryParam("loanOfficersOnly") @Parameter(description = "loanOfficersOnly") final boolean loanOfficersOnly,
|
@DefaultValue("false") @QueryParam("loanOfficersOnly") @Parameter(description = "loanOfficersOnly") final boolean loanOfficersOnly,
|
||||||
@DefaultValue("active") @QueryParam("status") @Parameter(description = "status") final String status) {
|
@DefaultValue("active") @QueryParam("status") @Parameter(description = "status") final String status) {
|
||||||
|
context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
||||||
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
|
||||||
|
|
||||||
final Collection<StaffData> staff;
|
final Collection<StaffData> staff;
|
||||||
if (staffInOfficeHierarchy) {
|
if (staffInOfficeHierarchy) {
|
||||||
staff = this.readPlatformService.retrieveAllStaffInOfficeAndItsParentOfficeHierarchy(officeId, loanOfficersOnly);
|
staff = readPlatformService.retrieveAllStaffInOfficeAndItsParentOfficeHierarchy(officeId, loanOfficersOnly);
|
||||||
} else {
|
} else {
|
||||||
staff = this.readPlatformService.retrieveAllStaff(officeId, loanOfficersOnly, status);
|
staff = readPlatformService.retrieveAllStaff(officeId, loanOfficersOnly, status);
|
||||||
}
|
}
|
||||||
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
return toApiJsonSerializer.serialize(settings, staff, RESPONSE_DATA_PARAMETERS);
|
||||||
return this.toApiJsonSerializer.serialize(settings, staff, RESPONSE_DATA_PARAMETERS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@@ -145,12 +124,9 @@ public class StaffApiResource {
|
|||||||
@ApiResponses({
|
@ApiResponses({
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = StaffApiResourceSwagger.CreateStaffResponse.class))) })
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = StaffApiResourceSwagger.CreateStaffResponse.class))) })
|
||||||
public String create(@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
public String create(@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createStaff().withJson(apiRequestBodyAsJson).build();
|
final CommandWrapper commandRequest = new CommandWrapperBuilder().createStaff().withJson(apiRequestBodyAsJson).build();
|
||||||
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
return toApiJsonSerializer.serialize(result);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -163,17 +139,14 @@ public class StaffApiResource {
|
|||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = StaffApiResourceSwagger.RetrieveOneResponse.class))) })
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = StaffApiResourceSwagger.RetrieveOneResponse.class))) })
|
||||||
public String retrieveOne(@PathParam("staffId") @Parameter(description = "staffId") final Long staffId,
|
public String retrieveOne(@PathParam("staffId") @Parameter(description = "staffId") final Long staffId,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
||||||
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
|
StaffData staff = readPlatformService.retrieveStaff(staffId);
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
|
||||||
|
|
||||||
StaffData staff = this.readPlatformService.retrieveStaff(staffId);
|
|
||||||
if (settings.isTemplate()) {
|
if (settings.isTemplate()) {
|
||||||
final Collection<OfficeData> allowedOffices = this.officeReadPlatformService.retrieveAllOfficesForDropdown();
|
final Collection<OfficeData> allowedOffices = officeReadPlatformService.retrieveAllOfficesForDropdown();
|
||||||
staff = StaffData.templateData(staff, allowedOffices);
|
staff = StaffData.templateData(staff, allowedOffices);
|
||||||
}
|
}
|
||||||
return this.toApiJsonSerializer.serialize(settings, staff, RESPONSE_DATA_PARAMETERS);
|
return toApiJsonSerializer.serialize(settings, staff, RESPONSE_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@@ -186,12 +159,9 @@ public class StaffApiResource {
|
|||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = StaffApiResourceSwagger.UpdateStaffResponse.class))) })
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = StaffApiResourceSwagger.UpdateStaffResponse.class))) })
|
||||||
public String update(@PathParam("staffId") @Parameter(description = "staffId") final Long staffId,
|
public String update(@PathParam("staffId") @Parameter(description = "staffId") final Long staffId,
|
||||||
@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateStaff(staffId).withJson(apiRequestBodyAsJson).build();
|
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateStaff(staffId).withJson(apiRequestBodyAsJson).build();
|
||||||
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
return toApiJsonSerializer.serialize(result);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -209,8 +179,8 @@ public class StaffApiResource {
|
|||||||
public String postTemplate(@FormDataParam("file") InputStream uploadedInputStream,
|
public String postTemplate(@FormDataParam("file") InputStream uploadedInputStream,
|
||||||
@FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("locale") final String locale,
|
@FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("locale") final String locale,
|
||||||
@FormDataParam("dateFormat") final String dateFormat) {
|
@FormDataParam("dateFormat") final String dateFormat) {
|
||||||
final Long importDocumentId = this.bulkImportWorkbookService.importWorkbook(GlobalEntityType.STAFF.toString(), uploadedInputStream,
|
final Long importDocumentId = bulkImportWorkbookService.importWorkbook(GlobalEntityType.STAFF.toString(), uploadedInputStream,
|
||||||
fileDetail, locale, dateFormat);
|
fileDetail, locale, dateFormat);
|
||||||
return this.toApiJsonSerializer.serialize(importDocumentId);
|
return toApiJsonSerializer.serialize(importDocumentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -53,7 +53,7 @@ public class Staff extends AbstractPersistableCustom {
|
|||||||
@Column(name = "mobile_no", length = 50, nullable = false, unique = true)
|
@Column(name = "mobile_no", length = 50, nullable = false, unique = true)
|
||||||
private String mobileNo;
|
private String mobileNo;
|
||||||
|
|
||||||
@Column(name = "external_id", length = 100, nullable = true, unique = true)
|
@Column(name = "external_id", length = 100, unique = true)
|
||||||
private String externalId;
|
private String externalId;
|
||||||
|
|
||||||
@Column(name = "email_address", length = 50, unique = true)
|
@Column(name = "email_address", length = 50, unique = true)
|
||||||
@@ -66,21 +66,21 @@ public class Staff extends AbstractPersistableCustom {
|
|||||||
@Column(name = "is_loan_officer", nullable = false)
|
@Column(name = "is_loan_officer", nullable = false)
|
||||||
private boolean loanOfficer;
|
private boolean loanOfficer;
|
||||||
|
|
||||||
@Column(name = "organisational_role_enum", nullable = true)
|
@Column(name = "organisational_role_enum")
|
||||||
private Integer organisationalRoleType;
|
private Integer organisationalRoleType;
|
||||||
|
|
||||||
@Column(name = "is_active", nullable = false)
|
@Column(name = "is_active", nullable = false)
|
||||||
private boolean active;
|
private boolean active;
|
||||||
|
|
||||||
@Column(name = "joining_date", nullable = true)
|
@Column(name = "joining_date")
|
||||||
private LocalDate joiningDate;
|
private LocalDate joiningDate;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "organisational_role_parent_staff_id", nullable = true)
|
@JoinColumn(name = "organisational_role_parent_staff_id")
|
||||||
private Staff organisationalRoleParentStaff;
|
private Staff organisationalRoleParentStaff;
|
||||||
|
|
||||||
@OneToOne(optional = true)
|
@OneToOne(optional = true)
|
||||||
@JoinColumn(name = "image_id", nullable = true)
|
@JoinColumn(name = "image_id")
|
||||||
private Image image;
|
private Image image;
|
||||||
|
|
||||||
public static Staff fromJson(final Office staffOffice, final JsonCommand command) {
|
public static Staff fromJson(final Office staffOffice, final JsonCommand command) {
|
||||||
|
|||||||
+56
-63
@@ -73,12 +73,10 @@ import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
|
|||||||
import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService;
|
import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Path("/clients")
|
@Path("/clients")
|
||||||
@Component
|
@Component
|
||||||
@Scope("singleton")
|
|
||||||
@Tag(name = "Client", description = "Clients are people and businesses that have applied (or may apply) to an MFI for loans.\n" + "\n"
|
@Tag(name = "Client", 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.")
|
+ "Clients can be created in Pending or straight into Active state.")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@@ -109,24 +107,24 @@ public class ClientsApiResource {
|
|||||||
@QueryParam("commandParam") @Parameter(description = "commandParam") final String commandParam,
|
@QueryParam("commandParam") @Parameter(description = "commandParam") final String commandParam,
|
||||||
@DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) {
|
@DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||||
|
|
||||||
ClientData clientData = null;
|
ClientData clientData = null;
|
||||||
this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||||
if (is(commandParam, "close")) {
|
if (is(commandParam, "close")) {
|
||||||
clientData = this.clientReadPlatformService.retrieveAllNarrations(ClientApiConstants.CLIENT_CLOSURE_REASON);
|
clientData = clientReadPlatformService.retrieveAllNarrations(ClientApiConstants.CLIENT_CLOSURE_REASON);
|
||||||
} else if (is(commandParam, "acceptTransfer")) {
|
} else if (is(commandParam, "acceptTransfer")) {
|
||||||
clientData = this.clientReadPlatformService.retrieveAllNarrations(ClientApiConstants.CLIENT_CLOSURE_REASON);
|
clientData = clientReadPlatformService.retrieveAllNarrations(ClientApiConstants.CLIENT_CLOSURE_REASON);
|
||||||
} else if (is(commandParam, "reject")) {
|
} else if (is(commandParam, "reject")) {
|
||||||
clientData = this.clientReadPlatformService.retrieveAllNarrations(ClientApiConstants.CLIENT_REJECT_REASON);
|
clientData = clientReadPlatformService.retrieveAllNarrations(ClientApiConstants.CLIENT_REJECT_REASON);
|
||||||
} else if (is(commandParam, "withdraw")) {
|
} else if (is(commandParam, "withdraw")) {
|
||||||
clientData = this.clientReadPlatformService.retrieveAllNarrations(ClientApiConstants.CLIENT_WITHDRAW_REASON);
|
clientData = clientReadPlatformService.retrieveAllNarrations(ClientApiConstants.CLIENT_WITHDRAW_REASON);
|
||||||
} else {
|
} else {
|
||||||
clientData = this.clientReadPlatformService.retrieveTemplate(officeId, staffInSelectedOfficeOnly);
|
clientData = clientReadPlatformService.retrieveTemplate(officeId, staffInSelectedOfficeOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
return this.toApiJsonSerializer.serialize(settings, clientData, ClientApiConstants.CLIENT_RESPONSE_DATA_PARAMETERS);
|
return toApiJsonSerializer.serialize(settings, clientData, ClientApiConstants.CLIENT_RESPONSE_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -152,24 +150,20 @@ public class ClientsApiResource {
|
|||||||
@QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder,
|
@QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder,
|
||||||
@QueryParam("orphansOnly") @Parameter(description = "orphansOnly") final Boolean orphansOnly) {
|
@QueryParam("orphansOnly") @Parameter(description = "orphansOnly") final Boolean orphansOnly) {
|
||||||
|
|
||||||
return this.retrieveAll(uriInfo, sqlSearch, officeId, externalId, displayName, firstname, lastname, status, hierarchy, offset,
|
return retrieveAll(uriInfo, sqlSearch, officeId, externalId, displayName, firstname, lastname, status, hierarchy, offset, limit,
|
||||||
limit, orderBy, sortOrder, orphansOnly, false);
|
orderBy, sortOrder, orphansOnly, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String retrieveAll(final UriInfo uriInfo, final String sqlSearch, final Long officeId, final String externalId,
|
public String retrieveAll(final UriInfo uriInfo, final String sqlSearch, final Long officeId, final String externalId,
|
||||||
final String displayName, final String firstname, final String lastname, final String status, final String hierarchy,
|
final String displayName, final String firstname, final String lastname, final String status, final String hierarchy,
|
||||||
final Integer offset, final Integer limit, final String orderBy, final String sortOrder, final Boolean orphansOnly,
|
final Integer offset, final Integer limit, final String orderBy, final String sortOrder, final Boolean orphansOnly,
|
||||||
final boolean isSelfUser) {
|
final boolean isSelfUser) {
|
||||||
|
context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||||
this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
|
||||||
|
|
||||||
final SearchParameters searchParameters = SearchParameters.forClients(sqlSearch, officeId, externalId, displayName, firstname,
|
final SearchParameters searchParameters = SearchParameters.forClients(sqlSearch, officeId, externalId, displayName, firstname,
|
||||||
lastname, status, hierarchy, offset, limit, orderBy, sortOrder, orphansOnly, isSelfUser);
|
lastname, status, hierarchy, offset, limit, orderBy, sortOrder, orphansOnly, isSelfUser);
|
||||||
|
final Page<ClientData> clientData = clientReadPlatformService.retrieveAll(searchParameters);
|
||||||
final Page<ClientData> clientData = this.clientReadPlatformService.retrieveAll(searchParameters);
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
|
return toApiJsonSerializer.serialize(settings, clientData, ClientApiConstants.CLIENT_RESPONSE_DATA_PARAMETERS);
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
|
||||||
return this.toApiJsonSerializer.serialize(settings, clientData, ClientApiConstants.CLIENT_RESPONSE_DATA_PARAMETERS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -184,22 +178,21 @@ public class ClientsApiResource {
|
|||||||
@Context final UriInfo uriInfo,
|
@Context final UriInfo uriInfo,
|
||||||
@DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) {
|
@DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
|
|
||||||
ClientData clientData = this.clientReadPlatformService.retrieveOne(clientId);
|
ClientData clientData = clientReadPlatformService.retrieveOne(clientId);
|
||||||
if (settings.isTemplate()) {
|
if (settings.isTemplate()) {
|
||||||
final ClientData templateData = this.clientReadPlatformService.retrieveTemplate(clientData.getOfficeId(),
|
final ClientData templateData = clientReadPlatformService.retrieveTemplate(clientData.getOfficeId(), staffInSelectedOfficeOnly);
|
||||||
staffInSelectedOfficeOnly);
|
|
||||||
clientData = ClientData.templateOnTop(clientData, templateData);
|
clientData = ClientData.templateOnTop(clientData, templateData);
|
||||||
Collection<SavingsAccountData> savingAccountOptions = this.savingsAccountReadPlatformService.retrieveForLookup(clientId, null);
|
Collection<SavingsAccountData> savingAccountOptions = savingsAccountReadPlatformService.retrieveForLookup(clientId, null);
|
||||||
if (savingAccountOptions != null && savingAccountOptions.size() > 0) {
|
if (savingAccountOptions != null && savingAccountOptions.size() > 0) {
|
||||||
clientData = ClientData.templateWithSavingAccountOptions(clientData, savingAccountOptions);
|
clientData = ClientData.templateWithSavingAccountOptions(clientData, savingAccountOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(settings, clientData, ClientApiConstants.CLIENT_RESPONSE_DATA_PARAMETERS);
|
return toApiJsonSerializer.serialize(settings, clientData, ClientApiConstants.CLIENT_RESPONSE_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@@ -220,9 +213,9 @@ public class ClientsApiResource {
|
|||||||
.withJson(apiRequestBodyAsJson) //
|
.withJson(apiRequestBodyAsJson) //
|
||||||
.build(); //
|
.build(); //
|
||||||
|
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@@ -244,9 +237,9 @@ public class ClientsApiResource {
|
|||||||
.withJson(apiRequestBodyAsJson) //
|
.withJson(apiRequestBodyAsJson) //
|
||||||
.build(); //
|
.build(); //
|
||||||
|
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@@ -263,9 +256,9 @@ public class ClientsApiResource {
|
|||||||
.deleteClient(clientId) //
|
.deleteClient(clientId) //
|
||||||
.build(); //
|
.build(); //
|
||||||
|
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@@ -315,51 +308,51 @@ public class ClientsApiResource {
|
|||||||
CommandWrapper commandRequest = null;
|
CommandWrapper commandRequest = null;
|
||||||
if (is(commandParam, "activate")) {
|
if (is(commandParam, "activate")) {
|
||||||
commandRequest = builder.activateClient(clientId).build();
|
commandRequest = builder.activateClient(clientId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "assignStaff")) {
|
} else if (is(commandParam, "assignStaff")) {
|
||||||
commandRequest = builder.assignClientStaff(clientId).build();
|
commandRequest = builder.assignClientStaff(clientId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
} else if (is(commandParam, "unassignStaff")) {
|
} else if (is(commandParam, "unassignStaff")) {
|
||||||
commandRequest = builder.unassignClientStaff(clientId).build();
|
commandRequest = builder.unassignClientStaff(clientId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
} else if (is(commandParam, "close")) {
|
} else if (is(commandParam, "close")) {
|
||||||
commandRequest = builder.closeClient(clientId).build();
|
commandRequest = builder.closeClient(clientId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "proposeTransfer")) {
|
} else if (is(commandParam, "proposeTransfer")) {
|
||||||
commandRequest = builder.proposeClientTransfer(clientId).build();
|
commandRequest = builder.proposeClientTransfer(clientId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "proposeAndAcceptTransfer")) {
|
} else if (is(commandParam, "proposeAndAcceptTransfer")) {
|
||||||
commandRequest = builder.proposeAndAcceptClientTransfer(clientId).build();
|
commandRequest = builder.proposeAndAcceptClientTransfer(clientId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "withdrawTransfer")) {
|
} else if (is(commandParam, "withdrawTransfer")) {
|
||||||
commandRequest = builder.withdrawClientTransferRequest(clientId).build();
|
commandRequest = builder.withdrawClientTransferRequest(clientId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "acceptTransfer")) {
|
} else if (is(commandParam, "acceptTransfer")) {
|
||||||
commandRequest = builder.acceptClientTransfer(clientId).build();
|
commandRequest = builder.acceptClientTransfer(clientId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "rejectTransfer")) {
|
} else if (is(commandParam, "rejectTransfer")) {
|
||||||
commandRequest = builder.rejectClientTransfer(clientId).build();
|
commandRequest = builder.rejectClientTransfer(clientId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "updateSavingsAccount")) {
|
} else if (is(commandParam, "updateSavingsAccount")) {
|
||||||
commandRequest = builder.updateClientSavingsAccount(clientId).build();
|
commandRequest = builder.updateClientSavingsAccount(clientId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "reject")) {
|
} else if (is(commandParam, "reject")) {
|
||||||
commandRequest = builder.rejectClient(clientId).build();
|
commandRequest = builder.rejectClient(clientId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "withdraw")) {
|
} else if (is(commandParam, "withdraw")) {
|
||||||
commandRequest = builder.withdrawClient(clientId).build();
|
commandRequest = builder.withdrawClient(clientId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "reactivate")) {
|
} else if (is(commandParam, "reactivate")) {
|
||||||
commandRequest = builder.reActivateClient(clientId).build();
|
commandRequest = builder.reActivateClient(clientId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "undoRejection")) {
|
} else if (is(commandParam, "undoRejection")) {
|
||||||
commandRequest = builder.undoRejection(clientId).build();
|
commandRequest = builder.undoRejection(clientId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "undoWithdrawal")) {
|
} else if (is(commandParam, "undoWithdrawal")) {
|
||||||
commandRequest = builder.undoWithdrawal(clientId).build();
|
commandRequest = builder.undoWithdrawal(clientId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
@@ -368,7 +361,7 @@ public class ClientsApiResource {
|
|||||||
"acceptTransfer", "rejectTransfer", "updateSavingsAccount", "reject", "withdraw", "reactivate" });
|
"acceptTransfer", "rejectTransfer", "updateSavingsAccount", "reject", "withdraw", "reactivate" });
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean is(final String commandParam, final String commandValue) {
|
private boolean is(final String commandParam, final String commandValue) {
|
||||||
@@ -388,15 +381,15 @@ public class ClientsApiResource {
|
|||||||
public String retrieveAssociatedAccounts(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId,
|
public String retrieveAssociatedAccounts(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||||
|
|
||||||
final AccountSummaryCollectionData clientAccount = this.accountDetailsReadPlatformService.retrieveClientAccountDetails(clientId);
|
final AccountSummaryCollectionData clientAccount = accountDetailsReadPlatformService.retrieveClientAccountDetails(clientId);
|
||||||
|
|
||||||
final Set<String> CLIENT_ACCOUNTS_DATA_PARAMETERS = new HashSet<>(
|
final Set<String> CLIENT_ACCOUNTS_DATA_PARAMETERS = new HashSet<>(
|
||||||
Arrays.asList("loanAccounts", "savingsAccounts", "shareAccounts"));
|
Arrays.asList("loanAccounts", "savingsAccounts", "shareAccounts"));
|
||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
return this.clientAccountSummaryToApiJsonSerializer.serialize(settings, clientAccount, CLIENT_ACCOUNTS_DATA_PARAMETERS);
|
return clientAccountSummaryToApiJsonSerializer.serialize(settings, clientAccount, CLIENT_ACCOUNTS_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -417,7 +410,7 @@ public class ClientsApiResource {
|
|||||||
@FormDataParam("locale") final String locale, @FormDataParam("dateFormat") final String dateFormat) {
|
@FormDataParam("locale") final String locale, @FormDataParam("dateFormat") final String dateFormat) {
|
||||||
final Long importDocumentId = bulkImportWorkbookService.importWorkbook(legalFormType, uploadedInputStream, fileDetail, locale,
|
final Long importDocumentId = bulkImportWorkbookService.importWorkbook(legalFormType, uploadedInputStream, fileDetail, locale,
|
||||||
dateFormat);
|
dateFormat);
|
||||||
return this.toApiJsonSerializer.serialize(importDocumentId);
|
return toApiJsonSerializer.serialize(importDocumentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -426,11 +419,11 @@ public class ClientsApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String retrieveObligeeDetails(@PathParam("clientId") final Long clientId, @Context final UriInfo uriInfo) {
|
public String retrieveObligeeDetails(@PathParam("clientId") final Long clientId, @Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||||
|
|
||||||
final List<ObligeeData> ObligeeList = this.guarantorReadPlatformService.retrieveObligeeDetails(clientId);
|
final List<ObligeeData> ObligeeList = guarantorReadPlatformService.retrieveObligeeDetails(clientId);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(ObligeeList);
|
return toApiJsonSerializer.serialize(ObligeeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -439,8 +432,8 @@ public class ClientsApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String retrieveTransferTemplate(@PathParam("clientId") final Long clientId, @Context final UriInfo uriInfo) {
|
public String retrieveTransferTemplate(@PathParam("clientId") final Long clientId, @Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||||
final LocalDate transferDate = this.clientReadPlatformService.retrieveClientTransferProposalDate(clientId);
|
final LocalDate transferDate = clientReadPlatformService.retrieveClientTransferProposalDate(clientId);
|
||||||
return this.toApiJsonSerializer.serialize(transferDate);
|
return toApiJsonSerializer.serialize(transferDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+36
-36
@@ -69,11 +69,11 @@ public class Client extends AbstractAuditableWithUTCDateTimeCustom {
|
|||||||
private Office office;
|
private Office office;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "transfer_to_office_id", nullable = true)
|
@JoinColumn(name = "transfer_to_office_id")
|
||||||
private Office transferToOffice;
|
private Office transferToOffice;
|
||||||
|
|
||||||
@OneToOne(optional = true)
|
@OneToOne(optional = true)
|
||||||
@JoinColumn(name = "image_id", nullable = true)
|
@JoinColumn(name = "image_id")
|
||||||
private Image image;
|
private Image image;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,31 +83,31 @@ public class Client extends AbstractAuditableWithUTCDateTimeCustom {
|
|||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "sub_status", nullable = true)
|
@JoinColumn(name = "sub_status")
|
||||||
private CodeValue subStatus;
|
private CodeValue subStatus;
|
||||||
|
|
||||||
@Column(name = "activation_date", nullable = true)
|
@Column(name = "activation_date")
|
||||||
private LocalDate activationDate;
|
private LocalDate activationDate;
|
||||||
|
|
||||||
@Column(name = "office_joining_date", nullable = true)
|
@Column(name = "office_joining_date")
|
||||||
private LocalDate officeJoiningDate;
|
private LocalDate officeJoiningDate;
|
||||||
|
|
||||||
@Column(name = "firstname", length = 50, nullable = true)
|
@Column(name = "firstname", length = 50)
|
||||||
private String firstname;
|
private String firstname;
|
||||||
|
|
||||||
@Column(name = "middlename", length = 50, nullable = true)
|
@Column(name = "middlename", length = 50)
|
||||||
private String middlename;
|
private String middlename;
|
||||||
|
|
||||||
@Column(name = "lastname", length = 50, nullable = true)
|
@Column(name = "lastname", length = 50)
|
||||||
private String lastname;
|
private String lastname;
|
||||||
|
|
||||||
@Column(name = "fullname", length = 100, nullable = true)
|
@Column(name = "fullname", length = 100)
|
||||||
private String fullname;
|
private String fullname;
|
||||||
|
|
||||||
@Column(name = "display_name", length = 100, nullable = false)
|
@Column(name = "display_name", length = 100, nullable = false)
|
||||||
private String displayName;
|
private String displayName;
|
||||||
|
|
||||||
@Column(name = "mobile_no", length = 50, nullable = true, unique = true)
|
@Column(name = "mobile_no", length = 50, unique = true)
|
||||||
private String mobileNo;
|
private String mobileNo;
|
||||||
|
|
||||||
@Column(name = "email_address", length = 50, unique = true)
|
@Column(name = "email_address", length = 50, unique = true)
|
||||||
@@ -116,14 +116,14 @@ public class Client extends AbstractAuditableWithUTCDateTimeCustom {
|
|||||||
@Column(name = "is_staff", nullable = false)
|
@Column(name = "is_staff", nullable = false)
|
||||||
private boolean isStaff;
|
private boolean isStaff;
|
||||||
|
|
||||||
@Column(name = "external_id", length = 100, nullable = true, unique = true)
|
@Column(name = "external_id", length = 100, unique = true)
|
||||||
private String externalId;
|
private String externalId;
|
||||||
|
|
||||||
@Column(name = "date_of_birth", nullable = true)
|
@Column(name = "date_of_birth")
|
||||||
private LocalDate dateOfBirth;
|
private LocalDate dateOfBirth;
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "gender_cv_id", nullable = true)
|
@JoinColumn(name = "gender_cv_id")
|
||||||
private CodeValue gender;
|
private CodeValue gender;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@@ -138,87 +138,87 @@ public class Client extends AbstractAuditableWithUTCDateTimeCustom {
|
|||||||
private boolean accountNumberRequiresAutoGeneration = false;
|
private boolean accountNumberRequiresAutoGeneration = false;
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "closure_reason_cv_id", nullable = true)
|
@JoinColumn(name = "closure_reason_cv_id")
|
||||||
private CodeValue closureReason;
|
private CodeValue closureReason;
|
||||||
|
|
||||||
@Column(name = "closedon_date", nullable = true)
|
@Column(name = "closedon_date")
|
||||||
private LocalDate closureDate;
|
private LocalDate closureDate;
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "reject_reason_cv_id", nullable = true)
|
@JoinColumn(name = "reject_reason_cv_id")
|
||||||
private CodeValue rejectionReason;
|
private CodeValue rejectionReason;
|
||||||
|
|
||||||
@Column(name = "rejectedon_date", nullable = true)
|
@Column(name = "rejectedon_date")
|
||||||
private LocalDate rejectionDate;
|
private LocalDate rejectionDate;
|
||||||
|
|
||||||
@ManyToOne(optional = true, fetch = FetchType.LAZY)
|
@ManyToOne(optional = true, fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "rejectedon_userid", nullable = true)
|
@JoinColumn(name = "rejectedon_userid")
|
||||||
private AppUser rejectedBy;
|
private AppUser rejectedBy;
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "withdraw_reason_cv_id", nullable = true)
|
@JoinColumn(name = "withdraw_reason_cv_id")
|
||||||
private CodeValue withdrawalReason;
|
private CodeValue withdrawalReason;
|
||||||
|
|
||||||
@Column(name = "withdrawn_on_date", nullable = true)
|
@Column(name = "withdrawn_on_date")
|
||||||
private LocalDate withdrawalDate;
|
private LocalDate withdrawalDate;
|
||||||
|
|
||||||
@ManyToOne(optional = true, fetch = FetchType.LAZY)
|
@ManyToOne(optional = true, fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "withdraw_on_userid", nullable = true)
|
@JoinColumn(name = "withdraw_on_userid")
|
||||||
private AppUser withdrawnBy;
|
private AppUser withdrawnBy;
|
||||||
|
|
||||||
@Column(name = "reactivated_on_date", nullable = true)
|
@Column(name = "reactivated_on_date")
|
||||||
private LocalDate reactivateDate;
|
private LocalDate reactivateDate;
|
||||||
|
|
||||||
@ManyToOne(optional = true, fetch = FetchType.LAZY)
|
@ManyToOne(optional = true, fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "reactivated_on_userid", nullable = true)
|
@JoinColumn(name = "reactivated_on_userid")
|
||||||
private AppUser reactivatedBy;
|
private AppUser reactivatedBy;
|
||||||
|
|
||||||
@ManyToOne(optional = true, fetch = FetchType.LAZY)
|
@ManyToOne(optional = true, fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "closedon_userid", nullable = true)
|
@JoinColumn(name = "closedon_userid")
|
||||||
private AppUser closedBy;
|
private AppUser closedBy;
|
||||||
|
|
||||||
@Column(name = "submittedon_date", nullable = true)
|
@Column(name = "submittedon_date")
|
||||||
private LocalDate submittedOnDate;
|
private LocalDate submittedOnDate;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Deprecated since common Auditable fields were introduced. Columns and data left untouched to help migration.
|
* Deprecated since common Auditable fields were introduced. Columns and data left untouched to help migration.
|
||||||
*
|
*
|
||||||
* @Column(name = "updated_on", nullable = true) private LocalDate updatedOnDate;
|
* @Column(name = "updated_on") private LocalDate updatedOnDate;
|
||||||
*
|
*
|
||||||
* @ManyToOne(optional = true, fetch = FetchType.LAZY)
|
* @ManyToOne(optional = true, fetch = FetchType.LAZY)
|
||||||
*
|
*
|
||||||
* @JoinColumn(name = "updated_by", nullable = true) private AppUser updatedBy;
|
* @JoinColumn(name = "updated_by") private AppUser updatedBy;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ManyToOne(optional = true, fetch = FetchType.LAZY)
|
@ManyToOne(optional = true, fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "activatedon_userid", nullable = true)
|
@JoinColumn(name = "activatedon_userid")
|
||||||
private AppUser activatedBy;
|
private AppUser activatedBy;
|
||||||
|
|
||||||
@Column(name = "default_savings_product", nullable = true)
|
@Column(name = "default_savings_product")
|
||||||
private Long savingsProductId;
|
private Long savingsProductId;
|
||||||
|
|
||||||
@Column(name = "default_savings_account", nullable = true)
|
@Column(name = "default_savings_account")
|
||||||
private Long savingsAccountId;
|
private Long savingsAccountId;
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "client_type_cv_id", nullable = true)
|
@JoinColumn(name = "client_type_cv_id")
|
||||||
private CodeValue clientType;
|
private CodeValue clientType;
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "client_classification_cv_id", nullable = true)
|
@JoinColumn(name = "client_classification_cv_id")
|
||||||
private CodeValue clientClassification;
|
private CodeValue clientClassification;
|
||||||
|
|
||||||
@Column(name = "legal_form_enum", nullable = true)
|
@Column(name = "legal_form_enum")
|
||||||
private Integer legalForm;
|
private Integer legalForm;
|
||||||
|
|
||||||
@Column(name = "reopened_on_date", nullable = true)
|
@Column(name = "reopened_on_date")
|
||||||
private LocalDate reopenedDate;
|
private LocalDate reopenedDate;
|
||||||
|
|
||||||
@ManyToOne(optional = true, fetch = FetchType.LAZY)
|
@ManyToOne(optional = true, fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "reopened_by_userid", nullable = true)
|
@JoinColumn(name = "reopened_by_userid")
|
||||||
private AppUser reopenedBy;
|
private AppUser reopenedBy;
|
||||||
|
|
||||||
@Column(name = "proposed_transfer_date", nullable = true)
|
@Column(name = "proposed_transfer_date")
|
||||||
private LocalDate proposedTransferDate;
|
private LocalDate proposedTransferDate;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "client", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
|
@OneToMany(mappedBy = "client", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
|
||||||
|
|||||||
+15
-39
@@ -41,6 +41,7 @@ import javax.ws.rs.Produces;
|
|||||||
import javax.ws.rs.core.Context;
|
import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.UriInfo;
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||||
@@ -52,14 +53,12 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
|
|||||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||||
import org.apache.fineract.portfolio.fund.data.FundData;
|
import org.apache.fineract.portfolio.fund.data.FundData;
|
||||||
import org.apache.fineract.portfolio.fund.service.FundReadPlatformService;
|
import org.apache.fineract.portfolio.fund.service.FundReadPlatformService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Path("/funds")
|
@Path("/funds")
|
||||||
@Component
|
@Component
|
||||||
@Scope("singleton")
|
|
||||||
@Tag(name = "Funds", description = "")
|
@Tag(name = "Funds", description = "")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class FundsApiResource {
|
public class FundsApiResource {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,17 +74,6 @@ public class FundsApiResource {
|
|||||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public FundsApiResource(final PlatformSecurityContext context, final FundReadPlatformService readPlatformService,
|
|
||||||
final DefaultToApiJsonSerializer<FundData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
|
|
||||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
|
|
||||||
this.context = context;
|
|
||||||
this.readPlatformService = readPlatformService;
|
|
||||||
this.toApiJsonSerializer = toApiJsonSerializer;
|
|
||||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
|
||||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@@ -93,13 +81,10 @@ public class FundsApiResource {
|
|||||||
@ApiResponses({
|
@ApiResponses({
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = FundsApiResourceSwagger.GetFundsResponse.class)))) })
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = FundsApiResourceSwagger.GetFundsResponse.class)))) })
|
||||||
public String retrieveFunds(@Context final UriInfo uriInfo) {
|
public String retrieveFunds(@Context final UriInfo uriInfo) {
|
||||||
|
context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
||||||
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
final Collection<FundData> funds = readPlatformService.retrieveAllFunds();
|
||||||
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
final Collection<FundData> funds = this.readPlatformService.retrieveAllFunds();
|
return toApiJsonSerializer.serialize(settings, funds, RESPONSE_DATA_PARAMETERS);
|
||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
|
||||||
return this.toApiJsonSerializer.serialize(settings, funds, RESPONSE_DATA_PARAMETERS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@@ -110,12 +95,9 @@ public class FundsApiResource {
|
|||||||
@ApiResponses({
|
@ApiResponses({
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FundsApiResourceSwagger.PostFundsResponse.class))) })
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FundsApiResourceSwagger.PostFundsResponse.class))) })
|
||||||
public String createFund(@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
public String createFund(@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createFund().withJson(apiRequestBodyAsJson).build();
|
final CommandWrapper commandRequest = new CommandWrapperBuilder().createFund().withJson(apiRequestBodyAsJson).build();
|
||||||
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
return toApiJsonSerializer.serialize(result);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -126,14 +108,11 @@ public class FundsApiResource {
|
|||||||
+ "funds/1")
|
+ "funds/1")
|
||||||
@ApiResponses({
|
@ApiResponses({
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FundsApiResourceSwagger.GetFundsResponse.class))) })
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FundsApiResourceSwagger.GetFundsResponse.class))) })
|
||||||
public String retreiveFund(@PathParam("fundId") @Parameter(description = "fundId") final Long fundId, @Context final UriInfo uriInfo) {
|
public String retrieveFund(@PathParam("fundId") @Parameter(description = "fundId") final Long fundId, @Context final UriInfo uriInfo) {
|
||||||
|
context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
||||||
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
final FundData fund = readPlatformService.retrieveFund(fundId);
|
||||||
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
final FundData fund = this.readPlatformService.retrieveFund(fundId);
|
return toApiJsonSerializer.serialize(settings, fund, RESPONSE_DATA_PARAMETERS);
|
||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
|
||||||
return this.toApiJsonSerializer.serialize(settings, fund, RESPONSE_DATA_PARAMETERS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@@ -146,11 +125,8 @@ public class FundsApiResource {
|
|||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FundsApiResourceSwagger.PutFundsFundIdResponse.class))) })
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FundsApiResourceSwagger.PutFundsFundIdResponse.class))) })
|
||||||
public String updateFund(@PathParam("fundId") @Parameter(description = "fundId") final Long fundId,
|
public String updateFund(@PathParam("fundId") @Parameter(description = "fundId") final Long fundId,
|
||||||
@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateFund(fundId).withJson(apiRequestBodyAsJson).build();
|
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateFund(fundId).withJson(apiRequestBodyAsJson).build();
|
||||||
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
return toApiJsonSerializer.serialize(result);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+85
-133
@@ -49,6 +49,7 @@ import javax.ws.rs.core.Context;
|
|||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.UriInfo;
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||||
@@ -96,17 +97,15 @@ import org.apache.fineract.portfolio.savings.data.GSIMContainer;
|
|||||||
import org.apache.fineract.portfolio.savings.service.GSIMReadPlatformService;
|
import org.apache.fineract.portfolio.savings.service.GSIMReadPlatformService;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
@Path("/groups")
|
@Path("/groups")
|
||||||
@Component
|
@Component
|
||||||
@Scope("singleton")
|
|
||||||
@Tag(name = "Groups", description = "Groups are used to provide a distinctive banking distribution channel used in microfinances throughout the world. The Group is an administrative unit. It can contain as few as 5 people or as many as 40 depending on how its used.\n"
|
@Tag(name = "Groups", description = "Groups are used to provide a distinctive banking distribution channel used in microfinances throughout the world. The Group is an administrative unit. It can contain as few as 5 people or as many as 40 depending on how its used.\n"
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ "Different styles of group lending - Joint-Liability Group, Grameen Model (Center-Group), Self-Help Groups, Village/Communal Banks)")
|
+ "Different styles of group lending - Joint-Liability Group, Grameen Model (Center-Group), Self-Help Groups, Village/Communal Banks)")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class GroupsApiResource {
|
public class GroupsApiResource {
|
||||||
|
|
||||||
private final PlatformSecurityContext context;
|
private final PlatformSecurityContext context;
|
||||||
@@ -132,50 +131,6 @@ public class GroupsApiResource {
|
|||||||
private final GLIMAccountInfoReadPlatformService glimAccountInfoReadPlatformService;
|
private final GLIMAccountInfoReadPlatformService glimAccountInfoReadPlatformService;
|
||||||
private final GSIMReadPlatformService gsimReadPlatformService;
|
private final GSIMReadPlatformService gsimReadPlatformService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public GroupsApiResource(final PlatformSecurityContext context, final GroupReadPlatformService groupReadPlatformService,
|
|
||||||
final CenterReadPlatformService centerReadPlatformService, final ClientReadPlatformService clientReadPlatformService,
|
|
||||||
final ToApiJsonSerializer<Object> toApiJsonSerializer,
|
|
||||||
final ToApiJsonSerializer<GroupGeneralData> groupTopOfHierarchyApiJsonSerializer,
|
|
||||||
final ToApiJsonSerializer<AccountSummaryCollectionData> groupSummaryToApiJsonSerializer,
|
|
||||||
final ToApiJsonSerializer<GLIMContainer> glimContainerToApiJsonSerializer,
|
|
||||||
final ToApiJsonSerializer<GSIMContainer> gsimContainerToApiJsonSerializer,
|
|
||||||
final ApiRequestParameterHelper apiRequestParameterHelper,
|
|
||||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
|
|
||||||
final CollectionSheetReadPlatformService collectionSheetReadPlatformService, final FromJsonHelper fromJsonHelper,
|
|
||||||
final GroupRolesReadPlatformService groupRolesReadPlatformService,
|
|
||||||
final AccountDetailsReadPlatformService accountDetailsReadPlatformService,
|
|
||||||
final CalendarReadPlatformService calendarReadPlatformService, final MeetingReadPlatformService meetingReadPlatformService,
|
|
||||||
final EntityDatatableChecksReadService entityDatatableChecksReadService,
|
|
||||||
final BulkImportWorkbookService bulkImportWorkbookService,
|
|
||||||
final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService,
|
|
||||||
final GLIMAccountInfoReadPlatformService glimAccountInfoReadPlatformService,
|
|
||||||
final GSIMReadPlatformService gsimReadPlatformService) {
|
|
||||||
this.context = context;
|
|
||||||
this.groupReadPlatformService = groupReadPlatformService;
|
|
||||||
this.centerReadPlatformService = centerReadPlatformService;
|
|
||||||
this.clientReadPlatformService = clientReadPlatformService;
|
|
||||||
this.toApiJsonSerializer = toApiJsonSerializer;
|
|
||||||
this.groupGeneralApiJsonSerializer = groupTopOfHierarchyApiJsonSerializer;
|
|
||||||
this.groupSummaryToApiJsonSerializer = groupSummaryToApiJsonSerializer;
|
|
||||||
this.glimContainerToApiJsonSerializer = glimContainerToApiJsonSerializer;
|
|
||||||
this.gsimContainerToApiJsonSerializer = gsimContainerToApiJsonSerializer;
|
|
||||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
|
||||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
|
||||||
this.collectionSheetReadPlatformService = collectionSheetReadPlatformService;
|
|
||||||
this.fromJsonHelper = fromJsonHelper;
|
|
||||||
this.groupRolesReadPlatformService = groupRolesReadPlatformService;
|
|
||||||
this.accountDetailsReadPlatformService = accountDetailsReadPlatformService;
|
|
||||||
this.calendarReadPlatformService = calendarReadPlatformService;
|
|
||||||
this.meetingReadPlatformService = meetingReadPlatformService;
|
|
||||||
this.entityDatatableChecksReadService = entityDatatableChecksReadService;
|
|
||||||
this.bulkImportWorkbookPopulatorService = bulkImportWorkbookPopulatorService;
|
|
||||||
this.bulkImportWorkbookService = bulkImportWorkbookService;
|
|
||||||
this.glimAccountInfoReadPlatformService = glimAccountInfoReadPlatformService;
|
|
||||||
this.gsimReadPlatformService = gsimReadPlatformService;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("template")
|
@Path("template")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@@ -193,32 +148,31 @@ public class GroupsApiResource {
|
|||||||
@QueryParam("command") @Parameter(description = "command") final String commandParam,
|
@QueryParam("command") @Parameter(description = "command") final String commandParam,
|
||||||
@DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) {
|
@DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(GroupingTypesApiConstants.GROUP_RESOURCE_NAME);
|
context.authenticatedUser().validateHasReadPermission(GroupingTypesApiConstants.GROUP_RESOURCE_NAME);
|
||||||
|
|
||||||
if (is(commandParam, "close")) {
|
if (is(commandParam, "close")) {
|
||||||
final GroupGeneralData groupClosureTemplate = this.groupReadPlatformService.retrieveGroupWithClosureReasons();
|
final GroupGeneralData groupClosureTemplate = groupReadPlatformService.retrieveGroupWithClosureReasons();
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
return this.groupGeneralApiJsonSerializer.serialize(settings, groupClosureTemplate,
|
return groupGeneralApiJsonSerializer.serialize(settings, groupClosureTemplate,
|
||||||
GroupingTypesApiConstants.GROUP_RESPONSE_DATA_PARAMETERS);
|
GroupingTypesApiConstants.GROUP_RESPONSE_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<DatatableData> datatableTemplates = this.entityDatatableChecksReadService
|
final List<DatatableData> datatableTemplates = entityDatatableChecksReadService
|
||||||
.retrieveTemplates(StatusEnum.CREATE.getCode().longValue(), EntityTables.GROUP.getName(), null);
|
.retrieveTemplates(StatusEnum.CREATE.getCode().longValue(), EntityTables.GROUP.getName(), null);
|
||||||
if (centerId != null) {
|
if (centerId != null) {
|
||||||
final GroupGeneralData centerGroupTemplate = this.centerReadPlatformService.retrieveCenterGroupTemplate(centerId);
|
final GroupGeneralData centerGroupTemplate = centerReadPlatformService.retrieveCenterGroupTemplate(centerId);
|
||||||
centerGroupTemplate.setDatatables(datatableTemplates);
|
centerGroupTemplate.setDatatables(datatableTemplates);
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
return this.groupGeneralApiJsonSerializer.serialize(settings, centerGroupTemplate,
|
return groupGeneralApiJsonSerializer.serialize(settings, centerGroupTemplate,
|
||||||
GroupingTypesApiConstants.CENTER_GROUP_RESPONSE_DATA_PARAMETERS);
|
GroupingTypesApiConstants.CENTER_GROUP_RESPONSE_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
final GroupGeneralData groupTemplate = this.groupReadPlatformService.retrieveTemplate(officeId, isCenterGroup,
|
final GroupGeneralData groupTemplate = groupReadPlatformService.retrieveTemplate(officeId, isCenterGroup,
|
||||||
staffInSelectedOfficeOnly);
|
staffInSelectedOfficeOnly);
|
||||||
groupTemplate.setDatatables(datatableTemplates);
|
groupTemplate.setDatatables(datatableTemplates);
|
||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
return this.groupGeneralApiJsonSerializer.serialize(settings, groupTemplate,
|
return groupGeneralApiJsonSerializer.serialize(settings, groupTemplate, GroupingTypesApiConstants.GROUP_RESPONSE_DATA_PARAMETERS);
|
||||||
GroupingTypesApiConstants.GROUP_RESPONSE_DATA_PARAMETERS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -242,19 +196,19 @@ public class GroupsApiResource {
|
|||||||
@QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder,
|
@QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder,
|
||||||
@QueryParam("orphansOnly") @Parameter(description = "orphansOnly") final Boolean orphansOnly) {
|
@QueryParam("orphansOnly") @Parameter(description = "orphansOnly") final Boolean orphansOnly) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(GroupingTypesApiConstants.GROUP_RESOURCE_NAME);
|
context.authenticatedUser().validateHasReadPermission(GroupingTypesApiConstants.GROUP_RESOURCE_NAME);
|
||||||
final PaginationParameters parameters = PaginationParameters.instance(paged, offset, limit, orderBy, sortOrder);
|
final PaginationParameters parameters = PaginationParameters.instance(paged, offset, limit, orderBy, sortOrder);
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
|
|
||||||
final SearchParameters searchParameters = SearchParameters.forGroups(officeId, staffId, externalId, name, hierarchy, offset, limit,
|
final SearchParameters searchParameters = SearchParameters.forGroups(officeId, staffId, externalId, name, hierarchy, offset, limit,
|
||||||
orderBy, sortOrder, orphansOnly);
|
orderBy, sortOrder, orphansOnly);
|
||||||
if (parameters.isPaged()) {
|
if (parameters.isPaged()) {
|
||||||
final Page<GroupGeneralData> groups = this.groupReadPlatformService.retrievePagedAll(searchParameters, parameters);
|
final Page<GroupGeneralData> groups = groupReadPlatformService.retrievePagedAll(searchParameters, parameters);
|
||||||
return this.toApiJsonSerializer.serialize(settings, groups, GroupingTypesApiConstants.GROUP_RESPONSE_DATA_PARAMETERS);
|
return toApiJsonSerializer.serialize(settings, groups, GroupingTypesApiConstants.GROUP_RESPONSE_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Collection<GroupGeneralData> groups = this.groupReadPlatformService.retrieveAll(searchParameters, parameters);
|
final Collection<GroupGeneralData> groups = groupReadPlatformService.retrieveAll(searchParameters, parameters);
|
||||||
return this.toApiJsonSerializer.serialize(settings, groups, GroupingTypesApiConstants.GROUP_RESPONSE_DATA_PARAMETERS);
|
return toApiJsonSerializer.serialize(settings, groups, GroupingTypesApiConstants.GROUP_RESPONSE_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -269,11 +223,11 @@ public class GroupsApiResource {
|
|||||||
@DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly,
|
@DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly,
|
||||||
@QueryParam("roleId") @Parameter(description = "roleId") final Long roleId) {
|
@QueryParam("roleId") @Parameter(description = "roleId") final Long roleId) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(GroupingTypesApiConstants.GROUP_RESOURCE_NAME);
|
context.authenticatedUser().validateHasReadPermission(GroupingTypesApiConstants.GROUP_RESOURCE_NAME);
|
||||||
final Set<String> associationParameters = ApiParameterHelper.extractAssociationsForResponseIfProvided(uriInfo.getQueryParameters());
|
final Set<String> associationParameters = ApiParameterHelper.extractAssociationsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
|
|
||||||
GroupGeneralData group = this.groupReadPlatformService.retrieveOne(groupId);
|
GroupGeneralData group = groupReadPlatformService.retrieveOne(groupId);
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
|
|
||||||
// associations
|
// associations
|
||||||
Collection<ClientData> membersOfGroup = null;
|
Collection<ClientData> membersOfGroup = null;
|
||||||
@@ -289,26 +243,26 @@ public class GroupsApiResource {
|
|||||||
Arrays.asList("clientMembers", "activeClientMembers", "groupRoles", "calendars", "collectionMeetingCalendar"));
|
Arrays.asList("clientMembers", "activeClientMembers", "groupRoles", "calendars", "collectionMeetingCalendar"));
|
||||||
}
|
}
|
||||||
if (associationParameters.contains("clientMembers")) {
|
if (associationParameters.contains("clientMembers")) {
|
||||||
membersOfGroup = this.clientReadPlatformService.retrieveClientMembersOfGroup(groupId);
|
membersOfGroup = clientReadPlatformService.retrieveClientMembersOfGroup(groupId);
|
||||||
if (CollectionUtils.isEmpty(membersOfGroup)) {
|
if (CollectionUtils.isEmpty(membersOfGroup)) {
|
||||||
membersOfGroup = null;
|
membersOfGroup = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (associationParameters.contains("activeClientMembers")) {
|
if (associationParameters.contains("activeClientMembers")) {
|
||||||
activeClientMembers = this.clientReadPlatformService.retrieveActiveClientMembersOfGroup(groupId);
|
activeClientMembers = clientReadPlatformService.retrieveActiveClientMembersOfGroup(groupId);
|
||||||
if (CollectionUtils.isEmpty(activeClientMembers)) {
|
if (CollectionUtils.isEmpty(activeClientMembers)) {
|
||||||
activeClientMembers = null;
|
activeClientMembers = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (associationParameters.contains("groupRoles")) {
|
if (associationParameters.contains("groupRoles")) {
|
||||||
groupRoles = this.groupRolesReadPlatformService.retrieveGroupRoles(groupId);
|
groupRoles = groupRolesReadPlatformService.retrieveGroupRoles(groupId);
|
||||||
if (CollectionUtils.isEmpty(groupRoles)) {
|
if (CollectionUtils.isEmpty(groupRoles)) {
|
||||||
groupRoles = null;
|
groupRoles = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (associationParameters.contains("parentCalendars")) {
|
if (associationParameters.contains("parentCalendars")) {
|
||||||
final List<Integer> calendarTypeOptions = CalendarUtils.createIntegerListFromQueryParameter("all");
|
final List<Integer> calendarTypeOptions = CalendarUtils.createIntegerListFromQueryParameter("all");
|
||||||
calendars = this.calendarReadPlatformService.retrieveParentCalendarsByEntity(groupId, CalendarEntityType.GROUPS.getValue(),
|
calendars = calendarReadPlatformService.retrieveParentCalendarsByEntity(groupId, CalendarEntityType.GROUPS.getValue(),
|
||||||
calendarTypeOptions);
|
calendarTypeOptions);
|
||||||
if (CollectionUtils.isEmpty(calendars)) {
|
if (CollectionUtils.isEmpty(calendars)) {
|
||||||
calendars = null;
|
calendars = null;
|
||||||
@@ -316,22 +270,22 @@ public class GroupsApiResource {
|
|||||||
}
|
}
|
||||||
if (associationParameters.contains("collectionMeetingCalendar")) {
|
if (associationParameters.contains("collectionMeetingCalendar")) {
|
||||||
if (group.isChildGroup()) {
|
if (group.isChildGroup()) {
|
||||||
collectionMeetingCalendar = this.calendarReadPlatformService.retrieveCollctionCalendarByEntity(group.getParentId(),
|
collectionMeetingCalendar = calendarReadPlatformService.retrieveCollctionCalendarByEntity(group.getParentId(),
|
||||||
CalendarEntityType.CENTERS.getValue());
|
CalendarEntityType.CENTERS.getValue());
|
||||||
} else {
|
} else {
|
||||||
collectionMeetingCalendar = this.calendarReadPlatformService.retrieveCollctionCalendarByEntity(groupId,
|
collectionMeetingCalendar = calendarReadPlatformService.retrieveCollctionCalendarByEntity(groupId,
|
||||||
CalendarEntityType.GROUPS.getValue());
|
CalendarEntityType.GROUPS.getValue());
|
||||||
}
|
}
|
||||||
if (collectionMeetingCalendar != null) {
|
if (collectionMeetingCalendar != null) {
|
||||||
final boolean withHistory = true;
|
final boolean withHistory = true;
|
||||||
final LocalDate tillDate = null;
|
final LocalDate tillDate = null;
|
||||||
final Collection<LocalDate> recurringDates = this.calendarReadPlatformService
|
final Collection<LocalDate> recurringDates = calendarReadPlatformService
|
||||||
.generateRecurringDates(collectionMeetingCalendar, withHistory, tillDate);
|
.generateRecurringDates(collectionMeetingCalendar, withHistory, tillDate);
|
||||||
final Collection<LocalDate> nextTenRecurringDates = this.calendarReadPlatformService
|
final Collection<LocalDate> nextTenRecurringDates = calendarReadPlatformService
|
||||||
.generateNextTenRecurringDates(collectionMeetingCalendar);
|
.generateNextTenRecurringDates(collectionMeetingCalendar);
|
||||||
final MeetingData lastMeeting = this.meetingReadPlatformService
|
final MeetingData lastMeeting = meetingReadPlatformService
|
||||||
.retrieveLastMeeting(collectionMeetingCalendar.getCalendarInstanceId());
|
.retrieveLastMeeting(collectionMeetingCalendar.getCalendarInstanceId());
|
||||||
final LocalDate recentEligibleMeetingDate = this.calendarReadPlatformService
|
final LocalDate recentEligibleMeetingDate = calendarReadPlatformService
|
||||||
.generateNextEligibleMeetingDateForCollection(collectionMeetingCalendar, lastMeeting);
|
.generateNextEligibleMeetingDateForCollection(collectionMeetingCalendar, lastMeeting);
|
||||||
collectionMeetingCalendar = CalendarData.withRecurringDates(collectionMeetingCalendar, recurringDates,
|
collectionMeetingCalendar = CalendarData.withRecurringDates(collectionMeetingCalendar, recurringDates,
|
||||||
nextTenRecurringDates, recentEligibleMeetingDate);
|
nextTenRecurringDates, recentEligibleMeetingDate);
|
||||||
@@ -343,7 +297,7 @@ public class GroupsApiResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (roleId != null) {
|
if (roleId != null) {
|
||||||
selectedRole = this.groupRolesReadPlatformService.retrieveGroupRole(groupId, roleId);
|
selectedRole = groupRolesReadPlatformService.retrieveGroupRole(groupId, roleId);
|
||||||
if (selectedRole != null) {
|
if (selectedRole != null) {
|
||||||
group = GroupGeneralData.updateSelectedRole(group, selectedRole);
|
group = GroupGeneralData.updateSelectedRole(group, selectedRole);
|
||||||
}
|
}
|
||||||
@@ -351,12 +305,12 @@ public class GroupsApiResource {
|
|||||||
|
|
||||||
final boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
|
final boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
|
||||||
if (template) {
|
if (template) {
|
||||||
final GroupGeneralData templateGroup = this.groupReadPlatformService.retrieveTemplate(group.officeId(), false,
|
final GroupGeneralData templateGroup = groupReadPlatformService.retrieveTemplate(group.officeId(), false,
|
||||||
staffInSelectedOfficeOnly);
|
staffInSelectedOfficeOnly);
|
||||||
group = GroupGeneralData.withTemplate(templateGroup, group);
|
group = GroupGeneralData.withTemplate(templateGroup, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.groupGeneralApiJsonSerializer.serialize(settings, group, GroupingTypesApiConstants.GROUP_RESPONSE_DATA_PARAMETERS);
|
return groupGeneralApiJsonSerializer.serialize(settings, group, GroupingTypesApiConstants.GROUP_RESPONSE_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@@ -374,8 +328,8 @@ public class GroupsApiResource {
|
|||||||
.createGroup() //
|
.createGroup() //
|
||||||
.withJson(apiRequestBodyAsJson) //
|
.withJson(apiRequestBodyAsJson) //
|
||||||
.build(); //
|
.build(); //
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@@ -393,8 +347,8 @@ public class GroupsApiResource {
|
|||||||
.unassignGroupStaff(groupId) //
|
.unassignGroupStaff(groupId) //
|
||||||
.withJson(apiRequestBodyAsJson) //
|
.withJson(apiRequestBodyAsJson) //
|
||||||
.build(); //
|
.build(); //
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,8 +367,8 @@ public class GroupsApiResource {
|
|||||||
.updateGroup(groupId) //
|
.updateGroup(groupId) //
|
||||||
.withJson(apiRequestBodyAsJson) //
|
.withJson(apiRequestBodyAsJson) //
|
||||||
.build(); //
|
.build(); //
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@@ -429,8 +383,8 @@ public class GroupsApiResource {
|
|||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||||
.deleteGroup(groupId) //
|
.deleteGroup(groupId) //
|
||||||
.build(); //
|
.build(); //
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@@ -480,55 +434,54 @@ public class GroupsApiResource {
|
|||||||
CommandProcessingResult result = null;
|
CommandProcessingResult result = null;
|
||||||
if (is(commandParam, "activate")) {
|
if (is(commandParam, "activate")) {
|
||||||
final CommandWrapper commandRequest = builder.activateGroup(groupId).build();
|
final CommandWrapper commandRequest = builder.activateGroup(groupId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
} else if (is(commandParam, "associateClients")) {
|
} else if (is(commandParam, "associateClients")) {
|
||||||
final CommandWrapper commandRequest = builder.associateClientsToGroup(groupId).build();
|
final CommandWrapper commandRequest = builder.associateClientsToGroup(groupId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
} else if (is(commandParam, "disassociateClients")) {
|
} else if (is(commandParam, "disassociateClients")) {
|
||||||
final CommandWrapper commandRequest = builder.disassociateClientsFromGroup(groupId).build();
|
final CommandWrapper commandRequest = builder.disassociateClientsFromGroup(groupId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
} else if (is(commandParam, "generateCollectionSheet")) {
|
} else if (is(commandParam, "generateCollectionSheet")) {
|
||||||
final JsonElement parsedQuery = this.fromJsonHelper.parse(apiRequestBodyAsJson);
|
final JsonElement parsedQuery = fromJsonHelper.parse(apiRequestBodyAsJson);
|
||||||
final JsonQuery query = JsonQuery.from(apiRequestBodyAsJson, parsedQuery, this.fromJsonHelper);
|
final JsonQuery query = JsonQuery.from(apiRequestBodyAsJson, parsedQuery, fromJsonHelper);
|
||||||
final JLGCollectionSheetData collectionSheet = this.collectionSheetReadPlatformService.generateGroupCollectionSheet(groupId,
|
final JLGCollectionSheetData collectionSheet = collectionSheetReadPlatformService.generateGroupCollectionSheet(groupId, query);
|
||||||
query);
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
return toApiJsonSerializer.serialize(settings, collectionSheet, GroupingTypesApiConstants.COLLECTIONSHEET_DATA_PARAMETERS);
|
||||||
return this.toApiJsonSerializer.serialize(settings, collectionSheet, GroupingTypesApiConstants.COLLECTIONSHEET_DATA_PARAMETERS);
|
|
||||||
} else if (is(commandParam, "saveCollectionSheet")) {
|
} else if (is(commandParam, "saveCollectionSheet")) {
|
||||||
final CommandWrapper commandRequest = builder.saveGroupCollectionSheet(groupId).build();
|
final CommandWrapper commandRequest = builder.saveGroupCollectionSheet(groupId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
} else if (is(commandParam, "unassignStaff")) {
|
} else if (is(commandParam, "unassignStaff")) {
|
||||||
final CommandWrapper commandRequest = builder.unassignGroupStaff(groupId).build();
|
final CommandWrapper commandRequest = builder.unassignGroupStaff(groupId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
} else if (is(commandParam, "assignStaff")) {
|
} else if (is(commandParam, "assignStaff")) {
|
||||||
final CommandWrapper commandRequest = builder.assignGroupStaff(groupId).build();
|
final CommandWrapper commandRequest = builder.assignGroupStaff(groupId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
} else if (is(commandParam, "assignRole")) {
|
} else if (is(commandParam, "assignRole")) {
|
||||||
final CommandWrapper commandRequest = builder.assignRole(groupId).build();
|
final CommandWrapper commandRequest = builder.assignRole(groupId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
} else if (is(commandParam, "unassignRole")) {
|
} else if (is(commandParam, "unassignRole")) {
|
||||||
final CommandWrapper commandRequest = builder.unassignRole(groupId, roleId).build();
|
final CommandWrapper commandRequest = builder.unassignRole(groupId, roleId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
} else if (is(commandParam, "updateRole")) {
|
} else if (is(commandParam, "updateRole")) {
|
||||||
final CommandWrapper commandRequest = builder.updateRole(groupId, roleId).build();
|
final CommandWrapper commandRequest = builder.updateRole(groupId, roleId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
} else if (is(commandParam, "transferClients")) {
|
} else if (is(commandParam, "transferClients")) {
|
||||||
final CommandWrapper commandRequest = builder.transferClientsBetweenGroups(groupId).build();
|
final CommandWrapper commandRequest = builder.transferClientsBetweenGroups(groupId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
} else if (is(commandParam, "close")) {
|
} else if (is(commandParam, "close")) {
|
||||||
final CommandWrapper commandRequest = builder.closeGroup(groupId).build();
|
final CommandWrapper commandRequest = builder.closeGroup(groupId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
} else {
|
} else {
|
||||||
throw new UnrecognizedQueryParamException("command", commandParam, new Object[] { "activate", "generateCollectionSheet",
|
throw new UnrecognizedQueryParamException("command", commandParam, new Object[] { "activate", "generateCollectionSheet",
|
||||||
"saveCollectionSheet", "unassignStaff", "assignRole", "unassignRole", "updateassignRole" });
|
"saveCollectionSheet", "unassignStaff", "assignRole", "unassignRole", "updateassignRole" });
|
||||||
@@ -552,15 +505,15 @@ public class GroupsApiResource {
|
|||||||
public String retrieveAccounts(@PathParam("groupId") @Parameter(description = "groupId") final Long groupId,
|
public String retrieveAccounts(@PathParam("groupId") @Parameter(description = "groupId") final Long groupId,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission("GROUP");
|
context.authenticatedUser().validateHasReadPermission("GROUP");
|
||||||
|
|
||||||
final AccountSummaryCollectionData groupAccount = this.accountDetailsReadPlatformService.retrieveGroupAccountDetails(groupId);
|
final AccountSummaryCollectionData groupAccount = accountDetailsReadPlatformService.retrieveGroupAccountDetails(groupId);
|
||||||
|
|
||||||
final Set<String> GROUP_ACCOUNTS_DATA_PARAMETERS = new HashSet<>(Arrays.asList("loanAccounts",
|
final Set<String> GROUP_ACCOUNTS_DATA_PARAMETERS = new HashSet<>(Arrays.asList("loanAccounts",
|
||||||
"groupLoanIndividualMonitoringAccounts", "savingsAccounts", "memberLoanAccounts", "memberSavingsAccounts"));
|
"groupLoanIndividualMonitoringAccounts", "savingsAccounts", "memberLoanAccounts", "memberSavingsAccounts"));
|
||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
return this.groupSummaryToApiJsonSerializer.serialize(settings, groupAccount, GROUP_ACCOUNTS_DATA_PARAMETERS);
|
return groupSummaryToApiJsonSerializer.serialize(settings, groupAccount, GROUP_ACCOUNTS_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -579,9 +532,9 @@ public class GroupsApiResource {
|
|||||||
public String postGroupTemplate(@FormDataParam("file") InputStream uploadedInputStream,
|
public String postGroupTemplate(@FormDataParam("file") InputStream uploadedInputStream,
|
||||||
@FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("locale") final String locale,
|
@FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("locale") final String locale,
|
||||||
@FormDataParam("dateFormat") final String dateFormat) {
|
@FormDataParam("dateFormat") final String dateFormat) {
|
||||||
final Long importDocumentId = this.bulkImportWorkbookService.importWorkbook(GlobalEntityType.GROUPS.toString(), uploadedInputStream,
|
final Long importDocumentId = bulkImportWorkbookService.importWorkbook(GlobalEntityType.GROUPS.toString(), uploadedInputStream,
|
||||||
fileDetail, locale, dateFormat);
|
fileDetail, locale, dateFormat);
|
||||||
return this.toApiJsonSerializer.serialize(importDocumentId);
|
return toApiJsonSerializer.serialize(importDocumentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -590,7 +543,7 @@ public class GroupsApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String retrieveglimAccounts(@PathParam("groupId") final Long groupId,
|
public String retrieveglimAccounts(@PathParam("groupId") final Long groupId,
|
||||||
@QueryParam("parentLoanAccountNo") final String parentLoanAccountNo, @Context final UriInfo uriInfo) {
|
@QueryParam("parentLoanAccountNo") final String parentLoanAccountNo, @Context final UriInfo uriInfo) {
|
||||||
this.context.authenticatedUser().validateHasReadPermission("GROUP");
|
context.authenticatedUser().validateHasReadPermission("GROUP");
|
||||||
List<GLIMContainer> glimContainer = Collections.emptyList();
|
List<GLIMContainer> glimContainer = Collections.emptyList();
|
||||||
if (parentLoanAccountNo == null) {
|
if (parentLoanAccountNo == null) {
|
||||||
glimContainer = (List<GLIMContainer>) glimAccountInfoReadPlatformService.findGlimAccount(groupId);
|
glimContainer = (List<GLIMContainer>) glimAccountInfoReadPlatformService.findGlimAccount(groupId);
|
||||||
@@ -602,8 +555,8 @@ public class GroupsApiResource {
|
|||||||
final Set<String> GLIM_ACCOUNTS_DATA_PARAMETERS = new HashSet<>(
|
final Set<String> GLIM_ACCOUNTS_DATA_PARAMETERS = new HashSet<>(
|
||||||
Arrays.asList("groupId", "accountNumber", "childGLIMAccounts", "memberLoanAccounts", "parentPrincipalAmount"));
|
Arrays.asList("groupId", "accountNumber", "childGLIMAccounts", "memberLoanAccounts", "parentPrincipalAmount"));
|
||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
return this.glimContainerToApiJsonSerializer.serialize(settings, glimContainer, GLIM_ACCOUNTS_DATA_PARAMETERS);
|
return glimContainerToApiJsonSerializer.serialize(settings, glimContainer, GLIM_ACCOUNTS_DATA_PARAMETERS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,23 +568,22 @@ public class GroupsApiResource {
|
|||||||
@QueryParam("parentGSIMAccountNo") final String parentGSIMAccountNo, @QueryParam("parentGSIMId") final Long parentGSIMId,
|
@QueryParam("parentGSIMAccountNo") final String parentGSIMAccountNo, @QueryParam("parentGSIMId") final Long parentGSIMId,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
List<GSIMContainer> gsimContainer;
|
List<GSIMContainer> gsimContainer;
|
||||||
this.context.authenticatedUser().validateHasReadPermission("GROUP");
|
context.authenticatedUser().validateHasReadPermission("GROUP");
|
||||||
|
|
||||||
if (parentGSIMAccountNo == null && parentGSIMId != null) {
|
if (parentGSIMAccountNo == null && parentGSIMId != null) {
|
||||||
gsimContainer = this.gsimReadPlatformService.findGsimAccountContainerbyGsimAccountId(parentGSIMId);
|
gsimContainer = gsimReadPlatformService.findGsimAccountContainerbyGsimAccountId(parentGSIMId);
|
||||||
} else if (parentGSIMAccountNo != null && parentGSIMId == null) {
|
} else if (parentGSIMAccountNo != null && parentGSIMId == null) {
|
||||||
gsimContainer = (List<GSIMContainer>) this.gsimReadPlatformService
|
gsimContainer = (List<GSIMContainer>) gsimReadPlatformService.findGsimAccountContainerbyGsimAccountNumber(parentGSIMAccountNo);
|
||||||
.findGsimAccountContainerbyGsimAccountNumber(parentGSIMAccountNo);
|
|
||||||
} else {
|
} else {
|
||||||
gsimContainer = (List<GSIMContainer>) this.gsimReadPlatformService.findGSIMAccountContainerByGroupId(groupId);
|
gsimContainer = (List<GSIMContainer>) gsimReadPlatformService.findGSIMAccountContainerByGroupId(groupId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final Set<String> GSIM_ACCOUNTS_DATA_PARAMETERS = new HashSet<>(
|
final Set<String> GSIM_ACCOUNTS_DATA_PARAMETERS = new HashSet<>(
|
||||||
Arrays.asList("gsimId", "groupId", "accountNumber", "childGSIMAccounts", "parentBalance", "savingsStatus"));
|
Arrays.asList("gsimId", "groupId", "accountNumber", "childGSIMAccounts", "parentBalance", "savingsStatus"));
|
||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
return this.gsimContainerToApiJsonSerializer.serialize(settings, gsimContainer, GSIM_ACCOUNTS_DATA_PARAMETERS);
|
return gsimContainerToApiJsonSerializer.serialize(settings, gsimContainer, GSIM_ACCOUNTS_DATA_PARAMETERS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-2
@@ -65,12 +65,10 @@ import org.apache.fineract.portfolio.loanaccount.data.LoanInstallmentChargeData;
|
|||||||
import org.apache.fineract.portfolio.loanaccount.exception.LoanNotFoundException;
|
import org.apache.fineract.portfolio.loanaccount.exception.LoanNotFoundException;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanChargeReadPlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanChargeReadPlatformService;
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService;
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Path("/loans")
|
@Path("/loans")
|
||||||
@Component
|
@Component
|
||||||
@Scope("singleton")
|
|
||||||
@Tag(name = "Loan Charges", description = "Its typical for MFIs to add extra costs for their loan products. They can be either Fees or Penalties.\n"
|
@Tag(name = "Loan Charges", description = "Its typical for MFIs to add extra costs for their loan products. They can be either Fees or Penalties.\n"
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ "Loan Charges are instances of Charges and represent either fees and penalties for loan products. 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 Loan) are described here")
|
+ "Loan Charges are instances of Charges and represent either fees and penalties for loan products. 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 Loan) are described here")
|
||||||
|
|||||||
-2
@@ -68,13 +68,11 @@ import org.apache.fineract.portfolio.loanaccount.service.LoanChargePaidByReadPla
|
|||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService;
|
import org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService;
|
||||||
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
|
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
|
||||||
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService;
|
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService;
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Path("/loans")
|
@Path("/loans")
|
||||||
@Component
|
@Component
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Scope("singleton")
|
|
||||||
@Tag(name = "Loan Transactions", description = "Capabilities include loan repayment's, interest waivers and the ability to 'adjust' an existing transaction. An 'adjustment' of a transaction is really a 'reversal' of existing transaction followed by creation of a new transaction with the provided details.")
|
@Tag(name = "Loan Transactions", description = "Capabilities include loan repayment's, interest waivers and the ability to 'adjust' an existing transaction. An 'adjustment' of a transaction is really a 'reversal' of existing transaction followed by creation of a new transaction with the provided details.")
|
||||||
public class LoanTransactionsApiResource {
|
public class LoanTransactionsApiResource {
|
||||||
|
|
||||||
|
|||||||
-2
@@ -151,13 +151,11 @@ import org.apache.fineract.portfolio.savings.DepositAccountType;
|
|||||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccountStatusType;
|
import org.apache.fineract.portfolio.savings.domain.SavingsAccountStatusType;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
@Path("/loans")
|
@Path("/loans")
|
||||||
@Component
|
@Component
|
||||||
@Scope("singleton")
|
|
||||||
@Tag(name = "Loans", description = "The API concept of loans models the loan application process and the loan contract/monitoring process.\n"
|
@Tag(name = "Loans", description = "The API concept of loans models the loan application process and the loan contract/monitoring process.\n"
|
||||||
+ "\n" + "Field Descriptions\n" + "accountNo\n"
|
+ "\n" + "Field Descriptions\n" + "accountNo\n"
|
||||||
+ "The account no. associated with this loan. Is auto generated if not provided at loan application creation time.\n"
|
+ "The account no. associated with this loan. Is auto generated if not provided at loan application creation time.\n"
|
||||||
|
|||||||
+2
-40
@@ -44,6 +44,7 @@ import javax.ws.rs.QueryParam;
|
|||||||
import javax.ws.rs.core.Context;
|
import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.UriInfo;
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.fineract.accounting.common.AccountingDropdownReadPlatformService;
|
import org.apache.fineract.accounting.common.AccountingDropdownReadPlatformService;
|
||||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||||
import org.apache.fineract.accounting.producttoaccountmapping.data.ChargeToGLAccountMapper;
|
import org.apache.fineract.accounting.producttoaccountmapping.data.ChargeToGLAccountMapper;
|
||||||
@@ -83,14 +84,12 @@ import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
|
|||||||
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService;
|
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService;
|
||||||
import org.apache.fineract.portfolio.rate.data.RateData;
|
import org.apache.fineract.portfolio.rate.data.RateData;
|
||||||
import org.apache.fineract.portfolio.rate.service.RateReadService;
|
import org.apache.fineract.portfolio.rate.service.RateReadService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Path("/loanproducts")
|
@Path("/loanproducts")
|
||||||
@Component
|
@Component
|
||||||
@Scope("singleton")
|
|
||||||
@Tag(name = "Loan Products", description = "A Loan product is a template that is used when creating a loan. Much of the template definition can be overridden during loan creation.")
|
@Tag(name = "Loan Products", description = "A Loan product is a template that is used when creating a loan. Much of the template definition can be overridden during loan creation.")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class LoanProductsApiResource {
|
public class LoanProductsApiResource {
|
||||||
|
|
||||||
private static final Set<String> LOAN_PRODUCT_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "shortName", "description",
|
private static final Set<String> LOAN_PRODUCT_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "shortName", "description",
|
||||||
@@ -136,43 +135,6 @@ public class LoanProductsApiResource {
|
|||||||
private final ConfigurationDomainService configurationDomainService;
|
private final ConfigurationDomainService configurationDomainService;
|
||||||
private final DelinquencyReadPlatformService delinquencyReadPlatformService;
|
private final DelinquencyReadPlatformService delinquencyReadPlatformService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public LoanProductsApiResource(final PlatformSecurityContext context, final LoanProductReadPlatformService readPlatformService,
|
|
||||||
final ChargeReadPlatformService chargeReadPlatformService, final CurrencyReadPlatformService currencyReadPlatformService,
|
|
||||||
final FundReadPlatformService fundReadPlatformService, final LoanDropdownReadPlatformService dropdownReadPlatformService,
|
|
||||||
final DefaultToApiJsonSerializer<LoanProductData> toApiJsonSerializer,
|
|
||||||
final ApiRequestParameterHelper apiRequestParameterHelper,
|
|
||||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
|
|
||||||
final ProductToGLAccountMappingReadPlatformService accountMappingReadPlatformService,
|
|
||||||
final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService,
|
|
||||||
final DefaultToApiJsonSerializer<ProductMixData> productMixDataApiJsonSerializer,
|
|
||||||
final ProductMixReadPlatformService productMixReadPlatformService,
|
|
||||||
final DropdownReadPlatformService commonDropdownReadPlatformService,
|
|
||||||
PaymentTypeReadPlatformService paymentTypeReadPlatformService,
|
|
||||||
final FloatingRatesReadPlatformService floatingRateReadPlatformService, final RateReadService rateReadService,
|
|
||||||
final ConfigurationDomainService configurationDomainService,
|
|
||||||
final DelinquencyReadPlatformService delinquencyReadPlatformService) {
|
|
||||||
this.context = context;
|
|
||||||
this.loanProductReadPlatformService = readPlatformService;
|
|
||||||
this.chargeReadPlatformService = chargeReadPlatformService;
|
|
||||||
this.currencyReadPlatformService = currencyReadPlatformService;
|
|
||||||
this.fundReadPlatformService = fundReadPlatformService;
|
|
||||||
this.dropdownReadPlatformService = dropdownReadPlatformService;
|
|
||||||
this.toApiJsonSerializer = toApiJsonSerializer;
|
|
||||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
|
||||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
|
||||||
this.accountMappingReadPlatformService = accountMappingReadPlatformService;
|
|
||||||
this.accountingDropdownReadPlatformService = accountingDropdownReadPlatformService;
|
|
||||||
this.productMixDataApiJsonSerializer = productMixDataApiJsonSerializer;
|
|
||||||
this.productMixReadPlatformService = productMixReadPlatformService;
|
|
||||||
this.commonDropdownReadPlatformService = commonDropdownReadPlatformService;
|
|
||||||
this.paymentTypeReadPlatformService = paymentTypeReadPlatformService;
|
|
||||||
this.floatingRateReadPlatformService = floatingRateReadPlatformService;
|
|
||||||
this.rateReadService = rateReadService;
|
|
||||||
this.configurationDomainService = configurationDomainService;
|
|
||||||
this.delinquencyReadPlatformService = delinquencyReadPlatformService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
|
|||||||
+65
-99
@@ -45,6 +45,7 @@ import javax.ws.rs.core.Context;
|
|||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.UriInfo;
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||||
@@ -71,15 +72,13 @@ import org.apache.fineract.portfolio.savings.service.SavingsAccountChargeReadPla
|
|||||||
import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService;
|
import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
@Path("/savingsaccounts")
|
@Path("/savingsaccounts")
|
||||||
@Component
|
@Component
|
||||||
@Scope("singleton")
|
|
||||||
@Tag(name = "Savings Account", description = "Savings accounts are instances of a particular savings product created for an individual or group. An application process around the creation of accounts is also supported.")
|
@Tag(name = "Savings Account", description = "Savings accounts are instances of a particular savings product created for an individual or group. An application process around the creation of accounts is also supported.")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class SavingsAccountsApiResource {
|
public class SavingsAccountsApiResource {
|
||||||
|
|
||||||
private final SavingsAccountReadPlatformService savingsAccountReadPlatformService;
|
private final SavingsAccountReadPlatformService savingsAccountReadPlatformService;
|
||||||
@@ -91,24 +90,6 @@ public class SavingsAccountsApiResource {
|
|||||||
private final BulkImportWorkbookService bulkImportWorkbookService;
|
private final BulkImportWorkbookService bulkImportWorkbookService;
|
||||||
private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService;
|
private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public SavingsAccountsApiResource(final SavingsAccountReadPlatformService savingsAccountReadPlatformService,
|
|
||||||
final PlatformSecurityContext context, final DefaultToApiJsonSerializer<SavingsAccountData> toApiJsonSerializer,
|
|
||||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
|
|
||||||
final ApiRequestParameterHelper apiRequestParameterHelper,
|
|
||||||
final SavingsAccountChargeReadPlatformService savingsAccountChargeReadPlatformService,
|
|
||||||
final BulkImportWorkbookService bulkImportWorkbookService,
|
|
||||||
final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService) {
|
|
||||||
this.savingsAccountReadPlatformService = savingsAccountReadPlatformService;
|
|
||||||
this.context = context;
|
|
||||||
this.toApiJsonSerializer = toApiJsonSerializer;
|
|
||||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
|
||||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
|
||||||
this.savingsAccountChargeReadPlatformService = savingsAccountChargeReadPlatformService;
|
|
||||||
this.bulkImportWorkbookService = bulkImportWorkbookService;
|
|
||||||
this.bulkImportWorkbookPopulatorService = bulkImportWorkbookPopulatorService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("template")
|
@Path("template")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@@ -124,14 +105,13 @@ public class SavingsAccountsApiResource {
|
|||||||
@DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly,
|
@DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME);
|
context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME);
|
||||||
|
|
||||||
final SavingsAccountData savingsAccount = this.savingsAccountReadPlatformService.retrieveTemplate(clientId, groupId, productId,
|
final SavingsAccountData savingsAccount = savingsAccountReadPlatformService.retrieveTemplate(clientId, groupId, productId,
|
||||||
staffInSelectedOfficeOnly);
|
staffInSelectedOfficeOnly);
|
||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
return this.toApiJsonSerializer.serialize(settings, savingsAccount,
|
return toApiJsonSerializer.serialize(settings, savingsAccount, SavingsApiSetConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
|
||||||
SavingsApiSetConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -150,14 +130,14 @@ public class SavingsAccountsApiResource {
|
|||||||
@QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy,
|
@QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy,
|
||||||
@QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) {
|
@QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME);
|
context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME);
|
||||||
|
|
||||||
final SearchParameters searchParameters = SearchParameters.forSavings(sqlSearch, externalId, offset, limit, orderBy, sortOrder);
|
final SearchParameters searchParameters = SearchParameters.forSavings(sqlSearch, externalId, offset, limit, orderBy, sortOrder);
|
||||||
|
|
||||||
final Page<SavingsAccountData> products = this.savingsAccountReadPlatformService.retrieveAll(searchParameters);
|
final Page<SavingsAccountData> products = savingsAccountReadPlatformService.retrieveAll(searchParameters);
|
||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
return this.toApiJsonSerializer.serialize(settings, products, SavingsApiSetConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
|
return toApiJsonSerializer.serialize(settings, products, SavingsApiSetConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@@ -175,9 +155,9 @@ public class SavingsAccountsApiResource {
|
|||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createSavingsAccount().withJson(apiRequestBodyAsJson).build();
|
final CommandWrapper commandRequest = new CommandWrapperBuilder().createSavingsAccount().withJson(apiRequestBodyAsJson).build();
|
||||||
|
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@@ -188,9 +168,9 @@ public class SavingsAccountsApiResource {
|
|||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createGSIMAccount().withJson(apiRequestBodyAsJson).build();
|
final CommandWrapper commandRequest = new CommandWrapperBuilder().createGSIMAccount().withJson(apiRequestBodyAsJson).build();
|
||||||
|
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -206,21 +186,21 @@ public class SavingsAccountsApiResource {
|
|||||||
@DefaultValue("all") @QueryParam("chargeStatus") @Parameter(description = "chargeStatus") final String chargeStatus,
|
@DefaultValue("all") @QueryParam("chargeStatus") @Parameter(description = "chargeStatus") final String chargeStatus,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME);
|
context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME);
|
||||||
|
|
||||||
if (!(is(chargeStatus, "all") || is(chargeStatus, "active") || is(chargeStatus, "inactive"))) {
|
if (!(is(chargeStatus, "all") || is(chargeStatus, "active") || is(chargeStatus, "inactive"))) {
|
||||||
throw new UnrecognizedQueryParamException("status", chargeStatus, new Object[] { "all", "active", "inactive" });
|
throw new UnrecognizedQueryParamException("status", chargeStatus, new Object[] { "all", "active", "inactive" });
|
||||||
}
|
}
|
||||||
|
|
||||||
final SavingsAccountData savingsAccount = this.savingsAccountReadPlatformService.retrieveOne(accountId);
|
final SavingsAccountData savingsAccount = savingsAccountReadPlatformService.retrieveOne(accountId);
|
||||||
|
|
||||||
final Set<String> mandatoryResponseParameters = new HashSet<>();
|
final Set<String> mandatoryResponseParameters = new HashSet<>();
|
||||||
final SavingsAccountData savingsAccountTemplate = populateTemplateAndAssociations(accountId, savingsAccount,
|
final SavingsAccountData savingsAccountTemplate = populateTemplateAndAssociations(accountId, savingsAccount,
|
||||||
staffInSelectedOfficeOnly, chargeStatus, uriInfo, mandatoryResponseParameters);
|
staffInSelectedOfficeOnly, chargeStatus, uriInfo, mandatoryResponseParameters);
|
||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters(),
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters(),
|
||||||
mandatoryResponseParameters);
|
mandatoryResponseParameters);
|
||||||
return this.toApiJsonSerializer.serialize(settings, savingsAccountTemplate,
|
return toApiJsonSerializer.serialize(settings, savingsAccountTemplate,
|
||||||
SavingsApiSetConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
|
SavingsApiSetConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +220,7 @@ public class SavingsAccountsApiResource {
|
|||||||
|
|
||||||
if (associationParameters.contains(SavingsApiConstants.transactions)) {
|
if (associationParameters.contains(SavingsApiConstants.transactions)) {
|
||||||
mandatoryResponseParameters.add(SavingsApiConstants.transactions);
|
mandatoryResponseParameters.add(SavingsApiConstants.transactions);
|
||||||
final Collection<SavingsAccountTransactionData> currentTransactions = this.savingsAccountReadPlatformService
|
final Collection<SavingsAccountTransactionData> currentTransactions = savingsAccountReadPlatformService
|
||||||
.retrieveAllTransactions(accountId, DepositAccountType.SAVINGS_DEPOSIT);
|
.retrieveAllTransactions(accountId, DepositAccountType.SAVINGS_DEPOSIT);
|
||||||
if (!CollectionUtils.isEmpty(currentTransactions)) {
|
if (!CollectionUtils.isEmpty(currentTransactions)) {
|
||||||
transactions = currentTransactions;
|
transactions = currentTransactions;
|
||||||
@@ -249,7 +229,7 @@ public class SavingsAccountsApiResource {
|
|||||||
|
|
||||||
if (associationParameters.contains(SavingsApiConstants.charges)) {
|
if (associationParameters.contains(SavingsApiConstants.charges)) {
|
||||||
mandatoryResponseParameters.add(SavingsApiConstants.charges);
|
mandatoryResponseParameters.add(SavingsApiConstants.charges);
|
||||||
final Collection<SavingsAccountChargeData> currentCharges = this.savingsAccountChargeReadPlatformService
|
final Collection<SavingsAccountChargeData> currentCharges = savingsAccountChargeReadPlatformService
|
||||||
.retrieveSavingsAccountCharges(accountId, chargeStatus);
|
.retrieveSavingsAccountCharges(accountId, chargeStatus);
|
||||||
if (!CollectionUtils.isEmpty(currentCharges)) {
|
if (!CollectionUtils.isEmpty(currentCharges)) {
|
||||||
charges = currentCharges;
|
charges = currentCharges;
|
||||||
@@ -258,10 +238,10 @@ public class SavingsAccountsApiResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SavingsAccountData templateData = null;
|
SavingsAccountData templateData = null;
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
if (settings.isTemplate()) {
|
if (settings.isTemplate()) {
|
||||||
templateData = this.savingsAccountReadPlatformService.retrieveTemplate(savingsAccount.getClientId(),
|
templateData = savingsAccountReadPlatformService.retrieveTemplate(savingsAccount.getClientId(), savingsAccount.getGroupId(),
|
||||||
savingsAccount.getGroupId(), savingsAccount.getSavingsProductId(), staffInSelectedOfficeOnly);
|
savingsAccount.getSavingsProductId(), staffInSelectedOfficeOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SavingsAccountData.withTemplateOptions(savingsAccount, templateData, transactions, charges);
|
return SavingsAccountData.withTemplateOptions(savingsAccount, templateData, transactions, charges);
|
||||||
@@ -286,43 +266,29 @@ public class SavingsAccountsApiResource {
|
|||||||
if (is(commandParam, "updateWithHoldTax")) {
|
if (is(commandParam, "updateWithHoldTax")) {
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson).updateWithHoldTax(accountId)
|
final CommandWrapper commandRequest = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson).updateWithHoldTax(accountId)
|
||||||
.build();
|
.build();
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateSavingsAccount(accountId).withJson(apiRequestBodyAsJson)
|
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateSavingsAccount(accountId).withJson(apiRequestBodyAsJson)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/gsim/{parentAccountId}")
|
@Path("/gsim/{parentAccountId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
/*
|
|
||||||
* public String updateGsim(@PathParam("parentAccountId") final Long parentAccountId, final String
|
|
||||||
* apiRequestBodyAsJson,
|
|
||||||
*
|
|
||||||
* @QueryParam("command") final String commandParam) {
|
|
||||||
*/
|
|
||||||
public String updateGsim(@PathParam("parentAccountId") final Long parentAccountId, final String apiRequestBodyAsJson) {
|
public String updateGsim(@PathParam("parentAccountId") final Long parentAccountId, final String apiRequestBodyAsJson) {
|
||||||
|
|
||||||
/*
|
|
||||||
* if (is(commandParam, "updateWithHoldTax")) { final CommandWrapper commandRequest = new
|
|
||||||
* CommandWrapperBuilder().withJson(apiRequestBodyAsJson). updateWithHoldTax(accountId) .build(); final
|
|
||||||
* CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource( commandRequest);
|
|
||||||
* return this.toApiJsonSerializer.serialize(result); }
|
|
||||||
*/
|
|
||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateGSIMAccount(parentAccountId).withJson(apiRequestBodyAsJson)
|
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateGSIMAccount(parentAccountId).withJson(apiRequestBodyAsJson)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@@ -342,31 +308,31 @@ public class SavingsAccountsApiResource {
|
|||||||
CommandProcessingResult result = null;
|
CommandProcessingResult result = null;
|
||||||
if (is(commandParam, "reject")) {
|
if (is(commandParam, "reject")) {
|
||||||
final CommandWrapper commandRequest = builder.rejectGSIMAccountApplication(parentAccountId).build();
|
final CommandWrapper commandRequest = builder.rejectGSIMAccountApplication(parentAccountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "withdrawnByApplicant")) {
|
} else if (is(commandParam, "withdrawnByApplicant")) {
|
||||||
final CommandWrapper commandRequest = builder.withdrawSavingsAccountApplication(parentAccountId).build();
|
final CommandWrapper commandRequest = builder.withdrawSavingsAccountApplication(parentAccountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "approve")) {
|
} else if (is(commandParam, "approve")) {
|
||||||
final CommandWrapper commandRequest = builder.approveGSIMAccountApplication(parentAccountId).build();
|
final CommandWrapper commandRequest = builder.approveGSIMAccountApplication(parentAccountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "undoapproval")) {
|
} else if (is(commandParam, "undoapproval")) {
|
||||||
final CommandWrapper commandRequest = builder.undoGSIMApplicationApproval(parentAccountId).build();
|
final CommandWrapper commandRequest = builder.undoGSIMApplicationApproval(parentAccountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "activate")) {
|
} else if (is(commandParam, "activate")) {
|
||||||
final CommandWrapper commandRequest = builder.gsimAccountActivation(parentAccountId).build();
|
final CommandWrapper commandRequest = builder.gsimAccountActivation(parentAccountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "calculateInterest")) {
|
} else if (is(commandParam, "calculateInterest")) {
|
||||||
final CommandWrapper commandRequest = builder.withNoJsonBody().savingsAccountInterestCalculation(parentAccountId).build();
|
final CommandWrapper commandRequest = builder.withNoJsonBody().savingsAccountInterestCalculation(parentAccountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "postInterest")) {
|
} else if (is(commandParam, "postInterest")) {
|
||||||
final CommandWrapper commandRequest = builder.savingsAccountInterestPosting(parentAccountId).build();
|
final CommandWrapper commandRequest = builder.savingsAccountInterestPosting(parentAccountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "applyAnnualFees")) {
|
} else if (is(commandParam, "applyAnnualFees")) {
|
||||||
final CommandWrapper commandRequest = builder.savingsAccountApplyAnnualFees(parentAccountId).build();
|
final CommandWrapper commandRequest = builder.savingsAccountApplyAnnualFees(parentAccountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "close")) {
|
} else if (is(commandParam, "close")) {
|
||||||
final CommandWrapper commandRequest = builder.closeGSIMApplication(parentAccountId).build();
|
final CommandWrapper commandRequest = builder.closeGSIMApplication(parentAccountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
}
|
}
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
throw new UnrecognizedQueryParamException("command", commandParam,
|
throw new UnrecognizedQueryParamException("command", commandParam,
|
||||||
@@ -377,7 +343,7 @@ public class SavingsAccountsApiResource {
|
|||||||
SavingsApiConstants.COMMAND_BLOCK_ACCOUNT, SavingsApiConstants.COMMAND_UNBLOCK_ACCOUNT });
|
SavingsApiConstants.COMMAND_BLOCK_ACCOUNT, SavingsApiConstants.COMMAND_UNBLOCK_ACCOUNT });
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@@ -433,57 +399,57 @@ public class SavingsAccountsApiResource {
|
|||||||
CommandProcessingResult result = null;
|
CommandProcessingResult result = null;
|
||||||
if (is(commandParam, "reject")) {
|
if (is(commandParam, "reject")) {
|
||||||
final CommandWrapper commandRequest = builder.rejectSavingsAccountApplication(accountId).build();
|
final CommandWrapper commandRequest = builder.rejectSavingsAccountApplication(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "withdrawnByApplicant")) {
|
} else if (is(commandParam, "withdrawnByApplicant")) {
|
||||||
final CommandWrapper commandRequest = builder.withdrawSavingsAccountApplication(accountId).build();
|
final CommandWrapper commandRequest = builder.withdrawSavingsAccountApplication(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "approve")) {
|
} else if (is(commandParam, "approve")) {
|
||||||
final CommandWrapper commandRequest = builder.approveSavingsAccountApplication(accountId).build();
|
final CommandWrapper commandRequest = builder.approveSavingsAccountApplication(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "undoapproval")) {
|
} else if (is(commandParam, "undoapproval")) {
|
||||||
final CommandWrapper commandRequest = builder.undoSavingsAccountApplication(accountId).build();
|
final CommandWrapper commandRequest = builder.undoSavingsAccountApplication(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "activate")) {
|
} else if (is(commandParam, "activate")) {
|
||||||
final CommandWrapper commandRequest = builder.savingsAccountActivation(accountId).build();
|
final CommandWrapper commandRequest = builder.savingsAccountActivation(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "calculateInterest")) {
|
} else if (is(commandParam, "calculateInterest")) {
|
||||||
final CommandWrapper commandRequest = builder.withNoJsonBody().savingsAccountInterestCalculation(accountId).build();
|
final CommandWrapper commandRequest = builder.withNoJsonBody().savingsAccountInterestCalculation(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "postInterest")) {
|
} else if (is(commandParam, "postInterest")) {
|
||||||
final CommandWrapper commandRequest = builder.savingsAccountInterestPosting(accountId).build();
|
final CommandWrapper commandRequest = builder.savingsAccountInterestPosting(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "applyAnnualFees")) {
|
} else if (is(commandParam, "applyAnnualFees")) {
|
||||||
final CommandWrapper commandRequest = builder.savingsAccountApplyAnnualFees(accountId).build();
|
final CommandWrapper commandRequest = builder.savingsAccountApplyAnnualFees(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "close")) {
|
} else if (is(commandParam, "close")) {
|
||||||
final CommandWrapper commandRequest = builder.closeSavingsAccountApplication(accountId).build();
|
final CommandWrapper commandRequest = builder.closeSavingsAccountApplication(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, "assignSavingsOfficer")) {
|
} else if (is(commandParam, "assignSavingsOfficer")) {
|
||||||
final CommandWrapper commandRequest = builder.assignSavingsOfficer(accountId).build();
|
final CommandWrapper commandRequest = builder.assignSavingsOfficer(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
} else if (is(commandParam, "unassignSavingsOfficer")) {
|
} else if (is(commandParam, "unassignSavingsOfficer")) {
|
||||||
final CommandWrapper commandRequest = builder.unassignSavingsOfficer(accountId).build();
|
final CommandWrapper commandRequest = builder.unassignSavingsOfficer(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
} else if (is(commandParam, SavingsApiConstants.COMMAND_BLOCK_DEBIT)) {
|
} else if (is(commandParam, SavingsApiConstants.COMMAND_BLOCK_DEBIT)) {
|
||||||
final CommandWrapper commandRequest = builder.blockDebitsFromSavingsAccount(accountId).build();
|
final CommandWrapper commandRequest = builder.blockDebitsFromSavingsAccount(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, SavingsApiConstants.COMMAND_UNBLOCK_DEBIT)) {
|
} else if (is(commandParam, SavingsApiConstants.COMMAND_UNBLOCK_DEBIT)) {
|
||||||
final CommandWrapper commandRequest = builder.unblockDebitsFromSavingsAccount(accountId).build();
|
final CommandWrapper commandRequest = builder.unblockDebitsFromSavingsAccount(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, SavingsApiConstants.COMMAND_BLOCK_CREDIT)) {
|
} else if (is(commandParam, SavingsApiConstants.COMMAND_BLOCK_CREDIT)) {
|
||||||
final CommandWrapper commandRequest = builder.blockCreditsToSavingsAccount(accountId).build();
|
final CommandWrapper commandRequest = builder.blockCreditsToSavingsAccount(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, SavingsApiConstants.COMMAND_UNBLOCK_CREDIT)) {
|
} else if (is(commandParam, SavingsApiConstants.COMMAND_UNBLOCK_CREDIT)) {
|
||||||
final CommandWrapper commandRequest = builder.unblockCreditsToSavingsAccount(accountId).build();
|
final CommandWrapper commandRequest = builder.unblockCreditsToSavingsAccount(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, SavingsApiConstants.COMMAND_BLOCK_ACCOUNT)) {
|
} else if (is(commandParam, SavingsApiConstants.COMMAND_BLOCK_ACCOUNT)) {
|
||||||
final CommandWrapper commandRequest = builder.blockSavingsAccount(accountId).build();
|
final CommandWrapper commandRequest = builder.blockSavingsAccount(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else if (is(commandParam, SavingsApiConstants.COMMAND_UNBLOCK_ACCOUNT)) {
|
} else if (is(commandParam, SavingsApiConstants.COMMAND_UNBLOCK_ACCOUNT)) {
|
||||||
final CommandWrapper commandRequest = builder.unblockSavingsAccount(accountId).build();
|
final CommandWrapper commandRequest = builder.unblockSavingsAccount(accountId).build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
@@ -496,7 +462,7 @@ public class SavingsAccountsApiResource {
|
|||||||
SavingsApiConstants.COMMAND_BLOCK_ACCOUNT, SavingsApiConstants.COMMAND_UNBLOCK_ACCOUNT });
|
SavingsApiConstants.COMMAND_BLOCK_ACCOUNT, SavingsApiConstants.COMMAND_UNBLOCK_ACCOUNT });
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean is(final String commandParam, final String commandValue) {
|
private boolean is(final String commandParam, final String commandValue) {
|
||||||
@@ -514,9 +480,9 @@ public class SavingsAccountsApiResource {
|
|||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteSavingsAccount(accountId).build();
|
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteSavingsAccount(accountId).build();
|
||||||
|
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return toApiJsonSerializer.serialize(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -535,9 +501,9 @@ public class SavingsAccountsApiResource {
|
|||||||
public String postSavingsTemplate(@FormDataParam("file") InputStream uploadedInputStream,
|
public String postSavingsTemplate(@FormDataParam("file") InputStream uploadedInputStream,
|
||||||
@FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("locale") final String locale,
|
@FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("locale") final String locale,
|
||||||
@FormDataParam("dateFormat") final String dateFormat) {
|
@FormDataParam("dateFormat") final String dateFormat) {
|
||||||
final Long importDocumentId = this.bulkImportWorkbookService.importWorkbook(GlobalEntityType.SAVINGS_ACCOUNT.toString(),
|
final Long importDocumentId = bulkImportWorkbookService.importWorkbook(GlobalEntityType.SAVINGS_ACCOUNT.toString(),
|
||||||
uploadedInputStream, fileDetail, locale, dateFormat);
|
uploadedInputStream, fileDetail, locale, dateFormat);
|
||||||
return this.toApiJsonSerializer.serialize(importDocumentId);
|
return toApiJsonSerializer.serialize(importDocumentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -556,8 +522,8 @@ public class SavingsAccountsApiResource {
|
|||||||
public String postSavingsTransactionTemplate(@FormDataParam("file") InputStream uploadedInputStream,
|
public String postSavingsTransactionTemplate(@FormDataParam("file") InputStream uploadedInputStream,
|
||||||
@FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("locale") final String locale,
|
@FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("locale") final String locale,
|
||||||
@FormDataParam("dateFormat") final String dateFormat) {
|
@FormDataParam("dateFormat") final String dateFormat) {
|
||||||
final Long importDocumentId = this.bulkImportWorkbookService.importWorkbook(GlobalEntityType.SAVINGS_TRANSACTIONS.toString(),
|
final Long importDocumentId = bulkImportWorkbookService.importWorkbook(GlobalEntityType.SAVINGS_TRANSACTIONS.toString(),
|
||||||
uploadedInputStream, fileDetail, locale, dateFormat);
|
uploadedInputStream, fileDetail, locale, dateFormat);
|
||||||
return this.toApiJsonSerializer.serialize(importDocumentId);
|
return toApiJsonSerializer.serialize(importDocumentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-43
@@ -40,6 +40,7 @@ import javax.ws.rs.QueryParam;
|
|||||||
import javax.ws.rs.core.Context;
|
import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.UriInfo;
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
|
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
|
||||||
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
|
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
|
||||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||||
@@ -59,22 +60,18 @@ import org.apache.fineract.portfolio.self.shareaccounts.service.AppUserShareAcco
|
|||||||
import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountData;
|
import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountData;
|
||||||
import org.apache.fineract.portfolio.shareaccounts.service.ShareAccountReadPlatformService;
|
import org.apache.fineract.portfolio.shareaccounts.service.ShareAccountReadPlatformService;
|
||||||
import org.apache.fineract.useradministration.domain.AppUser;
|
import org.apache.fineract.useradministration.domain.AppUser;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Path("/self/shareaccounts")
|
@Path("/self/shareaccounts")
|
||||||
@Component
|
@Component
|
||||||
@Scope("singleton")
|
|
||||||
|
|
||||||
@Tag(name = "Self Share Accounts", description = "")
|
@Tag(name = "Self Share Accounts", description = "")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class SelfShareAccountsApiResource {
|
public class SelfShareAccountsApiResource {
|
||||||
|
|
||||||
private final PlatformSecurityContext context;
|
private final PlatformSecurityContext context;
|
||||||
private final AccountsApiResource accountsApiResource;
|
private final AccountsApiResource accountsApiResource;
|
||||||
private final ShareAccountReadPlatformService readPlatformService;
|
private final ShareAccountReadPlatformService readPlatformService;
|
||||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||||
|
|
||||||
private final DefaultToApiJsonSerializer<AccountData> toApiJsonSerializer;
|
private final DefaultToApiJsonSerializer<AccountData> toApiJsonSerializer;
|
||||||
private final AppuserClientMapperReadService appuserClientMapperReadService;
|
private final AppuserClientMapperReadService appuserClientMapperReadService;
|
||||||
private final SelfShareAccountsDataValidator selfShareAccountsDataValidator;
|
private final SelfShareAccountsDataValidator selfShareAccountsDataValidator;
|
||||||
@@ -82,26 +79,6 @@ public class SelfShareAccountsApiResource {
|
|||||||
private final ChargeReadPlatformService chargeReadPlatformService;
|
private final ChargeReadPlatformService chargeReadPlatformService;
|
||||||
private final AppUserShareAccountsMapperReadPlatformService appUserShareAccountsMapperReadPlatformService;
|
private final AppUserShareAccountsMapperReadPlatformService appUserShareAccountsMapperReadPlatformService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public SelfShareAccountsApiResource(final PlatformSecurityContext context, final AccountsApiResource accountsApiResource,
|
|
||||||
final ShareAccountReadPlatformService readPlatformService, final DefaultToApiJsonSerializer<AccountData> toApiJsonSerializer,
|
|
||||||
final ApiRequestParameterHelper apiRequestParameterHelper, final AppuserClientMapperReadService appuserClientMapperReadService,
|
|
||||||
final SelfShareAccountsDataValidator selfShareAccountsDataValidator,
|
|
||||||
final ShareProductReadPlatformService shareProductReadPlatformService,
|
|
||||||
final ChargeReadPlatformService chargeReadPlatformService,
|
|
||||||
final AppUserShareAccountsMapperReadPlatformService appUserShareAccountsMapperReadPlatformService) {
|
|
||||||
this.context = context;
|
|
||||||
this.accountsApiResource = accountsApiResource;
|
|
||||||
this.readPlatformService = readPlatformService;
|
|
||||||
this.toApiJsonSerializer = toApiJsonSerializer;
|
|
||||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
|
||||||
this.selfShareAccountsDataValidator = selfShareAccountsDataValidator;
|
|
||||||
this.appuserClientMapperReadService = appuserClientMapperReadService;
|
|
||||||
this.shareProductReadPlatformService = shareProductReadPlatformService;
|
|
||||||
this.chargeReadPlatformService = chargeReadPlatformService;
|
|
||||||
this.appUserShareAccountsMapperReadPlatformService = appUserShareAccountsMapperReadPlatformService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("template")
|
@Path("template")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@@ -128,10 +105,10 @@ public class SelfShareAccountsApiResource {
|
|||||||
|
|
||||||
String clientName = null;
|
String clientName = null;
|
||||||
|
|
||||||
final Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveSharesApplicableCharges();
|
final Collection<ChargeData> chargeOptions = chargeReadPlatformService.retrieveSharesApplicableCharges();
|
||||||
final ShareAccountData accountData = new ShareAccountData(clientId, clientName, productOptions, chargeOptions);
|
final ShareAccountData accountData = new ShareAccountData(clientId, clientName, productOptions, chargeOptions);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(accountData);
|
return toApiJsonSerializer.serialize(accountData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,11 +122,11 @@ public class SelfShareAccountsApiResource {
|
|||||||
@ApiResponses({
|
@ApiResponses({
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SelfShareAccountsApiResourceSwagger.PostNewShareApplicationResponse.class)))) })
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SelfShareAccountsApiResourceSwagger.PostNewShareApplicationResponse.class)))) })
|
||||||
public String createAccount(final String apiRequestBodyAsJson) {
|
public String createAccount(final String apiRequestBodyAsJson) {
|
||||||
HashMap<String, Object> attr = this.selfShareAccountsDataValidator.validateShareAccountApplication(apiRequestBodyAsJson);
|
HashMap<String, Object> attr = selfShareAccountsDataValidator.validateShareAccountApplication(apiRequestBodyAsJson);
|
||||||
final Long clientId = (Long) attr.get(ShareAccountApiConstants.clientid_paramname);
|
final Long clientId = (Long) attr.get(ShareAccountApiConstants.clientid_paramname);
|
||||||
validateAppuserClientsMapping(clientId);
|
validateAppuserClientsMapping(clientId);
|
||||||
String accountType = ShareAccountApiConstants.shareEntityType;
|
String accountType = ShareAccountApiConstants.shareEntityType;
|
||||||
return this.accountsApiResource.createAccount(accountType, apiRequestBodyAsJson);
|
return accountsApiResource.createAccount(accountType, apiRequestBodyAsJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -158,32 +135,25 @@ public class SelfShareAccountsApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Operation(summary = "Retrieve a share application/account", description = "\n" + "\n" + "\n" + "Example Requests:\n" + "\n"
|
@Operation(summary = "Retrieve a share application/account", description = "\n" + "\n" + "\n" + "Example Requests:\n" + "\n"
|
||||||
+ "self/shareaccounts/12\n")
|
+ "self/shareaccounts/12\n")
|
||||||
// TODO actually write
|
|
||||||
// SelfShareAccountsApiResourceSwagger.GetShareAccountResponse (it currently
|
|
||||||
// does not exist)
|
|
||||||
// @ApiResponses({@ApiResponse(responseCode = "200", description = "OK",
|
|
||||||
// responseContainer
|
|
||||||
// = "List", schema = @Schema(implementation =
|
|
||||||
// SelfShareAccountsApiResourceSwagger.GetShareAccountResponse.class)})
|
|
||||||
public String retrieveShareAccount(@PathParam("accountId") final Long accountId, @Context final UriInfo uriInfo) {
|
public String retrieveShareAccount(@PathParam("accountId") final Long accountId, @Context final UriInfo uriInfo) {
|
||||||
validateAppuserShareAccountMapping(accountId);
|
validateAppuserShareAccountMapping(accountId);
|
||||||
final boolean includeTemplate = false;
|
final boolean includeTemplate = false;
|
||||||
AccountData accountData = this.readPlatformService.retrieveOne(accountId, includeTemplate);
|
AccountData accountData = readPlatformService.retrieveOne(accountId, includeTemplate);
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
return this.toApiJsonSerializer.serialize(settings, accountData, readPlatformService.getResponseDataParams());
|
return toApiJsonSerializer.serialize(settings, accountData, readPlatformService.getResponseDataParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateAppuserShareAccountMapping(final Long accountId) {
|
private void validateAppuserShareAccountMapping(final Long accountId) {
|
||||||
AppUser user = this.context.authenticatedUser();
|
AppUser user = context.authenticatedUser();
|
||||||
final boolean isMapped = this.appUserShareAccountsMapperReadPlatformService.isShareAccountsMappedToUser(accountId, user.getId());
|
final boolean isMapped = appUserShareAccountsMapperReadPlatformService.isShareAccountsMappedToUser(accountId, user.getId());
|
||||||
if (!isMapped) {
|
if (!isMapped) {
|
||||||
throw new ShareAccountNotFoundException(accountId);
|
throw new ShareAccountNotFoundException(accountId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateAppuserClientsMapping(final Long clientId) {
|
private void validateAppuserClientsMapping(final Long clientId) {
|
||||||
AppUser user = this.context.authenticatedUser();
|
AppUser user = context.authenticatedUser();
|
||||||
final boolean mappedClientId = this.appuserClientMapperReadService.isClientMappedToUser(clientId, user.getId());
|
final boolean mappedClientId = appuserClientMapperReadService.isClientMappedToUser(clientId, user.getId());
|
||||||
if (!mappedClientId) {
|
if (!mappedClientId) {
|
||||||
throw new ClientNotFoundException(clientId);
|
throw new ClientNotFoundException(clientId);
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-12
@@ -49,11 +49,11 @@ import org.apache.fineract.useradministration.domain.AppUser;
|
|||||||
public class ShareAccount extends AbstractPersistableCustom {
|
public class ShareAccount extends AbstractPersistableCustom {
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "client_id", nullable = true)
|
@JoinColumn(name = "client_id")
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "product_id", nullable = true)
|
@JoinColumn(name = "product_id")
|
||||||
private ShareProduct shareProduct;
|
private ShareProduct shareProduct;
|
||||||
|
|
||||||
@Column(name = "status_enum", nullable = false)
|
@Column(name = "status_enum", nullable = false)
|
||||||
@@ -63,42 +63,42 @@ public class ShareAccount extends AbstractPersistableCustom {
|
|||||||
private LocalDate submittedDate;
|
private LocalDate submittedDate;
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
@ManyToOne(optional = true)
|
||||||
@JoinColumn(name = "submitted_userid", nullable = true)
|
@JoinColumn(name = "submitted_userid")
|
||||||
protected AppUser submittedBy;
|
protected AppUser submittedBy;
|
||||||
|
|
||||||
@Column(name = "approved_date")
|
@Column(name = "approved_date")
|
||||||
protected LocalDate approvedDate;
|
protected LocalDate approvedDate;
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
@ManyToOne(optional = true)
|
||||||
@JoinColumn(name = "approved_userid", nullable = true)
|
@JoinColumn(name = "approved_userid")
|
||||||
protected AppUser approvedBy;
|
protected AppUser approvedBy;
|
||||||
|
|
||||||
@Column(name = "rejected_date")
|
@Column(name = "rejected_date")
|
||||||
protected LocalDate rejectedDate;
|
protected LocalDate rejectedDate;
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
@ManyToOne(optional = true)
|
||||||
@JoinColumn(name = "rejected_userid", nullable = true)
|
@JoinColumn(name = "rejected_userid")
|
||||||
protected AppUser rejectedBy;
|
protected AppUser rejectedBy;
|
||||||
|
|
||||||
@Column(name = "activated_date", nullable = true)
|
@Column(name = "activated_date")
|
||||||
protected LocalDate activatedDate;
|
protected LocalDate activatedDate;
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
@ManyToOne(optional = true)
|
||||||
@JoinColumn(name = "activated_userid", nullable = true)
|
@JoinColumn(name = "activated_userid")
|
||||||
protected AppUser activatedBy;
|
protected AppUser activatedBy;
|
||||||
|
|
||||||
@Column(name = "closed_date")
|
@Column(name = "closed_date")
|
||||||
protected LocalDate closedDate;
|
protected LocalDate closedDate;
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
@ManyToOne(optional = true)
|
||||||
@JoinColumn(name = "closed_userid", nullable = true)
|
@JoinColumn(name = "closed_userid")
|
||||||
protected AppUser closedBy;
|
protected AppUser closedBy;
|
||||||
|
|
||||||
@Column(name = "lastmodified_date")
|
@Column(name = "lastmodified_date")
|
||||||
protected LocalDateTime modifiedDate;
|
protected LocalDateTime modifiedDate;
|
||||||
|
|
||||||
@ManyToOne(optional = true)
|
@ManyToOne(optional = true)
|
||||||
@JoinColumn(name = "lastmodifiedby_id", nullable = true)
|
@JoinColumn(name = "lastmodifiedby_id")
|
||||||
protected AppUser modifiedBy;
|
protected AppUser modifiedBy;
|
||||||
|
|
||||||
@Column(name = "external_id")
|
@Column(name = "external_id")
|
||||||
@@ -120,7 +120,7 @@ public class ShareAccount extends AbstractPersistableCustom {
|
|||||||
private Boolean allowDividendCalculationForInactiveClients;
|
private Boolean allowDividendCalculationForInactiveClients;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "savings_account_id", nullable = true)
|
@JoinColumn(name = "savings_account_id")
|
||||||
private SavingsAccount savingsAccount;
|
private SavingsAccount savingsAccount;
|
||||||
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "shareAccount", orphanRemoval = true, fetch = FetchType.EAGER)
|
@OneToMany(cascade = CascadeType.ALL, mappedBy = "shareAccount", orphanRemoval = true, fetch = FetchType.EAGER)
|
||||||
@@ -130,14 +130,14 @@ public class ShareAccount extends AbstractPersistableCustom {
|
|||||||
private Integer lockinPeriodFrequency;
|
private Integer lockinPeriodFrequency;
|
||||||
|
|
||||||
@Enumerated(EnumType.ORDINAL)
|
@Enumerated(EnumType.ORDINAL)
|
||||||
@Column(name = "lockin_period_frequency_enum", nullable = true)
|
@Column(name = "lockin_period_frequency_enum")
|
||||||
private PeriodFrequencyType lockinPeriodFrequencyType;
|
private PeriodFrequencyType lockinPeriodFrequencyType;
|
||||||
|
|
||||||
@Column(name = "minimum_active_period_frequency")
|
@Column(name = "minimum_active_period_frequency")
|
||||||
private Integer minimumActivePeriodFrequency;
|
private Integer minimumActivePeriodFrequency;
|
||||||
|
|
||||||
@Enumerated(EnumType.ORDINAL)
|
@Enumerated(EnumType.ORDINAL)
|
||||||
@Column(name = "minimum_active_period_frequency_enum", nullable = true)
|
@Column(name = "minimum_active_period_frequency_enum")
|
||||||
private PeriodFrequencyType minimumActivePeriodFrequencyType;
|
private PeriodFrequencyType minimumActivePeriodFrequencyType;
|
||||||
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "shareAccount", orphanRemoval = true, fetch = FetchType.EAGER)
|
@OneToMany(cascade = CascadeType.ALL, mappedBy = "shareAccount", orphanRemoval = true, fetch = FetchType.EAGER)
|
||||||
|
|||||||
Reference in New Issue
Block a user