Package org.openiam.common.service
Class AbstractBaseService
- java.lang.Object
-
- org.openiam.common.service.AbstractBaseService
-
- Direct Known Subclasses:
AbstractProvisioningService
,BatchTaskScheduler
,KeyManagementRestController
,KeyManagementServiceImpl
,OrganizationTypeServiceImpl
public abstract class AbstractBaseService extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected AuditLogHelper
auditLogHelper
protected DefaultEntityValidator
entityValidator
protected PropertyValueCache
propertyValueSweeper
-
Constructor Summary
Constructors Constructor Description AbstractBaseService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getString(String key)
protected <T extends BaseIdentity,R extends BaseDataResponse<T>>
Rtransaction(org.springframework.transaction.support.TransactionCallback<R> action)
protected <T extends BaseIdentity,R extends BaseDataResponse<T>>
Rtransaction(org.springframework.transaction.support.TransactionCallback<R> action, Function<T,T> onSuccessTransaction)
protected <T extends BaseIdentity,R extends BaseDataResponse<T>>
Rtransaction(org.springframework.transaction.support.TransactionCallback<R> action, Function<T,T> onSuccessTransaction, Function<R,Void> onFailTransaction)
is used to managed Transactional operations.
-
-
-
Field Detail
-
auditLogHelper
@Autowired protected AuditLogHelper auditLogHelper
-
entityValidator
@Autowired protected DefaultEntityValidator entityValidator
-
propertyValueSweeper
@Autowired protected PropertyValueCache propertyValueSweeper
-
-
Method Detail
-
transaction
protected <T extends BaseIdentity,R extends BaseDataResponse<T>> R transaction(org.springframework.transaction.support.TransactionCallback<R> action, Function<T,T> onSuccessTransaction, Function<R,Void> onFailTransaction) throws BasicDataServiceException
is used to managed Transactional operations. Mostly we use for ES reindex case, baseuse reindex can't be call fromTransactional
methods. in case {@param action } throws Exception and {@param onFailTransaction} is NOT NULL, {@param onFailTransaction} will be called and afterBasicDataServiceException
will be thrown.- Type Parameters:
T
- - Type ofBaseIdentity
that will be returnedR
- - The Type ofBaseDataResponse
- Wrapper aroundAbstractBaseService
- Parameters:
action
- - transactional action to performonSuccessTransaction
- - theFunction
that is called in case {@param action } return not-null, successBaseDataResponse
, can be null, if null - nothing will be performedonFailTransaction
- - theFunction
that is called in case {@param action }return null, failedBaseDataResponse
, can be null, if null -BasicDataServiceException
will be thrown withResponseCode
fromBasicDataServiceException.getCode()
ifBasicDataServiceException.getCode()
is NULL, thanResponseCode.INTERNAL_ERROR
will be thrown as a default.- Returns:
- - return
AbstractBaseService
- Throws:
BasicDataServiceException
- - in case {@param action } throwsBasicDataServiceException
-
transaction
protected <T extends BaseIdentity,R extends BaseDataResponse<T>> R transaction(org.springframework.transaction.support.TransactionCallback<R> action) throws BasicDataServiceException
- Throws:
BasicDataServiceException
-
transaction
protected <T extends BaseIdentity,R extends BaseDataResponse<T>> R transaction(org.springframework.transaction.support.TransactionCallback<R> action, Function<T,T> onSuccessTransaction) throws BasicDataServiceException
- Throws:
BasicDataServiceException
-
-