Package com.skava.util
Class CacheUtil
java.lang.Object
com.skava.util.CacheUtil
- All Implemented Interfaces:
Serializable
This is a utility class which contains static methods used for loading cache
value from cache or DB in this service.
- Author:
- Infosys Equinox
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AttributeEntity
getAttributeFromCacheOrDB
(long collectionId, String attributeId, AttributeCommonServices attributeCommonService) static List<CollectionAttributeEntity>
getCollectionAttributeFromCacheOrDB
(UserCommonServices userCommonServices, CollectionAttributeRepository collectionAttributeRepository) This method is used to load collection attributes value from Cache or DB.static Collection
getCollectionValueFromCacheOrDB
(UserCommonServices userCommonServices, Long collectionId, Long businessId, String locale, boolean isloadProperties) This method is used to get collection value from cache or DB.static ConsentEntity
getConsentEntityFromDBOrCache
(ConsentCommonServices consentCommonServices, long consentId, long collectionId, UserCommonServices userCommonServices, String locale, boolean saveToCache) This method is used to load consent entity value from cache or DB.static Users
getUserValueFromCacheOrDB
(UserCommonServices userCommonServices, long collectionId, long userId, String locale, boolean isFullProfile, int type) This method is used to load user from cache or database.static boolean
isValidCollection
(long collectionId, long businessId, CollectionRepository collectionRepository, UserCommonServices accountCommonServices)
-
Constructor Details
-
CacheUtil
public CacheUtil()
-
-
Method Details
-
getCollectionValueFromCacheOrDB
public static Collection getCollectionValueFromCacheOrDB(UserCommonServices userCommonServices, Long collectionId, Long businessId, String locale, boolean isloadProperties) This method is used to get collection value from cache or DB. If it is present in Cache it also validate whether the given collection id is present within the business id else throws validate exception. If it is not present in cache, It gets loaded from DB and save collection details to cache.- Parameters:
userCommonServices
- HoldsUserCommonServices
object which is used to load collection value from cache or DB.collectionId
- Indicates the collection id for which the collection gets loaded.businessId
- Indicates the business id for which the collection gets loaded within the business id.locale
- Indicates the locale object which is used for response message.isloadProperties
- the isloadProperties- Returns:
- The
Collection
object on successful validations. If any validations fails, it throws validate exception.
-
getUserValueFromCacheOrDB
public static Users getUserValueFromCacheOrDB(UserCommonServices userCommonServices, long collectionId, long userId, String locale, boolean isFullProfile, int type) This method is used to load user from cache or database. If it is present in cache then it returns the users object else validate user whether the given user is present or not and on successful validation return the user object else throw validate exception.- Parameters:
userCommonServices
- HoldsUserCommonServices
object.collectionId
- Indicates the collection id which is used to load user within a collection.userId
- Indicates the user id which is used to load the user from cache or DB.isFullProfile
- Boolean value which is used to choose whether to display full profile of an user or not.type
- Indicates the type of the user (i.e) either register user or guest user.- Returns:
- The
Users
object which returns the users object on successful validations, else return the validate exceptions.
-
getCollectionAttributeFromCacheOrDB
public static List<CollectionAttributeEntity> getCollectionAttributeFromCacheOrDB(UserCommonServices userCommonServices, CollectionAttributeRepository collectionAttributeRepository) This method is used to load collection attributes value from Cache or DB.- Parameters:
userCommonServices
- HoldsUserCommonServices
object used for loading cache value from cacheimpl.collectionAttributeRepository
- HoldsCollectionAttributeRepository
object for loading attributes value.- Returns:
- The list of
CollectionAttributeEntity
object loaded from either cache or DB.
-
getConsentEntityFromDBOrCache
public static ConsentEntity getConsentEntityFromDBOrCache(ConsentCommonServices consentCommonServices, long consentId, long collectionId, UserCommonServices userCommonServices, String locale, boolean saveToCache) This method is used to load consent entity value from cache or DB.- Parameters:
consentCommonServices
- HoldsConsentCommonServices
object used for loading consent cache value from DB.consentId
- Indicates the consent id which is used for loading consent id from cache or DB.collectionId
- Indicates the collection id which is used for loading consent id from cache or DB.userCommonServices
- HoldsUserCommonServices
object used for loading consent cache value from cacheimpl.locale
- Indicates the locale value for response messages.saveToCache
- Boolean value which indicates whether to save details in cache or not.- Returns:
- The
ConsentEntity
object value on successful validation. if any validations fails, it throws validate exception.
-
getAttributeFromCacheOrDB
public static AttributeEntity getAttributeFromCacheOrDB(long collectionId, String attributeId, AttributeCommonServices attributeCommonService) - Parameters:
collectionId
-attributeId
-attributeCommonService
-- Returns:
-
isValidCollection
public static boolean isValidCollection(long collectionId, long businessId, CollectionRepository collectionRepository, UserCommonServices accountCommonServices) - Parameters:
collectionId
-businessId
-collectionRepository
-accountCommonServices
-- Returns:
-