Package daos.common

Class ComponentResultDao


  • @Singleton
    public class ComponentResultDao
    extends AbstractDao
    DAO for ComponentResult entity
    • Method Detail

      • replaceData

        public void replaceData​(java.lang.Long id,
                                java.lang.String data)
        Overwrite data in 'data' fields (data, dataShort, dataSize)
      • purgeData

        public void purgeData​(java.lang.Long id)
      • appendData

        public void appendData​(java.lang.Long id,
                               java.lang.String data)
        Append data to 'data' field and replace data in 'dataShort' and 'dataSize'
      • setDataSizeAndDataShort

        public void setDataSizeAndDataShort​(java.lang.Long id)
        Only set the 'dataShort' and 'dataSize' field with data from 'data' (used only during update from an old version of JATOS that didn't have those fields yet).
      • getData

        public java.lang.String getData​(java.lang.Long id)
        Get 'data' field without fetching the whole row. The result is of a different type depending on the database in use, MySQL or H2. So we have to treat them differently to get the String.
      • findByIds

        public java.util.List<ComponentResult> findByIds​(java.util.List<java.lang.Long> ids)
      • count

        public int count()
      • countByComponent

        public int countByComponent​(Component component)
        Returns the number of ComponentResults belonging to the given Component.
      • findAllIdsWhereDataSizeIsNull

        public java.util.List<java.lang.Long> findAllIdsWhereDataSizeIsNull()
        Fetches all ComponentResults without 'dataSize' (is null). This is used only during update from an old version of JATOS that didn't have those fields yet.
      • findAllByComponent

        public java.util.List<ComponentResult> findAllByComponent​(Component component,
                                                                  int first,
                                                                  int max)
        Returns paginated ComponentResult that belong to the given Component We can't use ScrollableResults for pagination since the MySQL Hibernate driver doesn't support it (https://stackoverflow.com/a/2826512/1278769)
      • sizeByStudy

        public long sizeByStudy​(Study study)
        Returns data size (in Byte) that is occupied by the 'data' field of all component results belonging to the given study.
      • findIdsByComponentIds

        public java.util.List<java.lang.Long> findIdsByComponentIds​(java.util.List<java.lang.Long> componentIds)
      • findIdsByComponentUuids

        public java.util.List<java.lang.Long> findIdsByComponentUuids​(java.util.List<java.lang.String> componentUuids)
      • findIdsByStudyIds

        public java.util.List<java.lang.Long> findIdsByStudyIds​(java.util.List<java.lang.Long> studyIds)
      • findIdsByStudyUuids

        public java.util.List<java.lang.Long> findIdsByStudyUuids​(java.util.List<java.lang.String> studyUuids)
      • findIdsByStudyResultId

        public java.util.List<java.lang.Long> findIdsByStudyResultId​(java.lang.Long srid)
      • findOrderedIdsByOrderedStudyResultIds

        public java.util.List<java.lang.Long> findOrderedIdsByOrderedStudyResultIds​(java.util.List<java.lang.Long> orderedSrids)
        Returns a list of component result IDs that belong to the given list of study result IDs. The order of the study results is kept, e.g., if the study result IDs are sr1, sr2, sr3 - then in the returned list are first all component result IDs of sr1, then all of sr2, and last all of sr3.
      • findIdsByComponentResultIds

        public java.util.List<java.lang.Long> findIdsByComponentResultIds​(java.util.List<java.lang.Long> crids)
        Takes a list component result IDs and checks if they exist in the database. Returns only the existing ones.
      • setQuotaReached

        public void setQuotaReached​(java.lang.Long componentResultId)