public class ServiceExecutor
extends java.lang.Object
Constructor and Description |
---|
ServiceExecutor(MambuAPIService mambuAPIService)
Create a new ServiceExecutor
|
Modifier and Type | Method and Description |
---|---|
<R> R |
createEntity(java.lang.Class<R> entity)
Create new entity
|
<T> T |
createOwnedEntity(MambuEntityType parentEntity,
java.lang.String parentId,
T postEntity)
Create new entity owned by a parent entity.
|
<R,T> R |
createOwnedEntity(MambuEntityType parentEntity,
java.lang.String parentId,
T postEntity,
java.lang.Class<?> resultClass)
Create new entity owned by a parent entity.
|
<R> java.lang.Boolean |
deleteEntity(MambuEntityType mambuEntity,
java.lang.String entityId)
Delete entity
|
<R> java.lang.Boolean |
deleteOwnedEntity(MambuEntityType parentEntity,
java.lang.String parentId,
MambuEntityType ownedEntity,
java.lang.String ownedEntityId)
Delete owned entity.
|
<R> R |
execute(ApiDefinition apiDefinition)
Convenience method to execute API request using its ApiDefinition.
|
<R> R |
execute(ApiDefinition apiDefinition,
ParamsMap paramsMap)
Convenience method to execute API Request using its ApiDefinition and params map.
|
<R> R |
execute(ApiDefinition apiDefinition,
java.lang.String objectId)
Convenience method to execute API Request using its ApiDefinition and object ID.
|
<R> R |
execute(ApiDefinition apiDefinition,
java.lang.String objectId,
ParamsMap paramsMap)
Convenience method to Execute API Request without relatedEntityId parameter
|
<R> R |
execute(ApiDefinition apiDefinition,
java.lang.String objectId,
java.lang.String relatedEntityId,
ParamsMap paramsMap)
Execute API Request using its ApiDefinition and supplied input data
|
<R,T> R |
executeJson(ApiDefinition apiDefinition,
T object)
Convenience method for executing API JSON Post Request using its ApiDefinition and supplied object.
|
<R,T> R |
executeJson(ApiDefinition apiDefinition,
T object,
java.lang.String objectId)
Convenience method for executing API JSON Post Request using its ApiDefinition, supplied object and object ID.
|
<R,T> R |
executeJson(ApiDefinition apiDefinition,
T object,
java.lang.String objectId,
java.lang.String relatedEntityId,
ParamsMap paramsMap)
Execute API JSON Post Request using its ApiDefinition and supplied input data.
|
<R> R |
executeJSONTransactionRequest(java.lang.String accountId,
com.mambu.api.server.handler.loan.model.JSONTransactionRequest request,
com.mambu.accounts.shared.model.Account.Type accountType,
java.lang.String transactionTypeName)
POST JSON Transaction Request
|
static java.lang.reflect.Type |
getCollectionType(java.lang.Class<?> clazz)
Get Type for the collection of objects returned by API for the specified class (e.g.
|
<R> R |
getEntity(MambuEntityType mambuEntity,
java.lang.String entityId)
Get Mambu entity.
|
<R> java.util.List<R> |
getList(MambuEntityType mambuEntity,
ParamsMap params)
Get a list of Mambu entities.
|
<R> R |
getOwnedEntities(MambuEntityType parentEntity,
java.lang.String parentId,
MambuEntityType ownedEntity,
java.lang.Integer offset,
java.lang.Integer limit)
Convenience method to Get a list of entities owned by a parent entity by specifying only pagination parameters
offset and limit.
|
<R> R |
getOwnedEntities(MambuEntityType parentEntity,
java.lang.String parentId,
MambuEntityType ownedEntity,
java.lang.Integer offset,
java.lang.Integer limit,
boolean requiresFullDetails)
Convenience method to Get a list of entities owned by a parent entity by specifying only pagination parameters
offset and limit.
|
<R> R |
getOwnedEntities(MambuEntityType parentEntity,
java.lang.String parentId,
MambuEntityType ownedEntity,
java.lang.String relatedEntityId,
ParamsMap params,
boolean requiresFullDetails)
Get a list of entities owned by a parent entity.
|
<R> R |
getOwnedEntity(MambuEntityType parentEntity,
java.lang.String parentId,
MambuEntityType ownedEntity,
java.lang.String ownedEntityId,
ParamsMap params)
Get owned entity.
|
<R> java.util.List<R> |
getPaginatedList(MambuEntityType mambuEntity,
java.lang.Integer offset,
java.lang.Integer limit)
Convenience method to GET a paginated list of Mambu entities.
|
<R> java.util.List<R> |
getPaginatedList(MambuEntityType mambuEntity,
java.lang.Integer offset,
java.lang.Integer limit,
boolean requiresFullDetails)
Convenience method to GET a paginated list of Mambu entities.
|
<R> R |
updateEntity(java.lang.Class<R> entity,
java.lang.String entityId)
Update entity
|
<R,T> R |
updateOwnedEntity(MambuEntityType parentEntity,
java.lang.String parentId,
T ownedEntity,
java.lang.String ownedEntityId)
Update existent owned entity.
|
@Inject public ServiceExecutor(MambuAPIService mambuAPIService)
mambuAPIService
- the service responsible with the connection to the serverpublic <R> R execute(ApiDefinition apiDefinition, java.lang.String objectId, java.lang.String relatedEntityId, ParamsMap paramsMap) throws MambuApiException
apiDefinition
- API definition for the requestobjectId
- api's object id (optional, must be null if not used)relatedEntityId
- an id of the relatedEntity (optional, must be null if not used)paramsMap
- map with API parametersMambuApiException
public <R> R execute(ApiDefinition apiDefinition, java.lang.String objectId, ParamsMap paramsMap) throws MambuApiException
apiDefinition
- API definition for the requestobjectId
- api's object id (optional, must be null if not used)paramsMap
- map with API parametersMambuApiException
public <R> R execute(ApiDefinition apiDefinition, java.lang.String objectId) throws MambuApiException
apiDefinition
- API definition for the requestobjectId
- api's object id (optional, must be null if not used)MambuApiException
public <R> R execute(ApiDefinition apiDefinition, ParamsMap paramsMap) throws MambuApiException
apiDefinition
- API definition for the requestparamsMap
- map with API parametersMambuApiException
public <R> R execute(ApiDefinition apiDefinition) throws MambuApiException
apiDefinition
- API definition for the requestMambuApiException
public <R,T> R executeJson(ApiDefinition apiDefinition, T object, java.lang.String objectId, java.lang.String relatedEntityId, ParamsMap paramsMap) throws MambuApiException
apiDefinition
- API definition for the requestobject
- the Mambu object to be created. Currently (as of Mambu 3.7) only Client, LoanAccount, SavingsAccount
and Document objects can be created using JSON API requestsobjectId
- object's id (optional, could be null if not used, for example for JSON create requests)paramsMap
- params map with additional parameters. could be null. Currently used to provided optional pagination
paramsMambuApiException
public <R,T> R executeJson(ApiDefinition apiDefinition, T object, java.lang.String objectId) throws MambuApiException
apiDefinition
- API definition for the requestobject
- the Mambu object to be created.objectId
- object's id (optional, could be null if not used, for example for JSON create requests)MambuApiException
public <R,T> R executeJson(ApiDefinition apiDefinition, T object) throws MambuApiException
apiDefinition
- API definition for the requestobject
- the Mambu object to be created.MambuApiException
public static java.lang.reflect.Type getCollectionType(java.lang.Class<?> clazz)
clazz
- class name for the object associated with the collectionpublic <R> R getOwnedEntities(MambuEntityType parentEntity, java.lang.String parentId, MambuEntityType ownedEntity, java.lang.String relatedEntityId, ParamsMap params, boolean requiresFullDetails) throws MambuApiException
parentEntity
- parent's MambuEntityType. Example MambuEntityType.CLIENTparentId
- encoded key or id of the parent entityownedEntity
- Mambu owned entity. Example, MambuEntityType.COMMENTrelatedEntityId
- related entity id. Can be null if not requiredparams
- params map with filtering parametersrequiresFullDetails
- boolean flag indicates whether the full or object is wantedMambuApiException
public <R> R getOwnedEntities(MambuEntityType parentEntity, java.lang.String parentId, MambuEntityType ownedEntity, java.lang.Integer offset, java.lang.Integer limit, boolean requiresFullDetails) throws MambuApiException
parentEntity
- parent's MambuEntityType. Example MambuEntityType.CLIENTparentId
- encoded key or id of the parent entityownedEntity
- Mambu owned entity. Example, MambuEntityType.COMMENToffset
- pagination offsetlimit
- pagination limitrequiresFullDetails
- boolean flag indicating whether a full or basic object is wantedMambuApiException
public <R> R getOwnedEntities(MambuEntityType parentEntity, java.lang.String parentId, MambuEntityType ownedEntity, java.lang.Integer offset, java.lang.Integer limit) throws MambuApiException
parentEntity
- parent's MambuEntityType. Example MambuEntityType.CLIENTparentId
- encoded key or id of the parent entityownedEntity
- Mambu owned entity. Example, MambuEntityType.COMMENToffset
- pagination offsetlimit
- pagination limitMambuApiException
public <R> R getOwnedEntity(MambuEntityType parentEntity, java.lang.String parentId, MambuEntityType ownedEntity, java.lang.String ownedEntityId, ParamsMap params) throws MambuApiException
parentEntity
- parent's MambuEntityType. Example MambuEntityType.CLIENTparentId
- encoded key or id of the parent entityownedEntity
- Mambu owned entity. Example, MambuEntityType.COMMENTownedEntityId
- encoded key or id of the owned entity. Optional. Can be null. Example GET
/api/loanproducts/{ID}/scheduleparams
- params map with filtering parameters. Optional. Can be null.MambuApiException
public <T> T createOwnedEntity(MambuEntityType parentEntity, java.lang.String parentId, T postEntity) throws MambuApiException
parentEntity
- parent entityparentId
- encoded key or id of the parent entitypostEntity
- posted entityMambuApiException
public <R,T> R createOwnedEntity(MambuEntityType parentEntity, java.lang.String parentId, T postEntity, java.lang.Class<?> resultClass) throws MambuApiException
parentEntity
- parent entityparentId
- encoded key or id of the parent entitypostEntity
- posted entityresultClass
- the class of the Mambu model returned in response.MambuApiException
public <R,T> R updateOwnedEntity(MambuEntityType parentEntity, java.lang.String parentId, T ownedEntity, java.lang.String ownedEntityId) throws MambuApiException
parentEntity
- parent entityparentId
- encoded key or id of the parent entityownedEntityId
- the encoded key or id of the entity being patchedMambuApiException
public <R> java.lang.Boolean deleteOwnedEntity(MambuEntityType parentEntity, java.lang.String parentId, MambuEntityType ownedEntity, java.lang.String ownedEntityId) throws MambuApiException
parentEntity
- parent entityparentId
- encoded key or id of the parent entityownedEntityId
- the encoded key or id of the entity being patchedMambuApiException
public <R> R getEntity(MambuEntityType mambuEntity, java.lang.String entityId) throws MambuApiException
mambuEntity
- Mambu entityentityId
- entity id or encoded keyMambuApiException
public <R> java.util.List<R> getList(MambuEntityType mambuEntity, ParamsMap params) throws MambuApiException
mambuEntity
- Mambu entityparams
- params map for getting a list of entities. The params map can contain all parameters specific to the
API, for example, pagination parameters, filter setting, branch and credit officer is, etc.MambuApiException
public <R> java.util.List<R> getPaginatedList(MambuEntityType mambuEntity, java.lang.Integer offset, java.lang.Integer limit, boolean requiresFullDetails) throws MambuApiException
mambuEntity
- Mambu entityoffset
- offsetlimit
- limitrequiresFullDetails
- flag indicating if is a full call if true then 'fullDetails=true' parameter will be added to the callMambuApiException
public <R> java.util.List<R> getPaginatedList(MambuEntityType mambuEntity, java.lang.Integer offset, java.lang.Integer limit) throws MambuApiException
mambuEntity
- Mambu entityoffset
- offsetlimit
- limitMambuApiException
public <R> R createEntity(java.lang.Class<R> entity) throws MambuApiException
entity
- entity to createMambuApiException
public <R> R updateEntity(java.lang.Class<R> entity, java.lang.String entityId) throws MambuApiException
entity
- entity to updateentityId
- entity id or encoded keyMambuApiException
public <R> java.lang.Boolean deleteEntity(MambuEntityType mambuEntity, java.lang.String entityId) throws MambuApiException
mambuEntity
- mambu entity to deleteentityId
- id or encoded key of the entity to be deletedMambuApiException
public <R> R executeJSONTransactionRequest(java.lang.String accountId, com.mambu.api.server.handler.loan.model.JSONTransactionRequest request, com.mambu.accounts.shared.model.Account.Type accountType, java.lang.String transactionTypeName) throws MambuApiException
accountId
- account id or encoded key. Must not be nullrequest
- JSON Transaction RequestaccountType
- account type, LOAN or SAVINGStransactionTypeName
- transaction type name. E.g. FEE, DISBURSEMENT, DEPOSITMambuApiException