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 a39219d..46d703a 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 @@ -3795,31 +3795,27 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements return parameterInstances; } + protected void checkTRId(TRId trId) throws TDGWTServiceException { + if (trId == null) { + logger.error("TRId is null"); + new TDGWTServiceException("No valid tabular resource id present"); + } + + if (trId.getId() == null || trId.getId().isEmpty()) { + logger.error("TRId not valid: " + trId); + new TDGWTServiceException("No valid tabular resource id present"); + } + } + /** * * @param service * @param trId * @throws TDGWTServiceException */ - protected void checkTabularResourceLocked(TabularDataService service, - TRId trId) throws TDGWTServiceException { + protected void checkTabularResourceLocked(TabularResource tabularResource) + throws TDGWTServiceException { try { - if (trId == null) { - logger.error("TRId is null"); - new TDGWTServiceException( - "No valid tabular resource id present"); - } - - if (trId.getId() == null || trId.getId().isEmpty()) { - logger.error("TRId not valid: " + trId); - new TDGWTServiceException( - "No valid tabular resource id present"); - } - - TabularResourceId tabularResourceId = new TabularResourceId( - Long.valueOf(trId.getId())); - TabularResource tabularResource = service - .getTabularResource(tabularResourceId); if (tabularResource.isLocked()) { logger.error("Tabular Resource Is Locked"); @@ -3842,14 +3838,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * @param trId * @throws TDGWTServiceException */ - protected void checkTabularResourceIsFinal(TabularDataService service, - TRId trId) throws TDGWTServiceException { + protected void checkTabularResourceIsFinal(TabularResource tabularResource) + throws TDGWTServiceException { try { - TabularResourceId tabularResourceId = new TabularResourceId( - Long.valueOf(trId.getId())); - TabularResource tabularResource = service - .getTabularResource(tabularResourceId); - if (tabularResource.isFinalized()) { logger.error("Tabular Resource Is Final"); throw new TDGWTIsFinalException("Tabular Resource Is Final"); @@ -3907,7 +3898,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, trId); + checkTRId(trId); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(trId.getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); // Export SDMX Codelist OperationDefinition exportSDMXOperation = OperationDefinitionMap @@ -3971,7 +3969,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, trId); + + checkTRId(trId); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(trId.getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); OpExecution4CSVExport opEx = new OpExecution4CSVExport(session, service, exportSession); @@ -4039,7 +4045,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, trId); + checkTRId(trId); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(trId.getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); OpExecution4JSONExport opEx = new OpExecution4JSONExport(session, service, exportSession); @@ -4097,10 +4110,17 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, changeColumnTypeSession - .getColumnData().getTrId()); - checkTabularResourceIsFinal(service, changeColumnTypeSession - .getColumnData().getTrId()); + + checkTRId(changeColumnTypeSession.getColumnData().getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(changeColumnTypeSession.getColumnData() + .getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4ChangeColumnType opEx = new OpExecution4ChangeColumnType( service, changeColumnTypeSession); @@ -4155,8 +4175,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, addColumnSession.getTrId()); - checkTabularResourceIsFinal(service, addColumnSession.getTrId()); + checkTRId(addColumnSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(addColumnSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4AddColumn opEx = new OpExecution4AddColumn(service, addColumnSession); @@ -4210,8 +4237,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, deleteColumnSession.getTrId()); - checkTabularResourceIsFinal(service, deleteColumnSession.getTrId()); + + checkTRId(deleteColumnSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(deleteColumnSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4DeleteColumn opEx = new OpExecution4DeleteColumn( service, deleteColumnSession); @@ -4279,10 +4314,17 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, filterColumnSession.getColumn() - .getTrId()); - checkTabularResourceIsFinal(service, filterColumnSession - .getColumn().getTrId()); + + checkTRId(filterColumnSession.getColumn().getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(filterColumnSession.getColumn().getTrId() + .getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4FilterColumn opEx = new OpExecution4FilterColumn( service, filterColumnSession, expression); @@ -4353,10 +4395,17 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, - replaceColumnByExpressionSession.getColumn().getTrId()); - checkTabularResourceIsFinal(service, - replaceColumnByExpressionSession.getColumn().getTrId()); + + checkTRId(replaceColumnByExpressionSession.getColumn().getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(replaceColumnByExpressionSession.getColumn() + .getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4ReplaceColumnByExpression opEx = new OpExecution4ReplaceColumnByExpression( service, replaceColumnByExpressionSession, @@ -4421,8 +4470,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, labelColumnSession.getTrId()); - checkTabularResourceIsFinal(service, labelColumnSession.getTrId()); + + checkTRId(labelColumnSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(labelColumnSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4LabelColumn opEx = new OpExecution4LabelColumn(service, labelColumnSession); @@ -4477,10 +4534,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, - changeTableTypeSession.getTrId()); - checkTabularResourceIsFinal(service, - changeTableTypeSession.getTrId()); + + checkTRId(changeTableTypeSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(changeTableTypeSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4ChangeTableType opEx = new OpExecution4ChangeTableType( service, changeTableTypeSession); @@ -4652,8 +4715,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, deleteRowsSession.getTrId()); - checkTabularResourceIsFinal(service, deleteRowsSession.getTrId()); + + checkTRId(deleteRowsSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(deleteRowsSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4DeleteRows opEx = new OpExecution4DeleteRows(service, deleteRowsSession); @@ -4712,8 +4783,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements + cloneTabularResourceSession); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, - cloneTabularResourceSession.getTrId()); + + checkTRId(cloneTabularResourceSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(cloneTabularResourceSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); OpExecution4Clone opEx = new OpExecution4Clone(service, cloneTabularResourceSession); @@ -4794,8 +4872,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, duplicatesSession.getTrId()); - checkTabularResourceIsFinal(service, duplicatesSession.getTrId()); + + checkTRId(duplicatesSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(duplicatesSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4Duplicates opEx = new OpExecution4Duplicates(service, duplicatesSession); @@ -5049,13 +5135,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, tabResource.getTrId()); - checkTabularResourceIsFinal(service, tabResource.getTrId()); + + checkTRId(tabResource.getTrId()); TabularResourceId tabularResourceId = new TabularResourceId( - new Long(tabResource.getTrId().getId())); - + Long.valueOf(tabResource.getTrId().getId())); TabularResource tr = service.getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tr); + checkTabularResourceIsFinal(tr); + logger.debug("setTabResourceInformation - old information:" + tr); if (tabResource.getName() != null) { @@ -5311,13 +5400,20 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, templateApplySession.getTrId()); - checkTabularResourceIsFinal(service, templateApplySession.getTrId()); + + checkTRId(templateApplySession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(templateApplySession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); TemplateId templateId = new TemplateId(templateApplySession .getTemplateData().getId()); - TabularResourceId tabularResourceId = new TabularResourceId( - new Long(templateApplySession.getTrId().getId())); + Task trTask = service.applyTemplate(templateId, tabularResourceId); logger.debug("startTemplateApply task start"); @@ -5401,8 +5497,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, replaceColumnSession.getTrId()); - checkTabularResourceIsFinal(service, replaceColumnSession.getTrId()); + + checkTRId(replaceColumnSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(replaceColumnSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4ReplaceColumn opEx = new OpExecution4ReplaceColumn( service, replaceColumnSession); @@ -5461,10 +5565,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, - replaceBatchColumnSession.getTrId()); - checkTabularResourceIsFinal(service, - replaceBatchColumnSession.getTrId()); + + checkTRId(replaceBatchColumnSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(replaceBatchColumnSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4ReplaceBatch opEx = new OpExecution4ReplaceBatch( service, replaceBatchColumnSession); @@ -5797,13 +5907,17 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, trId); - checkTabularResourceIsFinal(service, trId); + + checkTRId(trId); TabularResourceId tabularResourceId = new TabularResourceId( Long.valueOf(trId.getId())); TabularResource tabularResource = service .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); + List history = tabularResource.getHistory(); long historyId = 0; @@ -5900,11 +6014,17 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, rollBackSession.getTrId()); - checkTabularResourceIsFinal(service, rollBackSession.getTrId()); + + checkTRId(rollBackSession.getTrId()); TabularResourceId tabularResourceId = new TabularResourceId( Long.valueOf(rollBackSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); + HistoryStepId historyStepId = new HistoryStepId( rollBackSession.getHistoryId()); logger.debug("Start RollBack task:" @@ -6045,8 +6165,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, editRowSession.getTrId()); - checkTabularResourceIsFinal(service, editRowSession.getTrId()); + + checkTRId(editRowSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(editRowSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4EditRow opEx = new OpExecution4EditRow(service, editRowSession); @@ -6152,8 +6280,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, taskResubmitSession.getTrId()); - checkTabularResourceIsFinal(service, taskResubmitSession.getTrId()); + + checkTRId(taskResubmitSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(taskResubmitSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); if (taskResubmitSession.getTaskId() == null || taskResubmitSession.getTaskId().isEmpty()) { @@ -6203,8 +6339,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, taskResumeSession.getTrId()); - checkTabularResourceIsFinal(service, taskResumeSession.getTrId()); + + checkTRId(taskResumeSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(taskResumeSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); if (taskResumeSession.getTaskId() == null || taskResumeSession.getTaskId().isEmpty()) { @@ -6345,8 +6489,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, - extractCodelistSession.getTrId()); + checkTRId(extractCodelistSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(extractCodelistSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); OpExecution4ExtractCodelist opEx = new OpExecution4ExtractCodelist( service, extractCodelistSession); @@ -6403,10 +6553,17 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, splitColumnSession - .getColumnData().getTrId()); - checkTabularResourceIsFinal(service, splitColumnSession - .getColumnData().getTrId()); + + checkTRId(splitColumnSession.getColumnData().getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(splitColumnSession.getColumnData().getTrId() + .getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4SplitColumn opEx = new OpExecution4SplitColumn(service, splitColumnSession); @@ -6420,12 +6577,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException( "Error in invocation: Operation not supported"); } - Long id = Long.valueOf(splitColumnSession.getColumnData().getTrId() - .getId()); - TabularResourceId serviceTR = new TabularResourceId(id); logger.debug("OperationInvocation: \n" + invocations.toString()); - Task trTask = service.executeBatch(invocations, serviceTR); + Task trTask = service.executeBatch(invocations, tabularResourceId); logger.debug("Split Column on service: TaskId " + trTask.getId()); TaskWrapper taskWrapper = new TaskWrapper(trTask, @@ -6465,10 +6619,17 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, mergeColumnSession - .getColumnDataSource1().getTrId()); - checkTabularResourceIsFinal(service, mergeColumnSession - .getColumnDataSource1().getTrId()); + + checkTRId(mergeColumnSession.getColumnDataSource1().getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(mergeColumnSession.getColumnDataSource1() + .getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4MergeColumn opEx = new OpExecution4MergeColumn(service, mergeColumnSession); @@ -6483,12 +6644,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements "Error in invocation: Operation not supported"); } - Long id = Long.valueOf(mergeColumnSession.getColumnDataSource1() - .getTrId().getId()); - - TabularResourceId serviceTR = new TabularResourceId(id); logger.debug("OperationInvocation: \n" + invocations.toString()); - Task trTask = service.executeBatch(invocations, serviceTR); + Task trTask = service.executeBatch(invocations, tabularResourceId); logger.debug("Merge Column on service: TaskId " + trTask.getId()); TaskWrapper taskWrapper = new TaskWrapper(trTask, @@ -6709,8 +6866,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken(aslSession .getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, codelistMappingSession.getTrId()); - checkTabularResourceIsFinal(service, codelistMappingSession.getTrId()); + + checkTRId(codelistMappingSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(codelistMappingSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4CodelistMapping opEx = new OpExecution4CodelistMapping( service, codelistMappingSession, importUrl); @@ -6723,11 +6888,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException( "Error in invocation: Operation not supported"); } - Long id = Long.valueOf(codelistMappingSession.getTrId().getId()); - TabularResourceId serviceTR = new TabularResourceId(id); logger.debug("OperationInvocation: \n" + invocation.toString()); - Task trTask = service.execute(invocation, serviceTR); + Task trTask = service.execute(invocation, tabularResourceId); logger.debug("Codelist Mapping Import on service: TaskId " + trTask.getId()); TaskWrapper taskWrapper = new TaskWrapper(trTask, @@ -6750,8 +6913,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, groupBySession.getTrId()); - checkTabularResourceIsFinal(service, groupBySession.getTrId()); + + checkTRId(groupBySession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(groupBySession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4GroupBy opEx = new OpExecution4GroupBy(service, groupBySession); @@ -6764,11 +6935,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException( "Error in invocation: Operation not supported"); } - Long id = Long.valueOf(groupBySession.getTrId().getId()); - TabularResourceId serviceTR = new TabularResourceId(id); logger.debug("OperationInvocation: \n" + invocation.toString()); - Task trTask = service.execute(invocation, serviceTR); + Task trTask = service.execute(invocation, tabularResourceId); logger.debug("GroupBy start on service: TaskId " + trTask.getId()); TaskWrapper taskWrapper = new TaskWrapper(trTask, UIOperationsId.GroupBy, groupBySession.getTrId()); @@ -6805,8 +6974,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, normalizationSession.getTrId()); - checkTabularResourceIsFinal(service, normalizationSession.getTrId()); + + checkTRId(normalizationSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(normalizationSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4Normalization opEx = new OpExecution4Normalization( service, normalizationSession); @@ -6819,11 +6996,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException( "Error in invocation: Operation not supported"); } - Long id = Long.valueOf(normalizationSession.getTrId().getId()); - TabularResourceId serviceTR = new TabularResourceId(id); logger.debug("OperationInvocation: \n" + invocation.toString()); - Task trTask = service.execute(invocation, serviceTR); + Task trTask = service.execute(invocation, tabularResourceId); logger.debug("Normalization start on service: TaskId " + trTask.getId()); @@ -6865,10 +7040,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, - denormalizationSession.getTrId()); - checkTabularResourceIsFinal(service, - denormalizationSession.getTrId()); + + checkTRId(denormalizationSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(denormalizationSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4Denormalization opEx = new OpExecution4Denormalization( service, denormalizationSession); @@ -6881,11 +7062,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException( "Error in invocation: Operation not supported"); } - Long id = Long.valueOf(denormalizationSession.getTrId().getId()); - TabularResourceId serviceTR = new TabularResourceId(id); logger.debug("OperationInvocation: \n" + invocation.toString()); - Task trTask = service.execute(invocation, serviceTR); + Task trTask = service.execute(invocation, tabularResourceId); logger.debug("Denormalization start on service: TaskId " + trTask.getId()); TaskWrapper taskWrapper = new TaskWrapper(trTask, @@ -6923,8 +7102,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, unionSession.getTrId()); - checkTabularResourceIsFinal(service, unionSession.getTrId()); + + checkTRId(unionSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(unionSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + checkTabularResourceIsFinal(tabularResource); OpExecution4Union opEx = new OpExecution4Union(service, unionSession); @@ -6938,10 +7125,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements "Error Union invocation: Operation not supported"); } - TabularResourceId serviceTR = new TabularResourceId( - Long.valueOf(unionSession.getTrId().getId())); logger.debug("OperationInvocation: \n" + invocation.toString()); - Task trTask = service.execute(invocation, serviceTR); + Task trTask = service.execute(invocation, tabularResourceId); logger.debug("Start Task on service: TaskId " + trTask.getId()); TaskWrapper taskWrapper = new TaskWrapper(trTask, UIOperationsId.Union, unionSession.getTrId()); @@ -7101,9 +7286,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, trId); + + checkTRId(trId); + TabularResourceId tabularResourceId = new TabularResourceId( - Long.parseLong(trId.getId())); + Long.valueOf(trId.getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); List resources = service .getResources(tabularResourceId); @@ -7137,9 +7328,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, trId); + + checkTRId(trId); + TabularResourceId tabularResourceId = new TabularResourceId( - Long.parseLong(trId.getId())); + Long.valueOf(trId.getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); + ResourceType resourceType = ResourceTDTypeMap .getResourceType(resourceTDType); @@ -7178,7 +7376,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); TabularDataService service = TabularDataServiceFactory.getService(); - checkTabularResourceLocked(service, mapCreationSession.getTrId()); + + checkTRId(mapCreationSession.getTrId()); + + TabularResourceId tabularResourceId = new TabularResourceId( + Long.valueOf(mapCreationSession.getTrId().getId())); + TabularResource tabularResource = service + .getTabularResource(tabularResourceId); + + checkTabularResourceLocked(tabularResource); OpExecution4MapCreation opEx = new OpExecution4MapCreation(service, mapCreationSession); @@ -7192,10 +7398,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements "Error Generate Map invocation: Operation not supported"); } - TabularResourceId serviceTR = new TabularResourceId( - Long.valueOf(mapCreationSession.getTrId().getId())); logger.debug("OperationInvocation: \n" + invocation.toString()); - Task trTask = service.execute(invocation, serviceTR); + Task trTask = service.execute(invocation, tabularResourceId); logger.debug("Start Task on service: TaskId " + trTask.getId()); TaskWrapper taskWrapper = new TaskWrapper(trTask, @@ -7216,8 +7420,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } } - - + /** * */ @@ -7226,27 +7429,27 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throws TDGWTServiceException { try { String link = ""; - + HttpSession session = this.getThreadLocalRequest().getSession(); ASLSession aslSession = SessionUtil.getAslSession(session); UriResolverManager resolver; Map params = new HashMap(); - - switch(uriResolverSession.getApplicationType()){ + + switch (uriResolverSession.getApplicationType()) { case GIS: - resolver= new UriResolverManager( - uriResolverSession.getApplicationType().toString()); + resolver = new UriResolverManager(uriResolverSession + .getApplicationType().toString()); params.put("gis-UUID", uriResolverSession.getUuid()); params.put("scope", aslSession.getScope()); - link = resolver.getLink(params, true); // true, link is shorted otherwise none + link = resolver.getLink(params, true); // true, link is shorted + // otherwise none break; default: break; } - - + return link; } catch (TDGWTServiceException e) { @@ -7257,8 +7460,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements "Security exception, you haven't rights!"); } catch (Throwable e) { e.printStackTrace(); - throw new TDGWTServiceException("Error retrieving uri from resolver: " - + e.getLocalizedMessage()); + throw new TDGWTServiceException( + "Error retrieving uri from resolver: " + + e.getLocalizedMessage()); } }