Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@99437 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-09-03 15:42:56 +00:00
parent b31f8630f0
commit 4b965e266a
3 changed files with 26 additions and 15 deletions

View File

@ -75,7 +75,7 @@ public class SessionUtil {
ASLSession session; ASLSession session;
if (username == null) { if (username == null) {
logger.warn("no user found in session, using test one"); logger.warn("no user found in session, using test one");
throw new TDGWTSessionExpiredException("Session Expired!"); throw new TDGWTSessionExpiredException("Session Expired!");
// Remove comment for Test // Remove comment for Test
/* /*

View File

@ -1619,7 +1619,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
.getMetadata(ValidSinceMetadata.class); .getMetadata(ValidSinceMetadata.class);
if (validSinceMeta != null && validSinceMeta.getValue() != null) { if (validSinceMeta != null && validSinceMeta.getValue() != null) {
Calendar validSinceC=validSinceMeta.getValue(); Calendar validSinceC=validSinceMeta.getValue();
t.setValidFrom(sdfDate.format(validSinceC)); t.setValidFrom(sdfDate.format(validSinceC.getTime()));
} else { } else {
} }
@ -1632,7 +1632,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
.getMetadata(ValidUntilMetadata.class); .getMetadata(ValidUntilMetadata.class);
if (validUntilMeta != null && validUntilMeta.getValue() != null) { if (validUntilMeta != null && validUntilMeta.getValue() != null) {
Calendar validUntilC=validUntilMeta.getValue(); Calendar validUntilC=validUntilMeta.getValue();
t.setValidUntilTo(sdfDate.format(validUntilC)); t.setValidUntilTo(sdfDate.format(validUntilC.getTime()));
} else { } else {
} }

View File

@ -15,6 +15,7 @@ import org.gcube.data.analysis.tabulardata.model.table.Table;
import org.gcube.data.analysis.tabulardata.service.TabularDataService; import org.gcube.data.analysis.tabulardata.service.TabularDataService;
import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory; import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory;
import org.gcube.data.analysis.tabulardata.service.operation.Job; import org.gcube.data.analysis.tabulardata.service.operation.Job;
import org.gcube.data.analysis.tabulardata.service.operation.Task;
import org.gcube.data.analysis.tabulardata.service.operation.ValidationJob; import org.gcube.data.analysis.tabulardata.service.operation.ValidationJob;
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource; import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource;
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResourceId; import org.gcube.data.analysis.tabulardata.service.tabular.TabularResourceId;
@ -26,6 +27,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
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.task.JobS; 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; import org.gcube.portlets.user.td.gwtservice.shared.task.TaskS;
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskWrapper; import org.gcube.portlets.user.td.gwtservice.shared.task.TaskWrapper;
import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsJobS; import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsJobS;
@ -81,7 +83,7 @@ public class OperationMonitorCreator {
OperationMonitor operationMonitor = new OperationMonitor( OperationMonitor operationMonitor = new OperationMonitor(
operationMonitorSession.getTaskId(), operationMonitorSession.getTaskId(),
taskWrapper.getOperationId()); taskWrapper.getOperationId());
if (taskWrapper == null || taskWrapper.getTask() == null if (taskWrapper == null || taskWrapper.getTask() == null
|| taskWrapper.getTask().getId() == null || taskWrapper.getTask().getId() == null
|| taskWrapper.getTask().getId().getValue() == null || taskWrapper.getTask().getId().getValue() == null
@ -90,17 +92,26 @@ public class OperationMonitorCreator {
throw new TDGWTServiceException( throw new TDGWTServiceException(
"Error in Operation Monitor task is null"); "Error in Operation Monitor task is null");
} else { } else {
operationMonitor operationMonitor.setTaskId(taskWrapper.getTask().getId()
.setTaskId(taskWrapper.getTask().getId().getValue()); .getValue());
TaskStatus status = taskWrapper.getTask().getStatus(); if (operationMonitorSession.isAbort()) {
if (status == null) { Task task = taskWrapper.getTask();
logger.debug("Services TaskStatus : null"); task.abort();
throw new TDGWTServiceException(
"Error in OperationMonitor Status is null");
} else {
TaskS taskS = createTaskS(); TaskS taskS = createTaskS();
taskS.setState(State.ABORTED);
operationMonitor.setTask(taskS); operationMonitor.setTask(taskS);
} else {
TaskStatus status = taskWrapper.getTask().getStatus();
if (status == null) {
logger.debug("Services TaskStatus : null");
throw new TDGWTServiceException(
"Error in OperationMonitor Status is null");
} else {
TaskS taskS = createTaskS();
operationMonitor.setTask(taskS);
}
} }
SessionUtil.setTaskStarted(session, taskWrapper); SessionUtil.setTaskStarted(session, taskWrapper);
postOperation(operationMonitor); postOperation(operationMonitor);
@ -227,12 +238,12 @@ public class OperationMonitorCreator {
operationMonitor.setTrId(trId); operationMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);
logger.debug("CurrentTabResource :"+tabResource); logger.debug("CurrentTabResource :" + tabResource);
if (tabResource != null) { if (tabResource != null) {
tabResource.setTrId(trId); tabResource.setTrId(trId);
SessionUtil.setTabResource(session, tabResource); SessionUtil.setTabResource(session, tabResource);
} else { } else {
tabResource=new TabResource(); tabResource = new TabResource();
tabResource.setTrId(trId); tabResource.setTrId(trId);
SessionUtil.setTabResource(session, tabResource); SessionUtil.setTabResource(session, tabResource);
} }