Class CertificateServiceImpl
- java.lang.Object
-
- co.mastermindcms.modules.services.CertificateServiceImpl
-
- All Implemented Interfaces:
CertificateService
@Service public class CertificateServiceImpl extends java.lang.Object implements CertificateService
-
-
Field Summary
Fields Modifier and Type Field Description private AccessManagementService
accessManagementService
private CertificateRepository
certificateRepository
private static com.fasterxml.jackson.databind.ObjectMapper
mapper
private SellerRegistrationService
sellerRegistrationService
private SellerRepository
sellerRepository
private SequenceGeneratorService
sequenceGenerator
private MongoStorageService
storageService
private TranslationsRepository
translationsRepository
-
Constructor Summary
Constructors Constructor Description CertificateServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCertificatesByIds(java.util.ArrayList<java.lang.String> certificatesIds, java.lang.String sellerId)
This method does a relationship between entities.void
addCertificateToLoggedSeller(java.lang.String certificateId)
This method does a relationship between entities.void
addCertificateToSeller(java.lang.String certificateId, java.lang.String sellerId)
This method does a relationship between entities.private void
addRelations(Certificate certificate)
Certificate
createCertificate(Certificate certificate)
This method creates a database entity.Certificate
createCertificate(java.util.LinkedHashMap<java.lang.String,java.lang.Object> certificateAsMap)
This method creates a database entity.java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>>
getPaginationFilter(java.lang.String requestJson)
This method does calculation for a pages based on the request.CertificateRepository
getRepository()
java.util.List<Certificate>
getSellerCertificates(java.lang.String sellerId)
This method returns database entities as list.boolean
isCertificateExists(java.lang.String certificateId)
This method checks is exists database entity.boolean
isCertificateNotExists(java.lang.String certificateId)
This method checks is not exists database entity.private void
linkToSeller(java.lang.String certificateId, java.lang.String sellerId)
private void
prepareRelations(Certificate certificate)
void
removeCertificateAndClean(java.lang.String certificateId)
This method removes a database entity and clean all relationships from another entities.void
removeCertificateFromLoggedSeller(java.lang.String certificateId)
This method removes relationship between entities.void
removeCertificateFromSeller(java.lang.String certificateId, java.lang.String sellerId)
This method removes relationship between database entities.private void
removeCertificateFromSellers(java.lang.String certificateId)
private void
removeCertificateFromTranslation(java.lang.String certificateId, java.lang.String tranId)
private void
removeCertificateFromTranslations(java.lang.String certificateId)
void
removeCertificates(java.util.ArrayList<java.lang.String> certificateIds)
This method removes a list of database entities.private void
removeRelations(Certificate certificateUI, Certificate certificateDB)
Certificate
saveCertificate(java.util.LinkedHashMap<java.lang.String,java.lang.Object> certificateAsMap)
This method save an updates of database entity.java.util.List<Certificate>
searchResults(java.lang.String requestJson)
This method does search requests and returns data as list.org.springframework.data.domain.Page<Certificate>
searchResultsPaged(java.lang.String requestJson)
This method does search requests and returns data as pages.private void
unbindCertificateFromSeller(java.lang.String certificateId, java.lang.String sellerId)
-
-
-
Field Detail
-
translationsRepository
@Autowired private TranslationsRepository translationsRepository
-
sellerRepository
@Autowired private SellerRepository sellerRepository
-
certificateRepository
@Autowired private CertificateRepository certificateRepository
-
sequenceGenerator
@Autowired private SequenceGeneratorService sequenceGenerator
-
sellerRegistrationService
@Autowired private SellerRegistrationService sellerRegistrationService
-
accessManagementService
@Autowired private AccessManagementService accessManagementService
-
storageService
@Autowired private MongoStorageService storageService
-
mapper
private static final com.fasterxml.jackson.databind.ObjectMapper mapper
-
-
Method Detail
-
searchResults
public java.util.List<Certificate> searchResults(java.lang.String requestJson)
Description copied from interface:CertificateService
This method does search requests and returns data as list.- Specified by:
searchResults
in interfaceCertificateService
- Parameters:
requestJson
- search json- Returns:
- database entities as list
-
getRepository
public CertificateRepository getRepository()
- Specified by:
getRepository
in interfaceCertificateService
-
searchResultsPaged
public org.springframework.data.domain.Page<Certificate> searchResultsPaged(java.lang.String requestJson)
Description copied from interface:CertificateService
This method does search requests and returns data as pages.- Specified by:
searchResultsPaged
in interfaceCertificateService
- Parameters:
requestJson
- JSON-object of request contains an instructions for search queries- Returns:
- database entities separated to pages
-
getPaginationFilter
public java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>> getPaginationFilter(java.lang.String requestJson)
Description copied from interface:CertificateService
This method does calculation for a pages based on the request.- Specified by:
getPaginationFilter
in interfaceCertificateService
- Parameters:
requestJson
- JSON-object of request contains an instructions for search queries- Returns:
- map-representation of data
-
isCertificateExists
public boolean isCertificateExists(java.lang.String certificateId)
Description copied from interface:CertificateService
This method checks is exists database entity.- Specified by:
isCertificateExists
in interfaceCertificateService
- Parameters:
certificateId
- identification for database entity which will be checked- Returns:
- value as boolean
-
isCertificateNotExists
public boolean isCertificateNotExists(java.lang.String certificateId)
Description copied from interface:CertificateService
This method checks is not exists database entity.- Specified by:
isCertificateNotExists
in interfaceCertificateService
- Parameters:
certificateId
- identification for database entity which will be checked- Returns:
- value as boolean
-
addCertificateToLoggedSeller
@Transactional public void addCertificateToLoggedSeller(java.lang.String certificateId)
Description copied from interface:CertificateService
This method does a relationship between entities.- Specified by:
addCertificateToLoggedSeller
in interfaceCertificateService
- Parameters:
certificateId
- identification for database entity which will be updated
-
removeCertificateFromLoggedSeller
public void removeCertificateFromLoggedSeller(java.lang.String certificateId)
Description copied from interface:CertificateService
This method removes relationship between entities.- Specified by:
removeCertificateFromLoggedSeller
in interfaceCertificateService
- Parameters:
certificateId
- identification for database entity which will be updated
-
createCertificate
@Transactional public Certificate createCertificate(java.util.LinkedHashMap<java.lang.String,java.lang.Object> certificateAsMap)
Description copied from interface:CertificateService
This method creates a database entity.- Specified by:
createCertificate
in interfaceCertificateService
- Parameters:
certificateAsMap
- map-representation of database entity- Returns:
- database entity
-
createCertificate
@Transactional public Certificate createCertificate(Certificate certificate)
Description copied from interface:CertificateService
This method creates a database entity.- Specified by:
createCertificate
in interfaceCertificateService
- Parameters:
certificate
- database entity- Returns:
- database entity
-
saveCertificate
@Transactional public Certificate saveCertificate(java.util.LinkedHashMap<java.lang.String,java.lang.Object> certificateAsMap)
Description copied from interface:CertificateService
This method save an updates of database entity.- Specified by:
saveCertificate
in interfaceCertificateService
- Parameters:
certificateAsMap
- map-representation of database entity- Returns:
- saved instance of database entity
-
addCertificateToSeller
@Transactional public void addCertificateToSeller(java.lang.String certificateId, java.lang.String sellerId)
Description copied from interface:CertificateService
This method does a relationship between entities.- Specified by:
addCertificateToSeller
in interfaceCertificateService
- Parameters:
certificateId
- identification for database entity which will be updatedsellerId
- identification for database entity which will be updated
-
linkToSeller
private void linkToSeller(java.lang.String certificateId, java.lang.String sellerId)
-
removeCertificateFromTranslations
private void removeCertificateFromTranslations(java.lang.String certificateId)
-
removeCertificateFromTranslation
private void removeCertificateFromTranslation(java.lang.String certificateId, java.lang.String tranId)
-
addRelations
private void addRelations(Certificate certificate)
-
prepareRelations
private void prepareRelations(Certificate certificate)
-
removeRelations
private void removeRelations(Certificate certificateUI, Certificate certificateDB)
-
removeCertificateFromSellers
private void removeCertificateFromSellers(java.lang.String certificateId)
-
removeCertificateFromSeller
@Transactional public void removeCertificateFromSeller(java.lang.String certificateId, java.lang.String sellerId)
Description copied from interface:CertificateService
This method removes relationship between database entities.- Specified by:
removeCertificateFromSeller
in interfaceCertificateService
- Parameters:
certificateId
- identification for database entity which will be removedsellerId
- identification for database entity which will be updated
-
unbindCertificateFromSeller
private void unbindCertificateFromSeller(java.lang.String certificateId, java.lang.String sellerId)
-
removeCertificateAndClean
@Transactional public void removeCertificateAndClean(java.lang.String certificateId)
Description copied from interface:CertificateService
This method removes a database entity and clean all relationships from another entities.- Specified by:
removeCertificateAndClean
in interfaceCertificateService
- Parameters:
certificateId
- identification for database entity which will be removed
-
removeCertificates
@Transactional public void removeCertificates(java.util.ArrayList<java.lang.String> certificateIds)
Description copied from interface:CertificateService
This method removes a list of database entities.- Specified by:
removeCertificates
in interfaceCertificateService
- Parameters:
certificateIds
- the list of database entities which will be removed
-
addCertificatesByIds
public void addCertificatesByIds(java.util.ArrayList<java.lang.String> certificatesIds, java.lang.String sellerId)
Description copied from interface:CertificateService
This method does a relationship between entities.- Specified by:
addCertificatesByIds
in interfaceCertificateService
- Parameters:
certificatesIds
- the list of database entities which will be addedsellerId
- identification for database entity which will be updated
-
getSellerCertificates
public java.util.List<Certificate> getSellerCertificates(java.lang.String sellerId)
Description copied from interface:CertificateService
This method returns database entities as list.- Specified by:
getSellerCertificates
in interfaceCertificateService
- Parameters:
sellerId
- identification for database entity which related entities list be returned- Returns:
- database entities as list
-
-