From a1bf4935cd1a8fa3068e85aa2b9fac4d7a6920c0 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Mon, 13 Apr 2015 10:17:31 +0000 Subject: [PATCH] Updated ColumnData git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widget-common-event@113953 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/expression/ExpressionWrapper.java | 1 + .../shared/tr/column/ColumnData.java | 240 +++++++++++++ .../shared/tr/column/ColumnMockUp.java | 339 ++++++++++++++++++ .../shared/tr/column/ColumnViewData.java | 74 ++++ .../shared/tr/column/PeriodDataType.java | 68 ++++ .../shared/tr/column/ValueDataFormat.java | 64 ++++ 6 files changed, 786 insertions(+) create mode 100644 src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/ColumnData.java create mode 100644 src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/ColumnMockUp.java create mode 100644 src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/ColumnViewData.java create mode 100644 src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/PeriodDataType.java create mode 100644 src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/ValueDataFormat.java diff --git a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/client/expression/ExpressionWrapper.java b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/client/expression/ExpressionWrapper.java index 0f69a24..5fb3434 100644 --- a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/client/expression/ExpressionWrapper.java +++ b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/client/expression/ExpressionWrapper.java @@ -3,6 +3,7 @@ package org.gcube.portlets.user.td.widgetcommonevent.client.expression; import java.io.Serializable; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; +import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType; /** * diff --git a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/ColumnData.java b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/ColumnData.java new file mode 100644 index 0000000..0ab05b4 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/ColumnData.java @@ -0,0 +1,240 @@ +package org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column; + +import java.io.Serializable; +import java.util.ArrayList; + +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class ColumnData implements Serializable { + + private static final long serialVersionUID = 7614033455605898209L; + + private String id; // For insert in table only + private String columnId; // Id of column on server + private String name; + private String typeName; + private String typeCode; + private String dataTypeName; + private String label; + private String locale; + + private TRId trId; + + private boolean viewColumn; + private ColumnViewData columnViewData; + + private PeriodDataType periodDataType; + + // Relationship for Dimension and Timedimension columns + private RelationshipData relationship; + + // validation columns that validate this column + private ArrayList validationColumnReferences; + + // true if this is a validation column + private boolean validationColumn; + // if this is a validation column then contains the columns validated + private ArrayList validatedColumns; + + + public ColumnData(){ + + } + + /** + * + * @param id + * @param columnId + * @param name + * @param typeName + * @param typeCode + * @param dataTypeName + * @param label + * @param locale + * @param trId + * @param viewColumn + * @param columnViewData + * @param periodDataType + * @param relationship + * @param validationColumnReferences + * @param validationColumn + * @param validatedColumns + */ + public ColumnData(String id, String columnId, String name, String typeName, + String typeCode, String dataTypeName, String label, String locale, + TRId trId, boolean viewColumn, ColumnViewData columnViewData, + PeriodDataType periodDataType, RelationshipData relationship, + ArrayList validationColumnReferences, + boolean validationColumn, ArrayList validatedColumns) { + super(); + this.id = id; + this.columnId = columnId; + this.name = name; + this.typeName = typeName; + this.typeCode = typeCode; + this.dataTypeName = dataTypeName; + this.label = label; + this.locale = locale; + this.trId = trId; + this.viewColumn = viewColumn; + this.columnViewData = columnViewData; + this.periodDataType = periodDataType; + this.relationship = relationship; + this.validationColumnReferences = validationColumnReferences; + this.validationColumn = validationColumn; + this.validatedColumns = validatedColumns; + } + + + public String getColumnId() { + return columnId; + } + + public void setColumnId(String columnId) { + this.columnId = columnId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTypeName() { + return typeName; + } + + public void setTypeName(String typeName) { + this.typeName = typeName; + } + + public String getTypeCode() { + return typeCode; + } + + public void setTypeCode(String typeCode) { + this.typeCode = typeCode; + } + + public TRId getTrId() { + return trId; + } + + public void setTrId(TRId trId) { + this.trId = trId; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDataTypeName() { + return dataTypeName; + } + + public void setDataTypeName(String dataTypeName) { + this.dataTypeName = dataTypeName; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public ColumnViewData getColumnViewData() { + return columnViewData; + } + + public void setColumnViewData(ColumnViewData columnViewData) { + this.columnViewData = columnViewData; + } + + public boolean isViewColumn() { + return viewColumn; + } + + public void setViewColumn(boolean viewColumn) { + this.viewColumn = viewColumn; + } + + public boolean isValidationColumn() { + return validationColumn; + } + + public void setValidationColumn(boolean validationColumn) { + this.validationColumn = validationColumn; + } + + public ArrayList getValidatedColumns() { + return validatedColumns; + } + + public void setValidatedColumns(ArrayList validatedColumns) { + this.validatedColumns = validatedColumns; + } + + public ArrayList getValidationColumnReferences() { + return validationColumnReferences; + } + + public void setValidationColumnReferences( + ArrayList validationColumnReferences) { + this.validationColumnReferences = validationColumnReferences; + } + + public String getLocale() { + return locale; + } + + public void setLocale(String locale) { + this.locale = locale; + } + + public RelationshipData getRelationship() { + return relationship; + } + + public void setRelationship(RelationshipData relationship) { + this.relationship = relationship; + } + + public PeriodDataType getPeriodDataType() { + return periodDataType; + } + + public void setPeriodDataType(PeriodDataType periodDataType) { + this.periodDataType = periodDataType; + } + + + @Override + public String toString() { + return "ColumnData [id=" + id + ", columnId=" + columnId + ", name=" + + name + ", typeName=" + typeName + ", typeCode=" + typeCode + + ", dataTypeName=" + dataTypeName + ", label=" + label + + ", locale=" + locale + ", trId=" + trId + ", viewColumn=" + + viewColumn + ", columnViewData=" + columnViewData + + ", periodDataType=" + periodDataType + ", relationship=" + + relationship + ", validationColumnReferences=" + + validationColumnReferences + ", validationColumn=" + + validationColumn + ", validatedColumns=" + validatedColumns + + "]"; + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/ColumnMockUp.java b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/ColumnMockUp.java new file mode 100644 index 0000000..e2ec03e --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/ColumnMockUp.java @@ -0,0 +1,339 @@ +package org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column; + +import java.io.Serializable; + +import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression; + +/** + * + * @author "Giancarlo Panichi" + * + */ +public class ColumnMockUp implements Serializable { + + private static final long serialVersionUID = 7467523779864189492L; + + private String id;// For grid and combo only; + private String columnId;//ColumnId for template only; + private ColumnTypeCode columnType; + private ColumnDataType columnDataType; + private String defaultValue; + private String label; + private String localeName; + private boolean hasExpression; + private C_Expression expression; + + protected PeriodDataType timeDimensionType; + protected ColumnData codelistColumnReference; + + public ColumnMockUp() { + + } + + + /** + * ColumnMockUp + * + * + * @param id + * @param columnId + * @param columnType + * @param columnDataType + * @param label + */ + public ColumnMockUp(String id, String columnId, ColumnTypeCode columnType, + ColumnDataType columnDataType, String label) { + super(); + this.id = id; + this.columnId = columnId; + this.columnType = columnType; + this.columnDataType = columnDataType; + this.defaultValue = null; + this.label = label; + this.localeName = null; + this.hasExpression = false; + this.expression = null; + this.timeDimensionType = null; + this.codelistColumnReference = null; + } + + + + /** + * For Code, CodeDescription and Annotation Column + * @param id TODO + * @param columnId TODO + * @param label + * @param columnType + * @param defaultValue + * @param localeName + */ + public ColumnMockUp(String id,String columnId, + String label, ColumnTypeCode columnType, String defaultValue) { + this.id = id; + this.columnId=columnId; + this.label = label; + this.columnType = columnType; + this.columnDataType = ColumnDataType.Text; + this.defaultValue = defaultValue; + hasExpression = false; + expression = null; + } + + /** + * For Code, CodeDescription and Annotation Column + * @param id TODO + * @param columnId TODO + * @param label + * @param columnType + * @param expressionWrapper + */ + public ColumnMockUp(String id, String columnId, + String label, ColumnTypeCode columnType, C_Expression expression) { + this.id = null; + this.columnId=null; + this.label = label; + this.columnType = columnType; + this.columnDataType = ColumnDataType.Text; + this.defaultValue = null; + hasExpression = true; + this.expression = expression; + } + + /** + * For Attribute and Measure Column + * @param id TODO + * @param columnId TODO + * @param label + * @param columnType + * @param defaultValue + * @param localeName + */ + public ColumnMockUp(String id, String columnId, + String label, ColumnTypeCode columnType, ColumnDataType columnDataType, String defaultValue) { + this.id = id; + this.columnId=columnId; + this.label = label; + this.columnType = columnType; + this.columnDataType = columnDataType; + this.defaultValue = defaultValue; + hasExpression = false; + expression = null; + } + + /** + * For Attribute and Measure Column + * @param id TODO + * @param columnId TODO + * @param label + * @param columnType + * @param columnDataType + * @param expressionContainer + */ + public ColumnMockUp(String id, String columnId, + String label, ColumnTypeCode columnType, ColumnDataType columnDataType, C_Expression expression) { + this.id = id; + this.columnId=columnId; + this.label = label; + this.columnType = columnType; + this.columnDataType = columnDataType; + this.defaultValue = null; + hasExpression = true; + this.expression = expression; + } + + /** + * For CodeName Column + * @param id TODO + * @param columnId TODO + * @param label + * @param columnType + * @param localeName + * @param defaultValue + */ + public ColumnMockUp(String id, String columnId, + String label, ColumnTypeCode columnType, String localeName, String defaultValue) { + this.id = null; + this.columnId=null; + this.label = label; + this.columnType = columnType; + this.columnDataType = ColumnDataType.Text; + this.localeName = localeName; + this.defaultValue = defaultValue; + hasExpression = false; + expression = null; + } + + /** + * + * @param id TODO + * @param columnId TODO + * @param label + * @param columnType + * @param localeName + * @param expressionContainer + */ + public ColumnMockUp(String id, String columnId, + String label, ColumnTypeCode columnType, String localeName, C_Expression expression) { + this.id = id; + this.columnId=columnId; + this.label = label; + this.columnType = columnType; + this.columnDataType = ColumnDataType.Text; + this.localeName = localeName; + this.defaultValue = null; + hasExpression = true; + this.expression = expression; + } + + /** + * For Dimension + * @param id TODO + * @param columnId TODO + * @param label + * @param columnType + * @param defaultValue + * @param timeDimensionType + */ + public ColumnMockUp(String id, String columnId, + String label, ColumnTypeCode columnType, ColumnData codelistColumnReference, String defaultValue) { + this.id = id; + this.columnId=columnId; + this.label = label; + this.columnType = columnType; + this.columnDataType = ColumnDataType.Integer; + this.codelistColumnReference = codelistColumnReference; + this.defaultValue = defaultValue; + hasExpression = false; + expression = null; + + } + + /** + * For TimeDimension + * @param id TODO + * @param columnId TODO + * @param label + * @param columnType + * @param timeDimensionType + * @param defaultValue + */ + public ColumnMockUp(String id, String columnId, + String label, ColumnTypeCode columnType, PeriodDataType timeDimensionType, String defaultValue) { + this.id = id; + this.columnId=columnId; + this.label = label; + this.columnType = columnType; + this.columnDataType = ColumnDataType.Integer; + this.timeDimensionType = timeDimensionType; + this.defaultValue = defaultValue; + hasExpression = false; + expression = null; + + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public ColumnTypeCode getColumnType() { + return columnType; + } + + public void setColumnType(ColumnTypeCode columnType) { + this.columnType = columnType; + } + + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + public String getLocaleName() { + return localeName; + } + + public void setLocaleName(String localeName) { + this.localeName = localeName; + } + + public ColumnDataType getColumnDataType() { + return columnDataType; + } + + public void setColumnDataType(ColumnDataType columnDataType) { + this.columnDataType = columnDataType; + } + + public PeriodDataType getTimeDimensionType() { + return timeDimensionType; + } + + public void setTimeDimensionType(PeriodDataType timeDimensionType) { + this.timeDimensionType = timeDimensionType; + } + + public ColumnData getCodelistColumnReference() { + return codelistColumnReference; + } + + public void setCodelistColumnReference(ColumnData codelistColumnReference) { + this.codelistColumnReference = codelistColumnReference; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public boolean hasExpression() { + return hasExpression; + } + + public void setHasExpression(boolean hasExpression) { + this.hasExpression = hasExpression; + } + + public C_Expression getExpression() { + return expression; + } + + public void setExpression(C_Expression expression) { + this.expression = expression; + } + + public String getColumnId() { + return columnId; + } + + public void setColumnId(String columnId) { + this.columnId = columnId; + } + + @Override + public String toString() { + return "ColumnMockUp [id=" + id + ", columnId=" + columnId + + ", columnType=" + columnType + ", columnDataType=" + + columnDataType + ", defaultValue=" + defaultValue + + ", label=" + label + ", localeName=" + localeName + + ", hasExpression=" + hasExpression + ", expression=" + + expression + ", timeDimensionType=" + timeDimensionType + + ", codelistColumnReference=" + codelistColumnReference + "]"; + } + + + + + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/ColumnViewData.java b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/ColumnViewData.java new file mode 100644 index 0000000..b569e56 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/ColumnViewData.java @@ -0,0 +1,74 @@ +package org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column; + +import java.io.Serializable; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class ColumnViewData implements Serializable { + + private static final long serialVersionUID = 6727733264842637144L; + + /** + * ColumnId of dimension column in view + */ + protected String sourceTableDimensionColumnId; + + /** + * ColumnId of dimension column in table + */ + protected String targetTableColumnId; + + /** + * TableId of table + */ + protected long targetTableId; + + public ColumnViewData() { + + } + + public ColumnViewData(String sourceTableDimensionColumnId, + String targetTableColumnId, long targetTableId) { + this.sourceTableDimensionColumnId = sourceTableDimensionColumnId; + this.targetTableColumnId = targetTableColumnId; + this.targetTableId = targetTableId; + } + + public String getSourceTableDimensionColumnId() { + return sourceTableDimensionColumnId; + } + + public void setSourceTableDimensionColumnId( + String sourceTableDimensionColumnId) { + this.sourceTableDimensionColumnId = sourceTableDimensionColumnId; + } + + public String getTargetTableColumnId() { + return targetTableColumnId; + } + + public void setTargetTableColumnId(String targetTableColumnId) { + this.targetTableColumnId = targetTableColumnId; + } + + public long getTargetTableId() { + return targetTableId; + } + + public void setTargetTableId(long targetTableId) { + this.targetTableId = targetTableId; + } + + @Override + public String toString() { + return "ColumnViewData [sourceTableDimensionColumnId=" + + sourceTableDimensionColumnId + ", targetTableColumnId=" + + targetTableColumnId + ", targetTableId=" + targetTableId + + "]"; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/PeriodDataType.java b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/PeriodDataType.java new file mode 100644 index 0000000..672b5f6 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/PeriodDataType.java @@ -0,0 +1,68 @@ +package org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column; + +import java.io.Serializable; +import java.util.ArrayList; + +/** + * + * @author giancarlo email: g.panichi@isti.cnr.it + * + */ +public class PeriodDataType implements Serializable, Comparable { + + private static final long serialVersionUID = -5172920999547673068L; + + private String name; + private String label; + private ArrayList timeDataFormats; + + public PeriodDataType() { + + } + + public PeriodDataType(String name, String label, + ArrayList timeDataFormats) { + super(); + this.name = name; + this.label = label; + this.timeDataFormats = timeDataFormats; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public ArrayList getTimeDataFormats() { + return timeDataFormats; + } + + public void setTimeDataFormats(ArrayList timeDataFormats) { + this.timeDataFormats = timeDataFormats; + } + + @Override + public int compareTo(PeriodDataType periodDataType) { + return periodDataType.getName().compareTo(name); + } + + @Override + public String toString() { + return "PeriodDataType [name=" + name + ", label=" + label + + ", timeDataFormats=" + timeDataFormats + "]"; + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/ValueDataFormat.java b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/ValueDataFormat.java new file mode 100644 index 0000000..dd10e47 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/column/ValueDataFormat.java @@ -0,0 +1,64 @@ +package org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column; + +import java.io.Serializable; + +/** + * + * @author giancarlo email: g.panichi@isti.cnr.it + * + */ +public class ValueDataFormat implements Serializable { + + private static final long serialVersionUID = 6790236931169590842L; + + private String id; + private String example; + private String regexp; + + public ValueDataFormat() { + + } + + public ValueDataFormat(String id, String example, String regexp) { + super(); + this.id=id; + this.example = example; + this.regexp = regexp; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getExample() { + return example; + } + + public void setExample(String example) { + this.example = example; + } + + public String getRegexp() { + return regexp; + } + + public void setRegexp(String regexp) { + this.regexp = regexp; + } + + public String getLabel(){ + return id; + } + + @Override + public String toString() { + return "TimeDataFormat [id=" + id + ", example=" + example + + ", regexp=" + regexp + "]"; + } + +}