Updated Replace By Expression
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@100140 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
2655349bed
commit
f8dfee1c57
|
@ -144,6 +144,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVFileUtil;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVParserConfiguration;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVParserConfiguration;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CheckCSVSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CheckCSVSession;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession;
|
||||||
|
@ -1135,9 +1137,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
Table table = service.getLastTable(new TabularResourceId(Long
|
Table table = service.getLastTable(new TabularResourceId(Long
|
||||||
.valueOf(trId.getId())));
|
.valueOf(trId.getId())));
|
||||||
logger.debug("Table retrieved: " + table);
|
logger.debug("Table retrieved: " + table);
|
||||||
if(table==null){
|
if (table == null) {
|
||||||
logger.error("Last Table is Null: "+ Long
|
logger.error("Last Table is Null: "
|
||||||
.valueOf(trId.getId()));
|
+ Long.valueOf(trId.getId()));
|
||||||
new TDGWTServiceException("Last Table is Null");
|
new TDGWTServiceException("Last Table is Null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3518,11 +3520,35 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
.getTabularResource(tabularResourceId);
|
.getTabularResource(tabularResourceId);
|
||||||
|
|
||||||
if (tabularResource.isLocked()) {
|
if (tabularResource.isLocked()) {
|
||||||
throw new TDGWTServiceException("Tabular Resource Is Locked");
|
throw new TDGWTIsLockedException("Tabular Resource Is Locked");
|
||||||
|
}
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new TDGWTServiceException(e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param service
|
||||||
|
* @param trId
|
||||||
|
* @throws TDGWTServiceException
|
||||||
|
*/
|
||||||
|
protected void checkTabularResourceIsFinal(TabularDataService service,
|
||||||
|
TRId trId) throws TDGWTServiceException {
|
||||||
|
try {
|
||||||
|
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||||
|
Long.valueOf(trId.getId()));
|
||||||
|
TabularResource tabularResource = service
|
||||||
|
.getTabularResource(tabularResourceId);
|
||||||
|
|
||||||
|
if (tabularResource.isFinalized()) {
|
||||||
|
throw new TDGWTIsFinalException("Tabular Resource Is Final");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (TDGWTSessionExpiredException e) {
|
|
||||||
throw e;
|
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -3650,6 +3676,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, trId);
|
checkTabularResourceLocked(service, trId);
|
||||||
|
|
||||||
|
|
||||||
// Export CSV file
|
// Export CSV file
|
||||||
OperationDefinition exportCSVFileOperation = OperationDefinitionMap
|
OperationDefinition exportCSVFileOperation = OperationDefinitionMap
|
||||||
.map(OperationsId.CSVExport.toString(), service);
|
.map(OperationsId.CSVExport.toString(), service);
|
||||||
|
@ -3703,6 +3730,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, changeColumnTypeSession
|
checkTabularResourceLocked(service, changeColumnTypeSession
|
||||||
.getColumnData().getTrId());
|
.getColumnData().getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, changeColumnTypeSession
|
||||||
|
.getColumnData().getTrId());
|
||||||
|
|
||||||
OpExecution4ChangeColumnType opEx = new OpExecution4ChangeColumnType(
|
OpExecution4ChangeColumnType opEx = new OpExecution4ChangeColumnType(
|
||||||
service, changeColumnTypeSession);
|
service, changeColumnTypeSession);
|
||||||
|
@ -3758,6 +3787,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, addColumnSession.getTrId());
|
checkTabularResourceLocked(service, addColumnSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, addColumnSession.getTrId());
|
||||||
|
|
||||||
OpExecution4AddColumn opEx = new OpExecution4AddColumn(service,
|
OpExecution4AddColumn opEx = new OpExecution4AddColumn(service,
|
||||||
addColumnSession);
|
addColumnSession);
|
||||||
|
@ -3812,6 +3842,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, deleteColumnSession.getTrId());
|
checkTabularResourceLocked(service, deleteColumnSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, deleteColumnSession.getTrId());
|
||||||
|
|
||||||
OpExecution4DeleteColumn opEx = new OpExecution4DeleteColumn(
|
OpExecution4DeleteColumn opEx = new OpExecution4DeleteColumn(
|
||||||
service, deleteColumnSession);
|
service, deleteColumnSession);
|
||||||
|
@ -3881,14 +3912,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, filterColumnSession.getColumn()
|
checkTabularResourceLocked(service, filterColumnSession.getColumn()
|
||||||
.getTrId());
|
.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, filterColumnSession
|
||||||
|
.getColumn().getTrId());
|
||||||
|
|
||||||
OpExecution4FilterColumn opEx = new OpExecution4FilterColumn(
|
OpExecution4FilterColumn opEx = new OpExecution4FilterColumn(
|
||||||
service, filterColumnSession, expression);
|
service, filterColumnSession, expression);
|
||||||
OpExecutionDirector director = new OpExecutionDirector();
|
OpExecutionDirector director = new OpExecutionDirector();
|
||||||
director.setOperationExecutionBuilder(opEx);
|
director.setOperationExecutionBuilder(opEx);
|
||||||
director.constructOperationExecution();
|
director.constructOperationExecution();
|
||||||
OperationExecution invocation = director
|
OperationExecution invocation = director.getOperationExecution();
|
||||||
.getOperationExecution();
|
|
||||||
|
|
||||||
if (invocation == null) {
|
if (invocation == null) {
|
||||||
throw new TDGWTServiceException(
|
throw new TDGWTServiceException(
|
||||||
|
@ -3932,12 +3964,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
* @return
|
* @return
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
*/
|
*/
|
||||||
public String startReplaceColumnByExpression(ReplaceColumnByExpressionSession replaceColumnByExpressionSession,
|
public String startReplaceColumnByExpression(
|
||||||
Expression conditionExpression, Expression replaceExpression,HttpSession session)
|
ReplaceColumnByExpressionSession replaceColumnByExpressionSession,
|
||||||
throws TDGWTServiceException {
|
Expression conditionExpression, Expression replaceExpression,
|
||||||
|
HttpSession session) throws TDGWTServiceException {
|
||||||
try {
|
try {
|
||||||
// HttpSession session = this.getThreadLocalRequest().getSession();
|
// HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
SessionUtil.setReplaceColumnByExpressionSession(session, replaceColumnByExpressionSession);
|
SessionUtil.setReplaceColumnByExpressionSession(session,
|
||||||
|
replaceColumnByExpressionSession);
|
||||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
if (replaceColumnByExpressionSession == null) {
|
if (replaceColumnByExpressionSession == null) {
|
||||||
logger.error("ReplaceColumnByExpressionSession is null");
|
logger.error("ReplaceColumnByExpressionSession is null");
|
||||||
|
@ -3945,36 +3979,40 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
"Error in replace column by expression: ReplaceColumnByExpressionSession is null");
|
"Error in replace column by expression: ReplaceColumnByExpressionSession is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("StartReplaceColumnByExpression: " + replaceColumnByExpressionSession);
|
logger.debug("StartReplaceColumnByExpression: "
|
||||||
|
+ replaceColumnByExpressionSession);
|
||||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, replaceColumnByExpressionSession.getColumn()
|
checkTabularResourceLocked(service,
|
||||||
.getTrId());
|
replaceColumnByExpressionSession.getColumn().getTrId());
|
||||||
|
checkTabularResourceIsFinal(service,
|
||||||
|
replaceColumnByExpressionSession.getColumn().getTrId());
|
||||||
|
|
||||||
OpExecution4ReplaceColumnByExpression opEx = new OpExecution4ReplaceColumnByExpression(
|
OpExecution4ReplaceColumnByExpression opEx = new OpExecution4ReplaceColumnByExpression(
|
||||||
service, replaceColumnByExpressionSession, conditionExpression,replaceExpression);
|
service, replaceColumnByExpressionSession,
|
||||||
|
conditionExpression, replaceExpression);
|
||||||
OpExecutionDirector director = new OpExecutionDirector();
|
OpExecutionDirector director = new OpExecutionDirector();
|
||||||
director.setOperationExecutionBuilder(opEx);
|
director.setOperationExecutionBuilder(opEx);
|
||||||
director.constructOperationExecution();
|
director.constructOperationExecution();
|
||||||
OperationExecution invocation = director
|
OperationExecution invocation = director.getOperationExecution();
|
||||||
.getOperationExecution();
|
|
||||||
|
|
||||||
if (invocation == null) {
|
if (invocation == null) {
|
||||||
throw new TDGWTServiceException(
|
throw new TDGWTServiceException(
|
||||||
"Error in invocation: Operation not supported");
|
"Error in invocation: Operation not supported");
|
||||||
}
|
}
|
||||||
Long id = Long.valueOf(replaceColumnByExpressionSession.getColumn().getTrId()
|
Long id = Long.valueOf(replaceColumnByExpressionSession.getColumn()
|
||||||
.getId());
|
.getTrId().getId());
|
||||||
|
|
||||||
TabularResourceId serviceTR = new TabularResourceId(id);
|
TabularResourceId serviceTR = new TabularResourceId(id);
|
||||||
logger.debug("OperationInvocation: \n" + invocation.toString());
|
logger.debug("OperationInvocation: \n" + invocation.toString());
|
||||||
Task trTask = service.execute(invocation, serviceTR);
|
Task trTask = service.execute(invocation, serviceTR);
|
||||||
logger.debug("Replace Column by Expression on service: TaskId " + trTask.getId());
|
logger.debug("Replace Column by Expression on service: TaskId "
|
||||||
|
+ trTask.getId());
|
||||||
|
|
||||||
TaskWrapper taskWrapper = new TaskWrapper(trTask,
|
TaskWrapper taskWrapper = new TaskWrapper(trTask,
|
||||||
UIOperationsId.ReplaceByExpression, replaceColumnByExpressionSession
|
UIOperationsId.ReplaceByExpression,
|
||||||
.getColumn().getTrId());
|
replaceColumnByExpressionSession.getColumn().getTrId());
|
||||||
SessionUtil.setStartedTask(session, taskWrapper);
|
SessionUtil.setStartedTask(session, taskWrapper);
|
||||||
return trTask.getId().getValue();
|
return trTask.getId().getValue();
|
||||||
|
|
||||||
|
@ -3986,14 +4024,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
"Security exception, you haven't rights!");
|
"Security exception, you haven't rights!");
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new TDGWTServiceException("Error in replace column by expression: "
|
throw new TDGWTServiceException(
|
||||||
|
"Error in replace column by expression: "
|
||||||
+ e.getLocalizedMessage());
|
+ e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
@ -4010,6 +4047,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, labelColumnSession.getTrId());
|
checkTabularResourceLocked(service, labelColumnSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, labelColumnSession.getTrId());
|
||||||
|
|
||||||
OpExecution4LabelColumn opEx = new OpExecution4LabelColumn(service,
|
OpExecution4LabelColumn opEx = new OpExecution4LabelColumn(service,
|
||||||
labelColumnSession);
|
labelColumnSession);
|
||||||
|
@ -4066,6 +4104,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service,
|
checkTabularResourceLocked(service,
|
||||||
changeTableTypeSession.getTrId());
|
changeTableTypeSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service,
|
||||||
|
changeTableTypeSession.getTrId());
|
||||||
|
|
||||||
OpExecution4ChangeTableType opEx = new OpExecution4ChangeTableType(
|
OpExecution4ChangeTableType opEx = new OpExecution4ChangeTableType(
|
||||||
service, changeTableTypeSession);
|
service, changeTableTypeSession);
|
||||||
|
@ -4238,6 +4278,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, deleteRowsSession.getTrId());
|
checkTabularResourceLocked(service, deleteRowsSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, deleteRowsSession.getTrId());
|
||||||
|
|
||||||
OpExecution4DeleteRows opEx = new OpExecution4DeleteRows(service,
|
OpExecution4DeleteRows opEx = new OpExecution4DeleteRows(service,
|
||||||
deleteRowsSession);
|
deleteRowsSession);
|
||||||
|
@ -4298,6 +4339,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service,
|
checkTabularResourceLocked(service,
|
||||||
cloneTabularResourceSession.getTrId());
|
cloneTabularResourceSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service,
|
||||||
|
cloneTabularResourceSession.getTrId());
|
||||||
|
|
||||||
OpExecution4Clone opEx = new OpExecution4Clone(service,
|
OpExecution4Clone opEx = new OpExecution4Clone(service,
|
||||||
cloneTabularResourceSession);
|
cloneTabularResourceSession);
|
||||||
|
@ -4379,6 +4422,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, duplicatesSession.getTrId());
|
checkTabularResourceLocked(service, duplicatesSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, duplicatesSession.getTrId());
|
||||||
|
|
||||||
OpExecution4Duplicates opEx = new OpExecution4Duplicates(service,
|
OpExecution4Duplicates opEx = new OpExecution4Duplicates(service,
|
||||||
duplicatesSession);
|
duplicatesSession);
|
||||||
|
@ -4567,6 +4611,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, tabResource.getTrId());
|
checkTabularResourceLocked(service, tabResource.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, tabResource.getTrId());
|
||||||
|
|
||||||
TabularResourceId tabularResourceId = new TabularResourceId(
|
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||||
new Long(tabResource.getTrId().getId()));
|
new Long(tabResource.getTrId().getId()));
|
||||||
|
@ -4788,6 +4833,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, templateApplySession.getTrId());
|
checkTabularResourceLocked(service, templateApplySession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, templateApplySession.getTrId());
|
||||||
|
|
||||||
TemplateId templateId = new TemplateId(templateApplySession
|
TemplateId templateId = new TemplateId(templateApplySession
|
||||||
.getTemplateData().getId());
|
.getTemplateData().getId());
|
||||||
|
@ -4877,6 +4923,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, replaceColumnSession.getTrId());
|
checkTabularResourceLocked(service, replaceColumnSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, replaceColumnSession.getTrId());
|
||||||
|
|
||||||
OpExecution4ReplaceColumn opEx = new OpExecution4ReplaceColumn(
|
OpExecution4ReplaceColumn opEx = new OpExecution4ReplaceColumn(
|
||||||
service, replaceColumnSession);
|
service, replaceColumnSession);
|
||||||
|
@ -4937,6 +4984,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service,
|
checkTabularResourceLocked(service,
|
||||||
replaceBatchColumnSession.getTrId());
|
replaceBatchColumnSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service,
|
||||||
|
replaceBatchColumnSession.getTrId());
|
||||||
|
|
||||||
OpExecution4ReplaceBatch opEx = new OpExecution4ReplaceBatch(
|
OpExecution4ReplaceBatch opEx = new OpExecution4ReplaceBatch(
|
||||||
service, replaceBatchColumnSession);
|
service, replaceBatchColumnSession);
|
||||||
|
@ -5270,6 +5319,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, trId);
|
checkTabularResourceLocked(service, trId);
|
||||||
|
checkTabularResourceIsFinal(service, trId);
|
||||||
|
|
||||||
TabularResourceId tabularResourceId = new TabularResourceId(
|
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||||
Long.valueOf(trId.getId()));
|
Long.valueOf(trId.getId()));
|
||||||
|
@ -5340,6 +5390,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, rollBackSession.getTrId());
|
checkTabularResourceLocked(service, rollBackSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, rollBackSession.getTrId());
|
||||||
|
|
||||||
TabularResourceId tabularResourceId = new TabularResourceId(
|
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||||
Long.valueOf(rollBackSession.getTrId().getId()));
|
Long.valueOf(rollBackSession.getTrId().getId()));
|
||||||
|
@ -5480,6 +5531,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, editRowSession.getTrId());
|
checkTabularResourceLocked(service, editRowSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, editRowSession.getTrId());
|
||||||
|
|
||||||
OpExecution4EditRow opEx = new OpExecution4EditRow(service,
|
OpExecution4EditRow opEx = new OpExecution4EditRow(service,
|
||||||
editRowSession);
|
editRowSession);
|
||||||
|
@ -5586,6 +5638,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, taskResubmitSession.getTrId());
|
checkTabularResourceLocked(service, taskResubmitSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, taskResubmitSession.getTrId());
|
||||||
|
|
||||||
if (taskResubmitSession.getTaskId() == null
|
if (taskResubmitSession.getTaskId() == null
|
||||||
|| taskResubmitSession.getTaskId().isEmpty()) {
|
|| taskResubmitSession.getTaskId().isEmpty()) {
|
||||||
|
@ -5636,6 +5689,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, taskResumeSession.getTrId());
|
checkTabularResourceLocked(service, taskResumeSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, taskResumeSession.getTrId());
|
||||||
|
|
||||||
if (taskResumeSession.getTaskId() == null
|
if (taskResumeSession.getTaskId() == null
|
||||||
|| taskResumeSession.getTaskId().isEmpty()) {
|
|| taskResumeSession.getTaskId().isEmpty()) {
|
||||||
|
@ -5836,6 +5890,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, splitColumnSession
|
checkTabularResourceLocked(service, splitColumnSession
|
||||||
.getColumnData().getTrId());
|
.getColumnData().getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, splitColumnSession
|
||||||
|
.getColumnData().getTrId());
|
||||||
|
|
||||||
OpExecution4SplitColumn opEx = new OpExecution4SplitColumn(service,
|
OpExecution4SplitColumn opEx = new OpExecution4SplitColumn(service,
|
||||||
splitColumnSession);
|
splitColumnSession);
|
||||||
|
@ -5896,6 +5952,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, mergeColumnSession
|
checkTabularResourceLocked(service, mergeColumnSession
|
||||||
.getColumnDataSource1().getTrId());
|
.getColumnDataSource1().getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, mergeColumnSession
|
||||||
|
.getColumnDataSource1().getTrId());
|
||||||
|
|
||||||
OpExecution4MergeColumn opEx = new OpExecution4MergeColumn(service,
|
OpExecution4MergeColumn opEx = new OpExecution4MergeColumn(service,
|
||||||
mergeColumnSession);
|
mergeColumnSession);
|
||||||
|
@ -6137,6 +6195,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
.getUsername(), aslSession.getScope()));
|
.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, codelistMappingSession.getTrId());
|
checkTabularResourceLocked(service, codelistMappingSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, codelistMappingSession.getTrId());
|
||||||
|
|
||||||
OpExecution4CodelistMapping opEx = new OpExecution4CodelistMapping(
|
OpExecution4CodelistMapping opEx = new OpExecution4CodelistMapping(
|
||||||
service, codelistMappingSession, importUrl);
|
service, codelistMappingSession, importUrl);
|
||||||
|
@ -6177,6 +6236,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, groupBySession.getTrId());
|
checkTabularResourceLocked(service, groupBySession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, groupBySession.getTrId());
|
||||||
|
|
||||||
OpExecution4GroupBy opEx = new OpExecution4GroupBy(service,
|
OpExecution4GroupBy opEx = new OpExecution4GroupBy(service,
|
||||||
groupBySession);
|
groupBySession);
|
||||||
|
@ -6231,6 +6291,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, normalizationSession.getTrId());
|
checkTabularResourceLocked(service, normalizationSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, normalizationSession.getTrId());
|
||||||
|
|
||||||
OpExecution4Normalization opEx = new OpExecution4Normalization(
|
OpExecution4Normalization opEx = new OpExecution4Normalization(
|
||||||
service, normalizationSession);
|
service, normalizationSession);
|
||||||
|
@ -6291,6 +6352,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service,
|
checkTabularResourceLocked(service,
|
||||||
denormalizationSession.getTrId());
|
denormalizationSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, denormalizationSession.getTrId());
|
||||||
|
|
||||||
OpExecution4Denormalization opEx = new OpExecution4Denormalization(
|
OpExecution4Denormalization opEx = new OpExecution4Denormalization(
|
||||||
service, denormalizationSession);
|
service, denormalizationSession);
|
||||||
|
@ -6346,6 +6408,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
checkTabularResourceLocked(service, unionSession.getTrId());
|
checkTabularResourceLocked(service, unionSession.getTrId());
|
||||||
|
checkTabularResourceIsFinal(service, unionSession.getTrId());
|
||||||
|
|
||||||
OpExecution4Union opEx = new OpExecution4Union(service,
|
OpExecution4Union opEx = new OpExecution4Union(service,
|
||||||
unionSession);
|
unionSession);
|
||||||
|
@ -6492,7 +6555,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
operationMonitorSession);
|
operationMonitorSession);
|
||||||
OperationMonitor operationMonitor = backgroundOperationMonitorCreator
|
OperationMonitor operationMonitor = backgroundOperationMonitorCreator
|
||||||
.create();
|
.create();
|
||||||
logger.debug("BackgroundOperationMonitor(): " + operationMonitor);
|
logger.debug("BackgroundOperationMonitor(): "
|
||||||
|
+ operationMonitor);
|
||||||
backgroundOperationMonitorList.add(operationMonitor);
|
backgroundOperationMonitorList.add(operationMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package org.gcube.portlets.user.td.gwtservice.shared.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ASL Session Expired Exception
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class TDGWTIsFinalException extends TDGWTServiceException {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4306091799912937920L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public TDGWTIsFinalException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
public TDGWTIsFinalException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param message
|
||||||
|
* @param t
|
||||||
|
*/
|
||||||
|
public TDGWTIsFinalException(String message,Throwable t) {
|
||||||
|
super(message,t);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package org.gcube.portlets.user.td.gwtservice.shared.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ASL Session Expired Exception
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class TDGWTIsLockedException extends TDGWTServiceException {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4306091799912937920L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public TDGWTIsLockedException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
public TDGWTIsLockedException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param message
|
||||||
|
* @param t
|
||||||
|
*/
|
||||||
|
public TDGWTIsLockedException(String message,Throwable t) {
|
||||||
|
super(message,t);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -114,11 +114,13 @@ public class OperationMonitorCreator {
|
||||||
postOperation(operationMonitor);
|
postOperation(operationMonitor);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
TaskStatus status=null;
|
TaskStatus status = null;
|
||||||
try {
|
try {
|
||||||
status=taskWrapper.getTask().getStatus();
|
status = taskWrapper.getTask().getStatus();
|
||||||
} catch(Throwable e){
|
} catch (Throwable e) {
|
||||||
logger.debug("Error retrieving task status: "+taskWrapper.getTask()+" "+e.getLocalizedMessage());
|
logger.debug("Error retrieving task status: "
|
||||||
|
+ taskWrapper.getTask() + " "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (status == null) {
|
if (status == null) {
|
||||||
|
@ -139,7 +141,7 @@ public class OperationMonitorCreator {
|
||||||
return operationMonitor;
|
return operationMonitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TaskS createTaskS() {
|
protected TaskS createTaskS() throws TDGWTServiceException {
|
||||||
TaskS taskS = new TaskS();
|
TaskS taskS = new TaskS();
|
||||||
|
|
||||||
ArrayList<JobS> jobSList = new ArrayList<JobS>();
|
ArrayList<JobS> jobSList = new ArrayList<JobS>();
|
||||||
|
@ -168,13 +170,19 @@ public class OperationMonitorCreator {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
taskS = new TaskS(taskWrapper.getTask().getId().getValue(), taskWrapper
|
try {
|
||||||
.getTask().getProgress(), TaskStateMap.map(taskWrapper
|
taskS = new TaskS(taskWrapper.getTask().getId().getValue(),
|
||||||
.getTask().getStatus()), taskWrapper.getTask().getErrorCause(),
|
taskWrapper.getTask().getProgress(),
|
||||||
taskWrapper.getTask().getSubmitter(), taskWrapper.getTask()
|
TaskStateMap.map(taskWrapper.getTask().getStatus()),
|
||||||
.getStartTime(), taskWrapper.getTask().getEndTime(),
|
taskWrapper.getTask().getErrorCause(), taskWrapper
|
||||||
jobSList);
|
.getTask().getSubmitter(), taskWrapper.getTask()
|
||||||
|
.getStartTime(),
|
||||||
|
taskWrapper.getTask().getEndTime(), jobSList);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.error("error retrieving information about the task, "+e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new TDGWTServiceException("error retrieving information about the task, "+e.getLocalizedMessage());
|
||||||
|
}
|
||||||
logger.debug("Retrieved task information");
|
logger.debug("Retrieved task information");
|
||||||
return taskS;
|
return taskS;
|
||||||
}
|
}
|
||||||
|
@ -285,18 +293,17 @@ public class OperationMonitorCreator {
|
||||||
new Long(trId.getId()));
|
new Long(trId.getId()));
|
||||||
|
|
||||||
TabularResource tr = service.getTabularResource(tabularResourceId);
|
TabularResource tr = service.getTabularResource(tabularResourceId);
|
||||||
if(tr==null){
|
if (tr == null) {
|
||||||
logger.error("Tabular Resource Null [id="+trId.getId()+"]");
|
logger.error("Tabular Resource Null [id=" + trId.getId() + "]");
|
||||||
throw new TDGWTServiceException("Tabular Resource Null "+trId);
|
throw new TDGWTServiceException("Tabular Resource Null " + trId);
|
||||||
}
|
}
|
||||||
|
|
||||||
Table table = service.getLastTable(tabularResourceId);
|
Table table = service.getLastTable(tabularResourceId);
|
||||||
if(table==null){
|
if (table == null) {
|
||||||
logger.error("Last Table Null");
|
logger.error("Last Table Null");
|
||||||
throw new TDGWTServiceException("Last Table Null for "+tr);
|
throw new TDGWTServiceException("Last Table Null for " + tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Table viewTable = null;
|
Table viewTable = null;
|
||||||
|
|
||||||
if (table.contains(DatasetViewTableMetadata.class)) {
|
if (table.contains(DatasetViewTableMetadata.class)) {
|
||||||
|
|
Loading…
Reference in New Issue