dnet-hadoop/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/mdstore/MetadataRecord.java

124 lines
2.5 KiB
Java
Raw Normal View History

2021-02-26 10:58:48 +01:00
package eu.dnetlib.dhp.schema.mdstore;
2019-04-03 16:05:16 +02:00
import java.io.Serializable;
2021-02-26 10:58:48 +01:00
import eu.dnetlib.dhp.schema.common.ModelSupport;
2021-02-26 10:58:48 +01:00
/**
* This class models a record in a Metadata store collection on HDFS
*/
2021-03-03 10:22:53 +01:00
public class MetadataRecord implements Serializable {
2019-04-03 16:05:16 +02:00
/** The D-Net Identifier associated to the record */
private String id;
/** The original Identifier of the record */
private String originalId;
/** The encoding of the record, should be JSON or XML */
private String encoding;
/**
* The information about the provenance of the record see @{@link Provenance} for the model of this information
*/
private Provenance provenance;
/** The content of the metadata */
private String body;
/** the date when the record has been stored */
private Long dateOfCollection;
/** the date when the record has been stored */
private Long dateOfTransformation;
public MetadataRecord() {
}
public MetadataRecord(
String originalId,
String encoding,
Provenance provenance,
String body,
Long dateOfCollection) {
this.originalId = originalId;
this.encoding = encoding;
this.provenance = provenance;
this.body = body;
this.dateOfCollection = dateOfCollection;
2021-02-26 10:58:48 +01:00
this.id = ModelSupport.generateIdentifier(originalId, this.provenance.getNsPrefix());
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getOriginalId() {
return originalId;
}
public void setOriginalId(String originalId) {
this.originalId = originalId;
}
public String getEncoding() {
return encoding;
}
public void setEncoding(String encoding) {
this.encoding = encoding;
}
public Provenance getProvenance() {
return provenance;
}
public void setProvenance(Provenance provenance) {
this.provenance = provenance;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public Long getDateOfCollection() {
return dateOfCollection;
}
public void setDateOfCollection(Long dateOfCollection) {
this.dateOfCollection = dateOfCollection;
}
public Long getDateOfTransformation() {
return dateOfTransformation;
}
public void setDateOfTransformation(Long dateOfTransformation) {
this.dateOfTransformation = dateOfTransformation;
}
@Override
public boolean equals(Object o) {
if (!(o instanceof MetadataRecord)) {
return false;
}
return ((MetadataRecord) o).getId().equalsIgnoreCase(id);
}
@Override
public int hashCode() {
return id.hashCode();
}
2019-04-03 16:05:16 +02:00
}