Added comment

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@84936 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2013-11-05 10:21:28 +00:00
parent fd6feb1c74
commit 21c68ae4cd
1 changed files with 92 additions and 58 deletions

View File

@ -3,7 +3,6 @@
*/
package org.gcube.portlets.user.td.gwtservice.server;
import java.lang.Thread.State;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -79,6 +78,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
protected HttpSession session;
protected ASLSession aslSession;
/**
*
* {@inheritDoc}
*/
@Override
public void setTabResource(TabResource tabResource)
throws TDGWTServiceException {
try {
@ -104,8 +108,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
*
* {@inheritDoc}
*/
@Override
public TabResource getTabResourceInformation() throws TDGWTServiceException {
try {
session = this.getThreadLocalRequest().getSession();
@ -129,52 +134,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
+ e.getLocalizedMessage());
}
}
/**
* Retrieves the properties of the specified tabular resource
* {@inheritDoc}
*/
/*
* @Override public TRProperties getTaularResourceProperties(TRId trId)
* throws TDGXTServiceException { try { HttpSession session =
* this.getThreadLocalRequest().getSession();
*
* SessionUtil.setTRId(session, trId); TabularResourceId id = new
* TabularResourceId(Long.valueOf(trId .getId())); TabularDataService
* service = new TabularDataServiceMock();
*
* TabularResource tr = service.getTabularResource(id);
*
* NameMetadata nameMeta = tr.getMetadata(NameMetadata.class);
* CreationDateMetadata creationDateMeta = tr
* .getMetadata(CreationDateMetadata.class); AgencyMetadata agencyMeta =
* tr.getMetadata(AgencyMetadata.class);
*
* String nameTR = nameMeta.getValue(); String agencyTR =
* agencyMeta.getValue(); Date dateTR = creationDateMeta.getValue(); TableId
* tableId = tr.getHistory().get(tr.getHistory().size() - 1)
* .getResultTable().getId();
*
* HashMap<String, String> properties = new HashMap<String, String>();
*
* properties.put("Id", String.valueOf(tr.getId().getValue()));
* properties.put("Table id", String.valueOf(tableId.getValue()));
* properties.put("Name", nameTR); properties.put("Agency", agencyTR);
* properties.put("Creation Date", sdf.format(dateTR));
*
* logger.info("Tabular Resources retrived: " + properties);
*
* TRProperties trProperties = new TRProperties();
* trProperties.setProperties(properties);
*
* return trProperties; return null; } catch (Exception e) {
* logger.error("Error retrieving TabularResources: " +
* e.getLocalizedMessage()); throw new TDGXTServiceException(
* "Error retrieving Tabular Resources Properties: " +
* e.getLocalizedMessage()); }
*
* }
*/
@Override
public void setTDOpenSession(TDOpenSession s) throws TDGWTServiceException {
try {
@ -191,6 +154,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
}
/**
*
*
* @param tr
* @param tabResource
*/
protected void syncTRMetaData(TabularResource tr, TabResource tabResource) {
Date date = Calendar.getInstance().getTime();
tabResource.setDate(sdf.format(date));
@ -205,11 +174,24 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
*
* @param tr
* @throws TDGWTServiceException
*/
protected void retriveTRMetadataFromService(TabularResource tr)
throws TDGWTServiceException {
retriveTRMetadataFromService(tr, 0);
}
/**
* Retrieves the informations for a specific Tabular Resource from service
*
* @param tr TabularResource on service
* @param i Index on Grid
* @return TabResource for Grid
* @throws TDGWTServiceException
*/
protected TabResource retriveTRMetadataFromService(TabularResource tr, int i)
throws TDGWTServiceException {
@ -264,6 +246,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
return t;
}
/**
*
* {@inheritDoc}
*/
@Override
public ArrayList<TabResource> getTabularResources()
throws TDGWTServiceException {
@ -303,7 +289,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
* @param tabResource
* @throws TDGWTServiceException
*/
public void removeTabularResource(TabResource tabResource)
throws TDGWTServiceException {
try {
@ -330,6 +315,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
}
/**
*
* {@inheritDoc}
*/
@Override
public TabResource createTabularResource(TabResource tabResource)
throws TDGWTServiceException {
@ -363,7 +352,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
* jar {@inheritDoc}
* {@inheritDoc}
*/
@Override
public ArrayList<Codelist> getCodelists() throws TDGWTServiceException {
@ -411,8 +400,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
* SDMX Import
*
* @param sdmxImportSession
* @return
*/
protected Map<String, Object> retrieveOperationParameters(
SDMXImportSession sdmxImportSession) {
@ -429,6 +419,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
* {@inheritDoc}
*/
@Override
public void importSDMXClientLibraryRequest(
SDMXImportSession sdmxImportSession) throws TDGWTServiceException {
@ -477,6 +470,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
}
/**
*
* @param op
* @param capabilities
* @return
* @throws TDGWTServiceException
*/
protected EligibleOperation getEligibleOperationWithId(String op,
List<EligibleOperation> capabilities) throws TDGWTServiceException {
for (EligibleOperation operation : capabilities) {
@ -491,6 +491,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
* {@inheritDoc}
*/
@Override
public SDMXImportMonitor getSDMXImportMonitor()
throws TDGWTServiceException {
@ -520,7 +523,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
importMonitor.setProgress(task.getProgress());
JobResult result = task.getResult();
if (result == null) {
logger.info("Task Result: " + task.getResult());
logger.info("Task Result: Waiting");
} else {
importMonitor.setError(task.getResult()
.getException());
@ -569,7 +572,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
}
/**
* {@inheritDoc}
*/
@Override
public void setSDMXSession(SDMXImportSession sdmxImportSession)
throws TDGWTServiceException {
@ -590,10 +596,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
* CSV Import
*
* {@inheritDoc}
*/
@Override
public void setCSVSession(CSVImportSession importSession)
throws TDGWTServiceException {
@ -613,6 +617,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
* {@inheritDoc}
*/
@Override
public FileUploadMonitor getFileUploadMonitor()
throws TDGWTServiceException {
@ -631,6 +638,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
return fileUploadSession.getFileUploadMonitor();
}
/**
* {@inheritDoc}
*/
@Override
public AvailableCharsetList getAvailableCharset()
throws TDGWTServiceException {
@ -689,6 +700,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
}
/**
* {@inheritDoc}
*/
@Override
public ArrayList<CSVRowError> checkCSV(long errorsLimit)
throws TDGWTServiceException {
@ -716,7 +730,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
}
/**
* {@inheritDoc}
*/
@Override
public void startCSVImport(CSVImportSession csvImportSession)
throws TDGWTServiceException {
@ -745,7 +762,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
importCSVFileOnService(user, fileUploadSession, csvImportSession);
}
/**
*
* @param fileUrlOnStorage
* @param fileUploadSession
* @param csvImportSession
* @return
*/
protected Map<String, Object> csvImportFileParameter(
String fileUrlOnStorage, FileUploadSession fileUploadSession,
CSVImportSession csvImportSession) {
@ -767,7 +791,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
parameterInstances.put(HASHEADER, hasHeader);// true
return parameterInstances;
}
/**
*
* @param user
* @param fileUploadSession
* @param csvImportSession
* @throws TDGWTServiceException
*/
protected void importCSVFileOnService(String user,
FileUploadSession fileUploadSession,
CSVImportSession csvImportSession) throws TDGWTServiceException {
@ -808,7 +839,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
SessionUtil.setCSVImportFileTask(session, trTask);
}
/**
* {@inheritDoc}
*/
@Override
public CSVImportMonitor getCSVImportMonitor() throws TDGWTServiceException {
try {