Skip to content
Snippets Groups Projects
Verified Commit a5c3977b authored by Luc Everse's avatar Luc Everse :passport_control:
Browse files

Attach Submit metadata to submissions

parent 4aa6eaaa
Branches
Tags
2 merge requests!179Release 2.5.0,!177Submit integration
package nl.tudelft.ewi.auta.core.model;
import java.util.Objects;
/**
* Submission metadata as supplied by Submit.
*/
public class SubmitAppMetadata {
/**
* Submit's submission ID.
*/
private long submissionId;
/**
* Submit's script ID for the script that called AuTA.
*/
private long scriptId;
/**
* The key to authenticate with when returning feedback.
*/
private String key;
/**
* The grade scheme to use.
*
* This is one of the values listed in the "Allowed scores" table on
* https://gitlab.ewi.tudelft.nl/eip/labrador/submit/-/blob/8344af40/docs/ScriptApi.md
* For future extensibility, any value is accepted here.
*/
private String gradeScheme;
/**
* The URL to post feedback to.
*/
private String url;
/**
* Creates a new Submit metadata object.
*
* The members are initialized to (likely) invalid values. IDs are -1 and the key and grade
* scheme are empty strings.
*/
public SubmitAppMetadata() {
this.submissionId = -1;
this.scriptId = -1;
this.key = "";
this.gradeScheme = "";
this.url = "";
}
/**
* Creates a new Submit metadata object.
*
* @param submissionId the Submit submission ID
* @param scriptId the ID of the script calling AuTA
* @param key the key to authenticate with when uploading feedback
* @param gradeScheme the grade scheme to use
* @param url the URL to send feedback to
*/
public SubmitAppMetadata(
final long submissionId,
final long scriptId,
final String key,
final String gradeScheme,
final String url
) {
this.submissionId = submissionId;
this.scriptId = scriptId;
this.key = key;
this.gradeScheme = gradeScheme;
this.url = url;
}
/**
* Returns the Submit submission ID.
*
* @return the submission ID
*/
public long getSubmissionId() {
return this.submissionId;
}
/**
* Sets the Submit submission ID.
*
* @param submissionId the submission ID
*/
public void setSubmissionId(final long submissionId) {
this.submissionId = submissionId;
}
/**
* Returns the ID of the script that called AuTA.
*
* @return the script ID
*/
public long getScriptId() {
return this.scriptId;
}
/**
* Sets the ID of the script that called AuTA.
*
* @param scriptId the script ID
*/
public void setScriptId(final long scriptId) {
this.scriptId = scriptId;
}
/**
* Returns the key to authenticate with when returning feedback.
*
* @return the authentication key
*/
public String getKey() {
return this.key;
}
/**
* Sets the key to authenticate with when returning feedback.
*
* @param key the authentication key
*/
public void setKey(final String key) {
this.key = key;
}
/**
* Returns the grade scheme to use.
*
* @return the grade scheme
*/
public String getGradeScheme() {
return this.gradeScheme;
}
/**
* Sets the grade scheme to use.
*
* @param gradeScheme the grade scheme
*/
public void setGradeScheme(final String gradeScheme) {
this.gradeScheme = gradeScheme;
}
/**
* Returns the URL to send feedback to.
*
* @return the URL
*/
public String getUrl() {
return this.url;
}
/**
* Sets the URL to send feedback to.
*
* @param url the URL
*/
public void setUrl(final String url) {
this.url = url;
}
@Override
public boolean equals(final Object obj) {
if (!(obj instanceof SubmitAppMetadata)) {
return false;
}
final var other = (SubmitAppMetadata) obj;
return this.submissionId == other.submissionId
&& this.scriptId == other.scriptId
&& Objects.equals(this.key, other.key)
&& Objects.equals(this.gradeScheme, other.gradeScheme)
&& Objects.equals(this.url, other.url);
}
@Override
public int hashCode() {
return Objects.hash(this.submissionId, this.scriptId, this.key, this.gradeScheme, this.url);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment