Class WorkspaceWrapper
- java.lang.Object
-
- uk.ac.warwick.dcs.sherlock.module.web.data.wrappers.WorkspaceWrapper
-
public class WorkspaceWrapper extends java.lang.Object
The wrapper that manages the workspaces
-
-
Constructor Summary
Constructors Constructor Description WorkspaceWrapper(long id, Account account, WorkspaceRepository workspaceRepository)
Initialise the workspace wrapper using an id to find one in the databaseWorkspaceWrapper(Workspace workspace)
Initialise the workspace wrapper using an existing workspaceWorkspaceWrapper(WorkspaceForm workspaceForm, Account account, WorkspaceRepository workspaceRepository)
Initialise the workspace wrapper using the workspace form to create a new workspace
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<ITuple<ISubmission,ISubmission>>
addSubmissions(SubmissionsForm submissionsForm)
Add submissions to this workspacevoid
delete(WorkspaceRepository workspaceRepository)
Delete the workspacestatic java.util.List<WorkspaceWrapper>
findByAccount(Account account, WorkspaceRepository workspaceRepository)
Gets the list of workspaces owned by the current userlong
getEngineId()
Get the workspace engine idjava.util.List<ISourceFile>
getFiles()
Get the workspace fileslong
getId()
Get the workspace web idIWorkspace
getiWorkspace()
Get the engine workspace entityjava.util.List<IJob>
getJobs()
Get the workspace jobsjava.lang.String
getLanguage()
Get the workspace languagejava.lang.String
getName()
Get the workspace namejava.util.List<ISubmission>
getSubmissions()
Get the workspace submissionsWorkspace
getWorkspace()
Get the web database workspace entitylong
runTemplate(TemplateWrapper templateWrapper)
Runs a template on a workspacevoid
set(WorkspaceForm workspaceForm)
Update the workspace using the workspace formvoid
setLanguage(java.lang.String language)
Set the workspace languagevoid
setName(java.lang.String name)
Set the workspace name
-
-
-
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 formaccount
- the account of the current userworkspaceRepository
- 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 findaccount
- the account of the current userworkspaceRepository
- the database repository- Throws:
WorkspaceNotFound
- if the workspace was not found in the web databaseIWorkspaceNotFound
- 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
-
addSubmissions
public java.util.List<ITuple<ISubmission,ISubmission>> addSubmissions(SubmissionsForm submissionsForm) throws NoFilesUploaded, FileUploadFailed
Add submissions to this workspace- Parameters:
submissionsForm
- the form to use- Throws:
NoFilesUploaded
- if no files were uploadedFileUploadFailed
- if uploading the files failed
-
runTemplate
public long runTemplate(TemplateWrapper templateWrapper) throws TemplateContainsNoDetectors, java.lang.ClassNotFoundException, ParameterNotFound, DetectorNotFound, NoFilesUploaded
Runs a template on a workspace- Parameters:
templateWrapper
- the template to run- Throws:
TemplateContainsNoDetectors
- if there are no detectors in the templatejava.lang.ClassNotFoundException
- if the detector no longer existsParameterNotFound
- if the parameter no longer existsDetectorNotFound
- if the detector no longer existsNoFilesUploaded
- if no files were uploaded
-
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 userworkspaceRepository
- the database repository- Returns:
- the list of workspaces
-
-