argos/dmp-backend/src/main/java/models/components/datasetprofile/Field.java

155 lines
4.3 KiB
Java
Raw Normal View History

2017-11-27 14:40:16 +01:00
package models.components.datasetprofile;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import models.components.commons.DefaultValue;
import models.components.commons.Multiplicity;
import models.components.commons.ViewStyle;
import utilities.ModelDefinition;
import utilities.ViewStyleDefinition;
import utilities.builders.ModelBuilder;
public class Field implements ModelDefinition<entities.xmlmodels.modeldefinition.Field>,ViewStyleDefinition<entities.xmlmodels.viewstyledefinition.Field>{
2017-11-27 14:40:16 +01:00
private String id;
private int ordinal;
2017-11-27 14:40:16 +01:00
private String title;
private String value;
private String description;
private String extendedDescription;
private ViewStyle viewStyle;
private String datatype;
2017-11-27 14:40:16 +01:00
private boolean defaultVisibility;
private int page;
private DefaultValue defaultValue;
private Multiplicity multiplicity;
private Object data;
2017-11-27 14:40:16 +01:00
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;
}
2017-11-27 14:40:16 +01:00
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
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 ViewStyle getViewStyle() {
2017-11-27 14:40:16 +01:00
return viewStyle;
}
public void setViewStyle(ViewStyle viewStyle) {
2017-11-27 14:40:16 +01:00
this.viewStyle = viewStyle;
}
public boolean isDefaultVisibility() {
return defaultVisibility;
}
public void setDefaultVisibility(boolean defaultVisibility) {
this.defaultVisibility = defaultVisibility;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public DefaultValue getDefaultValue() {
return defaultValue;
2017-11-27 14:40:16 +01:00
}
public void setDefaultValue(DefaultValue defaultValue) {
this.defaultValue = defaultValue;
}
public String getDatatype() {
return datatype;
}
public void setDatatype(String datatype) {
this.datatype = datatype;
}
public Multiplicity getMultiplicity() {
return multiplicity;
}
public void setMultiplicity(Multiplicity multiplicity) {
this.multiplicity = multiplicity;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
@Override
public entities.xmlmodels.modeldefinition.Field toDatabaseDefinition(entities.xmlmodels.modeldefinition.Field field) {
field.setDatatype(this.datatype);
field.setDefaultValue(this.defaultValue);
field.setId(this.id);
field.setMultiplicity(this.multiplicity);
field.setOrdinal(this.ordinal);
return field;
}
@Override
public void fromDatabaseDefinition(entities.xmlmodels.modeldefinition.Field item) {
this.datatype = item.getDatatype();
this.defaultValue = item.getDefaultValue();
this.multiplicity = item.getMultiplicity();
}
@Override
public entities.xmlmodels.viewstyledefinition.Field toDatabaseDefinition(entities.xmlmodels.viewstyledefinition.Field field) {
field.setDefaultVisibility(this.defaultVisibility);
field.setDescription(this.description);
field.setExtendedDescription(this.extendedDescription);
field.setId(this.id);
field.setOrdinal(this.ordinal);
field.setTitle(this.title);
field.setViewStyle(this.viewStyle);
field.setData(new ModelBuilder().toFieldData(data, this.viewStyle.getRenderStyle()));
return field;
}
@Override
public void fromDatabaseDefinition(entities.xmlmodels.viewstyledefinition.Field item) {
this.defaultVisibility = item.isDefaultVisibility();
this.description = item.getDescription();
this.extendedDescription = item.getExtendedDescription();
this.id = item.getId();
this.ordinal = item.getOrdinal();
this.title = item.getTitle();
this.viewStyle = item.getViewStyle();
this.data = item.getData();
}
2017-11-27 14:40:16 +01:00
}