Package services.gui

Class BatchService


  • @Singleton
    public class BatchService
    extends java.lang.Object
    Service class for JATOS Controllers (not Publix).
    • Method Detail

      • clone

        public Batch clone​(Batch batch)
        Clones a Batch but does not persists. Doesn't copy batch session data and version.
      • createDefaultBatch

        public Batch createDefaultBatch()
        Create and initialises default Batch. Each Study has a default batch. Does NOT persist.
      • initBatch

        public void initBatch​(Batch batch,
                              Study study)
      • initAndPersistBatch

        public void initAndPersistBatch​(Batch batch,
                                        Study study,
                                        User signedinUser)
      • addDefaultAllowedWorkerTypes

        public void addDefaultAllowedWorkerTypes​(Batch batch)
      • updateBatch

        public void updateBatch​(Batch batch,
                                BatchProperties updatedBatchProps)
        Updates the given batch in the database with the given BatchProperties
      • fetchBatch

        public Batch fetchBatch​(java.lang.Long batchId,
                                Study study)
                         throws NotFoundException
        Gets the batch with given ID from the database or if the batchId is -1 returns the default batch of this study. If the batch doesn't exist it throws an NotFoundException.
        Throws:
        NotFoundException
      • remove

        public void remove​(Batch batch,
                           User signedinUser)
        Removes batch, all it's StudyResults, ComponentResults, GroupResults and Workers (if they don't belong to another batch) and persists the changes to the database.
      • validate

        public void validate​(Batch batch)
                      throws javax.validation.ValidationException
        Validates the batch by converting it to BatchProperties and uses its validate method. Throws ValidationException in case of an error.
        Throws:
        javax.validation.ValidationException
      • getBatchFromIdOrUuid

        public Batch getBatchFromIdOrUuid​(java.lang.String idOrUuid)
      • getBatchOrDefaultBatch

        public Batch getBatchOrDefaultBatch​(java.lang.Long batchId,
                                            Study study)