Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@97609 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
53ffaf35da
commit
cf26fb2986
|
@ -360,7 +360,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
.getTabularResource(new TabularResourceId(Long
|
.getTabularResource(new TabularResourceId(Long
|
||||||
.valueOf(currentTR.getTrId().getId())));
|
.valueOf(currentTR.getTrId().getId())));
|
||||||
|
|
||||||
|
|
||||||
currentTR.setDate(sdf.format(tr.getCreationDate().getTime()));
|
currentTR.setDate(sdf.format(tr.getCreationDate().getTime()));
|
||||||
currentTR.setValid(tr.isValid());
|
currentTR.setValid(tr.isValid());
|
||||||
currentTR.setFinalized(tr.isFinalized());
|
currentTR.setFinalized(tr.isFinalized());
|
||||||
|
@ -2561,8 +2560,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
"Error retrieving the session: null");
|
"Error retrieving the session: null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FileUploadMonitor fileUploadMonitor = SessionUtil
|
FileUploadMonitor fileUploadMonitor = SessionUtil
|
||||||
.getFileUploadMonitor(session);
|
.getFileUploadMonitor(session);
|
||||||
if (fileUploadMonitor == null) {
|
if (fileUploadMonitor == null) {
|
||||||
|
@ -2988,8 +2985,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
Constants.FILE_CSV_MIMETYPE);
|
Constants.FILE_CSV_MIMETYPE);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
FileUploadMonitor fum = SessionUtil.getFileUploadMonitor(session);
|
FileUploadMonitor fum = SessionUtil.getFileUploadMonitor(session);
|
||||||
fum.setFailed(
|
fum.setFailed("An error occured elaborating the file",
|
||||||
"An error occured elaborating the file",
|
|
||||||
FileUtil.exceptionDetailMessage(e));
|
FileUtil.exceptionDetailMessage(e));
|
||||||
SessionUtil.setFileUploadMonitor(session, fum);
|
SessionUtil.setFileUploadMonitor(session, fum);
|
||||||
fileUploadSession.setFileUploadState(FileUploadState.FAILED);
|
fileUploadSession.setFileUploadState(FileUploadState.FAILED);
|
||||||
|
@ -3002,8 +2998,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
logger.trace("changing state");
|
logger.trace("changing state");
|
||||||
FileUploadMonitor fum = SessionUtil.getFileUploadMonitor(session);
|
FileUploadMonitor fum = SessionUtil.getFileUploadMonitor(session);
|
||||||
fum.setState(
|
fum.setState(FileUploadState.COMPLETED);
|
||||||
FileUploadState.COMPLETED);
|
|
||||||
SessionUtil.setFileUploadMonitor(session, fum);
|
SessionUtil.setFileUploadMonitor(session, fum);
|
||||||
SessionUtil.setCSVFileUploadSession(session, fileUploadSession);
|
SessionUtil.setCSVFileUploadSession(session, fileUploadSession);
|
||||||
}
|
}
|
||||||
|
@ -4516,30 +4511,28 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
ArrayList<Expression> expressions = splitColumnSession.getExpressions();
|
ArrayList<Expression> expressions = splitColumnSession.getExpressions();
|
||||||
|
|
||||||
if (expressions == null || expressions.size() <= 1) {
|
if (expressions == null || expressions.size() <= 1) {
|
||||||
throw new TDGWTServiceException("No valid expressions in splitColumnSession");
|
throw new TDGWTServiceException(
|
||||||
|
"No valid expressions in splitColumnSession");
|
||||||
}
|
}
|
||||||
|
|
||||||
map1.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
map1.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE, ColumnTypeCodeMap
|
||||||
ColumnTypeCodeMap.getColumnType(splitColumnSession.getFirstSplitColumnType()));
|
.getColumnType(splitColumnSession.getFirstSplitColumnType()));
|
||||||
map1.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
map1.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE, ColumnDataTypeMap
|
||||||
ColumnDataTypeMap.map(splitColumnSession.getFirstSplitColumnDataType()));
|
.map(splitColumnSession.getFirstSplitColumnDataType()));
|
||||||
map1.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
map1.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||||
new ImmutableLocalizedText(splitColumnSession.getLabel1()));
|
new ImmutableLocalizedText(splitColumnSession.getLabel1()));
|
||||||
map1.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
map1.put(Constants.PARAMETER_ADD_COLUMN_VALUE, expressions.get(0));
|
||||||
expressions.get(0));
|
invocations.add(new OperationExecution(operationDefinition
|
||||||
invocations.add(new OperationExecution(
|
.getOperationId(), map1));
|
||||||
operationDefinition.getOperationId(), map1));
|
map2.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE, ColumnTypeCodeMap
|
||||||
map2.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
.getColumnType(splitColumnSession.getSecondSplitColumnType()));
|
||||||
ColumnTypeCodeMap.getColumnType(splitColumnSession.getSecondSplitColumnType()));
|
map2.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE, ColumnDataTypeMap
|
||||||
map2.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
.map(splitColumnSession.getSecondSplitColumnDataType()));
|
||||||
ColumnDataTypeMap.map(splitColumnSession.getSecondSplitColumnDataType()));
|
|
||||||
map2.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
map2.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||||
new ImmutableLocalizedText(splitColumnSession.getLabel2()));
|
new ImmutableLocalizedText(splitColumnSession.getLabel2()));
|
||||||
map2.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
map2.put(Constants.PARAMETER_ADD_COLUMN_VALUE, expressions.get(1));
|
||||||
expressions.get(1));
|
invocations.add(new OperationExecution(operationDefinition
|
||||||
invocations.add(new OperationExecution(
|
.getOperationId(), map2));
|
||||||
operationDefinition.getOperationId(), map2));
|
|
||||||
|
|
||||||
|
|
||||||
return invocations;
|
return invocations;
|
||||||
}
|
}
|
||||||
|
@ -4564,24 +4557,22 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
Expression expression = mergeColumnSession.getExpression();
|
Expression expression = mergeColumnSession.getExpression();
|
||||||
if (expression == null) {
|
if (expression == null) {
|
||||||
throw new TDGWTServiceException("No valid expression in splitColumnSession");
|
throw new TDGWTServiceException(
|
||||||
|
"No valid expression in splitColumnSession");
|
||||||
}
|
}
|
||||||
|
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE, ColumnTypeCodeMap
|
||||||
ColumnTypeCodeMap.getColumnType(mergeColumnSession.getMergeColumnType()));
|
.getColumnType(mergeColumnSession.getMergeColumnType()));
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE, ColumnDataTypeMap
|
||||||
ColumnDataTypeMap.map(mergeColumnSession.getMergeColumnDataType()));
|
.map(mergeColumnSession.getMergeColumnDataType()));
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||||
new ImmutableLocalizedText(mergeColumnSession.getLabel()));
|
new ImmutableLocalizedText(mergeColumnSession.getLabel()));
|
||||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, expression);
|
||||||
expression);
|
|
||||||
invocation = new OperationExecution(
|
invocation = new OperationExecution(
|
||||||
operationDefinition.getOperationId(), map);
|
operationDefinition.getOperationId(), map);
|
||||||
|
|
||||||
|
|
||||||
return invocation;
|
return invocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5967,6 +5958,38 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean checkTabularResourceNotFinal(TRId trId)
|
||||||
|
throws TDGWTServiceException {
|
||||||
|
try {
|
||||||
|
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
|
logger.debug("checkTabularResourceNotFinal: " + trId);
|
||||||
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
|
aslSession.getUsername()));
|
||||||
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
|
||||||
|
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||||
|
new Long(trId.getId()));
|
||||||
|
TabularResource tr = service.getTabularResource(tabularResourceId);
|
||||||
|
|
||||||
|
return tr.isFinalized();
|
||||||
|
|
||||||
|
} catch (TDGWTSessionExpiredException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new TDGWTServiceException(e.getLocalizedMessage());
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.debug("Error in checkTabularResourceNotFinal: "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new TDGWTServiceException(
|
||||||
|
"Error in checkTabularResourceNotFinal: "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
@ -7451,7 +7474,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
SessionUtil.setTaskResubmitTask(session, trTask);
|
SessionUtil.setTaskResubmitTask(session, trTask);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
} catch (TDGWTSessionExpiredException e) {
|
} catch (TDGWTSessionExpiredException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
|
@ -7556,8 +7578,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
logger.debug("TaskResubmitMonitor(): " + taskResubmitMonitor);
|
logger.debug("TaskResubmitMonitor(): " + taskResubmitMonitor);
|
||||||
return taskResubmitMonitor;
|
return taskResubmitMonitor;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (TDGWTSessionExpiredException e) {
|
} catch (TDGWTSessionExpiredException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -7868,8 +7888,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
public void startSplitColumn(SplitColumnSession splitColumnSession, HttpSession session)
|
public void startSplitColumn(SplitColumnSession splitColumnSession,
|
||||||
throws TDGWTServiceException {
|
HttpSession session) throws TDGWTServiceException {
|
||||||
try {
|
try {
|
||||||
// HttpSession session = this.getThreadLocalRequest().getSession();
|
// HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
SessionUtil.setSplitColumnSession(session, splitColumnSession);
|
SessionUtil.setSplitColumnSession(session, splitColumnSession);
|
||||||
|
@ -7885,8 +7905,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername()));
|
aslSession.getUsername()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
|
||||||
ArrayList<OperationExecution> invocations = retrieveOperationExecution(service,
|
ArrayList<OperationExecution> invocations = retrieveOperationExecution(
|
||||||
splitColumnSession);
|
service, splitColumnSession);
|
||||||
if (invocations == null) {
|
if (invocations == null) {
|
||||||
throw new TDGWTServiceException(
|
throw new TDGWTServiceException(
|
||||||
"Error in invocation: Operation not supported");
|
"Error in invocation: Operation not supported");
|
||||||
|
@ -7962,7 +7982,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
logger.debug("Task Result:" + task.getResult());
|
logger.debug("Task Result:" + task.getResult());
|
||||||
splitColumnMonitor.setProgress(task.getProgress());
|
splitColumnMonitor.setProgress(task.getProgress());
|
||||||
trId = new TRId();
|
trId = new TRId();
|
||||||
trId.setId(splitColumnSession.getColumnData().getTrId().getId());
|
trId.setId(splitColumnSession.getColumnData().getTrId()
|
||||||
|
.getId());
|
||||||
trId = retrieveTabularResourceBasicData(trId);
|
trId = retrieveTabularResourceBasicData(trId);
|
||||||
splitColumnMonitor.setTrId(trId);
|
splitColumnMonitor.setTrId(trId);
|
||||||
tabResource = SessionUtil.getTabResource(session);
|
tabResource = SessionUtil.getTabResource(session);
|
||||||
|
@ -8016,8 +8037,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
public void startMergeColumn(MergeColumnSession mergeColumnSession, HttpSession session)
|
public void startMergeColumn(MergeColumnSession mergeColumnSession,
|
||||||
throws TDGWTServiceException {
|
HttpSession session) throws TDGWTServiceException {
|
||||||
try {
|
try {
|
||||||
// HttpSession session = this.getThreadLocalRequest().getSession();
|
// HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
SessionUtil.setMergeColumnSession(session, mergeColumnSession);
|
SessionUtil.setMergeColumnSession(session, mergeColumnSession);
|
||||||
|
@ -8110,7 +8131,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
logger.debug("Task Result:" + task.getResult());
|
logger.debug("Task Result:" + task.getResult());
|
||||||
mergeColumnMonitor.setProgress(task.getProgress());
|
mergeColumnMonitor.setProgress(task.getProgress());
|
||||||
trId = new TRId();
|
trId = new TRId();
|
||||||
trId.setId(mergeColumnSession.getColumnData().getTrId().getId());
|
trId.setId(mergeColumnSession.getColumnData().getTrId()
|
||||||
|
.getId());
|
||||||
trId = retrieveTabularResourceBasicData(trId);
|
trId = retrieveTabularResourceBasicData(trId);
|
||||||
mergeColumnMonitor.setTrId(trId);
|
mergeColumnMonitor.setTrId(trId);
|
||||||
tabResource = SessionUtil.getTabResource(session);
|
tabResource = SessionUtil.getTabResource(session);
|
||||||
|
@ -8131,8 +8153,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
case STOPPED:
|
case STOPPED:
|
||||||
logger.debug("Task Result:" + task.getResult());
|
logger.debug("Task Result:" + task.getResult());
|
||||||
mergeColumnMonitor.setProgress(task.getProgress());
|
mergeColumnMonitor.setProgress(task.getProgress());
|
||||||
trId = retrieveTabularResourceBasicData(mergeColumnSession.getColumnData()
|
trId = retrieveTabularResourceBasicData(mergeColumnSession
|
||||||
.getTrId());
|
.getColumnData().getTrId());
|
||||||
|
|
||||||
mergeColumnMonitor.setTrId(trId);
|
mergeColumnMonitor.setTrId(trId);
|
||||||
tabResource = SessionUtil.getTabResource(session);
|
tabResource = SessionUtil.getTabResource(session);
|
||||||
|
@ -8248,8 +8270,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
wi.getName(), Constants.FILE_XML_MIMETYPE);
|
wi.getName(), Constants.FILE_XML_MIMETYPE);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
FileUploadMonitor fum = SessionUtil.getFileUploadMonitor(session);
|
FileUploadMonitor fum = SessionUtil.getFileUploadMonitor(session);
|
||||||
fum.setFailed(
|
fum.setFailed("An error occured elaborating the file",
|
||||||
"An error occured elaborating the file",
|
|
||||||
FileUtil.exceptionDetailMessage(e));
|
FileUtil.exceptionDetailMessage(e));
|
||||||
SessionUtil.setFileUploadMonitor(session, fum);
|
SessionUtil.setFileUploadMonitor(session, fum);
|
||||||
fileUploadSession.setFileUploadState(FileUploadState.FAILED);
|
fileUploadSession.setFileUploadState(FileUploadState.FAILED);
|
||||||
|
@ -8263,8 +8284,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
logger.trace("changing state");
|
logger.trace("changing state");
|
||||||
FileUploadMonitor fum = SessionUtil.getFileUploadMonitor(session);
|
FileUploadMonitor fum = SessionUtil.getFileUploadMonitor(session);
|
||||||
fum.setState(
|
fum.setState(FileUploadState.COMPLETED);
|
||||||
FileUploadState.COMPLETED);
|
|
||||||
SessionUtil.setFileUploadMonitor(session, fum);
|
SessionUtil.setFileUploadMonitor(session, fum);
|
||||||
|
|
||||||
SessionUtil.setCodelistMappingFileUploadSession(session,
|
SessionUtil.setCodelistMappingFileUploadSession(session,
|
||||||
|
@ -8296,14 +8316,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
logger.debug("StartCodelistMappingImport: "
|
logger.debug("StartCodelistMappingImport: "
|
||||||
+ codelistMappingSession.toString());
|
+ codelistMappingSession.toString());
|
||||||
|
|
||||||
|
importCodelistMappingFileOnService(session, aslSession, user,
|
||||||
|
codelistMappingSession);
|
||||||
importCodelistMappingFileOnService(session, aslSession, user, codelistMappingSession);
|
|
||||||
} catch (TDGWTSessionExpiredException e) {
|
} catch (TDGWTSessionExpiredException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new TDGWTServiceException("Error in Codelist Mapping import: "
|
throw new TDGWTServiceException(
|
||||||
|
"Error in Codelist Mapping import: "
|
||||||
+ e.getLocalizedMessage());
|
+ e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue