FINERACT-1724: Preparation for versioned APIs

This commit is contained in:
Arnold Galovics
2023-05-15 13:19:06 +02:00
committed by Arnold Gálovics
parent 190d995628
commit 037f7f264f
211 changed files with 1202 additions and 2215 deletions
@@ -53,7 +53,7 @@ public interface DocumentsApiFixed {
* @return Call<PostEntityTypeEntityIdDocumentsResponse>
*/
@retrofit2.http.Multipart
@POST("{entityType}/{entityId}/documents")
@POST("v1/{entityType}/{entityId}/documents")
Call<PostEntityTypeEntityIdDocumentsResponse> createDocument(@retrofit2.http.Path("entityType") String entityType,
@retrofit2.http.Path("entityId") Long entityId, @retrofit2.http.Part okhttp3.MultipartBody.Part file,
@retrofit2.http.Part("name") String name, @retrofit2.http.Part("description") String description);
@@ -69,7 +69,7 @@ public interface DocumentsApiFixed {
* documentId (required)
* @return Call&lt;DeleteEntityTypeEntityIdDocumentsResponse&gt;
*/
@DELETE("{entityType}/{entityId}/documents/{documentId}")
@DELETE("v1/{entityType}/{entityId}/documents/{documentId}")
Call<DeleteEntityTypeEntityIdDocumentsResponse> deleteDocument(@retrofit2.http.Path("entityType") String entityType,
@retrofit2.http.Path("entityId") Long entityId, @retrofit2.http.Path("documentId") Long documentId);
@@ -85,7 +85,7 @@ public interface DocumentsApiFixed {
* documentId (required)
* @return Call&lt;Void&gt;
*/
@GET("{entityType}/{entityId}/documents/{documentId}/attachment")
@GET("v1/{entityType}/{entityId}/documents/{documentId}/attachment")
Call<ResponseBody> downloadFile(@retrofit2.http.Path("entityType") String entityType, @retrofit2.http.Path("entityId") Long entityId,
@retrofit2.http.Path("documentId") Long documentId);
@@ -101,7 +101,7 @@ public interface DocumentsApiFixed {
* documentId (required)
* @return Call&lt;GetEntityTypeEntityIdDocumentsResponse&gt;
*/
@GET("{entityType}/{entityId}/documents/{documentId}")
@GET("v1/{entityType}/{entityId}/documents/{documentId}")
Call<GetEntityTypeEntityIdDocumentsResponse> getDocument(@retrofit2.http.Path("entityType") String entityType,
@retrofit2.http.Path("entityId") Long entityId, @retrofit2.http.Path("documentId") Long documentId);
@@ -115,7 +115,7 @@ public interface DocumentsApiFixed {
* entityId (required)
* @return Call&lt;List&lt;GetEntityTypeEntityIdDocumentsResponse&gt;&gt;
*/
@GET("{entityType}/{entityId}/documents")
@GET("v1/{entityType}/{entityId}/documents")
Call<List<GetEntityTypeEntityIdDocumentsResponse>> retrieveAllDocuments(@retrofit2.http.Path("entityType") String entityType,
@retrofit2.http.Path("entityId") Long entityId);
@@ -138,7 +138,7 @@ public interface DocumentsApiFixed {
* @return Call&lt;PutEntityTypeEntityIdDocumentsResponse&gt;
*/
@retrofit2.http.Multipart
@PUT("{entityType}/{entityId}/documents/{documentId}")
@PUT("v1/{entityType}/{entityId}/documents/{documentId}")
Call<PutEntityTypeEntityIdDocumentsResponse> updateDocument(@retrofit2.http.Path("entityType") String entityType,
@retrofit2.http.Path("entityId") Long entityId, @retrofit2.http.Path("documentId") Long documentId,
@retrofit2.http.Part okhttp3.MultipartBody.Part file, @retrofit2.http.Part("name") String name,
@@ -36,21 +36,21 @@ import retrofit2.http.PUT;
*/
public interface ImagesApi {
@POST("{entityType}/{entityId}/images")
@POST("v1/{entityType}/{entityId}/images")
@retrofit2.http.Multipart
Call<Void> create(@retrofit2.http.Path("entityType") String entityType, @retrofit2.http.Path("entityId") Long entityId,
@retrofit2.http.Part okhttp3.MultipartBody.Part file);
@GET("{entityType}/{entityId}/images")
@GET("v1/{entityType}/{entityId}/images")
Call<ResponseBody> get(@retrofit2.http.Path("entityType") String entityType, @retrofit2.http.Path("entityId") Long entityId,
@retrofit2.http.Query("maxWidth") Integer maxWidth, @retrofit2.http.Query("maxHeight") Integer maxHeight,
@retrofit2.http.Query("output") String output);
@PUT("{entityType}/{entityId}/images")
@PUT("v1/{entityType}/{entityId}/images")
@retrofit2.http.Multipart
Call<Void> update(@retrofit2.http.Path("entityType") String entityType, @retrofit2.http.Path("entityId") Long entityId,
@retrofit2.http.Part okhttp3.MultipartBody.Part file);
@DELETE("{entityType}/{entityId}/images")
@DELETE("v1/{entityType}/{entityId}/images")
Call<Void> delete(@retrofit2.http.Path("entityType") String entityType, @retrofit2.http.Path("entityId") Long entityId);
}
@@ -51,14 +51,14 @@ public interface RunReportsApi {
* isSelfServiceUserReport (optional, default to false)
* @return Call&lt;GetReportNameResponse&gt;
*/
@GET("runreports/{reportName}")
@GET("v1/runreports/{reportName}")
Call<RunReportsResponse> runReportGetData(@retrofit2.http.Path("reportName") String reportName,
@QueryMap Map<String, String> parameters, @retrofit2.http.Query("isSelfServiceUserReport") Boolean isSelfServiceUserReport);
/**
* Run Report which returns a response such as a PDF, CSV, XLS or XSLX file.
*/
@GET("runreports/{reportName}")
@GET("v1/runreports/{reportName}")
Call<ResponseBody> runReportGetFile(@retrofit2.http.Path("reportName") String reportName, @QueryMap Map<String, String> parameters,
@retrofit2.http.Query("isSelfServiceUserReport") Boolean isSelfServiceUserReport);
@@ -37,12 +37,10 @@ import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/runaccruals")
@Path("/v1/runaccruals")
@Component
@Scope("singleton")
@Tag(name = "Periodic Accrual Accounting", description = "Periodic Accrual is to accrue the loan income till the specific date or till batch job scheduled time.\n")
@RequiredArgsConstructor
public class AccrualAccountingApiResource {
@@ -55,12 +55,10 @@ import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSeria
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.organisation.office.service.OfficeReadPlatformService;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/glclosures")
@Path("/v1/glclosures")
@Component
@Scope("singleton")
@Tag(name = "Accounting Closure", description = "An accounting closure indicates that no more journal entries may be logged (or reversed) in the system, either manually or via the portfolio with an entry date prior to the defined closure date\n"
+ "\n" + "Field Descriptions\n" + "closingDate\n" + "The date for which the accounting closure is defined\n" + "officeId\n"
+ "The identifer of the branch for which accounting has been closed\n" + "comments\n"
@@ -50,12 +50,10 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/financialactivityaccounts")
@Path("/v1/financialactivityaccounts")
@Component
@Scope("singleton")
@Tag(name = "Mapping Financial Activities to Accounts", description = "Organization Level Financial Activities like Asset and Liability Transfer can be mapped to GL Account. Integrated accounting takes these accounts into consideration when an Account transfer is made between a savings to loan/savings account and vice-versa\n"
+ "\n" + "Field Descriptions\n" + "financialActivityId\n" + "The identifier of the Financial Activity\n" + "glAccountId\n"
+ "The identifier of a GL Account ( Ledger Account) which shall be used as the default account for the selected Financial Activity")
@@ -70,12 +70,10 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/glaccounts")
@Path("/v1/glaccounts")
@Component
@Scope("singleton")
@Tag(name = "General Ledger Account", description = "Ledger accounts represent an Individual account within an Organizations Chart Of Accounts(COA) and are assigned a name and unique number by which they can be identified. \n"
+ "All transactions relating to a company's assets, liabilities, owners' equity, revenue and expenses are recorded against these accounts")
@RequiredArgsConstructor
@@ -67,12 +67,10 @@ import org.apache.fineract.infrastructure.core.service.SearchParameters;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/journalentries")
@Path("/v1/journalentries")
@Component
@Scope("singleton")
@Tag(name = "Journal Entries", description = "A journal entry refers to the logging of transactions against general ledger accounts. A journal entry may consist of several line items, each of which is either a \"debit\" or a \"credit\". The total amount of the debits must equal the total amount of the credits or the journal entry is said to be \"unbalanced\" \n"
+ "\n" + "A journal entry directly changes the account balances on the general ledger")
@RequiredArgsConstructor
@@ -56,12 +56,10 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.core.service.Page;
import org.apache.fineract.infrastructure.core.service.SearchParameters;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/provisioningentries")
@Path("/v1/provisioningentries")
@Component
@Scope("singleton")
@Tag(name = "Provisioning Entries", description = "This defines the Provisioning Entries for all active loan products\n" + "\n"
+ "Field Descriptions\n" + "date\n" + "Date on which day provisioning entries should be created\n" + "createjournalentries\n"
+ "Boolean variable whether to add journal entries for generated provisioning entries\n")
@@ -67,12 +67,10 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.apache.fineract.organisation.office.data.OfficeData;
import org.apache.fineract.organisation.office.service.OfficeReadPlatformService;
import org.apache.fineract.useradministration.domain.AppUser;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/accountingrules")
@Path("/v1/accountingrules")
@Component
@Scope("singleton")
@Tag(name = "Accounting Rules", description = "It is typical scenario in MFI's that non accountants pass journal entries on a regular basis. For Ex: A branch office might deposit their entire cash at hand to their Bank account at the end of a working day. The branch office users might not understand enough of accounting to figure out which account needs to get credited and which account needs to be debited to represent this transaction.\n"
+ "\n"
+ "Enter accounting rules, an abstraction on top of manual Journal entires for enabling simpler data entry. An accounting rule can define any of the following abstractions\n"
@@ -46,12 +46,10 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/adhocquery")
@Path("/v1/adhocquery")
@Component
@Scope("singleton")
@Tag(name = "AdhocQuery Api", description = "")
@RequiredArgsConstructor
public class AdHocApiResource {
@@ -49,7 +49,6 @@ import org.apache.fineract.infrastructure.core.config.FineractProperties;
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.exception.InvalidInstanceTypeMethodException;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
@@ -65,9 +64,8 @@ import org.springframework.stereotype.Component;
* @see org.apache.fineract.batch.domain.BatchRequest
* @see org.apache.fineract.batch.domain.BatchResponse
*/
@Path("/batches")
@Path("/v1/batches")
@Component
@Scope("singleton")
@Tag(name = "Batch API", description = "The Apache Fineract Batch API enables a consumer to access significant amounts of data in a single call or to make changes to several objects at once. Batching allows a consumer to pass instructions for several operations in a single HTTP request. A consumer can also specify dependencies between related operations. Once all operations have been completed, a consolidated response will be passed back and the HTTP connection will be closed.\n"
+ "\n"
+ "The Batch API takes in an array of logical HTTP requests represented as JSON arrays - each request has a requestId (the id of a request used to specify the sequence and as a dependency between requests), a method (corresponding to HTTP method GET/PUT/POST/DELETE etc.), a relativeUrl (the portion of the URL after https://example.org/api/v2/), optional headers array (corresponding to HTTP headers), optional reference parameter if a request is dependent on another request and an optional body (for POST and PUT requests). The Batch API returns an array of logical HTTP responses represented as JSON arrays - each response has a requestId, a status code, an optional headers array and an optional body (which is a JSON encoded string).\n"
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command;
import lombok.Getter;
/**
* Provides an object to {@link org.apache.fineract.batch.service.BatchApiService} to get the proper commandStrategy for
* each request in BatchRequest. It uses Builder pattern to create object of this type.
@@ -26,6 +28,7 @@ package org.apache.fineract.batch.command;
*
* @see org.apache.fineract.batch.service.BatchApiService
*/
@Getter
public final class CommandContext {
/**
@@ -57,7 +60,6 @@ public final class CommandContext {
private final String method;
private CommandContext(final String resource, final String method) {
this.resource = resource;
this.method = method;
}
@@ -21,6 +21,7 @@ package org.apache.fineract.batch.command;
import static javax.ws.rs.HttpMethod.GET;
import static javax.ws.rs.HttpMethod.POST;
import static javax.ws.rs.HttpMethod.PUT;
import static org.apache.fineract.batch.command.CommandStrategyUtils.isResourceVersioned;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -101,7 +102,17 @@ public class CommandStrategyProvider {
* @see org.apache.fineract.batch.command.internal.UnknownCommandStrategy
*/
public CommandStrategy getCommandStrategy(final CommandContext commandContext) {
if (isResourceVersioned(commandContext)) {
return internalGetCommandStrategy(commandContext);
} else {
// for backward compatibility, support non-versioned relative paths too
CommandContext alteredCommandContext = CommandContext.resource("v1/" + commandContext.getResource())
.method(commandContext.getMethod()).build();
return internalGetCommandStrategy(alteredCommandContext);
}
}
private CommandStrategy internalGetCommandStrategy(CommandContext commandContext) {
if (commandStrategies.containsKey(commandContext)) {
return (CommandStrategy) this.applicationContext.getBean(commandStrategies.get(commandContext));
}
@@ -111,7 +122,6 @@ public class CommandStrategyProvider {
return (CommandStrategy) applicationContext.getBean(commandStrategies.get(entry.getKey()));
}
}
return new UnknownCommandStrategy();
}
@@ -120,100 +130,98 @@ public class CommandStrategyProvider {
* command Strategy will have to be added within this function in order to initiate it within the constructor.
*/
private static void init() {
commandStrategies.put(CommandContext.resource("clients").method(POST).build(), "createClientCommandStrategy");
commandStrategies.put(CommandContext.resource("clients\\/" + NUMBER_REGEX).method(PUT).build(), "updateClientCommandStrategy");
commandStrategies.put(CommandContext.resource("loans").method(POST).build(), "applyLoanCommandStrategy");
commandStrategies.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
commandStrategies.put(CommandContext.resource("v1\\/clients").method(POST).build(), "createClientCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/clients\\/" + NUMBER_REGEX).method(PUT).build(), "updateClientCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/loans").method(POST).build(), "applyLoanCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
"getLoanByIdCommandStrategy");
commandStrategies.put(
CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
"getLoanByExternalIdCommandStrategy");
commandStrategies.put(CommandContext.resource("savingsaccounts\\/" + NUMBER_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
commandStrategies.put(
CommandContext.resource("v1\\/savingsaccounts\\/" + NUMBER_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
"getSavingsAccountByIdCommandStrategy");
commandStrategies.put(CommandContext.resource("savingsaccounts").method(POST).build(), "applySavingsCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/savingsaccounts").method(POST).build(), "applySavingsCommandStrategy");
commandStrategies.put(CommandContext
.resource("savingsaccounts\\/" + NUMBER_REGEX + "\\/transactions" + OPTIONAL_COMMAND_PARAM_REGEX).method(POST).build(),
.resource("v1\\/savingsaccounts\\/" + NUMBER_REGEX + "\\/transactions" + OPTIONAL_COMMAND_PARAM_REGEX).method(POST).build(),
"savingsAccountTransactionCommandStrategy");
commandStrategies.put(CommandContext
.resource("savingsaccounts\\/" + NUMBER_REGEX + "\\/transactions\\/" + NUMBER_REGEX + OPTIONAL_COMMAND_PARAM_REGEX)
.resource("v1\\/savingsaccounts\\/" + NUMBER_REGEX + "\\/transactions\\/" + NUMBER_REGEX + OPTIONAL_COMMAND_PARAM_REGEX)
.method(POST).build(), "savingsAccountAdjustTransactionCommandStrategy");
commandStrategies.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + "\\/charges").method(POST).build(),
commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\/charges").method(POST).build(),
"createChargeCommandStrategy");
commandStrategies
.put(CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/charges" + OPTIONAL_COMMAND_PARAM_REGEX + "")
.method(POST).build(), "createChargeByLoanExternalIdCommandStrategy");
commandStrategies.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + "\\/charges").method(GET).build(),
"collectChargesCommandStrategy");
commandStrategies.put(CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/charges").method(GET).build(),
"collectChargesByLoanExternalIdCommandStrategy");
commandStrategies.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + "\\/charges\\/" + NUMBER_REGEX).method(GET).build(),
"getChargeByIdCommandStrategy");
commandStrategies.put(CommandContext.resource(
"loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/charges\\/external-id\\/" + UUID_PARAM_REGEX + OPTIONAL_QUERY_PARAM_REGEX)
.method(GET).build(), "getChargeByChargeExternalIdCommandStrategy");
commandStrategies.put(CommandContext
.resource("loans\\/" + NUMBER_REGEX + "\\/charges\\/" + NUMBER_REGEX + MANDATORY_COMMAND_PARAM_REGEX).method(POST).build(),
"adjustChargeCommandStrategy");
commandStrategies.put(CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/charges\\/external-id\\/"
+ UUID_PARAM_REGEX + MANDATORY_COMMAND_PARAM_REGEX).method(POST).build(), "adjustChargeByChargeExternalIdCommandStrategy");
commandStrategies.put(
CommandContext.resource("loans\\/" + NUMBER_REGEX + "\\/transactions" + MANDATORY_COMMAND_PARAM_REGEX).method(POST).build(),
"createTransactionLoanCommandStrategy");
commandStrategies.put(
CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/transactions" + MANDATORY_COMMAND_PARAM_REGEX)
CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/charges" + OPTIONAL_COMMAND_PARAM_REGEX + "")
.method(POST).build(),
"createTransactionByLoanExternalIdCommandStrategy");
commandStrategies
.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + "\\/transactions\\/" + NUMBER_REGEX + OPTIONAL_COMMAND_PARAM_REGEX)
.method(POST).build(), "adjustTransactionCommandStrategy");
commandStrategies.put(CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/transactions\\/external-id\\/"
+ UUID_PARAM_REGEX + OPTIONAL_COMMAND_PARAM_REGEX).method(POST).build(), "adjustTransactionByExternalIdCommandStrategy");
commandStrategies.put(CommandContext.resource("clients\\/" + NUMBER_REGEX + "\\?command=activate").method(POST).build(),
"activateClientCommandStrategy");
commandStrategies.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + "\\?command=approve").method(POST).build(),
"approveLoanCommandStrategy");
commandStrategies.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + "\\?command=disburse").method(POST).build(),
"disburseLoanCommandStrategy");
"createChargeByLoanExternalIdCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\/charges").method(GET).build(),
"collectChargesCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/charges").method(GET).build(),
"collectChargesByLoanExternalIdCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\/charges\\/" + NUMBER_REGEX).method(GET).build(),
"getChargeByIdCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/charges\\/external-id\\/"
+ UUID_PARAM_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(), "getChargeByChargeExternalIdCommandStrategy");
commandStrategies.put(
CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + MANDATORY_COMMAND_PARAM_REGEX).method(POST).build(),
"loanStateTransistionsByExternalIdCommandStrategy");
commandStrategies.put(CommandContext.resource("rescheduleloans").method(POST).build(),
"createLoanRescheduleRequestCommandStrategy");
commandStrategies.put(CommandContext.resource("rescheduleloans\\/" + NUMBER_REGEX + "\\?command=approve").method(POST).build(),
"approveLoanRescheduleCommandStrategy");
commandStrategies.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + "\\/transactions\\/" + NUMBER_REGEX).method(GET).build(),
"getTransactionByIdCommandStrategy");
commandStrategies.put(CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/transactions\\/external-id\\/"
+ UUID_PARAM_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(), "getTransactionByExternalIdCommandStrategy");
commandStrategies.put(
CommandContext.resource("datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX).method(POST).build(),
"createDatatableEntryCommandStrategy");
commandStrategies.put(
CommandContext.resource("datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX + "\\/" + NUMBER_REGEX)
.method(PUT).build(),
"updateDatatableEntryOneToManyCommandStrategy");
commandStrategies.put(
CommandContext.resource("datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX).method(PUT).build(),
"updateDatatableEntryOneToOneCommandStrategy");
commandStrategies.put(
CommandContext.resource("datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX + "\\/" + NUMBER_REGEX)
.method(PUT).build(),
"updateDatatableEntryOneToManyCommandStrategy");
CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\/charges\\/" + NUMBER_REGEX + MANDATORY_COMMAND_PARAM_REGEX)
.method(POST).build(),
"adjustChargeCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/charges\\/external-id\\/"
+ UUID_PARAM_REGEX + MANDATORY_COMMAND_PARAM_REGEX).method(POST).build(), "adjustChargeByChargeExternalIdCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\/transactions" + MANDATORY_COMMAND_PARAM_REGEX)
.method(POST).build(), "createTransactionLoanCommandStrategy");
commandStrategies.put(CommandContext
.resource("datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX + OPTIONAL_QUERY_PARAM_REGEX)
.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/transactions" + MANDATORY_COMMAND_PARAM_REGEX).method(POST)
.build(), "createTransactionByLoanExternalIdCommandStrategy");
commandStrategies.put(
CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\/transactions\\/" + NUMBER_REGEX + OPTIONAL_COMMAND_PARAM_REGEX)
.method(POST).build(),
"adjustTransactionCommandStrategy");
commandStrategies.put(
CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/transactions\\/external-id\\/"
+ UUID_PARAM_REGEX + OPTIONAL_COMMAND_PARAM_REGEX).method(POST).build(),
"adjustTransactionByExternalIdCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/clients\\/" + NUMBER_REGEX + "\\?command=activate").method(POST).build(),
"activateClientCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\?command=approve").method(POST).build(),
"approveLoanCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\?command=disburse").method(POST).build(),
"disburseLoanCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + MANDATORY_COMMAND_PARAM_REGEX)
.method(POST).build(), "loanStateTransistionsByExternalIdCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/rescheduleloans").method(POST).build(),
"createLoanRescheduleRequestCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/rescheduleloans\\/" + NUMBER_REGEX + "\\?command=approve").method(POST).build(),
"approveLoanRescheduleCommandStrategy");
commandStrategies.put(
CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\/transactions\\/" + NUMBER_REGEX).method(GET).build(),
"getTransactionByIdCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/transactions\\/external-id\\/"
+ UUID_PARAM_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(), "getTransactionByExternalIdCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX)
.method(POST).build(), "createDatatableEntryCommandStrategy");
commandStrategies.put(CommandContext
.resource("v1\\/datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX + "\\/" + NUMBER_REGEX)
.method(PUT).build(), "updateDatatableEntryOneToManyCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX)
.method(PUT).build(), "updateDatatableEntryOneToOneCommandStrategy");
commandStrategies.put(CommandContext
.resource("v1\\/datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX + "\\/" + NUMBER_REGEX)
.method(PUT).build(), "updateDatatableEntryOneToManyCommandStrategy");
commandStrategies.put(CommandContext
.resource("v1\\/datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX + OPTIONAL_QUERY_PARAM_REGEX)
.method(GET).build(), "getDatatableEntryByAppTableIdCommandStrategy");
commandStrategies.put(CommandContext.resource("datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX + "\\/"
+ NUMBER_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
commandStrategies.put(
CommandContext.resource("v1\\/datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX + "\\/"
+ NUMBER_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
"getDatatableEntryByAppTableIdAndDataTableIdCommandStrategy");
commandStrategies.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + OPTIONAL_COMMAND_PARAM_REGEX).method(PUT).build(),
commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + OPTIONAL_COMMAND_PARAM_REGEX).method(PUT).build(),
"modifyLoanApplicationCommandStrategy");
commandStrategies.put(
CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + OPTIONAL_COMMAND_PARAM_REGEX).method(PUT).build(),
"modifyLoanApplicationByExternalIdCommandStrategy");
commandStrategies.put(
CommandContext.resource("datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/query" + MANDATORY_QUERY_PARAM_REGEX)
.method(GET).build(),
"getDatatableEntryByQueryCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + OPTIONAL_COMMAND_PARAM_REGEX)
.method(PUT).build(), "modifyLoanApplicationByExternalIdCommandStrategy");
commandStrategies.put(CommandContext
.resource("v1\\/datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/query" + MANDATORY_QUERY_PARAM_REGEX).method(GET)
.build(), "getDatatableEntryByQueryCommandStrategy");
}
}
@@ -20,11 +20,16 @@ package org.apache.fineract.batch.command;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.batch.domain.BatchRequest;
import org.apache.fineract.infrastructure.core.api.MutableUriInfo;
public final class CommandStrategyUtils {
private static final Pattern VERSIONED_RELATIVE_URL_PATTERN = Pattern.compile("^(v[1-9][0-9]*/)(.*)$");
private CommandStrategyUtils() {
}
@@ -61,4 +66,24 @@ public final class CommandStrategyUtils {
}
}
public static String relativeUrlWithoutVersion(BatchRequest request) {
String relativeUrl = request.getRelativeUrl();
Matcher m = VERSIONED_RELATIVE_URL_PATTERN.matcher(relativeUrl);
if (m.matches()) {
return m.group(2);
} else {
return relativeUrl;
}
}
public static boolean isResourceVersioned(CommandContext commandContext) {
String relativeUrl = commandContext.getResource();
return isRelativeUrlVersioned(relativeUrl);
}
public static boolean isRelativeUrlVersioned(String relativeUrl) {
Matcher m = VERSIONED_RELATIVE_URL_PATTERN.matcher(relativeUrl);
return m.matches();
}
}
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -57,7 +59,7 @@ public class ActivateClientCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
final Long clientId = Long.parseLong(pathParameters.get(1).substring(0, pathParameters.get(1).indexOf("?")));
// Calls 'activate' function from 'ClientsApiResource' to activate a
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import java.util.regex.Matcher;
@@ -57,7 +59,7 @@ public class AdjustChargeByChargeExternalIdCommandStrategy implements CommandStr
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
// Expected pattern - loans\/external-id\/[\w\d_-]+\/charges\/external-id\/[\w\d_-]+(\?command=[\w]+)?
// Get the loan and charge ids for use in loanChargesApiResource
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import java.util.regex.Matcher;
@@ -57,7 +59,7 @@ public class AdjustChargeCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
// Get the loan and charge ids for use in loanChargesApiResource
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -58,7 +60,7 @@ public class AdjustTransactionByExternalIdCommandStrategy implements CommandStra
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
// Expected URL pattern - loans\/external-id\/[\w\d_-]+\/transactions\/external-id\/[\w\d_-]+(\?command=[\w]+)?
// Get the loan and transaction ids for use in loanTransactionsApiResource
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -57,7 +59,7 @@ public class AdjustTransactionCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
// Get the loan and transaction ids for use in loanTransactionsApiResource
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -57,7 +59,7 @@ public class ApproveLoanCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
final Long loanId = Long.parseLong(pathParameters.get(1).substring(0, pathParameters.get(1).indexOf("?")));
// Calls 'approve' function from 'LoansApiResource' to approve a
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -43,7 +45,7 @@ public class ApproveLoanRescheduleCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
final Long scheduleId = Long.parseLong(pathParameters.get(1).substring(0, pathParameters.get(1).indexOf("?")));
// Calls 'approve' function from 'Loans reschedule Request' to
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -58,7 +60,7 @@ public class CollectChargesByLoanExternalIdCommandStrategy implements CommandStr
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
// Expected pattern - loans\/external-id\/[\w\d_-]+\/charges
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -58,7 +60,7 @@ public class CollectChargesCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
// Pluck out the loanId out of the relative path
final Long loanId = Long.parseLong(pathParameters.get(1));
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -58,7 +60,7 @@ public class CreateChargeByLoanExternalIdCommandStrategy implements CommandStrat
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
// Expected pattern - loans\/external-id\/[\w\d_-]+\/charges
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -57,7 +59,7 @@ public class CreateChargeCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
final Long loanId = Long.parseLong(pathParameters.get(1));
// Calls 'executeLoanCharge' function from 'LoanChargesApiResource'
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -53,7 +55,7 @@ public class CreateDatatableEntryCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
// Pluck out the datatable name & loanId out of the relative path
final String datatableName = pathParameters.get(1);
final Long loanId = Long.parseLong(pathParameters.get(2));
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import java.util.regex.Matcher;
@@ -60,7 +62,7 @@ public class CreateTransactionByLoanExternalIdCommandStrategy implements Command
response.setHeaders(request.getHeaders());
// Expected Pattern - loans\/external-id\/[a-zA-Z0-9_-]*\/transactions\?command=[\w]+
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
final String loanExternalId = pathParameters.get(2);
final Pattern commandPattern = Pattern.compile("^?command=[a-zA-Z]+");
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import java.util.regex.Matcher;
@@ -59,7 +61,7 @@ public class CreateTransactionLoanCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
final Long loanId = Long.parseLong(pathParameters.get(1));
final Pattern commandPattern = Pattern.compile("^?command=[a-zA-Z]+");
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -57,7 +59,7 @@ public class DisburseLoanCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
final Long loanId = Long.parseLong(pathParameters.get(1).substring(0, pathParameters.get(1).indexOf("?")));
// Calls 'disburse' function from 'LoansApiResource' to disburse a
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -61,7 +63,7 @@ public class GetChargeByChargeExternalIdCommandStrategy implements CommandStrate
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
// Expected pattern - loans\/external-id\/[\w\d_-]+\/charges\/external-id\/[\w\d_-]+
// Get the loan and charge external ids for use in loanChargesApiResource
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -61,7 +63,7 @@ public class GetChargeByIdCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
// Get the loan and charge ids for use in loanChargesApiResource
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import java.util.Map;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
@@ -54,7 +56,7 @@ public class GetDatatableEntryByAppTableIdAndDataTableIdCommandStrategy implemen
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
final String relativeUrlSubString = StringUtils.substringAfter(relativeUrl, "/");
// uriInfo will contain the query parameter value(s) that are sent in the actual batch uri.
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import java.util.Map;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
@@ -54,7 +56,7 @@ public class GetDatatableEntryByAppTableIdCommandStrategy implements CommandStra
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
final String relativeUrlSubString = StringUtils.substringAfter(relativeUrl, "/");
// uriInfo will contain the query parameter value(s) that are sent in the actual batch uri.
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import java.util.Map;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
@@ -54,7 +56,7 @@ public class GetDatatableEntryByQueryCommandStrategy implements CommandStrategy
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
final String relativeUrlSubString = StringUtils.substringAfter(relativeUrl, "/");
// uriInfo will contain the query parameter value(s) that are sent in the actual batch uri.
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.HashMap;
import java.util.List;
@@ -59,7 +61,7 @@ public class GetLoanByExternalIdCommandStrategy implements CommandStrategy {
response.setHeaders(request.getHeaders());
// Expected pattern - loans\/external-id\/[\w\d_-]+\?associations=transactions
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
final String loanExternalIdPathParameter = pathParameters.get(2);
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.core.UriInfo;
@@ -55,7 +57,7 @@ public class GetLoanByIdCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
Long loanId;
// uriInfo will contain the query parameter value(s) that are sent in the actual batch uri.
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.core.UriInfo;
@@ -46,7 +48,7 @@ public class GetSavingsAccountByIdCommandStrategy implements CommandStrategy {
response.setRequestId(batchRequest.getRequestId());
response.setHeaders(batchRequest.getHeaders());
final String relativeUrl = batchRequest.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(batchRequest);
final Long savingsAccountId;
Map<String, String> queryParameters = new HashMap<>();
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.HashMap;
import java.util.List;
@@ -63,7 +65,7 @@ public class GetTransactionByExternalIdCommandStrategy implements CommandStrateg
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
// Expected pattern - loans\/external-id\/[\w\d_-]+\/transactions\/external-id\/[\w\d_-]+
// Get the loan and transaction ids for use in loanTransactionsApiResource
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.HashMap;
import java.util.List;
@@ -62,7 +64,7 @@ public class GetTransactionByIdCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
// Get the loan and transaction ids for use in loanTransactionsApiResource
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import java.util.regex.Matcher;
@@ -60,7 +62,7 @@ public class LoanStateTransistionsByExternalIdCommandStrategy implements Command
response.setHeaders(request.getHeaders());
// Expected pattern - loans\/external-id\/[\w\d_-]+\?command=***
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
final String loanExternalIdPathParameter = pathParameters.get(2);
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -68,7 +70,7 @@ public class ModifyLoanApplicationByExternalIdCommandStrategy implements Command
response.setHeaders(request.getHeaders());
// Expected pattern - loans\/external-id\/[\w\d_-]+\?command=adjust
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
// Get the loan id for use in loansApiResource
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -69,7 +71,7 @@ public class ModifyLoanApplicationCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
// Get the loan id for use in loansApiResource
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -44,7 +46,7 @@ public class SavingsAccountAdjustTransactionCommandStrategy implements CommandSt
response.setRequestId(batchRequest.getRequestId());
response.setHeaders(batchRequest.getHeaders());
String relativeUrl = batchRequest.getRelativeUrl();
String relativeUrl = relativeUrlWithoutVersion(batchRequest);
final List<String> pathParameters;
String command = null;
if (relativeUrl.indexOf('?') > 0) {
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -43,7 +45,7 @@ public class SavingsAccountTransactionCommandStrategy implements CommandStrategy
response.setRequestId(batchRequest.getRequestId());
response.setHeaders(batchRequest.getHeaders());
String relativeUrl = batchRequest.getRelativeUrl();
String relativeUrl = relativeUrlWithoutVersion(batchRequest);
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
String command = null;
if (relativeUrl.indexOf('?') > 0) {
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.batch.command.CommandStrategy;
@@ -56,7 +58,7 @@ public class UpdateClientCommandStrategy implements CommandStrategy {
response.setHeaders(request.getHeaders());
// Get the clientID
final String relativeUrl = request.getRelativeUrl();
final String relativeUrl = relativeUrlWithoutVersion(request);
final Long clientId = Long.parseLong(relativeUrl.substring(relativeUrl.indexOf('/') + 1));
// Calls 'update' function from 'ClientsApiResource' to update a
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -53,7 +55,7 @@ public class UpdateDatatableEntryOneToManyCommandStrategy implements CommandStra
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
// Pluck out the datatable name, entity id & datatable entry id out of the relative path
final String datatableName = pathParameters.get(1);
final Long entityId = Long.parseLong(pathParameters.get(2));
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -52,7 +54,7 @@ public class UpdateDatatableEntryOneToOneCommandStrategy implements CommandStrat
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
// Pluck out the datatable name, entity id & datatable entry id out of the relative path
final String datatableName = pathParameters.get(1);
final Long entityId = Long.parseLong(pathParameters.get(2));
@@ -53,11 +53,11 @@ import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSeria
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.springframework.stereotype.Component;
@Path("/jobs")
@Path("/v1/jobs")
@Component
@Tag(name = "Business Step Configuration", description = "")
@RequiredArgsConstructor
public class ConfigureBusinessStepResource {
public class ConfigureBusinessStepApiResource {
private static final Set<String> BUSINESS_STEP_CONFIG_RESPONSE_DATA_PARAMETERS = new HashSet<>(
Arrays.asList("jobName", "businessSteps"));
@@ -42,7 +42,7 @@ import org.springframework.web.bind.annotation.RequestBody;
@Profile("test")
@Component
@Path("/internal/loans")
@Path("/v1/internal/loans")
@RequiredArgsConstructor
@Slf4j
public class InternalLoanAccountLockApiResource implements InitializingBean {
@@ -46,7 +46,7 @@ import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSeria
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.springframework.stereotype.Component;
@Path("/loans")
@Path("/v1/loans")
@Component
@Tag(name = "Loan Account Lock", description = "")
@RequiredArgsConstructor
@@ -38,7 +38,7 @@ import org.apache.fineract.cob.service.LoanCOBCatchUpService;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.springframework.stereotype.Component;
@Path("/loans")
@Path("/v1/loans")
@Component
@Tag(name = "Loan COB Catch Up", description = "")
@RequiredArgsConstructor
@@ -50,12 +50,10 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.core.service.Page;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.infrastructure.security.utils.SQLBuilder;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/audits")
@Path("/v1/audits")
@Component
@Scope("singleton")
@Tag(name = "Audits", description = "Every non-read Mifos API request is audited. A fully processed request can not be changed or deleted. See maker checker api for situations where an audit is not fully processed.\n"
+ "\n"
+ "Permissions: To search and look at audit entries a user needs to be attached to a role that has one of the ALL_FUNCTIONS, ALL_FUNCTIONS_READ or READ_AUDIT permissions.\n"
@@ -53,12 +53,10 @@ import org.apache.fineract.infrastructure.core.exception.UnrecognizedQueryParamE
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.utils.SQLBuilder;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/makercheckers")
@Path("/v1/makercheckers")
@Component
@Scope("singleton")
@Tag(name = "Maker Checker (or 4-eye) functionality")
@RequiredArgsConstructor
public class MakercheckersApiResource {
@@ -42,6 +42,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -54,14 +55,12 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path(AccountNumberFormatConstants.resourceRelativeURL)
@Component
@Scope("singleton")
@Tag(name = "Account number format", description = "Account number preferences are used to describe custom formats for account numbers associated with Customer, Loan and Savings accounts.")
@RequiredArgsConstructor
public class AccountNumberFormatsApiResource {
private final PlatformSecurityContext context;
@@ -74,19 +73,6 @@ public class AccountNumberFormatsApiResource {
AccountNumberFormatConstants.prefixTypeParamName, AccountNumberFormatConstants.accountTypeOptionsParamName,
AccountNumberFormatConstants.prefixTypeOptionsParamName));
@Autowired
public AccountNumberFormatsApiResource(final PlatformSecurityContext context,
final ToApiJsonSerializer<AccountNumberFormatData> toApiJsonSerializer,
final AccountNumberFormatReadPlatformService accountNumberFormatReadPlatformService,
final ApiRequestParameterHelper apiRequestParameterHelper,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
this.context = context;
this.accountNumberFormatReadPlatformService = accountNumberFormatReadPlatformService;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
this.toApiJsonSerializer = toApiJsonSerializer;
}
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
@@ -34,7 +34,7 @@ public final class AccountNumberFormatConstants {
public static final String dateFormatParamName = "dateFormat";
// REST end point
public static final String resourceRelativeURL = "/accountnumberformats";
public static final String resourceRelativeURL = "/v1/accountnumberformats";
// request parameters
public static final String idParamName = "id";
@@ -30,6 +30,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.bulkimport.data.GlobalEntityType;
import org.apache.fineract.infrastructure.bulkimport.data.ImportData;
import org.apache.fineract.infrastructure.bulkimport.exceptions.ImportTypeNotFoundException;
@@ -39,14 +40,12 @@ import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSeria
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.documentmanagement.data.DocumentData;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/imports")
@Path("/v1/imports")
@Component
@Scope("singleton")
@Tag(name = "Bulk Import", description = "")
@RequiredArgsConstructor
public class BulkImportApiResource {
private static final String RESOURCE_NAME_FOR_PERMISSION = "IMPORT";
@@ -56,15 +55,6 @@ public class BulkImportApiResource {
private final DefaultToApiJsonSerializer<ImportData> toApiJsonSerializer;
private final ApiRequestParameterHelper apiRequestParameterHelper;
@Autowired
public BulkImportApiResource(final PlatformSecurityContext context, final BulkImportWorkbookService bulkImportWorkbookService,
final DefaultToApiJsonSerializer<ImportData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper) {
this.context = context;
this.bulkImportWorkbookService = bulkImportWorkbookService;
this.toApiJsonSerializer = toApiJsonSerializer;
this.apiRequestParameterHelper = apiRequestParameterHelper;
}
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@@ -51,7 +51,7 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.springframework.stereotype.Component;
@RequiredArgsConstructor
@Path("businessdate")
@Path("/v1/businessdate")
@Component
@Tag(name = "Business Date Management", description = "Business date management enables you to set up, fetch and adjust organisation business dates")
public class BusinessDateApiResource {
@@ -39,6 +39,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -49,19 +50,17 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/caches")
@Path("/v1/caches")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
@Scope("singleton")
@Tag(name = "Cache", description = "The following settings are possible for cache:\n" + "\n" + "No Caching: caching turned off\n"
+ "Single node: caching on for single instance deployments of platorm (works for multiple tenants but only one tomcat)\n"
+ "By default caching is set to No Caching. Switching between caches results in the cache been clear e.g. from Single node to No cache and back again would clear down the single node cache.")
@RequiredArgsConstructor
public class CacheApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(List.of("id"));
@@ -71,20 +70,9 @@ public class CacheApiResource {
private final DefaultToApiJsonSerializer<CacheData> toApiJsonSerializer;
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
@Qualifier("runtimeDelegatingCacheManager")
private final RuntimeDelegatingCacheManager cacheService;
@Autowired
public CacheApiResource(final PlatformSecurityContext context,
@Qualifier("runtimeDelegatingCacheManager") final RuntimeDelegatingCacheManager cacheService,
final DefaultToApiJsonSerializer<CacheData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
this.context = context;
this.cacheService = cacheService;
this.toApiJsonSerializer = toApiJsonSerializer;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
}
@GET
@Operation(summary = "Retrieve Cache Types", description = "Returns the list of caches.\n" + "\n" + "Example Requests:\n" + "\n"
+ "caches")
@@ -46,14 +46,12 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.core.service.Page;
import org.apache.fineract.infrastructure.core.service.SearchParameters;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/email")
@Path("/v1/email")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
@Scope("singleton")
@RequiredArgsConstructor
public class EmailApiResource {
@@ -50,18 +50,16 @@ import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSeria
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
* Created with IntelliJ IDEA. User: andrew Date: 19-5-14 Time: 15:17 To change this template use File | Settings | File
* Templates.
*/
@Path("/email/campaign")
@Path("/v1/email/campaign")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
@Scope("singleton")
@RequiredArgsConstructor
public class EmailCampaignApiResource {
@@ -27,26 +27,24 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
import org.apache.fineract.infrastructure.campaigns.email.data.EmailConfigurationData;
import org.apache.fineract.infrastructure.campaigns.email.service.EmailConfigurationReadPlatformService;
import org.apache.fineract.infrastructure.campaigns.email.service.EmailReadPlatformService;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/email/configuration")
@Path("/v1/email/configuration")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
@Scope("singleton")
@RequiredArgsConstructor
public class EmailConfigurationApiResource {
private static final String RESOURCE_NAME_FOR_PERMISSIONS = "EMAIL_CONFIGURATION";
@@ -56,19 +54,6 @@ public class EmailConfigurationApiResource {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final EmailConfigurationReadPlatformService emailConfigurationReadPlatformService;
@Autowired
public EmailConfigurationApiResource(final PlatformSecurityContext context, final EmailReadPlatformService readPlatformService,
final DefaultToApiJsonSerializer<EmailConfigurationData> toApiJsonSerializer,
final ApiRequestParameterHelper apiRequestParameterHelper,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
final EmailConfigurationReadPlatformService emailConfigurationReadPlatformService) {
this.context = context;
this.toApiJsonSerializer = toApiJsonSerializer;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
this.emailConfigurationReadPlatformService = emailConfigurationReadPlatformService;
}
@GET
public String retrieveAll(@Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
@@ -58,12 +58,10 @@ import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.infrastructure.core.service.Page;
import org.apache.fineract.infrastructure.core.service.SearchParameters;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/smscampaigns")
@Path("/v1/smscampaigns")
@Component
@Scope("singleton")
@RequiredArgsConstructor
public class SmsCampaignApiResource {
@@ -42,6 +42,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -54,16 +55,14 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/codes/{codeId}/codevalues")
@Path("/v1/codes/{codeId}/codevalues")
@Component
@Scope("singleton")
@Tag(name = "Code Values", description = "Code and code values: Codes represent a specific category of data, their code values are a specific instance of that category.\n"
+ "\n"
+ "Codes are mostly system defined which means the code itself comes out of the box and cannot be modified however its code values can be. e.g. 'Customer Identifier', it defaults to a code value of 'Passport' but could be 'Drivers License, National Id' etc")
@RequiredArgsConstructor
public class CodeValuesApiResource {
/**
@@ -81,17 +80,6 @@ public class CodeValuesApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
@Autowired
public CodeValuesApiResource(final PlatformSecurityContext context, final CodeValueReadPlatformService readPlatformService,
final DefaultToApiJsonSerializer<CodeValueData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
this.context = context;
this.readPlatformService = readPlatformService;
this.toApiJsonSerializer = toApiJsonSerializer;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
}
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@@ -42,6 +42,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -52,16 +53,14 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/codes")
@Path("/v1/codes")
@Component
@Scope("singleton")
@Tag(name = "Codes", description = "Code and code values: Codes represent a specific category of data, their code values are a specific instance of that category.\n"
+ "\n"
+ "Codes are mostly system defined which means the code itself comes out of the box and cannot be modified however its code values can be. e.g. 'Customer Identifier', it defaults to a code value of 'Passport' but could be 'Drivers License, National Id' etc")
@RequiredArgsConstructor
public class CodesApiResource {
/**
@@ -76,17 +75,6 @@ public class CodesApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
@Autowired
public CodesApiResource(final PlatformSecurityContext context, final CodeReadPlatformService readPlatformService,
final DefaultToApiJsonSerializer<CodeData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
this.context = context;
this.readPlatformService = readPlatformService;
this.toApiJsonSerializer = toApiJsonSerializer;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
}
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@@ -36,6 +36,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -46,40 +47,22 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/externalservice")
@Path("/v1/externalservice")
@Component
@Scope("singleton")
@Tag(name = "External Services", description = "External Services Configuration related to set of supported configurations for third party services like Amazon S3 and SMTP:\n"
+ "\n" + "S3 (Amazon S3):\n" + "s3_access_key -\n" + "s3_bucket_name -\n" + "s3_secret_key -\n" + "\n" + "\n"
+ "SMTP (Email Service):\n" + "username -\n" + "password -\n" + "host -\n" + "port -\n" + "useTLS -")
@RequiredArgsConstructor
public class ExternalServicesConfigurationApiResource {
private final PlatformSecurityContext context;
private final ExternalServicesPropertiesReadPlatformService externalServicePropertiesReadPlatformService;
private final ToApiJsonSerializer<ExternalServicesPropertiesData> toApiJsonSerializer;
// private final ToApiJsonSerializer<S3CredentialsData>
// s3ToApiJsonSerializer;
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
@Autowired
public ExternalServicesConfigurationApiResource(final PlatformSecurityContext context,
final ExternalServicesPropertiesReadPlatformService readPlatformService,
final ToApiJsonSerializer<ExternalServicesPropertiesData> toApiJsonSerializer,
final ApiRequestParameterHelper apiRequestParameterHelper,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
this.context = context;
this.externalServicePropertiesReadPlatformService = readPlatformService;
this.toApiJsonSerializer = toApiJsonSerializer;
// this.s3ToApiJsonSerializer = s3ToApiJsonSerializer;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
}
@GET
@Path("{servicename}")
@Consumes({ MediaType.APPLICATION_JSON })
@@ -40,6 +40,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -51,13 +52,10 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/configurations")
@Path("/v1/configurations")
@Component
@Scope("singleton")
@Tag(name = "Global Configuration", description = "Global configuration related to set of supported enable/disable configurations:\n" + "\n"
+ "maker-checker - defaults to false - if true turns on maker-checker functionality\n"
+ "reschedule-future-repayments - defaults to false - if true reschedules repayemnts which falls on a non-working day to configured repayment rescheduling rule\n"
@@ -67,6 +65,7 @@ import org.springframework.stereotype.Component;
+ "savings-interest-posting-current-period-end - Set it at the database level before any savings interest is posted. When set as false(default), interest will be posted on the first date of next period. If set as true, interest will be posted on last date of current period. There is no difference in the interest amount posted.\n"
+ "financial-year-beginning-month - Set it at the database level before any savings interest is posted. Allowed values 1 - 12 (January - December). Interest posting periods are evaluated based on this configuration.\n"
+ "meetings-mandatory-for-jlg-loans - if set to true, enforces all JLG loans to follow a meeting schedule belonging to either the parent group or Center.")
@RequiredArgsConstructor
public class GlobalConfigurationApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("globalConfiguration"));
@@ -80,20 +79,6 @@ public class GlobalConfigurationApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
@Autowired
public GlobalConfigurationApiResource(final PlatformSecurityContext context, final ConfigurationReadPlatformService readPlatformService,
final DefaultToApiJsonSerializer<GlobalConfigurationData> toApiJsonSerializer,
final ApiRequestParameterHelper apiRequestParameterHelper,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
final DefaultToApiJsonSerializer<GlobalConfigurationPropertyData> propertyDataJsonSerializer) {
this.context = context;
this.readPlatformService = readPlatformService;
this.toApiJsonSerializer = toApiJsonSerializer;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
this.propertyDataJsonSerializer = propertyDataJsonSerializer;
}
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@@ -25,18 +25,14 @@ import javax.ws.rs.Path;
import javax.ws.rs.ext.Provider;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.server.ServerProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;
@Configuration
@ApplicationPath("/api/v1")
@ApplicationPath("/api")
public class JerseyConfig extends ResourceConfig {
private static final Logger LOG = LoggerFactory.getLogger(JerseyConfig.class);
JerseyConfig() {
register(org.glassfish.jersey.media.multipart.MultiPartFeature.class);
property(ServerProperties.WADL_FEATURE_DISABLE, true);
@@ -25,7 +25,6 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
@@ -39,9 +38,8 @@ import org.springframework.stereotype.Component;
* @author Michael Vorburger.ch
*/
@Component
@Path("/echo")
@Scope("singleton")
public class EchoHeadersResource {
@Path("/v1/echo")
public class EchoHeadersApiResource {
@GET
@Consumes({ MediaType.WILDCARD })
@@ -34,6 +34,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -50,15 +51,13 @@ import org.apache.fineract.infrastructure.creditbureau.service.CreditBureauReadC
import org.apache.fineract.infrastructure.creditbureau.service.CreditBureauReadPlatformService;
import org.apache.fineract.infrastructure.creditbureau.service.OrganisationCreditBureauReadPlatformService;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/CreditBureauConfiguration")
@Path("/v1/CreditBureauConfiguration")
@Component
@Scope("singleton")
@Tag(name = "Credit Bureau Configuration", description = "")
public class CreditBureauConfigurationAPI {
@RequiredArgsConstructor
public class CreditBureauConfigurationApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
Arrays.asList("creditBureauId", "alias", "country", "creditBureauProductId", "startDate", "endDate", "isActive"));
@@ -75,32 +74,6 @@ public class CreditBureauConfigurationAPI {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final CreditBureauReadConfigurationService creditBureauConfiguration;
@Autowired
public CreditBureauConfigurationAPI(final PlatformSecurityContext context, final CreditBureauReadPlatformService readPlatformService,
final DefaultToApiJsonSerializer<CreditBureauData> toApiJsonSerializer,
final CreditBureauLoanProductMappingReadPlatformService readPlatformServiceCreditBureauLoanProduct,
final CreditBureauReadConfigurationService readPlatformServiceCreditBureauConfiguration,
final DefaultToApiJsonSerializer<CreditBureauLoanProductMappingData> toApiJsonSerializerCreditBureauLoanProduct,
final OrganisationCreditBureauReadPlatformService readPlatformServiceOrganisationCreditBureau,
final DefaultToApiJsonSerializer<OrganisationCreditBureauData> toApiJsonSerializerOrganisationCreditBureau,
final ApiRequestParameterHelper apiRequestParameterHelper,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
final DefaultToApiJsonSerializer<CreditBureauConfigurationData> toApiJsonSerializerReport,
final CreditBureauReadConfigurationService creditBureauConfiguration) {
this.context = context;
this.readPlatformService = readPlatformService;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.readPlatformServiceCreditBureauLoanProduct = readPlatformServiceCreditBureauLoanProduct;
this.toApiJsonSerializerCreditBureauLoanProduct = toApiJsonSerializerCreditBureauLoanProduct;
this.readPlatformServiceOrganisationCreditBureau = readPlatformServiceOrganisationCreditBureau;
this.toApiJsonSerializerOrganisationCreditBureau = toApiJsonSerializerOrganisationCreditBureau;
this.toApiJsonSerializer = toApiJsonSerializer;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
this.toApiJsonSerializerReport = toApiJsonSerializerReport;
this.creditBureauConfiguration = creditBureauConfiguration;
}
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@@ -62,10 +62,10 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
@Path("/creditBureauIntegration")
@Path("/v1/creditBureauIntegration")
@Component
@RequiredArgsConstructor
public class CreditBureauIntegrationAPI {
public class CreditBureauIntegrationApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "creditBureauId", "nrc", "creditReport"));
@@ -76,7 +76,7 @@ public class CreditBureauIntegrationAPI {
private final CreditReportWritePlatformService creditReportWritePlatformService;
private final CreditReportReadPlatformService creditReportReadPlatformService;
private final DefaultToApiJsonSerializer<CreditReportData> toApiJsonSerializer;
private static final Logger LOG = LoggerFactory.getLogger(CreditBureauIntegrationAPI.class);
private static final Logger LOG = LoggerFactory.getLogger(CreditBureauIntegrationApiResource.class);
@POST
@Path("creditReport")
@@ -44,6 +44,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -56,16 +57,14 @@ import org.apache.fineract.infrastructure.dataqueries.data.GenericResultsetData;
import org.apache.fineract.infrastructure.dataqueries.service.GenericDataService;
import org.apache.fineract.infrastructure.dataqueries.service.ReadWriteNonCoreDataService;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/datatables")
@Path("/v1/datatables")
@Component
@Scope("singleton")
@Tag(name = "Data Tables", description = "The datatables API allows you to plug-in your own tables (MySql) that have a relationship to a Apache Fineract core table. For example, you might want to add some extra client fields and record information about each of the clients' family members. Via the API you can create, read, update and delete entries for each 'plugged-in' table. The API checks for permission and for 'data scoping' (only data within the users' office hierarchy can be managed by the user).\n"
+ "\n"
+ "The Apache Fineract Reference App uses a JQuery plug-in called stretchydatatables (which in turn uses this datatables resource) to provide a pretty flexible CRUD (Create, Read, Update, Delete) User Interface.")
@RequiredArgsConstructor
public class DatatablesApiResource {
private final PlatformSecurityContext context;
@@ -74,18 +73,6 @@ public class DatatablesApiResource {
private final ToApiJsonSerializer<GenericResultsetData> toApiJsonSerializer;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
@Autowired
public DatatablesApiResource(final PlatformSecurityContext context, final GenericDataService genericDataService,
final ReadWriteNonCoreDataService readWriteNonCoreDataService,
final ToApiJsonSerializer<GenericResultsetData> toApiJsonSerializer,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
this.context = context;
this.genericDataService = genericDataService;
this.readWriteNonCoreDataService = readWriteNonCoreDataService;
this.toApiJsonSerializer = toApiJsonSerializer;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
}
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@@ -38,7 +38,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -51,13 +51,11 @@ import org.apache.fineract.infrastructure.dataqueries.data.EntityDataTableChecks
import org.apache.fineract.infrastructure.dataqueries.data.EntityDataTableChecksTemplateData;
import org.apache.fineract.infrastructure.dataqueries.data.GenericResultsetData;
import org.apache.fineract.infrastructure.dataqueries.service.EntityDatatableChecksReadService;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/entityDatatableChecks")
@AllArgsConstructor
@Path("/v1/entityDatatableChecks")
@RequiredArgsConstructor
@Component
@Scope("singleton")
@Tag(name = "Entity Data Table", description = "This defines Entity-Datatable Check.")
public class EntityDatatableChecksApiResource {
@@ -42,6 +42,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -53,14 +54,12 @@ import org.apache.fineract.infrastructure.dataqueries.data.ReportData;
import org.apache.fineract.infrastructure.dataqueries.service.ReadReportingService;
import org.apache.fineract.infrastructure.report.provider.ReportingProcessServiceProvider;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/reports")
@Path("/v1/reports")
@Component
@Scope("singleton")
@Tag(name = "Reports", description = "Non-core reports can be added, updated and deleted.")
@RequiredArgsConstructor
public class ReportsApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "reportName", "reportType",
@@ -74,19 +73,6 @@ public class ReportsApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final ReportingProcessServiceProvider reportingProcessServiceProvider;
@Autowired
public ReportsApiResource(final PlatformSecurityContext context, final ReadReportingService readReportingService,
final ToApiJsonSerializer<ReportData> toApiJsonSerializer,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
final ApiRequestParameterHelper apiRequestParameterHelper, ReportingProcessServiceProvider reportingProcessServiceProvider) {
this.context = context;
this.readReportingService = readReportingService;
this.toApiJsonSerializer = toApiJsonSerializer;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.reportingProcessServiceProvider = reportingProcessServiceProvider;
}
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@@ -38,6 +38,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.ApiParameterHelper;
import org.apache.fineract.infrastructure.core.exception.PlatformServiceUnavailableException;
import org.apache.fineract.infrastructure.dataqueries.data.ReportExportType;
@@ -48,14 +49,12 @@ import org.apache.fineract.infrastructure.security.exception.NoAuthorizationExce
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.useradministration.domain.AppUser;
import org.glassfish.jersey.internal.util.collection.MultivaluedStringMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/runreports")
@Path("/v1/runreports")
@Component
@Scope("singleton")
@Tag(name = "Run Reports", description = "")
@RequiredArgsConstructor
public class RunreportsApiResource {
public static final String IS_SELF_SERVICE_USER_REPORT_PARAMETER = "isSelfServiceUserReport";
@@ -64,14 +63,6 @@ public class RunreportsApiResource {
private final ReadReportingService readExtraDataAndReportingService;
private final ReportingProcessServiceProvider reportingProcessServiceProvider;
@Autowired
public RunreportsApiResource(final PlatformSecurityContext context, final ReadReportingService readExtraDataAndReportingService,
final ReportingProcessServiceProvider reportingProcessServiceProvider) {
this.context = context;
this.readExtraDataAndReportingService = readExtraDataAndReportingService;
this.reportingProcessServiceProvider = reportingProcessServiceProvider;
}
@GET
@Path("/availableExports/{reportName}")
@Consumes({ MediaType.APPLICATION_JSON })
@@ -45,6 +45,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
@@ -58,17 +59,15 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
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;
@Component
@Scope("singleton")
@Path("{entityType}/{entityId}/documents")
@Path("/v1/{entityType}/{entityId}/documents")
@Tag(name = "Documents", description = "Multiple Documents (a combination of a name, description and a file) may be attached to different Entities like Clients, Groups, Staff, Loans, Savings and Client Identifiers in the system\n"
+ "\n" + "Note: The currently allowed Entities are\n" + "\n" + "Clients: URL Pattern as clients\n" + "Staff: URL Pattern as staff\n"
+ "Loans: URL Pattern as loans\n" + "Savings: URL Pattern as savings\n" + "Client Identifiers: URL Pattern as client_identifiers\n"
+ "Groups: URL Pattern as groups")
@RequiredArgsConstructor
public class DocumentManagementApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
@@ -83,19 +82,6 @@ public class DocumentManagementApiResource {
private final ToApiJsonSerializer<DocumentData> toApiJsonSerializer;
private final FileUploadValidator fileUploadValidator;
@Autowired
public DocumentManagementApiResource(final PlatformSecurityContext context,
final DocumentReadPlatformService documentReadPlatformService, final DocumentWritePlatformService documentWritePlatformService,
final ApiRequestParameterHelper apiRequestParameterHelper, final ToApiJsonSerializer<DocumentData> toApiJsonSerializer,
final FileUploadValidator fileUploadValidator) {
this.context = context;
this.documentReadPlatformService = documentReadPlatformService;
this.documentWritePlatformService = documentWritePlatformService;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.toApiJsonSerializer = toApiJsonSerializer;
this.fileUploadValidator = fileUploadValidator;
}
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@@ -56,14 +56,12 @@ import org.apache.fineract.portfolio.client.data.ClientData;
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Slf4j
@RequiredArgsConstructor
@Component
@Scope("singleton")
@Path("{entity}/{entityId}/images")
@Path("/v1/{entity}/{entityId}/images")
public class ImagesApiResource {
private final PlatformSecurityContext context;
@@ -31,6 +31,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -42,16 +43,14 @@ import org.apache.fineract.infrastructure.entityaccess.data.FineractEntityRelati
import org.apache.fineract.infrastructure.entityaccess.data.FineractEntityToEntityMappingData;
import org.apache.fineract.infrastructure.entityaccess.service.FineractEntityAccessReadService;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/entitytoentitymapping")
@Path("/v1/entitytoentitymapping")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
@Scope("singleton")
@Tag(name = "Fineract Entity", description = "")
@RequiredArgsConstructor
public class FineractEntityApiResource {
private final PlatformSecurityContext context;
@@ -61,20 +60,6 @@ public class FineractEntityApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
@Autowired
public FineractEntityApiResource(final PlatformSecurityContext context, final FineractEntityAccessReadService readPlatformService,
final DefaultToApiJsonSerializer<FineractEntityRelationData> toApiJsonSerializer,
final DefaultToApiJsonSerializer<FineractEntityToEntityMappingData> toApiJsonSerializerOfficeToLoanProducts,
final ApiRequestParameterHelper apiRequestParameterHelper,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
this.context = context;
this.readPlatformService = readPlatformService;
this.toApiJsonSerializer = toApiJsonSerializer;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
this.toApiJsonSerializerOfficeToLoanProducts = toApiJsonSerializerOfficeToLoanProducts;
}
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@@ -51,7 +51,7 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.springframework.stereotype.Component;
@RequiredArgsConstructor
@Path("/externalevents/configuration")
@Path("/v1/externalevents/configuration")
@Component
@Tag(name = "External event configuration", description = "External event configuration enables user to enable/disable event posting to downstream message channel")
public class ExternalEventConfigurationApiResource {
@@ -34,20 +34,19 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.gcm.domain.DeviceRegistration;
import org.apache.fineract.infrastructure.gcm.domain.DeviceRegistrationData;
import org.apache.fineract.infrastructure.gcm.service.DeviceRegistrationReadPlatformService;
import org.apache.fineract.infrastructure.gcm.service.DeviceRegistrationWritePlatformService;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/self/device/registration")
@Path("/v1/self/device/registration")
@Component
@Scope("singleton")
@Tag(name = "Device Registration", description = "")
@RequiredArgsConstructor
public class DeviceRegistrationApiResource {
private final PlatformSecurityContext context;
@@ -55,17 +54,6 @@ public class DeviceRegistrationApiResource {
private final DefaultToApiJsonSerializer<DeviceRegistrationData> toApiJsonSerializer;
private final DeviceRegistrationReadPlatformService deviceRegistrationReadPlatformService;
@Autowired
public DeviceRegistrationApiResource(PlatformSecurityContext context,
final DefaultToApiJsonSerializer<DeviceRegistrationData> toApiJsonSerializer,
final DeviceRegistrationReadPlatformService deviceRegistrationReadPlatformService,
final DeviceRegistrationWritePlatformService deviceRegistrationWritePlatformService) {
this.context = context;
this.toApiJsonSerializer = toApiJsonSerializer;
this.deviceRegistrationReadPlatformService = deviceRegistrationReadPlatformService;
this.deviceRegistrationWritePlatformService = deviceRegistrationWritePlatformService;
}
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@@ -55,7 +55,7 @@ import org.apache.fineract.infrastructure.hooks.service.HookReadPlatformService;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.stereotype.Component;
@Path("/hooks")
@Path("/v1/hooks")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
@@ -39,7 +39,7 @@ import org.springframework.stereotype.Component;
@Profile("test")
@Component
@Path("/instance-mode")
@Path("/v1/instance-mode")
@Tag(name = "Instance Mode", description = "Instance mode changing API")
@RequiredArgsConstructor
@Slf4j
@@ -41,17 +41,16 @@ import org.springframework.web.filter.OncePerRequestFilter;
@RequiredArgsConstructor
public class FineractInstanceModeApiFilter extends OncePerRequestFilter {
private static final List<ExceptionListItem> EXCEPTION_LIST = List
.of(item(FineractProperties.FineractModeProperties::isBatchManagerEnabled, pi -> pi.startsWith("/jobs")),
item(FineractProperties.FineractModeProperties::isBatchManagerEnabled, pi -> pi.startsWith("/scheduler")),
item(FineractProperties.FineractModeProperties::isBatchManagerEnabled, pi -> pi.startsWith("/loans/catch-up")),
item(FineractProperties.FineractModeProperties::isBatchManagerEnabled,
pi -> pi.startsWith("/loans/is-catch-up-running")),
item(p -> true, pi -> pi.startsWith("/instance-mode")),
// Batches with all GET requests need to be allowed in read-only instances, hence this check will be
// moved
// under the Api Resource.
item(p -> true, pi -> pi.startsWith("/batches")));
private static final List<ExceptionListItem> EXCEPTION_LIST = List.of(
item(FineractProperties.FineractModeProperties::isBatchManagerEnabled, pi -> pi.startsWith("/v1/jobs")),
item(FineractProperties.FineractModeProperties::isBatchManagerEnabled, pi -> pi.startsWith("/v1/scheduler")),
item(FineractProperties.FineractModeProperties::isBatchManagerEnabled, pi -> pi.startsWith("/v1/loans/catch-up")),
item(FineractProperties.FineractModeProperties::isBatchManagerEnabled, pi -> pi.startsWith("/v1/loans/is-catch-up-running")),
item(p -> true, pi -> pi.startsWith("/v1/instance-mode")),
// Batches with all GET requests need to be allowed in read-only instances, hence this check will be
// moved
// under the Api Resource.
item(p -> true, pi -> pi.startsWith("/v1/batches")));
private final FineractProperties fineractProperties;
@@ -41,7 +41,7 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.springframework.stereotype.Component;
@Path("/jobs")
@Path("/v1/jobs")
@Component
@Tag(name = "Inline Job", description = "")
@RequiredArgsConstructor
@@ -47,9 +47,8 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Path("/scheduler")
@Path("/v1/scheduler")
@Component
@Tag(name = "Scheduler", description = "")
public class SchedulerApiResource {
@@ -63,7 +63,7 @@ import org.apache.fineract.infrastructure.security.exception.NoAuthorizationExce
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.stereotype.Component;
@Path("/jobs")
@Path("/v1/jobs")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.infrastructure.jobs.filter;
import static org.apache.fineract.batch.command.CommandStrategyUtils.isRelativeUrlVersioned;
import com.google.common.collect.Lists;
import io.github.resilience4j.core.functions.Either;
import java.io.IOException;
@@ -76,10 +78,10 @@ public class LoanCOBApiFilter extends OncePerRequestFilter implements BatchReque
private static final List<HttpMethod> HTTP_METHODS = List.of(HttpMethod.POST, HttpMethod.PUT, HttpMethod.DELETE);
public static final Pattern IGNORE_LOAN_PATH_PATTERN = Pattern.compile("\\/loans\\/catch-up");
public static final Pattern LOAN_PATH_PATTERN = Pattern.compile("\\/(?:reschedule)?loans\\/(?:external-id\\/)?([^\\/\\?]+).*");
public static final Pattern IGNORE_LOAN_PATH_PATTERN = Pattern.compile("/v[1-9][0-9]*/loans/catch-up");
public static final Pattern LOAN_PATH_PATTERN = Pattern.compile("/v[1-9][0-9]*/(?:reschedule)?loans/(?:external-id/)?([^/?]+).*");
public static final Pattern LOAN_GLIMACCOUNT_PATH_PATTERN = Pattern.compile("\\/loans\\/glimAccount\\/(\\d+).*");
public static final Pattern LOAN_GLIMACCOUNT_PATH_PATTERN = Pattern.compile("/v[1-9][0-9]*/loans/glimAccount/(\\d+).*");
private static final Predicate<String> URL_FUNCTION = s -> LOAN_PATH_PATTERN.matcher(s).find()
|| LOAN_GLIMACCOUNT_PATH_PATTERN.matcher(s).find();
private static final String JOB_NAME = "INLINE_LOAN_COB";
@@ -223,7 +225,7 @@ public class LoanCOBApiFilter extends OncePerRequestFilter implements BatchReque
}
private boolean isRescheduleLoans(String pathInfo) {
return LOAN_PATH_PATTERN.matcher(pathInfo).matches() && pathInfo.contains("/rescheduleloans/");
return LOAN_PATH_PATTERN.matcher(pathInfo).matches() && pathInfo.contains("/v1/rescheduleloans/");
}
private boolean isOnApiList(String pathInfo, String method) {
@@ -244,10 +246,16 @@ public class LoanCOBApiFilter extends OncePerRequestFilter implements BatchReque
tr.setPropagationBehavior(TransactionDefinition.PROPAGATION_NOT_SUPPORTED);
return tr.execute(status -> {
try {
if (isOnApiList("/" + batchRequest.getRelativeUrl(), batchRequest.getMethod())) {
String method = batchRequest.getMethod();
String relativeUrl = "/" + batchRequest.getRelativeUrl();
if (!isRelativeUrlVersioned(batchRequest.getRelativeUrl())) {
// to support pre-versioned relative paths
relativeUrl = "/v1/" + batchRequest.getRelativeUrl();
}
if (isOnApiList(relativeUrl, method)) {
boolean bypassUser = isBypassUser();
if (!bypassUser) {
List<Long> result = calculateRelevantLoanIds("/" + batchRequest.getRelativeUrl());
List<Long> result = calculateRelevantLoanIds(relativeUrl);
if (!result.isEmpty() && (isLoanSoftLocked(result) || isLoanBehind(result))) {
executeInlineCob(result);
}
@@ -39,6 +39,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -52,14 +53,12 @@ import org.apache.fineract.infrastructure.reportmailingjob.ReportMailingJobConst
import org.apache.fineract.infrastructure.reportmailingjob.data.ReportMailingJobData;
import org.apache.fineract.infrastructure.reportmailingjob.service.ReportMailingJobReadPlatformService;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/" + ReportMailingJobConstants.REPORT_MAILING_JOB_RESOURCE_NAME)
@Path("/v1/" + ReportMailingJobConstants.REPORT_MAILING_JOB_RESOURCE_NAME)
@Component
@Scope("singleton")
@Tag(name = "Report Mailing Jobs", description = "This resource allows you to create a scheduled job that runs a report and sents it by email to specified email addresses.\n\nThe scheduled job can be configured to run once or on a regular basis (once a day, twice a week, etc)")
@RequiredArgsConstructor
public class ReportMailingJobApiResource {
private final PlatformSecurityContext platformSecurityContext;
@@ -68,19 +67,6 @@ public class ReportMailingJobApiResource {
private final DefaultToApiJsonSerializer<ReportMailingJobData> reportMailingToApiJsonSerializer;
private final ReportMailingJobReadPlatformService reportMailingJobReadPlatformService;
@Autowired
public ReportMailingJobApiResource(final PlatformSecurityContext platformSecurityContext,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
final ApiRequestParameterHelper apiRequestParameterHelper,
final DefaultToApiJsonSerializer<ReportMailingJobData> reportMailingToApiJsonSerializer,
final ReportMailingJobReadPlatformService reportMailingJobReadPlatformService) {
this.platformSecurityContext = platformSecurityContext;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.reportMailingToApiJsonSerializer = reportMailingToApiJsonSerializer;
this.reportMailingJobReadPlatformService = reportMailingJobReadPlatformService;
}
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@@ -33,6 +33,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
@@ -42,13 +43,12 @@ import org.apache.fineract.infrastructure.reportmailingjob.ReportMailingJobConst
import org.apache.fineract.infrastructure.reportmailingjob.data.ReportMailingJobRunHistoryData;
import org.apache.fineract.infrastructure.reportmailingjob.service.ReportMailingJobRunHistoryReadPlatformService;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Path("/" + ReportMailingJobConstants.REPORT_MAILING_JOB_RUN_HISTORY_RESOURCE_NAME)
@Path("/v1/" + ReportMailingJobConstants.REPORT_MAILING_JOB_RUN_HISTORY_RESOURCE_NAME)
@Component
@Tag(name = "List Report Mailing Job History", description = "")
@RequiredArgsConstructor
public class ReportMailingJobRunHistoryApiResource {
private final PlatformSecurityContext platformSecurityContext;
@@ -56,17 +56,6 @@ public class ReportMailingJobRunHistoryApiResource {
private final DefaultToApiJsonSerializer<ReportMailingJobRunHistoryData> reportMailingToApiJsonSerializer;
private final ReportMailingJobRunHistoryReadPlatformService reportMailingJobRunHistoryReadPlatformService;
@Autowired
public ReportMailingJobRunHistoryApiResource(final PlatformSecurityContext platformSecurityContext,
final ApiRequestParameterHelper apiRequestParameterHelper,
final DefaultToApiJsonSerializer<ReportMailingJobRunHistoryData> reportMailingToApiJsonSerializer,
final ReportMailingJobRunHistoryReadPlatformService reportMailingJobRunHistoryReadPlatformService) {
this.platformSecurityContext = platformSecurityContext;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.reportMailingToApiJsonSerializer = reportMailingToApiJsonSerializer;
this.reportMailingJobRunHistoryReadPlatformService = reportMailingJobRunHistoryReadPlatformService;
}
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@@ -39,6 +39,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.constants.TwoFactorConstants;
@@ -48,11 +49,9 @@ import org.apache.fineract.portfolio.client.service.ClientReadPlatformService;
import org.apache.fineract.useradministration.data.RoleData;
import org.apache.fineract.useradministration.domain.AppUser;
import org.apache.fineract.useradministration.domain.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Scope;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.core.Authentication;
@@ -60,10 +59,10 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.stereotype.Component;
@Component
@Scope("singleton")
@ConditionalOnProperty("fineract.security.basicauth.enabled")
@Path("/authentication")
@Path("/v1/authentication")
@Tag(name = "Authentication HTTP Basic", description = "An API capability that allows client applications to verify authentication details using HTTP Basic Authentication.")
@RequiredArgsConstructor
public class AuthenticationApiResource {
@Value("${fineract.security.2fa.enabled}")
@@ -75,23 +74,12 @@ public class AuthenticationApiResource {
public String password;
}
@Qualifier("customAuthenticationProvider")
private final DaoAuthenticationProvider customAuthenticationProvider;
private final ToApiJsonSerializer<AuthenticatedUserData> apiJsonSerializerService;
private final SpringSecurityPlatformSecurityContext springSecurityPlatformSecurityContext;
private final ClientReadPlatformService clientReadPlatformService;
@Autowired
public AuthenticationApiResource(
@Qualifier("customAuthenticationProvider") final DaoAuthenticationProvider customAuthenticationProvider,
final ToApiJsonSerializer<AuthenticatedUserData> apiJsonSerializerService,
final SpringSecurityPlatformSecurityContext springSecurityPlatformSecurityContext,
ClientReadPlatformService aClientReadPlatformService) {
this.customAuthenticationProvider = customAuthenticationProvider;
this.apiJsonSerializerService = apiJsonSerializerService;
this.springSecurityPlatformSecurityContext = springSecurityPlatformSecurityContext;
clientReadPlatformService = aClientReadPlatformService;
}
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@@ -30,6 +30,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -44,16 +45,14 @@ import org.apache.fineract.infrastructure.security.domain.TFAccessToken;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.infrastructure.security.service.TwoFactorService;
import org.apache.fineract.useradministration.domain.AppUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/twofactor")
@Path("/v1/twofactor")
@Component
@ConditionalOnProperty("fineract.security.2fa.enabled")
@Scope("singleton")
@Tag(name = "Two Factor", description = "")
@RequiredArgsConstructor
public class TwoFactorApiResource {
private final ToApiJsonSerializer<OTPMetadata> otpRequestSerializer;
@@ -65,20 +64,6 @@ public class TwoFactorApiResource {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final TwoFactorService twoFactorService;
@Autowired
public TwoFactorApiResource(ToApiJsonSerializer<OTPMetadata> otpRequestSerializer,
ToApiJsonSerializer<OTPDeliveryMethod> otpDeliveryMethodSerializer, ToApiJsonSerializer<AccessTokenData> accessTokenSerializer,
DefaultToApiJsonSerializer<Map<String, Object>> toApiJsonSerializer, PlatformSecurityContext context,
PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, TwoFactorService twoFactorService) {
this.otpRequestSerializer = otpRequestSerializer;
this.otpDeliveryMethodSerializer = otpDeliveryMethodSerializer;
this.accessTokenSerializer = accessTokenSerializer;
this.toApiJsonSerializer = toApiJsonSerializer;
this.context = context;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
this.twoFactorService = twoFactorService;
}
@GET
@Produces({ MediaType.APPLICATION_JSON })
public String getOTPDeliveryMethods(@Context final UriInfo uriInfo) {
@@ -25,6 +25,7 @@ import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -32,17 +33,15 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.infrastructure.security.service.TwoFactorConfigurationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/twofactor/configure")
@Path("/v1/twofactor/configure")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
@Scope("singleton")
@ConditionalOnProperty("fineract.security.2fa.enabled")
@RequiredArgsConstructor
public class TwoFactorConfigurationApiResource {
private static final String RESOURCE_NAME_FOR_PERMISSIONS = "TWOFACTOR_CONFIG";
@@ -52,16 +51,6 @@ public class TwoFactorConfigurationApiResource {
private final DefaultToApiJsonSerializer<Map<String, Object>> toApiJsonSerializer;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
@Autowired
public TwoFactorConfigurationApiResource(PlatformSecurityContext context, TwoFactorConfigurationService configurationService,
DefaultToApiJsonSerializer<Map<String, Object>> toApiJsonSerializer,
PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
this.context = context;
this.configurationService = configurationService;
this.toApiJsonSerializer = toApiJsonSerializer;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
}
@GET
public String retrieveAll() {
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
@@ -31,6 +31,7 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.constants.TwoFactorConstants;
@@ -40,10 +41,8 @@ import org.apache.fineract.infrastructure.security.service.SpringSecurityPlatfor
import org.apache.fineract.useradministration.data.RoleData;
import org.apache.fineract.useradministration.domain.AppUser;
import org.apache.fineract.useradministration.domain.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Scope;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
@@ -52,11 +51,11 @@ import org.springframework.stereotype.Component;
/*
* Implementation of Oauth2 authentication APIs, loaded only when "oauth" profile is enabled.
*/
@Path("/userdetails")
@Path("/v1/userdetails")
@Component
@ConditionalOnProperty("fineract.security.oauth.enabled")
@Scope("singleton")
@Tag(name = "Fetch authenticated user details", description = "")
@RequiredArgsConstructor
public class UserDetailsApiResource {
private final ToApiJsonSerializer<AuthenticatedOauthUserData> apiJsonSerializerService;
@@ -65,13 +64,6 @@ public class UserDetailsApiResource {
@Value("${fineract.security.2fa.enabled}")
private boolean twoFactorEnabled;
@Autowired
public UserDetailsApiResource(final ToApiJsonSerializer<AuthenticatedOauthUserData> apiJsonSerializerService,
final SpringSecurityPlatformSecurityContext springSecurityPlatformSecurityContext) {
this.apiJsonSerializerService = apiJsonSerializerService;
this.springSecurityPlatformSecurityContext = springSecurityPlatformSecurityContext;
}
@GET
@Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Fetch authenticated user details\n", description = "checks the Authentication and returns the set roles and permissions allowed.")
@@ -49,7 +49,7 @@ import org.apache.fineract.infrastructure.sms.data.SmsData;
import org.apache.fineract.infrastructure.sms.service.SmsReadPlatformService;
import org.springframework.stereotype.Component;
@Path("/sms")
@Path("/v1/sms")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
@@ -27,6 +27,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -35,17 +36,15 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.infrastructure.survey.data.LikelihoodData;
import org.apache.fineract.infrastructure.survey.service.ReadLikelihoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
* Created by Cieyou on 3/12/14.
*/
@Path("/likelihood")
@Path("/v1/likelihood")
@Component
@Scope("singleton")
@Tag(name = "Likelihood", description = "")
@RequiredArgsConstructor
public class LikelihoodApiResource {
private final DefaultToApiJsonSerializer<LikelihoodData> toApiJsonSerializer;
@@ -53,18 +52,6 @@ public class LikelihoodApiResource {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final ReadLikelihoodService readService;
@Autowired
LikelihoodApiResource(final PlatformSecurityContext context,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
final DefaultToApiJsonSerializer<LikelihoodData> toApiJsonSerializer, final ReadLikelihoodService readService) {
this.context = context;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
this.toApiJsonSerializer = toApiJsonSerializer;
this.readService = readService;
}
@GET
@Path("{ppiName}")
@Consumes({ MediaType.APPLICATION_JSON })
@@ -25,40 +25,25 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.infrastructure.survey.data.LikeliHoodPovertyLineData;
import org.apache.fineract.infrastructure.survey.data.PpiPovertyLineData;
import org.apache.fineract.infrastructure.survey.service.PovertyLineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/povertyLine")
@Path("/v1/povertyLine")
@Component
@Scope("singleton")
@Tag(name = "Poverty Line", description = "")
@RequiredArgsConstructor
public class PovertyLineApiResource {
private final DefaultToApiJsonSerializer<PpiPovertyLineData> toApiJsonSerializer;
private final DefaultToApiJsonSerializer<LikeliHoodPovertyLineData> likelihoodToApiJsonSerializer;
// private final DefaultToApiJsonSerializer<PpiPovertyLineData>
// toApiJsonSerializer;
private final PlatformSecurityContext context;
private final PovertyLineService readService;
@Autowired
PovertyLineApiResource(final PlatformSecurityContext context, final DefaultToApiJsonSerializer<PpiPovertyLineData> toApiJsonSerializer,
final PovertyLineService readService,
final DefaultToApiJsonSerializer<LikeliHoodPovertyLineData> likelihoodToApiJsonSerializer) {
this.context = context;
this.toApiJsonSerializer = toApiJsonSerializer;
this.readService = readService;
this.likelihoodToApiJsonSerializer = likelihoodToApiJsonSerializer;
}
@GET
@Path("{ppiName}")
@Consumes({ MediaType.APPLICATION_JSON })
@@ -37,6 +37,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -49,17 +50,15 @@ import org.apache.fineract.infrastructure.survey.data.ClientScoresOverview;
import org.apache.fineract.infrastructure.survey.data.SurveyData;
import org.apache.fineract.infrastructure.survey.data.SurveyDataTableData;
import org.apache.fineract.infrastructure.survey.service.ReadSurveyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
* Created by Cieyou on 2/27/14.
*/
@Path("/survey")
@Path("/v1/survey")
@Component
@Scope("singleton")
@Tag(name = "Survey", description = "")
@RequiredArgsConstructor
public class SurveyApiResource {
private final DefaultToApiJsonSerializer<SurveyData> toApiJsonSerializer;
@@ -69,20 +68,6 @@ public class SurveyApiResource {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final GenericDataService genericDataService;
@Autowired
public SurveyApiResource(final DefaultToApiJsonSerializer<SurveyData> toApiJsonSerializer, final PlatformSecurityContext context,
final ReadSurveyService readSurveyService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
final DefaultToApiJsonSerializer<ClientScoresOverview> toApiJsonClientScoreOverviewSerializer,
final GenericDataService genericDataService) {
this.toApiJsonSerializer = toApiJsonSerializer;
this.context = context;
this.readSurveyService = readSurveyService;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
this.toApiJsonClientScoreOverviewSerializer = toApiJsonClientScoreOverviewSerializer;
this.genericDataService = genericDataService;
}
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@@ -45,6 +45,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
@@ -70,34 +71,19 @@ import org.apache.fineract.interoperation.data.InteropTransferResponseData;
import org.apache.fineract.interoperation.domain.InteropIdentifierType;
import org.apache.fineract.interoperation.domain.InteropTransferActionType;
import org.apache.fineract.interoperation.service.InteropService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/interoperation") // api/v1/
@Path("/v1/interoperation") // api/v1/
@Component
@Scope("singleton")
@Tag(name = "Inter Operation", description = "")
@RequiredArgsConstructor
public class InteropApiResource {
private PlatformSecurityContext context;
private ApiRequestParameterHelper apiRequestParameterHelper;
private DefaultToApiJsonSerializer<CommandProcessingResult> jsonSerializer;
private InteropService interopService;
private PortfolioCommandSourceWritePlatformService commandsSourceService;
@Autowired
public InteropApiResource(PlatformSecurityContext context, ApiRequestParameterHelper apiRequestParameterHelper,
DefaultToApiJsonSerializer<CommandProcessingResult> defaultToApiJsonSerializer, InteropService interopService,
PortfolioCommandSourceWritePlatformService portfolioCommandSourceWritePlatformService) {
this.context = context;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.jsonSerializer = defaultToApiJsonSerializer;
this.interopService = interopService;
this.commandsSourceService = portfolioCommandSourceWritePlatformService;
}
private final PlatformSecurityContext context;
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final DefaultToApiJsonSerializer<CommandProcessingResult> jsonSerializer;
private final InteropService interopService;
private final PortfolioCommandSourceWritePlatformService commandsSourceService;
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@@ -25,29 +25,21 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.mix.data.XBRLData;
import org.apache.fineract.mix.service.XBRLBuilder;
import org.apache.fineract.mix.service.XBRLResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/mixreport")
@Path("/v1/mixreport")
@Component
@Scope("singleton")
@Tag(name = "Mix Report", description = "")
@RequiredArgsConstructor
public class MixReportApiResource {
private final XBRLResultService xbrlResultService;
private final XBRLBuilder xbrlBuilder;
@Autowired
public MixReportApiResource(final XBRLResultService xbrlResultService, final XBRLBuilder xbrlBuilder) {
this.xbrlResultService = xbrlResultService;
this.xbrlBuilder = xbrlBuilder;
}
@GET
@Produces({ MediaType.APPLICATION_XML })
public String retrieveXBRLReport(@QueryParam("startDate") final Date startDate, @QueryParam("endDate") final Date endDate,
@@ -30,21 +30,19 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.mix.data.MixTaxonomyData;
import org.apache.fineract.mix.service.MixTaxonomyReadPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/mixtaxonomy")
@Path("/v1/mixtaxonomy")
@Component
@Scope("singleton")
@Tag(name = "Mix Taxonomy", description = "")
@RequiredArgsConstructor
public class MixTaxonomyApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
@@ -55,15 +53,6 @@ public class MixTaxonomyApiResource {
private final MixTaxonomyReadPlatformService readTaxonomyService;
private final ApiRequestParameterHelper apiRequestParameterHelper;
@Autowired
public MixTaxonomyApiResource(final PlatformSecurityContext context, final ToApiJsonSerializer<MixTaxonomyData> toApiJsonSerializer,
final MixTaxonomyReadPlatformService readTaxonomyService, final ApiRequestParameterHelper apiRequestParameterHelper) {
this.context = context;
this.toApiJsonSerializer = toApiJsonSerializer;
this.readTaxonomyService = readTaxonomyService;
this.apiRequestParameterHelper = apiRequestParameterHelper;
}
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })

Some files were not shown because too many files have changed in this diff Show More