added Mapping of OriginalDescription

This commit is contained in:
Sandro La Bruzzo 2019-10-24 17:36:44 +02:00
parent 6c32d418ac
commit 2dd9572f41
3 changed files with 36 additions and 8 deletions

View File

@ -10,7 +10,8 @@ public class OAIProvenance implements Serializable {
return originDescription;
}
public void setOriginDescription(OriginDescription originDescription) {
public OAIProvenance setOriginDescription(OriginDescription originDescription) {
this.originDescription = originDescription;
return this;
}
}

View File

@ -22,55 +22,62 @@ public class OriginDescription implements Serializable {
return harvestDate;
}
public void setHarvestDate(String harvestDate) {
public OriginDescription setHarvestDate(String harvestDate) {
this.harvestDate = harvestDate;
return this;
}
public Boolean getAltered() {
return altered;
}
public void setAltered(Boolean altered) {
public OriginDescription setAltered(Boolean altered) {
this.altered = altered;
return this;
}
public String getBaseURL() {
return baseURL;
}
public void setBaseURL(String baseURL) {
public OriginDescription setBaseURL(String baseURL) {
this.baseURL = baseURL;
return this;
}
public String getIdentifier() {
return identifier;
}
public void setIdentifier(String identifier) {
public OriginDescription setIdentifier(String identifier) {
this.identifier = identifier;
return this;
}
public String getDatestamp() {
return datestamp;
}
public void setDatestamp(String datestamp) {
public OriginDescription setDatestamp(String datestamp) {
this.datestamp = datestamp;
return this;
}
public String getMetadataNamespace() {
return metadataNamespace;
}
public void setMetadataNamespace(String metadataNamespace) {
public OriginDescription setMetadataNamespace(String metadataNamespace) {
this.metadataNamespace = metadataNamespace;
return this;
}
public OriginDescription getOriginDescription() {
return originDescription;
}
public void setOriginDescription(OriginDescription originDescription) {
public OriginDescription setOriginDescription(OriginDescription originDescription) {
this.originDescription = originDescription;
return this;
}
}

View File

@ -54,6 +54,26 @@ public class ProtoUtils {
.setValue(extraInfo.getValue());
}
public static OAIProvenance mapOAIProvenance(FieldTypeProtos.OAIProvenance oaiProvenance) {
return new OAIProvenance().setOriginDescription(mapOriginalDescription(oaiProvenance.getOriginDescription()));
}
public static OriginDescription mapOriginalDescription(FieldTypeProtos.OAIProvenance.OriginDescription originDescription) {
final OriginDescription originDescriptionResult = new OriginDescription()
.setHarvestDate(originDescription.getHarvestDate())
.setAltered(originDescription.getAltered())
.setBaseURL(originDescription.getBaseURL())
.setIdentifier(originDescription.getIdentifier())
.setDatestamp(originDescription.getDatestamp())
.setMetadataNamespace(originDescription.getMetadataNamespace());
if (originDescription.hasOriginDescription())
originDescriptionResult.setOriginDescription(mapOriginalDescription(originDescription.getOriginDescription()));
return originDescriptionResult;
}
public static Field<String> mapStringField(FieldTypeProtos.StringField s) {
return new Field<String>()
.setValue(s.getValue())