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>
*
*/
public class TDGWTServiceImpl extends RemoteServiceServlet implements
TDGWTService {
public class TDGWTServiceImpl extends RemoteServiceServlet implements TDGWTService {
private static final long serialVersionUID = -5707400086333186368L;
protected static Logger logger = LoggerFactory
.getLogger(TDGWTServiceImpl.class);
protected static Logger logger = LoggerFactory.getLogger(TDGWTServiceImpl.class);
protected static SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
protected TabularDataService service;
@ -133,8 +131,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
* {@inheritDoc}
*/
@Override
public void setTabResource(TabResource tabResource)
throws TDGWTServiceException {
public void setTabResource(TabResource tabResource) throws TDGWTServiceException {
try {
session = this.getThreadLocalRequest().getSession();
if (tabResource == null) {
@ -164,8 +161,17 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
*/
@Override
public TabResource getTabResourceInformation() throws TDGWTServiceException {
try {
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);
TabResource currentTR = SessionUtil.getTabResource(session);
@ -175,19 +181,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
"CURRENT_TABULAR_RESOURCE is null");
}
ArrayList<TRMetadata> trMetadatas = getTRMetadata(currentTR
.getTrId());
ArrayList<TRMetadata> trMetadatas = getTRMetadata(currentTR.getTrId());
updateTabResourceInformation(currentTR, trMetadatas);
SessionUtil.setTabResource(session, currentTR);
return currentTR;
} catch (Exception e) {
logger.error(
"Error setting TabResource parameter: "
+ e.getLocalizedMessage(), e);
throw new TDGWTServiceException(
"Error setting TabResource parameter: "
+ e.getLocalizedMessage());
logger.error("Error setting TabResource parameter: "+ e.getLocalizedMessage(), e);
throw new TDGWTServiceException("Error setting TabResource parameter: "+ e.getLocalizedMessage());
}
}