updated getTabResourceInformation for HttpSession

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@86822 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-12-11 10:55:36 +00:00
parent 93745ac0b0
commit 2ba5621b6a
1 changed files with 16 additions and 15 deletions

View File

@ -116,12 +116,10 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
*/ */
public class TDGWTServiceImpl extends RemoteServiceServlet implements public class TDGWTServiceImpl extends RemoteServiceServlet implements TDGWTService {
TDGWTService {
private static final long serialVersionUID = -5707400086333186368L; private static final long serialVersionUID = -5707400086333186368L;
protected static Logger logger = LoggerFactory protected static Logger logger = LoggerFactory.getLogger(TDGWTServiceImpl.class);
.getLogger(TDGWTServiceImpl.class);
protected static SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); protected static SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
protected TabularDataService service; protected TabularDataService service;
@ -133,8 +131,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void setTabResource(TabResource tabResource) public void setTabResource(TabResource tabResource) throws TDGWTServiceException {
throws TDGWTServiceException {
try { try {
session = this.getThreadLocalRequest().getSession(); session = this.getThreadLocalRequest().getSession();
if (tabResource == null) { if (tabResource == null) {
@ -164,8 +161,17 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
*/ */
@Override @Override
public TabResource getTabResourceInformation() throws TDGWTServiceException { public TabResource getTabResourceInformation() throws TDGWTServiceException {
try {
session = this.getThreadLocalRequest().getSession(); session = this.getThreadLocalRequest().getSession();
return getTabulaResourceInformationForHttpSession(session);
}
public TabResource getTabResourceInformation(HttpSession session) throws TDGWTServiceException {
return getTabulaResourceInformationForHttpSession(session);
}
private TabResource getTabulaResourceInformationForHttpSession(HttpSession session) throws TDGWTServiceException{
try {
aslSession = SessionUtil.getAslSession(session); aslSession = SessionUtil.getAslSession(session);
TabResource currentTR = SessionUtil.getTabResource(session); TabResource currentTR = SessionUtil.getTabResource(session);
@ -175,19 +181,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
"CURRENT_TABULAR_RESOURCE is null"); "CURRENT_TABULAR_RESOURCE is null");
} }
ArrayList<TRMetadata> trMetadatas = getTRMetadata(currentTR ArrayList<TRMetadata> trMetadatas = getTRMetadata(currentTR.getTrId());
.getTrId());
updateTabResourceInformation(currentTR, trMetadatas); updateTabResourceInformation(currentTR, trMetadatas);
SessionUtil.setTabResource(session, currentTR); SessionUtil.setTabResource(session, currentTR);
return currentTR; return currentTR;
} catch (Exception e) { } catch (Exception e) {
logger.error( logger.error("Error setting TabResource parameter: "+ e.getLocalizedMessage(), e);
"Error setting TabResource parameter: " throw new TDGWTServiceException("Error setting TabResource parameter: "+ e.getLocalizedMessage());
+ e.getLocalizedMessage(), e);
throw new TDGWTServiceException(
"Error setting TabResource parameter: "
+ e.getLocalizedMessage());
} }
} }