Class AttestationResultService


  • public class AttestationResultService
    extends java.lang.Object
    Service class to handle AttestationResult in the database
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static org.apache.logging.log4j.Logger LOGGER  
      private org.apache.ibatis.session.SqlSessionFactory sessionFactory  
    • Constructor Summary

      Constructors 
      Constructor Description
      AttestationResultService()
      Default constructor.
      AttestationResultService​(org.apache.ibatis.session.SqlSessionFactory sessionFactoryIn)
      Build a services with the given session factory.
    • Field Detail

      • LOGGER

        private static final org.apache.logging.log4j.Logger LOGGER
      • sessionFactory

        private final org.apache.ibatis.session.SqlSessionFactory sessionFactory
    • Constructor Detail

      • AttestationResultService

        public AttestationResultService()
        Default constructor.
      • AttestationResultService

        public AttestationResultService​(org.apache.ibatis.session.SqlSessionFactory sessionFactoryIn)
        Build a services with the given session factory.
        Parameters:
        sessionFactoryIn - the sql session factory
    • Method Detail

      • getPendingResultByType

        public java.util.List<java.lang.Long> getPendingResultByType​(java.util.Collection<java.lang.Integer> resultTypeList,
                                                                     int batchSize)
        Retrieve the ids of the available attestation results with the given state and result type.
        Parameters:
        resultTypeList - a list of possible result types to match
        batchSize - the number of results to fetch at max
        Returns:
        the ids of the attestation results matching the criteria
      • processAttestationResult

        public void processAttestationResult​(long id,
                                             AttestationWorker worker)
        Process an attestation result. The result is extracted from the database and locked for update.
        Parameters:
        id - the id of the attestation result
        worker - the worker processing the attestation result
      • lockAttestationResult

        private static AttestationResult lockAttestationResult​(org.apache.ibatis.session.SqlSession session,
                                                               long id)