Updated Batch Replace on TimeDimension Column

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@101631 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-11-17 17:31:35 +00:00
parent 293833b4f3
commit d9c70845b1
1 changed files with 46 additions and 42 deletions

View File

@ -281,7 +281,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
private static final String TABULAR_RESOURCE_IS_FINAL = "Tabular Resource Is Final";
private static final String TABULAR_RESOURCE_IS_LOCKED = "Tabular Resource Is Locked";
private static final String SECURITY_EXCEPTION_RIGHTS = "Security exception, you don't have the required rights!";
private static final long serialVersionUID = -5707400086333186368L;
private static Logger logger = LoggerFactory
.getLogger(TDGWTServiceImpl.class);
@ -5299,8 +5299,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
*
* {@inheritDoc}
@ -6524,24 +6522,31 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
TableId tableId = new TableId(new Long(refColumn.getTableId()));
Table table = service.getTable(tableId);
TableDescriptorMetadata tableDesc = table
.getMetadata(TableDescriptorMetadata.class);
if (tableDesc == null) {
logger.error("Error in getConnection(): No TableDescriptorMetadata found for table "
TableDescriptorMetadata tableDesc = null;
TRId trId;
if (table.contains(TableDescriptorMetadata.class)) {
tableDesc = table.getMetadata(TableDescriptorMetadata.class);
if (tableDesc.getRefId() == 0) {
logger.error("Error refId=0 for Table:" + table.toString());
throw new TDGWTServiceException("Error refId=0 for Table:"
+ table.toString());
} else {
logger.debug("Table connect to tabular resource: "
+ tableDesc.getRefId());
TRId tId = new TRId(String.valueOf(tableDesc.getRefId()));
trId = retrieveTabularResourceBasicData(tId);
}
} else{
logger.debug("Attention: No TableDescriptorMetadata found for table. Supposed Time Dimension :"
+ table);
throw new TDGWTServiceException(
"Error in getConnection(): No TableDescriptorMetadata found for table "
+ table);
trId = new TRId();
trId.setTableId(refColumn.getTableId());
}
if (tableDesc.getRefId() == 0) {
logger.error("Error refId=0 for Table:" + table.toString());
throw new TDGWTServiceException("Error refId=0 for Table:"
+ table.toString());
}
logger.debug("Table connect to tabular resource: "
+ tableDesc.getRefId());
TRId tId = new TRId(String.valueOf(tableDesc.getRefId()));
TRId trId = retrieveTabularResourceBasicData(tId);
ColumnData columnData = getColumn(refColumn.getColumnId(), trId);
return columnData;
@ -7752,7 +7757,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
}
/**
*
* {@inheritDoc}
@ -7797,7 +7802,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
+ e.getLocalizedMessage());
}
}
/**
*
* {@inheritDoc}
@ -7911,7 +7916,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
+ e.getLocalizedMessage());
}
}
/**
*
* {@inheritDoc}
@ -8018,7 +8023,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
+ e.getLocalizedMessage());
}
}
/**
*
* {@inheritDoc}
@ -8081,37 +8086,37 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
}
/**
*
* {@inheritDoc}
*/
@Override
public void saveResource(
SaveResourceSession saveResourceSession)
public void saveResource(SaveResourceSession saveResourceSession)
throws TDGWTServiceException {
try {
HttpSession session = this.getThreadLocalRequest().getSession();
SessionUtil
.setSaveResourceSession(session, saveResourceSession);
SessionUtil.setSaveResourceSession(session, saveResourceSession);
ASLSession aslSession = SessionUtil.getAslSession(session);
FilesStorage storage = new FilesStorage();
logger.debug("Create Item On Workspace: [ uri: "
+ saveResourceSession.getUri() + " ,user: " + aslSession.getUsername()
+ " ,fileName: " + saveResourceSession.getFileName()
+ " ,fileDescription: "
+ saveResourceSession.getFileDescription()
+ " ,mimetype:"+saveResourceSession.getMimeType() + " ,folder: "
+ saveResourceSession.getUri() + " ,user: "
+ aslSession.getUsername() + " ,fileName: "
+ saveResourceSession.getFileName() + " ,fileDescription: "
+ saveResourceSession.getFileDescription() + " ,mimetype:"
+ saveResourceSession.getMimeType() + " ,folder: "
+ saveResourceSession.getItemId() + "]");
storage.createItemOnWorkspace(saveResourceSession.getUri(), aslSession.getUsername(),
saveResourceSession.getFileName(),
saveResourceSession.getFileDescription(), saveResourceSession.getMimeType(),
saveResourceSession.getItemId());
storage.createItemOnWorkspace(saveResourceSession.getUri(),
aslSession.getUsername(),
saveResourceSession.getFileName(),
saveResourceSession.getFileDescription(),
saveResourceSession.getMimeType(),
saveResourceSession.getItemId());
return;
} catch (TDGWTServiceException e) {
throw e;
} catch (SecurityException e) {
@ -8124,6 +8129,5 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
}
}