Class WorkspaceWrapper


  • public class WorkspaceWrapper
    extends java.lang.Object
    The wrapper that manages the workspaces
    • Constructor Detail

      • WorkspaceWrapper

        public WorkspaceWrapper​(WorkspaceForm workspaceForm,
                                Account account,
                                WorkspaceRepository workspaceRepository)
        Initialise the workspace wrapper using the workspace form to create a new workspace
        Parameters:
        workspaceForm - the form
        account - the account of the current user
        workspaceRepository - the database repository
      • WorkspaceWrapper

        public WorkspaceWrapper​(Workspace workspace)
                         throws IWorkspaceNotFound
        Initialise the workspace wrapper using an existing workspace
        Parameters:
        workspace - the workspace to manage
        Throws:
        IWorkspaceNotFound - if the workspace entity was not found in the engine
      • WorkspaceWrapper

        public WorkspaceWrapper​(long id,
                                Account account,
                                WorkspaceRepository workspaceRepository)
                         throws WorkspaceNotFound,
                                IWorkspaceNotFound
        Initialise the workspace wrapper using an id to find one in the database
        Parameters:
        id - the id of the account to find
        account - the account of the current user
        workspaceRepository - the database repository
        Throws:
        WorkspaceNotFound - if the workspace was not found in the web database
        IWorkspaceNotFound - if the workspace entity was not found in the engine
    • Method Detail

      • getWorkspace

        public Workspace getWorkspace()
        Get the web database workspace entity
        Returns:
        the workspace
      • getiWorkspace

        public IWorkspace getiWorkspace()
        Get the engine workspace entity
        Returns:
        the workspace
      • getId

        public long getId()
        Get the workspace web id
        Returns:
        the id
      • getEngineId

        public long getEngineId()
        Get the workspace engine id
        Returns:
        the id
      • getName

        public java.lang.String getName()
        Get the workspace name
        Returns:
        the name
      • getLanguage

        public java.lang.String getLanguage()
        Get the workspace language
        Returns:
        the language
      • getFiles

        public java.util.List<ISourceFile> getFiles()
        Get the workspace files
        Returns:
        the list of files
      • getSubmissions

        public java.util.List<ISubmission> getSubmissions()
        Get the workspace submissions
        Returns:
        the list of submissions
      • getJobs

        public java.util.List<IJob> getJobs()
        Get the workspace jobs
        Returns:
        the list of jobs
      • setName

        public void setName​(java.lang.String name)
        Set the workspace name
        Parameters:
        name - the new name
      • setLanguage

        public void setLanguage​(java.lang.String language)
        Set the workspace language
        Parameters:
        language - the new language
      • set

        public void set​(WorkspaceForm workspaceForm)
        Update the workspace using the workspace form
        Parameters:
        workspaceForm - the form to use
      • delete

        public void delete​(WorkspaceRepository workspaceRepository)
        Delete the workspace
        Parameters:
        workspaceRepository - the database repository
      • findByAccount

        public static java.util.List<WorkspaceWrapper> findByAccount​(Account account,
                                                                     WorkspaceRepository workspaceRepository)
        Gets the list of workspaces owned by the current user
        Parameters:
        account - the account of the current user
        workspaceRepository - the database repository
        Returns:
        the list of workspaces