Class BaseStorage

    • Constructor Detail

      • BaseStorage

        public BaseStorage()
    • Method Detail

      • createWorkspace

        public IWorkspace createWorkspace​(java.lang.String name,
                                          java.lang.String lang)
        Description copied from interface: IStorageWrapper
        Create a new IWorkspace instance
        Specified by:
        createWorkspace in interface IStorageWrapper
        Parameters:
        name - name to create workspace under
        lang - language of the workspace
        Returns:
        instance
      • getCodeBlockGroupClass

        public java.lang.Class<? extends ICodeBlockGroup> getCodeBlockGroupClass()
        Description copied from interface: IStorageWrapper
        Fetches the class of ICodeBlockGroup used in this IStorageWrapper implementation
        Specified by:
        getCodeBlockGroupClass in interface IStorageWrapper
        Returns:
        class for ICodeBlockGroup
      • getWorkspaces

        public java.util.List<IWorkspace> getWorkspaces​(java.util.List<java.lang.Long> ids)
        Specified by:
        getWorkspaces in interface IStorageWrapper
        Parameters:
        ids - workspace ids to fetch
        Returns:
        a list of all workspaces matching the passed ids in the database
      • storeCodeBlockGroups

        public boolean storeCodeBlockGroups​(java.util.List<ICodeBlockGroup> groups)
        Description copied from interface: IStorageWrapper
        Stores the passed code block groups to the database
        Specified by:
        storeCodeBlockGroups in interface IStorageWrapper
        Parameters:
        groups - list of the code block groups to store
        Returns:
        was successful?
      • storeFile

        public java.util.List<ITuple<ISubmission,​ISubmission>> storeFile​(IWorkspace workspace,
                                                                               java.lang.String filename,
                                                                               byte[] fileContent)
                                                                        throws WorkspaceUnsupportedException
        Description copied from interface: IStorageWrapper
        Store file
        Specified by:
        storeFile in interface IStorageWrapper
        Parameters:
        workspace - workspace to upload file to
        filename - filename uploaded, used as the identifier to show to the user, identifying the file or files
        fileContent - raw content of the file
        Returns:
        list of tuples, which contain any collisions between submission names. The first element is the existing submission, the second is the new
        Throws:
        WorkspaceUnsupportedException - Thrown if IWorkspace instance was not created by this IStorageWrapper implementation
      • storeFile

        public java.util.List<ITuple<ISubmission,​ISubmission>> storeFile​(IWorkspace workspace,
                                                                               java.lang.String filename,
                                                                               byte[] fileContent,
                                                                               boolean archiveContainsMultipleSubmissions)
                                                                        throws WorkspaceUnsupportedException
        Description copied from interface: IStorageWrapper
        Store file
        Specified by:
        storeFile in interface IStorageWrapper
        Parameters:
        workspace - workspace to upload file to
        filename - filename uploaded, used as the identifier to show to the user, identifying the file or files
        fileContent - raw content of the file
        archiveContainsMultipleSubmissions - are the archive top level directories separate submissions?
        Returns:
        list of tuples, which contain any collisions between submission names. The first element is the existing submission, the second is the new
        Throws:
        WorkspaceUnsupportedException - Thrown if IWorkspace instance was not created by this IStorageWrapper implementation
      • writePendingSubmission

        public void writePendingSubmission​(ISubmission pendingSubmission)
                                    throws SubmissionUnsupportedException
        Description copied from interface: IStorageWrapper
        If the submission clashes with an already existing submission, it will be set as pending

        IF a submission is pending this method will remove existing submission with the same name and write the pending submission to the database

        Specified by:
        writePendingSubmission in interface IStorageWrapper
        Parameters:
        pendingSubmission - pending submission to properly write
        Throws:
        SubmissionUnsupportedException - Thrown if ISubmission instance was not created by this IStorageWrapper implementation