From 41508e7e8876669e913e67d0b5c98c2329147cfa Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Thu, 23 Oct 2014 16:17:59 +0000 Subject: [PATCH] Updated TRId git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widget-common-event@100928 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../td/widgetcommonevent/shared/TRId.java | 62 +++++++++++++------ .../shared/tr/TabResourceTypeMap.java | 21 +++++++ 2 files changed, 63 insertions(+), 20 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/TabResourceTypeMap.java diff --git a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/TRId.java b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/TRId.java index dba1d94..22f1489 100644 --- a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/TRId.java +++ b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/TRId.java @@ -2,6 +2,8 @@ package org.gcube.portlets.user.td.widgetcommonevent.shared; import java.io.Serializable; +import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.TabResourceType; + /** * Tabular Resoure Identification * @@ -17,11 +19,17 @@ public class TRId implements Serializable { * Tabular resource id */ private String id; + + /** + * TabResourceType: Standard, Flow.... + */ + private TabResourceType tabResourceType; + /** - * Tabular resource type + * Tabular resource type: Generic, Codelist, Dataset... */ - private String tabularResourceType; + private String tableTypeName; /** * Last view id or table id of tabular resource @@ -29,7 +37,7 @@ public class TRId implements Serializable { private String tableId; /** - * Type of last table or view + * Type of last Table or View */ private String tableType; @@ -50,7 +58,8 @@ public class TRId implements Serializable { public TRId(String id) { this.id = id; - tabularResourceType = null; + tabResourceType=null; + tableTypeName = null; tableId = null; tableType = null; referenceTargetTableId = null; @@ -58,9 +67,10 @@ public class TRId implements Serializable { } - public TRId(String id, String tableId) { + public TRId(String id, TabResourceType tabResourceType, String tableId) { this.id = id; - tabularResourceType = null; + tabResourceType=null; + tableTypeName = null; this.tableId = tableId; tableType = null; referenceTargetTableId = null; @@ -68,20 +78,20 @@ public class TRId implements Serializable { } - public TRId(String id, String tabularResourceType, String tableId, - String tableType) { + public TRId(String id, TabResourceType tabResourceType, String tableTypeName, + String tableId, String tableType) { this.id = id; - this.tabularResourceType = tabularResourceType; + this.tableTypeName = tableTypeName; this.tableId = tableId; this.tableType = tableType; referenceTargetTableId = null; viewTable = false; } - public TRId(String id, String tabularResourceType, String tableId, - String tableType, String referenceTargetTableId, boolean viewTable) { + public TRId(String id, TabResourceType tabResourceType, String tableTypeName, + String tableId, String tableType, String referenceTargetTableId, boolean viewTable) { this.id = id; - this.tabularResourceType = tabularResourceType; + this.tableTypeName = tableTypeName; this.tableId = tableId; this.tableType = tableType; this.referenceTargetTableId = referenceTargetTableId; @@ -95,13 +105,22 @@ public class TRId implements Serializable { public void setId(String id) { this.id = id; } - - public String getTabularResourceType() { - return tabularResourceType; + + + public TabResourceType getTabResourceType() { + return tabResourceType; } - public void setTabularResourceType(String tabularResourceType) { - this.tabularResourceType = tabularResourceType; + public void setTabResourceType(TabResourceType tabResourceType) { + this.tabResourceType = tabResourceType; + } + + public String getTableTypeName() { + return tableTypeName; + } + + public void setTableTypeName(String tableTypeName) { + this.tableTypeName = tableTypeName; } public String getTableId() { @@ -150,10 +169,13 @@ public class TRId implements Serializable { @Override public String toString() { - return "TRId [id=" + id + ", tabularResourceType=" - + tabularResourceType + ", tableId=" + tableId + ", tableType=" - + tableType + ", referenceTargetTableId=" + return "TRId [id=" + id + ", tabResourceType=" + tabResourceType + + ", tableTypeName=" + tableTypeName + ", tableId=" + tableId + + ", tableType=" + tableType + ", referenceTargetTableId=" + referenceTargetTableId + ", viewTable=" + viewTable + "]"; } + + + } diff --git a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/TabResourceTypeMap.java b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/TabResourceTypeMap.java new file mode 100644 index 0000000..4b6cd2a --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/tr/TabResourceTypeMap.java @@ -0,0 +1,21 @@ +package org.gcube.portlets.user.td.widgetcommonevent.shared.tr; + +/** + * + * @author giancarlo + * email: g.panichi@isti.cnr.it + * + */ +public class TabResourceTypeMap { + public static TabResourceType map(String tabResourceType){ + if(tabResourceType.compareTo(TabResourceType.FLOW.toString())==0){ + return TabResourceType.FLOW; + } else { + if(tabResourceType.compareTo(TabResourceType.STANDARD.toString())==0){ + return TabResourceType.STANDARD; + } else { + return TabResourceType.UNKNOWN; + } + } + } +}