123 lines
3.6 KiB
Java
123 lines
3.6 KiB
Java
package eu.eudat.models.admin.components.datasetprofile;
|
|
|
|
import eu.eudat.models.components.commons.Multiplicity;
|
|
import eu.eudat.utilities.interfaces.ViewStyleDefinition;
|
|
import eu.eudat.utilities.builders.ModelBuilder;
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
|
|
import java.util.List;
|
|
|
|
public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet> {
|
|
private String id;
|
|
private Integer ordinal;
|
|
private Multiplicity multiplicity;
|
|
private String title;
|
|
private String description;
|
|
private String extendedDescription;
|
|
private boolean hasCommentField;
|
|
private List<Field> fields;
|
|
|
|
public List<Field> getFields() {
|
|
return fields;
|
|
}
|
|
|
|
public void setFields(List<Field> fields) {
|
|
this.fields = fields;
|
|
}
|
|
|
|
public String getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(String id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public int getOrdinal() {
|
|
return ordinal;
|
|
}
|
|
|
|
public void setOrdinal(int ordinal) {
|
|
this.ordinal = ordinal;
|
|
}
|
|
|
|
public Multiplicity getMultiplicity() {
|
|
return multiplicity;
|
|
}
|
|
|
|
public void setMultiplicity(Multiplicity multiplicity) {
|
|
this.multiplicity = multiplicity;
|
|
}
|
|
|
|
public void setOrdinal(Integer ordinal) {
|
|
this.ordinal = ordinal;
|
|
}
|
|
|
|
public String getTitle() {
|
|
return title;
|
|
}
|
|
|
|
public void setTitle(String title) {
|
|
this.title = title;
|
|
}
|
|
|
|
public String getDescription() {
|
|
return description;
|
|
}
|
|
|
|
public void setDescription(String description) {
|
|
this.description = description;
|
|
}
|
|
|
|
public String getExtendedDescription() {
|
|
return extendedDescription;
|
|
}
|
|
|
|
public void setExtendedDescription(String extendedDescription) {
|
|
this.extendedDescription = extendedDescription;
|
|
}
|
|
|
|
public boolean getHasCommentField() {
|
|
return hasCommentField;
|
|
}
|
|
|
|
public void setHasCommentField(boolean hasCommentField) {
|
|
this.hasCommentField = hasCommentField;
|
|
}
|
|
|
|
@Override
|
|
public eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet toDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet item) {
|
|
if (this.id == null || this.id.isEmpty()) this.id = "fieldSet_" + RandomStringUtils.random(5, true, true);
|
|
|
|
List<eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field> viewStylefields = new ModelBuilder().toViewStyleDefinition(this.fields, eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field.class);
|
|
item.setFields(viewStylefields);
|
|
item.setId(this.id);
|
|
item.setDescription(this.description);
|
|
item.setTitle(this.title);
|
|
item.setExtendedDescription(this.extendedDescription);
|
|
item.setOrdinal(this.ordinal);
|
|
item.setMultiplicity(this.multiplicity);
|
|
item.setHasCommentField(this.hasCommentField);
|
|
return item;
|
|
}
|
|
|
|
@Override
|
|
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet item) {
|
|
this.fields = new ModelBuilder().fromViewStyleDefinition(item.getFields(), Field.class);
|
|
this.id = item.getId();
|
|
this.ordinal = item.getOrdinal();
|
|
this.description = item.getDescription();
|
|
this.extendedDescription = item.getExtendedDescription();
|
|
this.title = item.getTitle();
|
|
this.multiplicity = item.getMultiplicity();
|
|
this.hasCommentField = item.getHasCommentField();
|
|
}
|
|
|
|
@Override
|
|
public int compareTo(Object o) {
|
|
return this.ordinal.compareTo(((FieldSet) o).ordinal);
|
|
}
|
|
|
|
|
|
}
|