Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@111606 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
05bab63e7f
commit
a62a11db11
|
@ -6685,7 +6685,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
TaskS taskS = new TaskS(task.getId().getValue(),
|
TaskS taskS = new TaskS(task.getId().getValue(),
|
||||||
task.getProgress(), state, task.getErrorCause(),
|
task.getProgress(), state, task.getErrorCause(),
|
||||||
task.getSubmitter(), task.getStartTime(),
|
task.getSubmitter(), task.getStartTime(),
|
||||||
task.getEndTime(), jobSList, collateralTRIds);
|
task.getEndTime(), jobSList, collateralTRIds, null);
|
||||||
taskSList.add(taskS);
|
taskSList.add(taskS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ public class BackgroundOperationMonitorCreator {
|
||||||
.getTask().getSubmitter(), taskWrapper.getTask()
|
.getTask().getSubmitter(), taskWrapper.getTask()
|
||||||
.getStartTime(),
|
.getStartTime(),
|
||||||
taskWrapper.getTask().getEndTime(), jobSList,
|
taskWrapper.getTask().getEndTime(), jobSList,
|
||||||
collateralTRIds);
|
collateralTRIds, String.valueOf(taskWrapper.getTask().getTabularResourceId().getValue()));
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("error retrieving information about the task, "
|
logger.error("error retrieving information about the task, "
|
||||||
|
|
|
@ -51,7 +51,7 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
public class OperationMonitorCreator {
|
public class OperationMonitorCreator {
|
||||||
private static final String SECURITY_EXCEPTION_RIGHTS = "Security exception, you don't have the required rights!";
|
private static final String SECURITY_EXCEPTION_RIGHTS = "Security exception, you don't have the required rights!";
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(OperationMonitorCreator.class);
|
.getLogger(OperationMonitorCreator.class);
|
||||||
|
|
||||||
|
@ -59,15 +59,12 @@ public class OperationMonitorCreator {
|
||||||
"yyyy-MM-dd HH:mm");
|
"yyyy-MM-dd HH:mm");
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private static SimpleDateFormat sdfDate = new SimpleDateFormat(
|
private static SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
"yyyy-MM-dd");
|
|
||||||
|
|
||||||
private HttpSession session;
|
private HttpSession session;
|
||||||
private TaskWrapper taskWrapper;
|
private TaskWrapper taskWrapper;
|
||||||
private OperationMonitorSession operationMonitorSession;
|
private OperationMonitorSession operationMonitorSession;
|
||||||
private ASLSession aslSession;
|
private ASLSession aslSession;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -82,10 +79,7 @@ public class OperationMonitorCreator {
|
||||||
this.aslSession = aslSession;
|
this.aslSession = aslSession;
|
||||||
this.taskWrapper = taskWrapper;
|
this.taskWrapper = taskWrapper;
|
||||||
this.operationMonitorSession = operationMonitorSession;
|
this.operationMonitorSession = operationMonitorSession;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,7 +149,7 @@ public class OperationMonitorCreator {
|
||||||
return operationMonitor;
|
return operationMonitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TaskS createTaskS() throws TDGWTServiceException {
|
protected TaskS createTaskS() throws TDGWTServiceException {
|
||||||
TaskS taskS = new TaskS();
|
TaskS taskS = new TaskS();
|
||||||
|
|
||||||
ArrayList<JobS> jobSList = new ArrayList<JobS>();
|
ArrayList<JobS> jobSList = new ArrayList<JobS>();
|
||||||
|
@ -185,31 +179,36 @@ public class OperationMonitorCreator {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
ArrayList<TRId> collateralTRIds=new ArrayList<TRId>();
|
ArrayList<TRId> collateralTRIds = new ArrayList<TRId>();
|
||||||
TaskResult taskResult=taskWrapper.getTask().getResult();
|
TaskResult taskResult = taskWrapper.getTask().getResult();
|
||||||
if(taskResult!=null){
|
if (taskResult != null) {
|
||||||
List<TableId> collaterals=taskResult.getCollateralTables();
|
List<TableId> collaterals = taskResult.getCollateralTables();
|
||||||
for(TableId tId:collaterals){
|
for (TableId tId : collaterals) {
|
||||||
String tabulRId=retrieveTabularResourceIdFromTable(tId);
|
String tabulRId = retrieveTabularResourceIdFromTable(tId);
|
||||||
TRId tabularRId=new TRId(tabulRId);
|
TRId tabularRId = new TRId(tabulRId);
|
||||||
tabularRId.setTableId(String.valueOf(tId.getValue()));
|
tabularRId.setTableId(String.valueOf(tId.getValue()));
|
||||||
collateralTRIds.add(tabularRId);
|
collateralTRIds.add(tabularRId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
taskS = new TaskS(taskWrapper.getTask().getId().getValue(),
|
taskS = new TaskS(taskWrapper.getTask().getId().getValue(),
|
||||||
taskWrapper.getTask().getProgress(),
|
taskWrapper.getTask().getProgress(),
|
||||||
TaskStateMap.map(taskWrapper.getTask().getStatus()),
|
TaskStateMap.map(taskWrapper.getTask().getStatus()),
|
||||||
taskWrapper.getTask().getErrorCause(), taskWrapper
|
taskWrapper.getTask().getErrorCause(), taskWrapper
|
||||||
.getTask().getSubmitter(), taskWrapper.getTask()
|
.getTask().getSubmitter(), taskWrapper.getTask()
|
||||||
.getStartTime(),
|
.getStartTime(),
|
||||||
taskWrapper.getTask().getEndTime(), jobSList, collateralTRIds);
|
taskWrapper.getTask().getEndTime(), jobSList,
|
||||||
|
collateralTRIds, String.valueOf(taskWrapper.getTask()
|
||||||
|
.getTabularResourceId().getValue()));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("error retrieving information about the task, "+e.getLocalizedMessage());
|
logger.error("error retrieving information about the task, "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new TDGWTServiceException("error retrieving information about the task, "+e.getLocalizedMessage());
|
throw new TDGWTServiceException(
|
||||||
|
"error retrieving information about the task, "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
logger.debug("Retrieved task information");
|
logger.debug("Retrieved task information");
|
||||||
return taskS;
|
return taskS;
|
||||||
|
@ -260,7 +259,7 @@ public class OperationMonitorCreator {
|
||||||
Table table;
|
Table table;
|
||||||
TabExportMetadata trExportMetadata;
|
TabExportMetadata trExportMetadata;
|
||||||
ExportMetadata exportMetadata;
|
ExportMetadata exportMetadata;
|
||||||
|
|
||||||
switch (taskWrapper.getOperationId()) {
|
switch (taskWrapper.getOperationId()) {
|
||||||
case CSVExport:
|
case CSVExport:
|
||||||
table = taskWrapper.getTask().getResult().getPrimaryTable();
|
table = taskWrapper.getTask().getResult().getPrimaryTable();
|
||||||
|
@ -293,7 +292,7 @@ public class OperationMonitorCreator {
|
||||||
logger.debug("ExportMetadata: " + exportMetadata);
|
logger.debug("ExportMetadata: " + exportMetadata);
|
||||||
|
|
||||||
operationMonitor.setTrId(SessionUtil.getTRId(session));
|
operationMonitor.setTrId(SessionUtil.getTRId(session));
|
||||||
|
|
||||||
trExportMetadata = new TabExportMetadata();
|
trExportMetadata = new TabExportMetadata();
|
||||||
trExportMetadata.setUrl(exportMetadata.getUri());
|
trExportMetadata.setUrl(exportMetadata.getUri());
|
||||||
trExportMetadata.setDestinationType(exportMetadata
|
trExportMetadata.setDestinationType(exportMetadata
|
||||||
|
@ -302,8 +301,8 @@ public class OperationMonitorCreator {
|
||||||
.getExportDate()));
|
.getExportDate()));
|
||||||
|
|
||||||
saveJSONExportInDestination(exportMetadata);
|
saveJSONExportInDestination(exportMetadata);
|
||||||
break;
|
break;
|
||||||
case CSVImport:
|
case CSVImport:
|
||||||
trId = new TRId();
|
trId = new TRId();
|
||||||
trId.setId(taskWrapper.getTrId().getId());
|
trId.setId(taskWrapper.getTrId().getId());
|
||||||
trId = retrieveTabularResourceBasicData(trId);
|
trId = retrieveTabularResourceBasicData(trId);
|
||||||
|
@ -320,9 +319,9 @@ public class OperationMonitorCreator {
|
||||||
SessionUtil.setTabResource(session, tabResource);
|
SessionUtil.setTabResource(session, tabResource);
|
||||||
}
|
}
|
||||||
SessionUtil.setTRId(session, trId);
|
SessionUtil.setTRId(session, trId);
|
||||||
SessionUtil.addToCurrentTabularResourcesOpen(session,tabResource);
|
SessionUtil.addToCurrentTabularResourcesOpen(session, tabResource);
|
||||||
break;
|
break;
|
||||||
case SDMXImport:
|
case SDMXImport:
|
||||||
trId = new TRId();
|
trId = new TRId();
|
||||||
trId.setId(taskWrapper.getTrId().getId());
|
trId.setId(taskWrapper.getTrId().getId());
|
||||||
trId = retrieveTabularResourceBasicData(trId);
|
trId = retrieveTabularResourceBasicData(trId);
|
||||||
|
@ -339,8 +338,8 @@ public class OperationMonitorCreator {
|
||||||
SessionUtil.setTabResource(session, tabResource);
|
SessionUtil.setTabResource(session, tabResource);
|
||||||
}
|
}
|
||||||
SessionUtil.setTRId(session, trId);
|
SessionUtil.setTRId(session, trId);
|
||||||
SessionUtil.addToCurrentTabularResourcesOpen(session,tabResource);
|
SessionUtil.addToCurrentTabularResourcesOpen(session, tabResource);
|
||||||
break;
|
break;
|
||||||
case Clone:
|
case Clone:
|
||||||
trId = new TRId();
|
trId = new TRId();
|
||||||
trId.setId(taskWrapper.getTrId().getId());
|
trId.setId(taskWrapper.getTrId().getId());
|
||||||
|
@ -386,7 +385,7 @@ public class OperationMonitorCreator {
|
||||||
logger.error("Tabular Resource Null [id=" + trId.getId() + "]");
|
logger.error("Tabular Resource Null [id=" + trId.getId() + "]");
|
||||||
throw new TDGWTServiceException("Tabular Resource Null " + trId);
|
throw new TDGWTServiceException("Tabular Resource Null " + trId);
|
||||||
}
|
}
|
||||||
//logger.debug("Retrieve Tabular Resource Basic Data: "+tr);
|
// logger.debug("Retrieve Tabular Resource Basic Data: "+tr);
|
||||||
|
|
||||||
Table table = service.getLastTable(tabularResourceId);
|
Table table = service.getLastTable(tabularResourceId);
|
||||||
if (table == null) {
|
if (table == null) {
|
||||||
|
@ -409,14 +408,18 @@ public class OperationMonitorCreator {
|
||||||
|
|
||||||
TRId newTRId;
|
TRId newTRId;
|
||||||
if (viewTable == null) {
|
if (viewTable == null) {
|
||||||
newTRId = new TRId(String.valueOf(tr.getId().getValue()),
|
newTRId = new TRId(
|
||||||
TabularResourceTypeMap.map(tr.getTabularResourceType()), tr.getTableType(), String.valueOf(table.getId()
|
String.valueOf(tr.getId().getValue()),
|
||||||
.getValue()), table.getTableType().getName());
|
TabularResourceTypeMap.map(tr.getTabularResourceType()),
|
||||||
|
tr.getTableType(), String.valueOf(table.getId()
|
||||||
|
.getValue()), table.getTableType().getName());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
newTRId = new TRId(String.valueOf(tr.getId().getValue()),
|
newTRId = new TRId(
|
||||||
TabularResourceTypeMap.map(tr.getTabularResourceType()), tr.getTableType(), String.valueOf(viewTable.getId()
|
String.valueOf(tr.getId().getValue()),
|
||||||
.getValue()), viewTable.getTableType()
|
TabularResourceTypeMap.map(tr.getTabularResourceType()),
|
||||||
|
tr.getTableType(), String.valueOf(viewTable.getId()
|
||||||
|
.getValue()), viewTable.getTableType()
|
||||||
.getName(), String.valueOf(table.getId()
|
.getName(), String.valueOf(table.getId()
|
||||||
.getValue()), true);
|
.getValue()), true);
|
||||||
|
|
||||||
|
@ -429,8 +432,7 @@ public class OperationMonitorCreator {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new TDGWTServiceException(
|
throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS);
|
||||||
SECURITY_EXCEPTION_RIGHTS);
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new TDGWTServiceException("Error Retrieving Basic Data: "
|
throw new TDGWTServiceException("Error Retrieving Basic Data: "
|
||||||
|
@ -483,8 +485,7 @@ public class OperationMonitorCreator {
|
||||||
"Error in export csv: no destination present");
|
"Error in export csv: no destination present");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save export json data on Workspace
|
* Save export json data on Workspace
|
||||||
*
|
*
|
||||||
|
@ -530,14 +531,14 @@ public class OperationMonitorCreator {
|
||||||
"Error in export json: no destination present");
|
"Error in export json: no destination present");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String retrieveTabularResourceIdFromTable(
|
private String retrieveTabularResourceIdFromTable(TableId tableId)
|
||||||
TableId tableId) throws TDGWTServiceException {
|
throws TDGWTServiceException {
|
||||||
try {
|
try {
|
||||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
|
||||||
Table table = service.getTable(tableId);
|
Table table = service.getTable(tableId);
|
||||||
|
|
||||||
if (table.contains(TableDescriptorMetadata.class)) {
|
if (table.contains(TableDescriptorMetadata.class)) {
|
||||||
|
@ -555,6 +556,5 @@ public class OperationMonitorCreator {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,15 +15,16 @@ public class TaskS implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 8228657333318157153L;
|
private static final long serialVersionUID = 8228657333318157153L;
|
||||||
|
|
||||||
protected String id;
|
private String id;
|
||||||
protected float progress;
|
private float progress;
|
||||||
protected State state;
|
private State state;
|
||||||
protected Throwable errorCause;
|
private Throwable errorCause;
|
||||||
protected String submitter;
|
private String submitter;
|
||||||
protected Date startTime;
|
private Date startTime;
|
||||||
protected Date endTime;
|
private Date endTime;
|
||||||
protected ArrayList<JobS> jobs;
|
private ArrayList<JobS> jobs;
|
||||||
protected ArrayList<TRId> collateralTRIds;
|
private ArrayList<TRId> collateralTRIds;
|
||||||
|
private String tabularResourceId;
|
||||||
|
|
||||||
public TaskS() {
|
public TaskS() {
|
||||||
|
|
||||||
|
@ -40,11 +41,12 @@ public class TaskS implements Serializable {
|
||||||
* @param endTime
|
* @param endTime
|
||||||
* @param jobs
|
* @param jobs
|
||||||
* @param collateralTRIds
|
* @param collateralTRIds
|
||||||
|
* @param tabularResourceId TODO
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public TaskS(String id, float progress, State state, Throwable errorCause,
|
public TaskS(String id, float progress, State state, Throwable errorCause,
|
||||||
String submitter, Date startTime, Date endTime,
|
String submitter, Date startTime, Date endTime,
|
||||||
ArrayList<JobS> jobs, ArrayList<TRId> collateralTRIds) {
|
ArrayList<JobS> jobs, ArrayList<TRId> collateralTRIds, String tabularResourceId) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.progress = progress;
|
this.progress = progress;
|
||||||
this.state = state;
|
this.state = state;
|
||||||
|
@ -54,6 +56,7 @@ public class TaskS implements Serializable {
|
||||||
this.endTime = endTime;
|
this.endTime = endTime;
|
||||||
this.jobs = jobs;
|
this.jobs = jobs;
|
||||||
this.collateralTRIds = collateralTRIds;
|
this.collateralTRIds = collateralTRIds;
|
||||||
|
this.tabularResourceId=tabularResourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -127,6 +130,14 @@ public class TaskS implements Serializable {
|
||||||
public void setCollateralTRIds(ArrayList<TRId> collateralTRIds) {
|
public void setCollateralTRIds(ArrayList<TRId> collateralTRIds) {
|
||||||
this.collateralTRIds = collateralTRIds;
|
this.collateralTRIds = collateralTRIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTabularResourceId() {
|
||||||
|
return tabularResourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTabularResourceId(String tabularResourceId) {
|
||||||
|
this.tabularResourceId = tabularResourceId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -134,7 +145,9 @@ public class TaskS implements Serializable {
|
||||||
+ state + ", errorCause=" + errorCause + ", submitter="
|
+ state + ", errorCause=" + errorCause + ", submitter="
|
||||||
+ submitter + ", startTime=" + startTime + ", endTime="
|
+ submitter + ", startTime=" + startTime + ", endTime="
|
||||||
+ endTime + ", jobs=" + jobs + ", collateralTRIds="
|
+ endTime + ", jobs=" + jobs + ", collateralTRIds="
|
||||||
+ collateralTRIds + "]";
|
+ collateralTRIds + ", tabularResourceId=" + tabularResourceId
|
||||||
|
+ "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue