diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java index 9488fbf..776c76f 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java @@ -16,7 +16,6 @@ import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource; import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper; import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadSession; import org.gcube.portlets.user.td.gwtservice.server.trservice.TRTasksManager; -import org.gcube.portlets.user.td.gwtservice.shared.Constants; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; @@ -78,15 +77,15 @@ public class SessionUtil { ASLSession session; if (username == null) { logger.warn("no user found in session, using test one"); - /*throw new TDGWTSessionExpiredException("Session Expired!");*/ - + throw new TDGWTSessionExpiredException("Session Expired!"); + /* username = Constants.DEFAULT_USER; String scope = Constants.DEFAULT_SCOPE; httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, username); session = SessionManager.getInstance().getASLSession( httpSession.getId(), username); - session.setScope(scope); + session.setScope(scope);*/ } else { session = SessionManager.getInstance().getASLSession( 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 62807f1..a4a87fa 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 @@ -366,9 +366,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements public TabResource getTabResourceInformation(TRId trId) throws TDGWTServiceException { try { - @SuppressWarnings("unused") + HttpSession session = this.getThreadLocalRequest().getSession(); - // ASLSession aslSession = SessionUtil.getAslSession(session); + ASLSession aslSession = SessionUtil.getAslSession(session); if (trId == null) { logger.error("GetTabularREsourceInformation TRId is null"); throw new TDGWTServiceException( @@ -382,8 +382,19 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements ArrayList trMetadatas = getTRMetadata(currentTR .getTrId()); updateTabResourceInformation(currentTR, trMetadatas); - currentTR.setDate(getTRCreationDate(trId)); - currentTR.setValid(isTabularResourceValid(trId)); + + + AuthorizationProvider.instance.set(new AuthorizationToken( + aslSession.getUsername())); + TabularDataService service = TabularDataServiceFactory.getService(); + + TabularResource tr = service + .getTabularResource(new TabularResourceId(Long + .valueOf(currentTR.getTrId().getId()))); + + currentTR.setDate(sdf.format(tr.getCreationDate().getTime())); + currentTR.setValid(tr.isValid()); + currentTR.setFinalized(tr.isFinalized()); logger.debug("GetTabResourceInformation() updated information:" + currentTR.toString()); @@ -1427,6 +1438,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements t.setId(String.valueOf(i)); t.setTrId(trId); t.setValid(tr.isValid()); + t.setFinalized(tr.isFinalized()); if (tr.contains(NameMetadata.class)) { NameMetadata nameMeta = tr.getMetadata(NameMetadata.class); if (nameMeta != null && nameMeta.getValue() != null) { @@ -2085,6 +2097,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements .getValue()), table.getTableType().getName()); tabResource.setTrId(trId); tabResource.setValid(serviceTR.isValid()); + tabResource.setFinalized(serviceTR.isFinalized()); return tabResource; } catch (TDGWTSessionExpiredException e) {