diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTService.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTService.java index 28811c8..6deee11 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTService.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTService.java @@ -53,6 +53,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.normalization.Normalizati import org.gcube.portlets.user.td.gwtservice.shared.tr.open.TDOpenSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.paging.CodelistPagingLoadConfig; import org.gcube.portlets.user.td.gwtservice.shared.tr.paging.CodelistPagingLoadResult; +import org.gcube.portlets.user.td.gwtservice.shared.tr.replacebyexternal.ReplaceByExternalSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.RemoveResourceSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDDescriptor; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDType; @@ -281,9 +282,10 @@ public interface TDGWTService extends RemoteService { * * * @param activeTRId + * @return TODO * @throws TDGWTServiceException */ - public void setActiveTabularResource(TRId activeTRId) + public TRId setActiveTabularResource(TRId activeTRId) throws TDGWTServiceException; // Task @@ -813,6 +815,18 @@ public interface TDGWTService extends RemoteService { public String startReplaceColumn(ReplaceColumnSession replaceColumnSession) throws TDGWTServiceException; + + /** + * Start replace column by external tabular resource + * + * @param replaceByExternalSession + * @return + * @throws TDGWTServiceException + */ + public String startReplaceByExternal(ReplaceByExternalSession replaceByExternalSession) + throws TDGWTServiceException; + + // Templates /** * Retrieves templates of user diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTServiceAsync.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTServiceAsync.java index 31e3c68..ac1bcc9 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTServiceAsync.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTServiceAsync.java @@ -52,6 +52,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.normalization.Normalizati import org.gcube.portlets.user.td.gwtservice.shared.tr.open.TDOpenSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.paging.CodelistPagingLoadConfig; import org.gcube.portlets.user.td.gwtservice.shared.tr.paging.CodelistPagingLoadResult; +import org.gcube.portlets.user.td.gwtservice.shared.tr.replacebyexternal.ReplaceByExternalSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.RemoveResourceSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDDescriptor; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDType; @@ -157,7 +158,7 @@ public interface TDGWTServiceAsync { void closeTabularResource(TRId closeTRId, AsyncCallback callback); - void setActiveTabularResource(TRId activeTRId, AsyncCallback callback); + void setActiveTabularResource(TRId activeTRId, AsyncCallback callback); // Task void startTaskResubmit(TaskResubmitSession taskResubmitSession, @@ -302,6 +303,9 @@ public interface TDGWTServiceAsync { // Replace Operation void startReplaceColumn(ReplaceColumnSession replaceColumnSession, AsyncCallback callback); + + void startReplaceByExternal(ReplaceByExternalSession replaceByExternalSession, + AsyncCallback callback); // Templates void getTemplates(AsyncCallback> callback); diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionConstants.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionConstants.java index 178738a..52e42fc 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionConstants.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionConstants.java @@ -66,6 +66,8 @@ public class SessionConstants { protected static final String UNION_SESSION = "UNION_SESSION"; + protected static final String REPLACE_BY_EXTERNAL_SESSION = "REPLACE_BY_EXTERNAL_SESSION"; + protected static final String STATISTICAL_OPERATION_SESSION = "STATISTICAL_OPERATION_SESSION"; protected static final String NORMALIZATION_SESSION = "NORMALIZATION_SESSION"; 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 1f2c3df..f8aa7bb 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 @@ -51,6 +51,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.groupby.TimeAggregationSe import org.gcube.portlets.user.td.gwtservice.shared.tr.normalization.DenormalizationSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.normalization.NormalizationSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.open.TDOpenSession; +import org.gcube.portlets.user.td.gwtservice.shared.tr.replacebyexternal.ReplaceByExternalSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.EditRowSession; @@ -1452,6 +1453,31 @@ public class SessionUtil { httpSession.setAttribute(SessionConstants.UNION_SESSION, unionSession); } + + // + public static ReplaceByExternalSession getReplaceByExternalSession(HttpSession httpSession) { + ReplaceByExternalSession replaceByExternalSession = (ReplaceByExternalSession) httpSession + .getAttribute(SessionConstants.REPLACE_BY_EXTERNAL_SESSION); + if (replaceByExternalSession != null) { + return replaceByExternalSession; + } else { + replaceByExternalSession = new ReplaceByExternalSession(); + httpSession.setAttribute(SessionConstants.REPLACE_BY_EXTERNAL_SESSION, + replaceByExternalSession); + return replaceByExternalSession; + } + } + + public static void setReplaceByExternalSession(HttpSession httpSession, + ReplaceByExternalSession replaceByExternalSession) { + ReplaceByExternalSession re = (ReplaceByExternalSession) httpSession + .getAttribute(SessionConstants.REPLACE_BY_EXTERNAL_SESSION); + if (re != null) { + httpSession.removeAttribute(SessionConstants.REPLACE_BY_EXTERNAL_SESSION); + } + httpSession.setAttribute(SessionConstants.REPLACE_BY_EXTERNAL_SESSION, replaceByExternalSession); + + } // diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java index 261d693..2a4b734 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java @@ -127,6 +127,7 @@ import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4MapC import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4MergeColumn; import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4Normalization; import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4ReplaceBatch; +import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4ReplaceByExternal; import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4ReplaceColumn; import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4ReplaceColumnByExpression; import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4SDMXCodelistImport; @@ -232,6 +233,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.paging.CodelistPagingLoad import org.gcube.portlets.user.td.gwtservice.shared.tr.paging.CodelistPagingLoadResult; import org.gcube.portlets.user.td.gwtservice.shared.tr.paging.Direction; import org.gcube.portlets.user.td.gwtservice.shared.tr.paging.OrderInfo; +import org.gcube.portlets.user.td.gwtservice.shared.tr.replacebyexternal.ReplaceByExternalSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.RemoveResourceSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDDescriptor; import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDType; @@ -521,24 +523,107 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * {@inheritDoc} */ @Override - public void setActiveTabularResource(TRId activeTRId) + public TRId setActiveTabularResource(TRId activeTRId) throws TDGWTServiceException { try { logger.debug("setActiveTabularResource(): " + activeTRId); HttpSession session = this.getThreadLocalRequest().getSession(); - SessionUtil.getAslSession(session); + ASLSession aslSession = SessionUtil.getAslSession(session); TabResource tabResource = SessionUtil .getFromCurrentTabularResourcesOpen(session, activeTRId); if (tabResource != null) { + AuthorizationProvider.instance.set(new AuthorizationToken( + aslSession.getUsername(), aslSession.getScope())); + TabularDataService service = TabularDataServiceFactory + .getService(); + + Table table = service.getLastTable(new TabularResourceId(Long + .valueOf(tabResource.getTrId().getId()))); + logger.debug("Table retrieved: " + table); + if (table == null) { + logger.error("Last Table is Null: " + + Long.valueOf(tabResource.getTrId().getId())); + new TDGWTServiceException("Last table is null"); + } + + Table viewTable = null; + if (table.contains(DatasetViewTableMetadata.class)) { + DatasetViewTableMetadata dwm = table + .getMetadata(DatasetViewTableMetadata.class); + logger.debug("DatasetViewTableMetadata: " + dwm); + try { + viewTable = service.getTable(dwm + .getTargetDatasetViewTableId()); + } catch (Exception e) { + logger.error("View table not found: " + + e.getLocalizedMessage()); + } + } else { + logger.debug("Table not contains DataseViewTableMetadata"); + } + TRId trIdNew=tabResource.getTrId(); + if (viewTable == null) { + logger.debug("ViewTable is null"); + String tableId=String.valueOf(table.getId().getValue()); + + if (tabResource + .getTrId() + .getTableId() + .compareTo(tableId) == 0) { + trIdNew.setTableId( + tableId); + trIdNew.setTableType( + table.getTableType().getName()); + trIdNew.setViewTable(false); + tabResource.setTrId(trIdNew); + } else { + trIdNew.setTableId( + tableId); + trIdNew.setTableType( + table.getTableType().getName()); + trIdNew.setViewTable(false); + tabResource.setTrId(trIdNew); + SessionUtil.addToCurrentTabularResourcesOpen(session, tabResource); + + } + } else { + String tableId=String.valueOf(viewTable.getId().getValue()); + if (tabResource + .getTrId() + .getTableId() + .compareTo(tableId) == 0) { + trIdNew.setTableId( + tableId); + trIdNew.setTableType( + viewTable.getTableType().getName()); + trIdNew.setReferenceTargetTableId( + String.valueOf(table.getId().getValue())); + trIdNew.setViewTable(true); + tabResource.setTrId(trIdNew); + } else { + trIdNew.setTableId( + tableId); + trIdNew.setTableType( + viewTable.getTableType().getName()); + trIdNew.setReferenceTargetTableId( + String.valueOf(table.getId().getValue())); + trIdNew.setViewTable(true); + tabResource.setTrId(trIdNew); + SessionUtil.addToCurrentTabularResourcesOpen(session, tabResource); + } + } + + // SessionUtil.setTabResource(session, tabResource); SessionUtil.setTRId(session, tabResource.getTrId()); + logger.debug("New Active: "+tabResource.getTrId()); } else { logger.error("Set Active Tabular Resource failed, no valid id!: " + activeTRId); throw new TDGWTServiceException( "Set Active Tabular Resource failed, no valid id!"); } - return; + return tabResource.getTrId(); } catch (TDGWTServiceException e) { throw e; @@ -2052,12 +2137,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements tabResource.setValid(tr.isValid()); tabResource.setFinalized(tr.isFinalized()); tabResource.setLocked(tr.isLocked()); - ArrayList> meta=new ArrayList>(); - - + ArrayList> meta = new ArrayList>(); + meta.add(new NameMetadata(tabResource.getName())); meta.add(new DescriptionMetadata(tabResource.getDescription())); - + if (tabResource.getAgency() != null && !tabResource.getAgency().isEmpty()) { meta.add(new AgencyMetadata(tabResource.getAgency())); @@ -2105,9 +2189,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } } - + tr.setAllMetadata(meta); - } @@ -5459,10 +5542,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements checkTabularResourceIsFinal(tr); logger.debug("setTabResourceInformation - old information:" + tr); - - ArrayList> meta=new ArrayList>(); - - + + ArrayList> meta = new ArrayList>(); + if (tabResource.getName() != null) { NameMetadata name = new NameMetadata(tabResource.getName()); meta.add(name); @@ -5472,7 +5554,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements DescriptionMetadata description = new DescriptionMetadata( tabResource.getDescription()); meta.add(description); - + } if (tabResource.getAgency() != null) { @@ -5495,7 +5577,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements validFromC.setTime(dateF); ValidSinceMetadata validSince = new ValidSinceMetadata(); validSince.setValue(validFromC); - meta.add(validSince); + meta.add(validSince); } catch (ParseException e) { logger.info("ValidFromMetadata is not set, no valid calendar present"); } @@ -5528,9 +5610,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } } - + tr.setAllMetadata(meta); - + if (tabResource.isFinalized()) { if (tr.isValid()) { if (!tr.isFinalized()) { @@ -7533,6 +7615,69 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } } + + + /** + * + * {@inheritDoc} + */ + @Override + public String startReplaceByExternal(ReplaceByExternalSession replaceByExternalSession) + throws TDGWTServiceException { + try { + HttpSession session = this.getThreadLocalRequest().getSession(); + SessionUtil.setReplaceByExternalSession(session, replaceByExternalSession); + ASLSession aslSession = SessionUtil.getAslSession(session); + + AuthorizationProvider.instance.set(new AuthorizationToken( + aslSession.getUsername(), aslSession.getScope())); + TabularDataService service = TabularDataServiceFactory.getService(); + + checkTRId(replaceByExternalSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(replaceByExternalSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceIsFlow(tabularResource); + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); + + OpExecution4ReplaceByExternal opEx = new OpExecution4ReplaceByExternal(service, + replaceByExternalSession); + OpExecutionDirector director = new OpExecutionDirector(); + director.setOperationExecutionBuilder(opEx); + director.constructOperationExecution(); + OperationExecution invocation = director.getOperationExecution(); + + if (invocation == null) { + throw new TDGWTServiceException( + "Error replace by external invocation: Operation not supported"); + } + + logger.debug("OperationInvocation: \n" + invocation.toString()); + Task trTask = service.execute(invocation, tabularResourceId); + logger.debug("Start Task on service: TaskId " + trTask.getId()); + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.ReplaceByExternal, replaceByExternalSession.getTrId()); + SessionUtil.setStartedTask(session, taskWrapper); + return trTask.getId().getValue(); + + } catch (TDGWTServiceException e) { + throw e; + } catch (SecurityException e) { + e.printStackTrace(); + throw new TDGWTServiceException( + "Security exception, you haven't rights!"); + } catch (Throwable e) { + e.printStackTrace(); + throw new TDGWTServiceException("Error in replace by external: " + + e.getLocalizedMessage()); + } + + } + /** * @@ -7948,8 +8093,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements HttpSession session = this.getThreadLocalRequest().getSession(); ASLSession aslSession = SessionUtil.getAslSession(session); - logger.debug("Get uri from resolver: "+uriResolverSession); - + logger.debug("Get uri from resolver: " + uriResolverSession); + UriResolverManager resolver; Map params = new HashMap(); @@ -7959,7 +8104,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements .getApplicationType().toString()); params.put("gis-UUID", uriResolverSession.getUuid()); params.put("scope", aslSession.getScope()); - logger.debug("Uri Resolver params: "+params); + logger.debug("Uri Resolver params: " + params); link = resolver.getLink(params, true); // true, link is shorted // otherwise none break; @@ -7967,8 +8112,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements break; } - - logger.debug("Retrieved Link: "+link); + + logger.debug("Retrieved Link: " + link); return link; } catch (TDGWTServiceException e) { diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/opexecution/OpExecution4ReplaceByExternal.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/opexecution/OpExecution4ReplaceByExternal.java new file mode 100644 index 0000000..d2037e9 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/opexecution/OpExecution4ReplaceByExternal.java @@ -0,0 +1,107 @@ +package org.gcube.portlets.user.td.gwtservice.server.opexecution; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationDefinition; +import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationExecution; +import org.gcube.data.analysis.tabulardata.expression.Expression; +import org.gcube.data.analysis.tabulardata.expression.composite.comparable.Equals; +import org.gcube.data.analysis.tabulardata.expression.logical.And; +import org.gcube.data.analysis.tabulardata.model.column.ColumnLocalId; +import org.gcube.data.analysis.tabulardata.model.column.ColumnReference; +import org.gcube.data.analysis.tabulardata.model.table.TableId; +import org.gcube.data.analysis.tabulardata.service.TabularDataService; +import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitionMap; +import org.gcube.portlets.user.td.gwtservice.shared.Constants; +import org.gcube.portlets.user.td.gwtservice.shared.OperationsId; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException; +import org.gcube.portlets.user.td.gwtservice.shared.tr.replacebyexternal.ReplaceByExternalColumnsMapping; +import org.gcube.portlets.user.td.gwtservice.shared.tr.replacebyexternal.ReplaceByExternalSession; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Operation Execution for replace by external tabular resource + * + * @author "Giancarlo Panichi" email: g.panichi@isti.cnr.it + * + */ +public class OpExecution4ReplaceByExternal extends OpExecutionBuilder { + protected static Logger logger = LoggerFactory + .getLogger(OpExecution4ReplaceByExternal.class); + + private TabularDataService service; + private ReplaceByExternalSession replaceByExternalSession; + + public OpExecution4ReplaceByExternal( + TabularDataService service, + ReplaceByExternalSession replaceByExternalSession) { + this.service = service; + this.replaceByExternalSession = replaceByExternalSession; + } + + @Override + public void buildOpEx() throws TDGWTServiceException { + OperationExecution invocation = null; + + logger.debug(replaceByExternalSession.toString()); + OperationDefinition operationDefinition; + Map map = new HashMap(); + + operationDefinition = OperationDefinitionMap.map( + OperationsId.ReplaceColumnByExpression.toString(), service); + + TableId currentTableId=null; + if(replaceByExternalSession.getCurrentTabularResource().getTrId().isViewTable()){ + currentTableId=new TableId(Long.valueOf(replaceByExternalSession.getCurrentTabularResource().getTrId().getReferenceTargetTableId())); + } else { + currentTableId=new TableId(Long.valueOf(replaceByExternalSession.getCurrentTabularResource().getTrId().getTableId())); + } + + TableId externalTableId=null; + if(replaceByExternalSession.getExternalTabularResource().getTrId().isViewTable()){ + externalTableId=new TableId(Long.valueOf(replaceByExternalSession.getExternalTabularResource().getTrId().getReferenceTargetTableId())); + } else { + externalTableId=new TableId(Long.valueOf(replaceByExternalSession.getExternalTabularResource().getTrId().getTableId())); + } + + ArrayList conditions=new ArrayList(); + for(ReplaceByExternalColumnsMapping colMapping:replaceByExternalSession.getColumnsMatch()){ + ColumnReference currentColumn=new ColumnReference(currentTableId, new ColumnLocalId(colMapping.getCurrentColumn().getColumnId())); + ColumnReference externalColumn=new ColumnReference(externalTableId, new ColumnLocalId(colMapping.getExternalColumn().getColumnId())); + Equals eq=new Equals(currentColumn, externalColumn); + conditions.add(eq); + } + + Expression condition=null; + if(conditions.size()<=0){ + logger.error("No columns selected"); + throw new TDGWTServiceException("No columns selected"); + } else { + if(conditions.size()==1){ + condition=conditions.get(0); + } else { + And andCond=new And(conditions); + condition=andCond; + } + } + + ColumnReference replaceColumn=new ColumnReference(externalTableId, new ColumnLocalId(replaceByExternalSession.getReplaceColumn().getColumnId())); + + map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_CONDITION, + condition); + map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_VALUE, + replaceColumn); + + invocation = new OperationExecution( + operationDefinition.getOperationId(), map); + + + operationExecutionSpec.setOp(invocation); + + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/ColumnMap.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/ColumnMap.java index 47c1fa7..aa53331 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/ColumnMap.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/ColumnMap.java @@ -106,5 +106,8 @@ public class ColumnMap { } } + + + } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/UIOperationsId.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/UIOperationsId.java index 8dc30a9..d7a3228 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/UIOperationsId.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/UIOperationsId.java @@ -87,6 +87,7 @@ public enum UIOperationsId { TimeAggregation("Time Aggregation"), ReplaceValue("Replace Value"), ReplaceByExpression("Replace By Expression"), + ReplaceByExternal("Replace By External"), ReplaceBatch("Replace Batch"), FilterColumn("Filter Column"), Union("Union"), diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/replacebyexternal/ReplaceByExternalColumnsMapping.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/replacebyexternal/ReplaceByExternalColumnsMapping.java new file mode 100644 index 0000000..1a766ca --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/replacebyexternal/ReplaceByExternalColumnsMapping.java @@ -0,0 +1,71 @@ +package org.gcube.portlets.user.td.gwtservice.shared.tr.replacebyexternal; + +import java.io.Serializable; + +import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; + +/** + * + * @author "Giancarlo Panichi" email: g.panichi@isti.cnr.it + * + */ +public class ReplaceByExternalColumnsMapping implements Serializable { + + private static final long serialVersionUID = 2795844498148679703L; + + protected String columnLabel; + protected ColumnData currentColumn; + protected ColumnData externalColumn; + + public ReplaceByExternalColumnsMapping() { + + } + + /** + * + * @param columnLabel + * @param currentColumn + * @param externalColumn + */ + public ReplaceByExternalColumnsMapping(String columnLabel, + ColumnData currentColumn, ColumnData externalColumn) { + super(); + this.columnLabel = columnLabel; + this.currentColumn = currentColumn; + this.externalColumn = externalColumn; + } + + public String getColumnLabel() { + return columnLabel; + } + + public void setColumnLabel(String columnLabel) { + this.columnLabel = columnLabel; + } + + public ColumnData getCurrentColumn() { + return currentColumn; + } + + public void setCurrentColumn(ColumnData currentColumn) { + this.currentColumn = currentColumn; + } + + public ColumnData getExternalColumn() { + return externalColumn; + } + + public void setExternalColumn(ColumnData externalColumn) { + this.externalColumn = externalColumn; + } + + @Override + public String toString() { + return "ReplaceByExternalColumnsMapping [columnLabel=" + columnLabel + + ", currentColumn=" + currentColumn + ", externalColumn=" + + externalColumn + "]"; + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/replacebyexternal/ReplaceByExternalSession.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/replacebyexternal/ReplaceByExternalSession.java new file mode 100644 index 0000000..45cef5c --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/replacebyexternal/ReplaceByExternalSession.java @@ -0,0 +1,101 @@ +package org.gcube.portlets.user.td.gwtservice.shared.tr.replacebyexternal; + +import java.io.Serializable; +import java.util.ArrayList; + +import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; +import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class ReplaceByExternalSession implements Serializable { + + private static final long serialVersionUID = 3791535835292213831L; + protected TRId trId; + protected TabResource currentTabularResource; + protected TabResource externalTabularResource; + protected ColumnData replaceColumn; + protected ArrayList columnsMatch; + + public ReplaceByExternalSession() { + + } + + /** + * + * @param trId + * @param currentTabularResource + * @param externalTabularResource + * @param replaceColumn + * @param columnsMatch + */ + public ReplaceByExternalSession(TRId trId, + TabResource currentTabularResource, + TabResource externalTabularResource, ColumnData replaceColumn, + ArrayList columnsMatch) { + super(); + this.trId = trId; + this.currentTabularResource = currentTabularResource; + this.externalTabularResource = externalTabularResource; + this.replaceColumn = replaceColumn; + this.columnsMatch = columnsMatch; + } + + public TRId getTrId() { + return trId; + } + + public void setTrId(TRId trId) { + this.trId = trId; + } + + public TabResource getCurrentTabularResource() { + return currentTabularResource; + } + + public void setCurrentTabularResource(TabResource currentTabularResource) { + this.currentTabularResource = currentTabularResource; + } + + public TabResource getExternalTabularResource() { + return externalTabularResource; + } + + public void setExternalTabularResource(TabResource externalTabularResource) { + this.externalTabularResource = externalTabularResource; + } + + public ColumnData getReplaceColumn() { + return replaceColumn; + } + + public void setReplaceColumn(ColumnData replaceColumn) { + this.replaceColumn = replaceColumn; + } + + public ArrayList getColumnsMatch() { + return columnsMatch; + } + + public void setColumnsMatch( + ArrayList columnsMatch) { + this.columnsMatch = columnsMatch; + } + + @Override + public String toString() { + return "ReplaceByExternalSession [trId=" + trId + + ", currentTabularResource=" + currentTabularResource + + ", externalTabularResource=" + externalTabularResource + + ", replaceColumn=" + replaceColumn + ", columnsMatch=" + + columnsMatch + "]"; + } + + + +}