org.eclipse.pass.deposit.model.DepositSubmission Maven / Gradle / Ivy
/*
* Copyright 2018 Johns Hopkins University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.eclipse.pass.deposit.model;
import java.time.ZonedDateTime;
import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;
import com.google.gson.JsonObject;
/**
* Encapsulates a submission to the target system, including the manuscript and supplement files, metadata describing
* the manuscript, authors, and the journal of publication, and a manifest cataloging every file in the submission.
*
* @author Elliot Metsger ([email protected])
*/
public class DepositSubmission {
/**
* Internal, submission engine, identifier
*/
private String id;
/**
* Date the Submission resource was submitted to the PASS repository.
*
* Set by Ember when the user clicks the Submit button
*/
private ZonedDateTime submissionDate;
/**
* Manifest containing an entry for each file in the submission
*/
private DepositManifest manifest;
/**
* Metadata describing the contents of the submission
*/
private DepositMetadata metadata;
/**
* The files uploaded by the user, including the manuscript and supplement files.
*/
private List files;
/**
* Short, human-readable, name of the submission. Used to generate the file name for the package file.
*/
private String name;
/**
* The PASS Submission.metadata serialized as a JsonObject
*/
private JsonObject submissionMeta;
/**
* @return {@link #id}
*/
public String getId() {
return id;
}
/**
* @param id {@link #id}
*/
public void setId(String id) {
this.id = id;
}
/**
* @return {@link #manifest}
*/
public DepositManifest getManifest() {
return manifest;
}
/**
* @param manifest {@link #manifest}
*/
public void setManifest(DepositManifest manifest) {
this.manifest = manifest;
}
/**
* @return {@link #metadata}
*/
public DepositMetadata getMetadata() {
return metadata;
}
/**
* @param metadata {@link #metadata}
*/
public void setMetadata(DepositMetadata metadata) {
this.metadata = metadata;
}
/**
* @return {@link #files}
*/
public List getFiles() {
return files;
}
/**
* @param files {@link #files}
*/
public void setFiles(List files) {
this.files = files;
}
/**
* @return {@link #name}
*/
public String getName() {
return name;
}
/**
* @param name {@link #name}
*/
public void setName(String name) {
this.name = name;
}
/**
* Date the Submission resource was submitted to the PASS repository.
*
* Set by Ember when the user clicks the Submit button
*/
public ZonedDateTime getSubmissionDate() {
return submissionDate;
}
/**
* Date the Submission resource was submitted to the PASS repository.
*
* Set by Ember when the user clicks the Submit button
*/
public void setSubmissionDate(ZonedDateTime submissionDate) {
this.submissionDate = submissionDate;
}
public JsonObject getSubmissionMeta() {
return submissionMeta;
}
/**
* @param submissionMeta {@link #submissionMeta}
*/
public void setSubmissionMeta(JsonObject submissionMeta) {
this.submissionMeta = submissionMeta;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DepositSubmission that = (DepositSubmission) o;
return Objects.equals(id, that.id) && Objects.equals(submissionDate, that.submissionDate)
&& Objects.equals(manifest, that.manifest) && Objects.equals(metadata, that.metadata)
&& Objects.equals(files, that.files) && Objects.equals(name, that.name)
&& Objects.equals(submissionMeta, that.submissionMeta);
}
@Override
public int hashCode() {
return Objects.hash(id, submissionDate, manifest, metadata, files, name, submissionMeta);
}
@Override
public String toString() {
return new StringJoiner("\n ", DepositSubmission.class.getSimpleName()
+ "[", "]").add("id='" + id + "'").add("submissionDate="
+ submissionDate).add("manifest=" + manifest).add("metadata=" + metadata)
.add("files=" + files)
.add("name='" + name + "'")
.add("submissionMeta=" + submissionMeta).toString();
}
}