Updated PeriodDataType
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@111649 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3b41f8306f
commit
086ae47577
|
@ -132,9 +132,24 @@ public interface TDGWTService extends RemoteService {
|
|||
|
||||
|
||||
//PeriodDataType
|
||||
/**
|
||||
* Get list of PeriodDataType
|
||||
*
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public ArrayList<PeriodDataType> getPeriodDataTypes()
|
||||
throws TDGWTServiceException;
|
||||
|
||||
/**
|
||||
* Retrieves the hierarchical relationship for the specific period data type
|
||||
*
|
||||
* @param periodDataType
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public ArrayList<PeriodDataType> getHierarchicalRelationshipForPeriodDataTypes(PeriodDataType periodDataType)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
// TabularResource
|
||||
/**
|
||||
|
|
|
@ -100,6 +100,7 @@ public interface TDGWTServiceAsync {
|
|||
//PeriodDataType
|
||||
void getPeriodDataTypes(AsyncCallback<ArrayList<PeriodDataType>> callback);
|
||||
|
||||
void getHierarchicalRelationshipForPeriodDataTypes(PeriodDataType periodDataType, AsyncCallback<ArrayList<PeriodDataType>> callback);
|
||||
|
||||
// TabularResource
|
||||
void getCurrentTRId(AsyncCallback<TRId> callback);
|
||||
|
|
|
@ -337,6 +337,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
timeF.getExample(), timeF.getRegExpr());
|
||||
timeDataFormats.add(timeDataFormat);
|
||||
}
|
||||
|
||||
PeriodDataType periodDataType = new PeriodDataType(
|
||||
period.name(), period.getName(), timeDataFormats);
|
||||
periodDataTypes.add(periodDataType);
|
||||
|
@ -356,6 +357,54 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ArrayList<PeriodDataType> getHierarchicalRelationshipForPeriodDataTypes(PeriodDataType periodDataType)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
SessionUtil.getAslSession(session);
|
||||
|
||||
ArrayList<PeriodDataType> hierarchicalPeriodDataTypes = new ArrayList<PeriodDataType>();
|
||||
|
||||
PeriodType periodType= PeriodTypeMap.map(periodDataType);
|
||||
|
||||
List<PeriodType> hierarchicalList=PeriodType.getHierarchicalRelation().get(periodType);
|
||||
|
||||
|
||||
for (PeriodType period : hierarchicalList) {
|
||||
ArrayList<TimeDataFormat> timeDataFormats = new ArrayList<TimeDataFormat>();
|
||||
List<TimeFormat> listTimeFormat = period.getAcceptedFormats();
|
||||
for (TimeFormat timeF : listTimeFormat) {
|
||||
TimeDataFormat timeDataFormat = new TimeDataFormat(
|
||||
timeF.getExample(), timeF.getRegExpr());
|
||||
timeDataFormats.add(timeDataFormat);
|
||||
}
|
||||
PeriodDataType periodDT = new PeriodDataType(
|
||||
period.name(), period.getName(), timeDataFormats);
|
||||
hierarchicalPeriodDataTypes.add(periodDT);
|
||||
}
|
||||
|
||||
return hierarchicalPeriodDataTypes;
|
||||
|
||||
} catch (TDGWTServiceException e) {
|
||||
throw e;
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS);
|
||||
} catch (Throwable e) {
|
||||
logger.error("getPeriodDataTypes(): " + e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException("Error retrieving hierarchical list of period types: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -309,7 +309,6 @@ public class OperationMonitorCreator {
|
|||
|
||||
operationMonitor.setTrId(trId);
|
||||
tabResource = SessionUtil.getCSVImportTabResource(session);
|
||||
logger.debug("CurrentTabResource :" + tabResource);
|
||||
if (tabResource != null) {
|
||||
tabResource.setTrId(trId);
|
||||
SessionUtil.setTabResource(session, tabResource);
|
||||
|
@ -318,6 +317,7 @@ public class OperationMonitorCreator {
|
|||
tabResource.setTrId(trId);
|
||||
SessionUtil.setTabResource(session, tabResource);
|
||||
}
|
||||
logger.debug("CurrentTabResource set:" + tabResource);
|
||||
SessionUtil.setTRId(session, trId);
|
||||
SessionUtil.addToCurrentTabularResourcesOpen(session, tabResource);
|
||||
break;
|
||||
|
@ -328,7 +328,6 @@ public class OperationMonitorCreator {
|
|||
|
||||
operationMonitor.setTrId(trId);
|
||||
tabResource = SessionUtil.getSDMXImportTabResource(session);
|
||||
logger.debug("CurrentTabResource :" + tabResource);
|
||||
if (tabResource != null) {
|
||||
tabResource.setTrId(trId);
|
||||
SessionUtil.setTabResource(session, tabResource);
|
||||
|
@ -337,6 +336,7 @@ public class OperationMonitorCreator {
|
|||
tabResource.setTrId(trId);
|
||||
SessionUtil.setTabResource(session, tabResource);
|
||||
}
|
||||
logger.debug("CurrentTabResource set:" + tabResource);
|
||||
SessionUtil.setTRId(session, trId);
|
||||
SessionUtil.addToCurrentTabularResourcesOpen(session, tabResource);
|
||||
break;
|
||||
|
@ -347,13 +347,10 @@ public class OperationMonitorCreator {
|
|||
operationMonitor.setTrId(trId);
|
||||
break;
|
||||
default:
|
||||
trId = new TRId();
|
||||
trId.setId(taskWrapper.getTrId().getId());
|
||||
trId = new TRId(taskWrapper.getTrId().getId());
|
||||
trId = retrieveTabularResourceBasicData(trId);
|
||||
|
||||
operationMonitor.setTrId(trId);
|
||||
tabResource = SessionUtil.getTabResource(session);
|
||||
logger.debug("CurrentTabResource :" + tabResource);
|
||||
if (tabResource != null) {
|
||||
tabResource.setTrId(trId);
|
||||
SessionUtil.setTabResource(session, tabResource);
|
||||
|
@ -362,6 +359,7 @@ public class OperationMonitorCreator {
|
|||
tabResource.setTrId(trId);
|
||||
SessionUtil.setTabResource(session, tabResource);
|
||||
}
|
||||
logger.debug("CurrentTabResource set:" + tabResource);
|
||||
SessionUtil.setTRId(session, trId);
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue