Interface ProcessService

  • All Known Implementing Classes:
    ProcessServiceImpl

    public interface ProcessService
    An interface for the ProcessService with methods regarding the Process workload
    • Method Detail

      • create

        Process create​(Context context,
                       EPerson ePerson,
                       String scriptName,
                       List<DSpaceCommandLineParameter> parameters)
                throws SQLException
        This method will create a Process object in the database
        Parameters:
        context - The relevant DSpace context
        ePerson - The ePerson for which this process will be created on
        scriptName - The script name to be used for the process
        parameters - The parameters to be used for the process
        Returns:
        The created process
        Throws:
        SQLException - If something goes wrong
      • find

        Process find​(Context context,
                     int processId)
              throws SQLException
        This method will retrieve a Process object from the Database with the given ID
        Parameters:
        context - The relevant DSpace context
        processId - The process id on which we'll search for in the database
        Returns:
        The process that holds the given process id
        Throws:
        SQLException - If something goes wrong
      • findAll

        List<Process> findAll​(Context context)
                       throws SQLException
        Returns a list of all Process objects in the database
        Parameters:
        context - The relevant DSpace context
        Returns:
        The list of all Process objects in the Database
        Throws:
        SQLException - If something goes wrong
      • findAll

        List<Process> findAll​(Context context,
                              int limit,
                              int offset)
                       throws SQLException
        Returns a list of all Process objects in the database
        Parameters:
        context - The relevant DSpace context
        limit - The limit for the amount of Processes returned
        offset - The offset for the Processes to be returned
        Returns:
        The list of all Process objects in the Database
        Throws:
        SQLException - If something goes wrong
      • findAllSortByScript

        List<Process> findAllSortByScript​(Context context)
                                   throws SQLException
        Returns a list of all Process objects in the database sorted by script name
        Parameters:
        context - The relevant DSpace context
        Returns:
        The list of all Process objects in the database sorted by script name
        Throws:
        SQLException - If something goes wrong
      • findAllSortByStartTime

        List<Process> findAllSortByStartTime​(Context context)
                                      throws SQLException
        Returns a list of all Process objects in the database sorted by start time The most recent one will be shown first
        Parameters:
        context - The relevant DSpace context
        Returns:
        The list of all Process objects sorted by start time
        Throws:
        SQLException - If something goes wrong
      • start

        void start​(Context context,
                   Process process)
            throws SQLException
        This method will perform the logic needed to update the Process object in the database to represent a started state. A started state refers to ProcessStatus.RUNNING
        Parameters:
        context - The relevant DSpace context
        process - The Process object to be updated
        Throws:
        SQLException - If something goes wrong
      • fail

        void fail​(Context context,
                  Process process)
           throws SQLException
        This method will perform the logic needed to update the Process object in the database to represent a failed state
        Parameters:
        context - The relevant DSpace context
        process - The Process object to be updated
        Throws:
        SQLException - If something goes wrong
      • complete

        void complete​(Context context,
                      Process process)
               throws SQLException
        This method will perform the logic needed to update the Process object in the database to represent a complete state
        Parameters:
        context - The relevant DSpace context
        process - The Process object to be updated
        Throws:
        SQLException - If something goes wrong
      • appendFile

        void appendFile​(Context context,
                        Process process,
                        InputStream is,
                        String type,
                        String fileName)
                 throws IOException,
                        SQLException,
                        AuthorizeException
        The method will create a bitstream from the given inputstream with the given type as metadata and given name as name and attach it to the given process
        Parameters:
        context - The relevant DSpace context
        process - The process for which the bitstream will be made
        is - The inputstream for the bitstream
        type - The type of the bitstream
        fileName - The name of the bitstream
        Throws:
        IOException - If something goes wrong
        SQLException - If something goes wrong
        AuthorizeException - If something goes wrong
      • update

        void update​(Context context,
                    Process process)
             throws SQLException
        This method will be used to update the given Process object in the database
        Parameters:
        context - The relevant DSpace context
        process - The Process object to be updated
        Throws:
        SQLException - If something goes wrong
      • getParameters

        List<DSpaceCommandLineParameter> getParameters​(Process process)
        This method will retrieve the list of parameters from the Process in its String format and it will parse these parameters to a list of DSpaceCommandLineParameter objects for better usability throughout DSpace
        Parameters:
        process - The Process object for which we'll return the parameters
        Returns:
        The list of parsed parameters from the Process object
      • getBitstreamByName

        Bitstream getBitstreamByName​(Context context,
                                     Process process,
                                     String bitstreamName)
        This method will return the Bitstream that matches the given name for the given Process
        Parameters:
        context - The relevant DSpace context
        process - The process that should hold the requested Bitstream
        bitstreamName - The name of the requested Bitstream
        Returns:
        The Bitstream from the given Process that matches the given bitstream name
      • getBitstream

        Bitstream getBitstream​(Context context,
                               Process process,
                               String type)
        This method will return the Bitstream for a given process with a given type
        Parameters:
        context - The relevant DSpace context
        process - The process that holds the Bitstreams to be searched in
        type - The type that the Bitstream must have
        Returns:
        The Bitstream of the given type for the given Process
      • getBitstreams

        List<Bitstream> getBitstreams​(Context context,
                                      Process process)
        This method will return all the Bitstreams for a given process
        Parameters:
        context - The relevant DSpace context
        process - The process that holds the Bitstreams to be searched in
        Returns:
        The list of Bitstreams
      • countTotal

        int countTotal​(Context context)
                throws SQLException
        Returns the total amount of Process objects in the dataase
        Parameters:
        context - The relevant DSpace context
        Returns:
        An integer that describes the amount of Process objects in the database
        Throws:
        SQLException - If something goes wrong
      • getFileTypesForProcessBitstreams

        List<String> getFileTypesForProcessBitstreams​(Context context,
                                                      Process process)
        This will return a list of Strings where each String represents the type of a Bitstream in the Process given
        Parameters:
        context - The DSpace context
        process - The Process object that we'll use to find the bitstreams
        Returns:
        A list of Strings where each String represents a fileType that is in the Process
      • search

        List<Process> search​(Context context,
                             ProcessQueryParameterContainer processQueryParameterContainer,
                             int limit,
                             int offset)
                      throws SQLException
        Returns a list of all Processes in the database which match the given field requirements. If the requirements are not null, they will be combined with an AND operation.
        Parameters:
        context - The relevant DSpace context
        processQueryParameterContainer - The ProcessQueryParameterContainer containing all the values that the returned Process objects must adhere to
        limit - The limit for the amount of Processes returned
        offset - The offset for the Processes to be returned
        Returns:
        The list of all Processes which match the metadata requirements
        Throws:
        SQLException - If something goes wrong
      • countSearch

        int countSearch​(Context context,
                        ProcessQueryParameterContainer processQueryParameterContainer)
                 throws SQLException
        Count all the processes which match the requirements. The requirements are evaluated like the search method.
        Parameters:
        context - The relevant DSpace context
        processQueryParameterContainer - The ProcessQueryParameterContainer containing all the values that the returned Process objects must adhere to
        Returns:
        The number of results matching the query
        Throws:
        SQLException - If something goes wrong
      • appendLog

        void appendLog​(int processId,
                       String scriptName,
                       String output,
                       ProcessLogLevel processLogLevel)
                throws IOException
        This method will append the given output to the Process its logs
        Parameters:
        processId - The ID of the Process to append the log for
        scriptName - The name of the Script that Process runs
        output - The output to append
        processLogLevel - The loglevel of the output
        Throws:
        IOException - If something goes wrong