From 342f1b317836db5db93af899a8f7b24096a7eb66 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Fri, 16 May 2014 15:27:14 +0000 Subject: [PATCH] Minor Update git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@95802 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../gwtservice/server/TDGWTServiceImpl.java | 450 +++++++++--------- .../gwtservice/shared/task/InvocationS.java | 71 +++ .../user/td/gwtservice/shared/task/JobS.java | 6 +- 3 files changed, 290 insertions(+), 237 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/InvocationS.java 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 352905a..ef3afc3 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.shared.sdmx.SDMXImportSession; import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts; import org.gcube.portlets.user.td.gwtservice.shared.share.ShareInfo; import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource; +import org.gcube.portlets.user.td.gwtservice.shared.task.InvocationS; import org.gcube.portlets.user.td.gwtservice.shared.task.JobS; import org.gcube.portlets.user.td.gwtservice.shared.task.State; import org.gcube.portlets.user.td.gwtservice.shared.task.TaskS; @@ -194,7 +195,6 @@ import org.slf4j.LoggerFactory; import com.google.gwt.user.server.rpc.RemoteServiceServlet; - /** * * @author "Giancarlo Panichi" parameterInstance = csvImportFileParameter( fileUrlOnStorage, fileUploadSession, csvImportSession); @@ -2667,7 +2659,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements .getUsername())); TabularDataService service = TabularDataServiceFactory.getService(); - // Import CSV file OperationDefinition importCSVFileOperation = OperationDefinitionMap @@ -2796,9 +2787,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } logger.debug("getImportMonitor(): " + importMonitor); return importMonitor; - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException( @@ -2915,9 +2906,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements .getId()))); return sdf.format(tr.getCreationDate().getTime()); - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { logger.error( "Error in getTRCreationDate(): " + e.getLocalizedMessage(), @@ -2951,7 +2942,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("IsTabularResourceValid: " + tr.isValid()); return tr.isValid(); } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { logger.error("Error checking if it is a valid tabular resource: " + e.getLocalizedMessage(), e); @@ -3025,9 +3016,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("GetTRMetadata retrived: " + listTRMetadata.size()); return listTRMetadata; - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { logger.error( "Error in getTRMetadata(): " + e.getLocalizedMessage(), e); @@ -3067,8 +3058,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements ArrayList vList = new ArrayList(); int i = 0; for (Validation v : vals) { - valid = new Validations(String.valueOf(i), v.getDescription(), - v.isValid()); + valid = new Validations(String.valueOf(i), + v.getDescription(), v.isValid()); vList.add(valid); i++; } @@ -3079,9 +3070,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("TabValidationsMetadata: " + tabValidationsMetadata); return tabValidationsMetadata; - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { logger.error( "Error in getTableValidationMetadata(): " @@ -3206,9 +3197,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } return listTabMetadata; - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { logger.error( "Error in getTableMetadata(): " + e.getLocalizedMessage(), @@ -3462,7 +3453,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("getExportMonitor(): " + exportMonitor); return exportMonitor; - + } catch (TDGWTSessionExpiredException e) { throw e; } catch (Throwable e) { @@ -3517,7 +3508,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements .getUsername())); TabularDataService service = TabularDataServiceFactory.getService(); - // Export CSV file OperationDefinition exportCSVFileOperation = OperationDefinitionMap .map(OperationsId.CSVExport.toString(), service); @@ -3649,7 +3639,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("getExportMonitor(): " + exportMonitor); return exportMonitor; - + } catch (TDGWTSessionExpiredException e) { throw e; } catch (Throwable e) { @@ -3716,7 +3706,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throws TDGWTServiceException { OperationExecution invocation = null; - logger.debug(changeColumnTypeSession.toString()); OperationDefinition operationDefinition; @@ -3727,16 +3716,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements switch (type) { case ANNOTATION: operationDefinition = OperationDefinitionMap.map( - OperationsId.ChangeToAnnotationColumn.toString(), - service); + OperationsId.ChangeToAnnotationColumn.toString(), service); invocation = new OperationExecution(changeColumnTypeSession .getColumnData().getColumnId(), operationDefinition.getOperationId(), map); break; case ATTRIBUTE: operationDefinition = OperationDefinitionMap.map( - OperationsId.ChangeToAttributeColumn.toString(), - service); + OperationsId.ChangeToAttributeColumn.toString(), service); map.put(Constants.PARAMETER_TARGET_DATA_TYPE, ColumnDataTypeMap .map(changeColumnTypeSession.getColumnDataTypeTarget())); @@ -3753,8 +3740,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements break; case CODEDESCRIPTION: operationDefinition = OperationDefinitionMap.map( - OperationsId.ChangeToCodeDescription.toString(), - service); + OperationsId.ChangeToCodeDescription.toString(), service); invocation = new OperationExecution(changeColumnTypeSession .getColumnData().getColumnId(), operationDefinition.getOperationId(), map); @@ -3771,8 +3757,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements break; case DIMENSION: operationDefinition = OperationDefinitionMap.map( - OperationsId.ChangeToDimensionColumn.toString(), - service); + OperationsId.ChangeToDimensionColumn.toString(), service); ColumnData col = changeColumnTypeSession .getCodelistColumnReference(); logger.debug("ReferenceColumn To Set: " + col); @@ -3789,9 +3774,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements operationDefinition.getOperationId(), map); break; case MEASURE: - operationDefinition = OperationDefinitionMap - .map(OperationsId.ChangeToMeasureColumn.toString(), - service); + operationDefinition = OperationDefinitionMap.map( + OperationsId.ChangeToMeasureColumn.toString(), service); map.put(Constants.PARAMETER_TARGET_DATA_TYPE, ColumnDataTypeMap .map(changeColumnTypeSession.getColumnDataTypeTarget())); @@ -3838,8 +3822,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements if (replaceColumnSession.isReplaceDimension()) { logger.debug("Is a Replace of view column"); operationDefinition = OperationDefinitionMap.map( - OperationsId.ReplaceColumnByExpression.toString(), - service); + OperationsId.ReplaceColumnByExpression.toString(), service); Expression condition = ExpressionGenerator .genReplaceValueParameterCondition(replaceColumnSession); @@ -3860,8 +3843,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Is a Replace of basic column"); operationDefinition = OperationDefinitionMap.map( - OperationsId.ReplaceColumnByExpression.toString(), - service); + OperationsId.ReplaceColumnByExpression.toString(), service); Expression condition = ExpressionGenerator .genReplaceValueParameterCondition(replaceColumnSession); @@ -3880,56 +3862,53 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements return invocation; } - - + /** * Retrieve OperationExecution for change column type * * @param replaceColumnSession * @return */ - //TODO Check this operation + // TODO Check this operation protected OperationExecution retrieveOperationExecution( - TabularDataService service, - EditRowSession editRowSession) + TabularDataService service, EditRowSession editRowSession) throws TDGWTServiceException { OperationExecution invocation = null; logger.debug(editRowSession.toString()); OperationDefinition operationDefinition; - + Map map = new HashMap(); - ValueMap valueMap=new ValueMap(); - ArrayList> compositeValue=valueMap.genValueMap(editRowSession); - + ValueMap valueMap = new ValueMap(); + ArrayList> compositeValue = valueMap + .genValueMap(editRowSession); + if (editRowSession.isNewRow()) { logger.debug("Is a add row"); operationDefinition = OperationDefinitionMap.map( - OperationsId.AddRow.toString(), - service); - - map.put(Constants.PARAMETER_ADD_ROW_COMPOSITE, - compositeValue); - - invocation = new OperationExecution(operationDefinition.getOperationId(), map); - + OperationsId.AddRow.toString(), service); + + map.put(Constants.PARAMETER_ADD_ROW_COMPOSITE, compositeValue); + + invocation = new OperationExecution( + operationDefinition.getOperationId(), map); + } else { logger.debug("Is a edit row"); - + operationDefinition = OperationDefinitionMap.map( OperationsId.ModifyTuplesValuesByExpression.toString(), service); - - map.put(Constants.PARAMETER_ADD_ROW_COMPOSITE, - compositeValue); - - invocation = new OperationExecution(operationDefinition.getOperationId(), map); + + map.put(Constants.PARAMETER_ADD_ROW_COMPOSITE, compositeValue); + + invocation = new OperationExecution( + operationDefinition.getOperationId(), map); } return invocation; } - /** * Retrieve OperationExecution for change column type @@ -3946,7 +3925,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements for (ReplaceEntry re : replaceBatchColumnSession.getReplaceEntryList()) { OperationExecution invocation = null; - logger.debug(replaceBatchColumnSession.toString()); OperationDefinition operationDefinition; @@ -4015,7 +3993,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throws TDGWTServiceException { logger.debug(deleteColumnSession.toString()); - + OperationDefinition operationDefinition; operationDefinition = OperationDefinitionMap.map( OperationsId.RemoveColumn.toString(), service); @@ -4068,8 +4046,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements switch (duplicatesSession.getDuplicateOp()) { case VALIDATE: operationDefinition = OperationDefinitionMap.map( - OperationsId.DuplicateTupleValidation.toString(), - service); + OperationsId.DuplicateTupleValidation.toString(), service); map.put(Constants.PARAMETER_KEY, columnReferences); @@ -4078,9 +4055,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements break; case DELETE: - operationDefinition = OperationDefinitionMap - .map(OperationsId.RemoveDuplicateTuples.toString(), - service); + operationDefinition = OperationDefinitionMap.map( + OperationsId.RemoveDuplicateTuples.toString(), service); map.put(Constants.PARAMETER_KEY, columnReferences); @@ -4225,9 +4201,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Start Task on service: TaskId " + trTask.getId()); SessionUtil.setChangeColumnTypeTask(session, trTask); return; - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error in ChangeColumnType: " @@ -4332,9 +4308,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setChangeColumnTypeTask(session, task); } - logger.debug("ChangeColumnTypeMonitor(): " + changeColumnTypeMonitor); + logger.debug("ChangeColumnTypeMonitor(): " + + changeColumnTypeMonitor); return changeColumnTypeMonitor; - + } catch (TDGWTSessionExpiredException e) { throw e; } catch (Throwable e) { @@ -4376,7 +4353,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Start Task on service: TaskId " + trTask.getId()); SessionUtil.setDeleteColumnTask(session, trTask); return; - + } catch (TDGWTSessionExpiredException e) { throw e; } catch (Throwable e) { @@ -4484,7 +4461,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("DeleteColumnMonitor(): " + deleteColumnMonitor); return deleteColumnMonitor; - + } catch (TDGWTSessionExpiredException e) { throw e; } catch (Throwable e) { @@ -4678,7 +4655,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setChangeTableTypeTask(session, trTask); return; } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error Changing Table Type: " @@ -4901,7 +4878,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } return columns; } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { logger.error( "Error in getColumnsForDimension() retrieving Columns: " @@ -4942,7 +4919,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setDeleteRowsTask(session, trTask); return; } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error Deleting Rows: " @@ -5117,7 +5094,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements return trId; } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException("Error Cloning: " @@ -5157,7 +5134,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setDuplicatesTask(session, trTask); return; } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException( @@ -5342,9 +5319,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements String[] usersArray = users.toArray(new String[0]); logger.debug("Share with Users: " + users); service.share(serviceTR, usersArray); - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (SecurityException e) { e.printStackTrace(); throw new TDGWTServiceException(e.getLocalizedMessage()); @@ -5397,9 +5374,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements tabResource.getRight()); tr.setMetadata(rights); } - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { logger.debug("Error in setTabResourceInformation: " + e.getLocalizedMessage()); @@ -5434,7 +5411,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Retrieved Occurences"); return occurences; - + } catch (TDGWTSessionExpiredException e) { throw e; } catch (Throwable e) { @@ -5493,7 +5470,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Retrieved TemplateData List"); return templateDataList; - + } catch (TDGWTSessionExpiredException e) { throw e; } catch (Throwable e) { @@ -5530,9 +5507,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements Task task = service.applyTemplate(templateId, tabularResourceId); logger.debug("startTemplateApply task start"); SessionUtil.setTemplateApplyTask(session, task); - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { logger.debug("Error StartTemplateApply: " + e.getLocalizedMessage()); e.printStackTrace(); @@ -5640,7 +5617,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("TemplateApplyMonitor(): " + templateApplyMonitor); return templateApplyMonitor; - + } catch (TDGWTSessionExpiredException e) { throw e; } catch (Throwable e) { @@ -5672,9 +5649,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements templateId = new TemplateId(template.getId()); service.remove(templateId); } - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (NoSuchTemplateException e) { logger.debug("Error StartTemplateDelete: No such Template"); e.printStackTrace(); @@ -5720,9 +5697,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Start Task on service: TaskId " + trTask.getId()); SessionUtil.setReplaceColumnTask(session, trTask); return; - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { e.printStackTrace(); throw new TDGWTServiceException( @@ -5830,7 +5807,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("ReplaceColumnMonitor(): " + replaceColumnMonitor); return replaceColumnMonitor; - + } catch (TDGWTSessionExpiredException e) { throw e; } catch (Throwable e) { @@ -5879,7 +5856,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Start Task on service: TaskId " + trTask.getId()); SessionUtil.setReplaceBatchColumnTask(session, trTask); return; - + } catch (TDGWTSessionExpiredException e) { throw e; } catch (Throwable e) { @@ -5995,7 +5972,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("ReplaceBatchColumnMonitor(): " + replaceBatchColumnMonitor); return replaceBatchColumnMonitor; - + } catch (TDGWTSessionExpiredException e) { throw e; } catch (Throwable e) { @@ -6027,9 +6004,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("locales :" + locales); return locales; - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { logger.debug("getLocales(): " + e.getLocalizedMessage()); e.printStackTrace(); @@ -6086,9 +6063,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Last Operation Info :" + op); return op; - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { logger.debug("getLastOperationInfo(): " + e.getLocalizedMessage()); e.printStackTrace(); @@ -6140,9 +6117,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } logger.debug("Last Operation Info :" + op); return op; - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { logger.debug("getLastOperationInfo(): " + e.getLocalizedMessage()); e.printStackTrace(); @@ -6200,9 +6177,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("History :" + opHistoryList); return opHistoryList; - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { logger.debug("getHistory(): " + e.getLocalizedMessage()); e.printStackTrace(); @@ -6254,9 +6231,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("History :" + opHistoryList); return opHistoryList; - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { logger.debug("getHistory(): " + e.getLocalizedMessage()); e.printStackTrace(); @@ -6264,8 +6241,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements + e.getLocalizedMessage()); } } - - + /** * * {@inheritDoc} @@ -6275,7 +6251,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements try { HttpSession session = this.getThreadLocalRequest().getSession(); ASLSession aslSession = SessionUtil.getAslSession(session); - + logger.debug("discard(): " + trId); AuthorizationProvider.instance.set(new AuthorizationToken( @@ -6338,7 +6314,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements try { HttpSession session = this.getThreadLocalRequest().getSession(); ASLSession aslSession = SessionUtil.getAslSession(session); - + logger.debug("rollBack(): " + rollBackSession); SessionUtil.setRollBackSession(session, rollBackSession); @@ -6360,7 +6336,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setRollBackSessionTask(session, trTask); return; } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { logger.debug("rollBack(): " + e.getLocalizedMessage()); e.printStackTrace(); @@ -6482,7 +6458,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements try { HttpSession session = this.getThreadLocalRequest().getSession(); ASLSession aslSession = SessionUtil.getAslSession(session); - + logger.debug("GetTableValidationsMetadata on " + trId.toString()); AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername())); @@ -6499,14 +6475,23 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements int i = 1; ArrayList validations = new ArrayList(); for (ValidationDescriptor val : job.getValidations()) { - Validations validation = new Validations(String.valueOf(i), - val.getDescription(), val.isValid()); + Validations validation = new Validations( + String.valueOf(i), val.getDescription(), + val.isValid()); validations.add(validation); i++; } + InvocationS invocationS=null; + if (job.getInvocation() != null) { + invocationS = new InvocationS(job.getInvocation() + .getColumnId(), job.getInvocation() + .getIdentifier(), job.getInvocation() + .getOperationId(), job.getInvocation() + .getParameters()); + } JobS jobS = new JobS(String.valueOf(j), job.getProgress(), job.getHumaReadableStatus(), job.getDescription(), - validations); + validations,invocationS); jobSList.add(jobS); j++; @@ -6525,7 +6510,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements + validationsTasksMetadata); return validationsTasksMetadata; } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { logger.error( "Error in getValidationsTasksMetadata(): " @@ -6536,7 +6521,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } } - @Override public void startEditRow(EditRowSession editRowSession) throws TDGWTServiceException { @@ -6556,31 +6540,30 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements "Error in invocation: Operation not supported"); } Long id; - if(editRowSession.getTrId().isViewTable()){ - id=Long.valueOf(editRowSession.getTrId().getReferenceTargetTableId()); + if (editRowSession.getTrId().isViewTable()) { + id = Long.valueOf(editRowSession.getTrId() + .getReferenceTargetTableId()); } else { - id=Long.valueOf(editRowSession.getTrId().getId()); + id = Long.valueOf(editRowSession.getTrId().getId()); } - - TabularResourceId serviceTR = new TabularResourceId( - id); + + TabularResourceId serviceTR = new TabularResourceId(id); logger.debug("OperationInvocation: \n" + invocation.toString()); Task trTask = service.execute(invocation, serviceTR); logger.debug("Start Task on service: TaskId " + trTask.getId()); SessionUtil.setEditRowTask(session, trTask); return; - + } catch (TDGWTSessionExpiredException e) { - throw e; + throw e; } catch (Throwable e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Error in operation: " - + e.getLocalizedMessage()); + throw new TDGWTServiceException("Error in operation: " + + e.getLocalizedMessage()); } - + } - + @Override public EditRowMonitor getEditRowMonitor() throws TDGWTServiceException { try { @@ -6673,15 +6656,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } catch (TDGWTSessionExpiredException e) { throw e; } catch (Throwable e) { - logger.debug("Error in EditRowMonitor: " - + e.getLocalizedMessage()); + logger.debug("Error in EditRowMonitor: " + e.getLocalizedMessage()); e.printStackTrace(); - throw new TDGWTServiceException("Error: " - + e.getLocalizedMessage()); + throw new TDGWTServiceException("Error: " + e.getLocalizedMessage()); } } - } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/InvocationS.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/InvocationS.java new file mode 100644 index 0000000..519cac7 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/InvocationS.java @@ -0,0 +1,71 @@ +package org.gcube.portlets.user.td.gwtservice.shared.task; + +import java.io.Serializable; +import java.util.Map; + +/** + * + * @author "Giancarlo Panichi" + * + */ +public class InvocationS implements Serializable { + + private static final long serialVersionUID = -7112348181058962879L; + + protected String columnId; + protected long operationId; + protected Long identifier; + protected Map parameters; + + public InvocationS(){ + + } + + public InvocationS(String columnId,long operationId,Long identifier,Map parameters){ + this.columnId=columnId; + this.operationId=operationId; + this.identifier=identifier; + this.parameters=parameters; + } + + + public String getColumnId() { + return columnId; + } + + public void setColumnId(String columnId) { + this.columnId = columnId; + } + + public long getOperationId() { + return operationId; + } + + public void setOperationId(long operationId) { + this.operationId = operationId; + } + + public Long getIdentifier() { + return identifier; + } + + public void setIdentifier(Long identifier) { + this.identifier = identifier; + } + + public Map getParameters() { + return parameters; + } + + public void setParameters(Map parameters) { + this.parameters = parameters; + } + + @Override + public String toString() { + return "InvocationS [columnId=" + columnId + ", operationId=" + + operationId + ", identifier=" + identifier + ", parameters=" + + parameters + "]"; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/JobS.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/JobS.java index a1c150d..680e7f8 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/JobS.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/JobS.java @@ -19,18 +19,20 @@ public class JobS implements Serializable { protected String humaReadableStatus; protected String description; protected ArrayList validations; - + protected InvocationS invocation; + public JobS() { } public JobS(String id, float progress, String humaReadableStatus, String description, - ArrayList validations) { + ArrayList validations, InvocationS invocation) { this.id=id; this.progress=progress; this.humaReadableStatus=humaReadableStatus; this.description=description; this.validations=validations; + this.invocation=invocation; } public String getId() {