64 lines
1.8 KiB
Java
64 lines
1.8 KiB
Java
package eu.eudat.service.visibility;
|
|
|
|
import eu.eudat.commons.types.description.FieldEntity;
|
|
import eu.eudat.model.persist.descriptionproperties.FieldPersist;
|
|
|
|
import java.time.Instant;
|
|
import java.util.List;
|
|
|
|
public class Field {
|
|
|
|
private final String textValue;
|
|
|
|
private final List<String> textListValue;
|
|
|
|
private final Instant dateValue;
|
|
|
|
private final ExternalIdentifier externalIdentifier;
|
|
|
|
public String getTextValue() {
|
|
return textValue;
|
|
}
|
|
|
|
|
|
public List<String> getTextListValue() {
|
|
return textListValue;
|
|
}
|
|
|
|
|
|
public Instant getDateValue() {
|
|
return dateValue;
|
|
}
|
|
|
|
|
|
public ExternalIdentifier getExternalIdentifier() {
|
|
return externalIdentifier;
|
|
}
|
|
|
|
|
|
public Field(FieldPersist persist){
|
|
List<String> tempTextListValue;
|
|
this.textValue = persist.getTextValue();
|
|
this.dateValue = persist.getDateValue();
|
|
tempTextListValue = persist.getTextListValue();
|
|
if (persist.getExternalIdentifier() != null) this.externalIdentifier = new ExternalIdentifier(persist.getExternalIdentifier());
|
|
else this.externalIdentifier = null;
|
|
if (persist.getReferences() != null && !persist.getReferences().isEmpty()){
|
|
tempTextListValue = persist.getReferences().stream().filter(x-> x.getId() != null).map(x-> x.getId().toString()).toList();
|
|
}
|
|
this.textListValue = tempTextListValue;
|
|
}
|
|
|
|
|
|
public Field(FieldEntity entity){
|
|
this.textValue = entity.getTextValue();
|
|
this.dateValue = entity.getDateValue();
|
|
this.textListValue = entity.getTextListValue();
|
|
if (entity.getExternalIdentifier() != null) this.externalIdentifier = new ExternalIdentifier(entity.getExternalIdentifier());
|
|
else this.externalIdentifier = null;
|
|
}
|
|
|
|
}
|
|
|
|
|