From d65634135a5f629642f12976fe80227df0dcb18e Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Thu, 26 Mar 2015 19:56:41 +0000 Subject: [PATCH] Minor Update git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@113765 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../td/gwtservice/server/SessionUtil.java | 7 +- .../opexecution/OpExecution4AddColumn.java | 4 +- .../ExtractCodelistOperationMap.java | 4 +- .../extract/ExtractCodelistTargetColumn.java | 10 +- .../td/gwtservice/shared/tr/ColumnMockUp.java | 312 ++++++++++++++++++ .../td/gwtservice/shared/tr/DefNewColumn.java | 194 ----------- .../shared/tr/column/AddColumnSession.java | 10 +- 7 files changed, 330 insertions(+), 211 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/ColumnMockUp.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/DefNewColumn.java diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java index d6f8377..09a7028 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java @@ -17,6 +17,7 @@ import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper; import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession; import org.gcube.portlets.user.td.gwtservice.server.file.CodelistMappingFileUploadSession; import org.gcube.portlets.user.td.gwtservice.server.trservice.TRTasksManager; +import org.gcube.portlets.user.td.gwtservice.shared.Constants; import org.gcube.portlets.user.td.gwtservice.shared.chart.ChartTopRatingSession; import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession; @@ -87,10 +88,10 @@ public class SessionUtil { ASLSession session; if (username == null) { logger.warn("no user found in session, using test one"); - throw new TDGWTSessionExpiredException("Session Expired!"); + /*throw new TDGWTSessionExpiredException("Session Expired!"); */ // Remove comment for Test - /* + username = Constants.DEFAULT_USER; String scope = Constants.DEFAULT_SCOPE; @@ -98,7 +99,7 @@ public class SessionUtil { session = SessionManager.getInstance().getASLSession( httpSession.getId(), username); session.setScope(scope); - */ + } else { session = SessionManager.getInstance().getASLSession( httpSession.getId(), username); diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/opexecution/OpExecution4AddColumn.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/opexecution/OpExecution4AddColumn.java index d89c31a..28a26f1 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/opexecution/OpExecution4AddColumn.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/opexecution/OpExecution4AddColumn.java @@ -13,7 +13,7 @@ import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitio import org.gcube.portlets.user.td.gwtservice.server.trservice.TDTypeValueMap; import org.gcube.portlets.user.td.gwtservice.shared.Constants; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException; -import org.gcube.portlets.user.td.gwtservice.shared.tr.DefNewColumn; +import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnMockUp; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.AddColumnSession; import org.gcube.portlets.user.td.widgetcommonevent.shared.operations.OperationsId; import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType; @@ -52,7 +52,7 @@ public class OpExecution4AddColumn extends OpExecutionBuilder { Map map = new HashMap(); - DefNewColumn defNewColumn = addColumnSession.getColumn(); + ColumnMockUp defNewColumn = addColumnSession.getColumn(); ColumnTypeCode type = defNewColumn.getColumnType(); diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/ExtractCodelistOperationMap.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/ExtractCodelistOperationMap.java index 11fde4f..2af99b6 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/ExtractCodelistOperationMap.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/ExtractCodelistOperationMap.java @@ -19,7 +19,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.Constants; import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession; import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistTargetColumn; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; -import org.gcube.portlets.user.td.gwtservice.shared.tr.DefNewColumn; +import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnMockUp; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode; import org.slf4j.Logger; @@ -64,7 +64,7 @@ public class ExtractCodelistOperationMap { columnSourceId); if (target.isNewColumn()) { HashMap column_definition = new HashMap(); - DefNewColumn defNewColumn = target.getDefColumn(); + ColumnMockUp defNewColumn = target.getDefColumn(); ColumnTypeCode columnTypeCode = defNewColumn.getColumnType(); ColumnType columnType = ColumnTypeCodeMap .getColumnType(columnTypeCode); diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/extract/ExtractCodelistTargetColumn.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/extract/ExtractCodelistTargetColumn.java index fa8da3d..5c6b323 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/extract/ExtractCodelistTargetColumn.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/extract/ExtractCodelistTargetColumn.java @@ -3,7 +3,7 @@ package org.gcube.portlets.user.td.gwtservice.shared.extract; import java.io.Serializable; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; -import org.gcube.portlets.user.td.gwtservice.shared.tr.DefNewColumn; +import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnMockUp; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; /** @@ -19,7 +19,7 @@ public class ExtractCodelistTargetColumn implements Serializable { protected ColumnData sourceColumn; protected ColumnData targetColumn; protected TRId codelist; - protected DefNewColumn defColumn; + protected ColumnMockUp defColumn; public ExtractCodelistTargetColumn() { @@ -33,7 +33,7 @@ public class ExtractCodelistTargetColumn implements Serializable { this.codelist = codelist; } - public ExtractCodelistTargetColumn(ColumnData sourceColumn, DefNewColumn defNewColumn) { + public ExtractCodelistTargetColumn(ColumnData sourceColumn, ColumnMockUp defNewColumn) { this.newColumn = true; this.sourceColumn = sourceColumn; this.defColumn=defNewColumn; @@ -71,11 +71,11 @@ public class ExtractCodelistTargetColumn implements Serializable { this.codelist = codelist; } - public DefNewColumn getDefColumn() { + public ColumnMockUp getDefColumn() { return defColumn; } - public void setDefColumn(DefNewColumn defColumn) { + public void setDefColumn(ColumnMockUp defColumn) { this.defColumn = defColumn; } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/ColumnMockUp.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/ColumnMockUp.java new file mode 100644 index 0000000..cc07c8d --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/ColumnMockUp.java @@ -0,0 +1,312 @@ +package org.gcube.portlets.user.td.gwtservice.shared.tr; + +import java.io.Serializable; + +import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression; +import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType; +import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode; + +/** + * + * @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() { + + } + + /** + * 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 isHasExpression() { + 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/gwtservice/shared/tr/DefNewColumn.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/DefNewColumn.java deleted file mode 100644 index b1b546b..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/DefNewColumn.java +++ /dev/null @@ -1,194 +0,0 @@ -package org.gcube.portlets.user.td.gwtservice.shared.tr; - -import java.io.Serializable; - -import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType; -import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode; - - - -/** - * - * @author "Giancarlo Panichi" - * - */ -public class DefNewColumn implements Serializable { - - private static final long serialVersionUID = 7467523779864189492L; - - protected String id;// For grid and combo only; - protected ColumnTypeCode columnType; - protected ColumnDataType columnDataType; - protected String defaultValue; - protected String label; - protected String localeName; - - protected PeriodDataType timeDimensionType; - protected ColumnData codelistColumnReference; - - public DefNewColumn() { - - } - - /** - * For Code, CodeDescription and Annotation Column - * - * @param label - * @param columnType - * @param localeName - * @param defaultValue - */ - public DefNewColumn(String label, ColumnTypeCode columnType, - String defaultValue) { - this.id = "1"; - this.label = label; - this.columnType = columnType; - this.defaultValue = defaultValue; - } - - /** - * For Attribute and Measure Column - * - * @param label - * @param columnType - * @param localeName - * @param defaultValue - */ - public DefNewColumn(String label, ColumnTypeCode columnType, - ColumnDataType columnDataType, String defaultValue) { - this.id = "1"; - this.label = label; - this.columnType = columnType; - this.columnDataType = columnDataType; - this.defaultValue = defaultValue; - } - - /** - * For CodeName Column - * - * @param label - * @param columnType - * @param localeName - * @param defaultValue - */ - public DefNewColumn(String label, ColumnTypeCode columnType, - String localeName, String defaultValue) { - this.id = "1"; - this.label = label; - this.columnType = columnType; - this.localeName = localeName; - this.defaultValue = defaultValue; - } - - /** - * For Dimension - * - * - * @param label - * @param columnType - * @param timeDimensionType - * @param defaultValue - */ - public DefNewColumn(String label, ColumnTypeCode columnType, - ColumnData codelistColumnReference, String defaultValue) { - this.id = "1"; - this.label = label; - this.columnType = columnType; - this.codelistColumnReference = codelistColumnReference; - this.defaultValue = defaultValue; - - } - - /** - * For TimeDimension - * - * - * @param label - * @param columnType - * @param timeDimensionType - * @param defaultValue - */ - public DefNewColumn(String label, ColumnTypeCode columnType, - PeriodDataType timeDimensionType, String defaultValue) { - this.id = "1"; - this.label = label; - this.columnType = columnType; - this.timeDimensionType = timeDimensionType; - this.defaultValue = defaultValue; - - } - - 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; - } - - @Override - public String toString() { - return "DefNewColumn [id=" + id + ", columnType=" + columnType - + ", columnDataType=" + columnDataType + ", defaultValue=" - + defaultValue + ", label=" + label + ", localeName=" - + localeName + ", timeDimensionType=" + timeDimensionType - + ", codelistColumnReference=" + codelistColumnReference + "]"; - } - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/column/AddColumnSession.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/column/AddColumnSession.java index b46926e..27d8ade 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/column/AddColumnSession.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/column/AddColumnSession.java @@ -2,7 +2,7 @@ package org.gcube.portlets.user.td.gwtservice.shared.tr.column; import java.io.Serializable; -import org.gcube.portlets.user.td.gwtservice.shared.tr.DefNewColumn; +import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnMockUp; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; /** @@ -16,14 +16,14 @@ public class AddColumnSession implements Serializable { private static final long serialVersionUID = -1896235499708614266L; private TRId trId; - private DefNewColumn column; + private ColumnMockUp column; public AddColumnSession(){ } - public AddColumnSession(TRId trId,DefNewColumn column){ + public AddColumnSession(TRId trId,ColumnMockUp column){ this.trId=trId; this.column=column; } @@ -36,11 +36,11 @@ public class AddColumnSession implements Serializable { this.trId = trId; } - public DefNewColumn getColumn() { + public ColumnMockUp getColumn() { return column; } - public void setColumn(DefNewColumn column) { + public void setColumn(ColumnMockUp column) { this.column = column; }