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 8147064..2d58df9 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.codelisthelper.CodelistMappingSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession; 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 cca0c85..b70efe8 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 @@ -3683,6 +3683,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * * {@inheritDoc} */ + + //TODO public String startLabelColumn(LabelColumnSession labelColumnSession) throws TDGWTServiceException { try { @@ -3700,23 +3702,21 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements OpExecutionDirector director = new OpExecutionDirector(); director.setOperationExecutionBuilder(opEx); director.constructOperationExecution(); - OperationExecution invocation = director.getOperationExecution(); + List invocations = director + .getListOperationExecution(); - if (invocation == null) { - throw new TDGWTServiceException( - "Error Changing the Column Label: Operation not supported for now!"); + if (invocations == null) { + throw new TDGWTServiceException("Operation not supported"); } - TabularResourceId serviceTR = new TabularResourceId( - Long.valueOf(labelColumnSession.getColumnData().getTrId() + Long.valueOf(labelColumnSession.getTrId() .getId())); - logger.debug("OperationInvocation: \n" + invocation.toString()); - Task trTask = service.execute(invocation, serviceTR); + logger.debug("OperationInvocation: \n" + invocations); + Task trTask = service.executeBatch(invocations, serviceTR); logger.debug("Start Task on service: TaskId " + trTask.getId()); - TaskWrapper taskWrapper = new TaskWrapper(trTask, UIOperationsId.ChangeColumnLabel, labelColumnSession - .getColumnData().getTrId()); + .getTrId()); SessionUtil.setTaskStarted(session, taskWrapper); return trTask.getId().getValue(); diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/opexecution/OpExecution4LabelColumn.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/opexecution/OpExecution4LabelColumn.java index c597c65..f9d1e2c 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/opexecution/OpExecution4LabelColumn.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/opexecution/OpExecution4LabelColumn.java @@ -1,5 +1,6 @@ package org.gcube.portlets.user.td.gwtservice.server.opexecution; +import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -11,6 +12,7 @@ import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitio 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.ColumnData; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.LabelColumnSession; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,24 +39,32 @@ public class OpExecution4LabelColumn extends OpExecutionBuilder { @Override public void buildOpEx() throws TDGWTServiceException { - OperationExecution invocation = null; + logger.debug("LabelColumnSession :" + labelColumnSession); + ArrayList invocations = new ArrayList(); - logger.debug(labelColumnSession.toString()); - OperationDefinition operationDefinition; - Map map = new HashMap(); + HashMap columnsMaps = labelColumnSession.getMaps(); - ImmutableLocalizedText localizedText = new ImmutableLocalizedText( - labelColumnSession.getLabel()); + for (ColumnData key : columnsMaps.keySet()) { + OperationExecution invocation = null; - map.put(Constants.NAME_PARAMETER_ID, localizedText); + OperationDefinition operationDefinition; + Map map = new HashMap(); - operationDefinition = OperationDefinitionMap.map( - OperationsId.ColumnNameAdd.toString(), service); + ImmutableLocalizedText localizedText = new ImmutableLocalizedText( + columnsMaps.get(key)); - invocation = new OperationExecution(labelColumnSession.getColumnData() - .getColumnId(), operationDefinition.getOperationId(), map); - - operationExecutionSpec.setOp(invocation); + map.put(Constants.NAME_PARAMETER_ID, localizedText); + + operationDefinition = OperationDefinitionMap.map( + OperationsId.ColumnNameAdd.toString(), service); + + invocation = new OperationExecution(key.getColumnId(), + operationDefinition.getOperationId(), map); + + invocations.add(invocation); + + } + operationExecutionSpec.setOps(invocations); } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/column/LabelColumnSession.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/column/LabelColumnSession.java index 153de12..a7bd7ab 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/column/LabelColumnSession.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/column/LabelColumnSession.java @@ -1,43 +1,53 @@ package org.gcube.portlets.user.td.gwtservice.shared.tr.column; import java.io.Serializable; +import java.util.HashMap; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; /** * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * */ public class LabelColumnSession implements Serializable { - + private static final long serialVersionUID = -1896235499708614266L; - - protected ColumnData columnData; - protected String label; - - - public String getLabel() { - return label; + + protected TRId trId; + protected HashMap maps; + + public LabelColumnSession() { + } - public void setLabel(String label) { - this.label = label; + + public LabelColumnSession(TRId trId, HashMap maps) { + super(); + this.trId = trId; + this.maps = maps; } - public ColumnData getColumnData() { - return columnData; + + public TRId getTrId() { + return trId; } - public void setColumnData(ColumnData columnData) { - this.columnData = columnData; + + public void setTrId(TRId trId) { + this.trId = trId; } - + + public HashMap getMaps() { + return maps; + } + + public void setMaps(HashMap maps) { + this.maps = maps; + } + @Override public String toString() { - return "LabelColumnSession [columnData=" + columnData + ", label=" - + label + "]"; + return "LabelColumnSession [trId=" + trId + ", maps=" + maps + "]"; } - - - - + }