Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@94246 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-04-03 13:32:29 +00:00
parent a17d4b01cf
commit 701c43759f
4 changed files with 154 additions and 82 deletions

View File

@ -53,6 +53,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Codelist;
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Dataset; import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Dataset;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@ -174,7 +175,18 @@ public interface TDGWTService extends RemoteService {
*/ */
public ArrayList<TRMetadata> getTRMetadata(TRId trId) public ArrayList<TRMetadata> getTRMetadata(TRId trId)
throws TDGWTServiceException; throws TDGWTServiceException;
/**
* Return true if is a valid tabular resource
*
* @param trId
* @return
* @throws TDGWTServiceException
*/
public Boolean isTabularResourceValid(TRId trId)
throws TDGWTServiceException;
//Share //Share
/** /**
* Retrieves information sharing on the tabular resource * Retrieves information sharing on the tabular resource

View File

@ -96,14 +96,14 @@ public interface TDGWTServiceAsync {
void getColumns(AsyncCallback<ArrayList<ColumnData>> callback); void getColumns(AsyncCallback<ArrayList<ColumnData>> callback);
void getColumns(TRId trId, AsyncCallback<ArrayList<ColumnData>> callback); void getColumns(TRId trId, AsyncCallback<ArrayList<ColumnData>> callback);
void getColumnsForDimension(TRId trId, AsyncCallback<ArrayList<ColumnData>> callback); void getColumnsForDimension(TRId trId, AsyncCallback<ArrayList<ColumnData>> callback);
void getColumn(TRId trId, String columnName, AsyncCallback<ColumnData> callback); void getColumn(TRId trId, String columnName, AsyncCallback<ColumnData> callback);
void removeTabularResource(TRId trId, AsyncCallback<Void> callback); void removeTabularResource(TRId trId, AsyncCallback<Void> callback);
void isTabularResourceValid(TRId trId,AsyncCallback<Boolean> callback);
//Share //Share
void getShareInfo(TRId trId, AsyncCallback<ShareInfo> callback); void getShareInfo(TRId trId, AsyncCallback<ShareInfo> callback);

View File

@ -253,6 +253,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
.getTrId()); .getTrId());
updateTabResourceInformation(currentTR, trMetadatas); updateTabResourceInformation(currentTR, trMetadatas);
currentTR.setDate(getTRCreationDate(currentTR.getTrId())); currentTR.setDate(getTRCreationDate(currentTR.getTrId()));
currentTR.setValid(isTabularResourceValid(currentTR.getTrId()));
SessionUtil.setTabResource(session, currentTR); SessionUtil.setTabResource(session, currentTR);
logger.debug("GetTabResourceInformation() updated information:" logger.debug("GetTabResourceInformation() updated information:"
+ currentTR.toString()); + currentTR.toString());
@ -293,6 +294,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
.getTrId()); .getTrId());
updateTabResourceInformation(currentTR, trMetadatas); updateTabResourceInformation(currentTR, trMetadatas);
currentTR.setDate(getTRCreationDate(trId)); currentTR.setDate(getTRCreationDate(trId));
currentTR.setValid(isTabularResourceValid(trId));
logger.debug("GetTabResourceInformation() updated information:" logger.debug("GetTabResourceInformation() updated information:"
+ currentTR.toString()); + currentTR.toString());
return currentTR; return currentTR;
@ -936,6 +939,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
+ tabResource.getAgency() + " ,rights:" + tabResource.getAgency() + " ,rights:"
+ tabResource.getRight() + "]"); + tabResource.getRight() + "]");
tabResource.setDate(sdf.format(tr.getCreationDate().getTime())); tabResource.setDate(sdf.format(tr.getCreationDate().getTime()));
tabResource.setValid(tr.isValid());
tr.setMetadata(new NameMetadata(tabResource.getName())); tr.setMetadata(new NameMetadata(tabResource.getName()));
tr.setMetadata(new DescriptionMetadata(tabResource.getDescription())); tr.setMetadata(new DescriptionMetadata(tabResource.getDescription()));
// tr.setMetadata(new CreationDateMetadata(date)); // tr.setMetadata(new CreationDateMetadata(date));
@ -977,6 +981,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
trId.setTabularResourceType(tr.getTableType()); trId.setTabularResourceType(tr.getTableType());
t.setId(String.valueOf(i)); t.setId(String.valueOf(i));
t.setTrId(trId); t.setTrId(trId);
t.setValid(tr.isValid());
if (tr.contains(NameMetadata.class)) { if (tr.contains(NameMetadata.class)) {
NameMetadata nameMeta = tr.getMetadata(NameMetadata.class); NameMetadata nameMeta = tr.getMetadata(NameMetadata.class);
if (nameMeta != null && nameMeta.getValue() != null) { if (nameMeta != null && nameMeta.getValue() != null) {
@ -1039,13 +1044,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
Table viewTable = null; Table viewTable = null;
TRId trId; TRId trId;
TabResource t; TabResource t;
if (table == null) { if (table == null) {
logger.info("Tabular resource " + tr.getId() + " has no table."); logger.info("Tabular resource " + tr.getId() + " has no table.");
t = new TabResource(); t = new TabResource();
t.setTrId(null); t.setTrId(null);
} else { } else {
tableId = table.getId(); tableId = table.getId();
if (tableId == null) { if (tableId == null) {
logger.info("Tabular Resource " + tr.getId() logger.info("Tabular Resource " + tr.getId()
+ " has last table with id null."); + " has last table with id null.");
@ -1062,23 +1067,26 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.error("view table not found"); logger.error("view table not found");
} }
} }
if (viewTable == null) { if (viewTable == null) {
trId = new TRId(String.valueOf(tr.getId().getValue()), trId = new TRId(String.valueOf(tr.getId().getValue()),
tr.getTableType(), String.valueOf(tableId.getValue()), tr.getTableType(), String.valueOf(tableId
table.getTableType().getName()); .getValue()), table.getTableType()
.getName());
} else { } else {
trId = new TRId(String.valueOf(tr.getId().getValue()), trId = new TRId(String.valueOf(tr.getId().getValue()),
tr.getTableType(), String.valueOf(viewTable.getId().getValue()), tr.getTableType(), String.valueOf(viewTable.getId()
viewTable.getTableType().getName(),String.valueOf(tableId.getValue()),true); .getValue()), viewTable.getTableType()
.getName(), String.valueOf(tableId
.getValue()), true);
} }
t = getTabResourceInformation(trId); t = getTabResourceInformation(trId);
} }
} }
t.setId(String.valueOf(i)); t.setId(String.valueOf(i));
return t; return t;
@ -1111,8 +1119,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
try { try {
TabResource t = retrieveTRMetadataFromService(service, tr, TabResource t = retrieveTRMetadataFromService(service, tr,
i); i);
if (t.getTrId() != null) { if (t.getTrId() != null && t.isValid()) {
ltr.add(t); ltr.add(t);
} }
} catch (Throwable e) { } catch (Throwable e) {
logger.error("TabResource discarded: " + tr + " cause: " logger.error("TabResource discarded: " + tr + " cause: "
@ -1567,13 +1576,21 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
TabularResourceId id = new TabularResourceId(Long.valueOf(trId TabularResourceId id = new TabularResourceId(Long.valueOf(trId
.getId())); .getId()));
service.removeTabularResource(id); TabularResource tr = service.getTabularResource(id);
String owner = tr.getOwner();
if (owner != null && owner.compareTo(aslSession.getUsername()) == 0) {
service.removeTabularResource(id);
} else {
throw new TDGWTServiceException(
"You are not the owner of this tabular resource (owner: "
+ owner + ")");
}
return; return;
} catch (Throwable e) { } catch (Throwable e) {
logger.error( logger.error(
"Error removing TabularResource: " "Error deleting the tabular resource: "
+ e.getLocalizedMessage(), e); + e.getLocalizedMessage(), e);
throw new TDGWTServiceException("Error removing TabularResource: " throw new TDGWTServiceException("Error deleting the tabular resource: "
+ e.getLocalizedMessage()); + e.getLocalizedMessage());
} }
} }
@ -1601,12 +1618,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
TabularResource serviceTR = service.createTabularResource(); TabularResource serviceTR = service.createTabularResource();
Table table = service.getLastTable(serviceTR.getId()); Table table = service.getLastTable(serviceTR.getId());
syncTRMetaData(serviceTR, tabResource); syncTRMetaData(serviceTR, tabResource);
TRId trId = new TRId(String.valueOf(serviceTR.getId().getValue()), TRId trId = new TRId(String.valueOf(serviceTR.getId().getValue()),
serviceTR.getTableType(), String.valueOf(table.getId() serviceTR.getTableType(), String.valueOf(table.getId()
.getValue()), table.getTableType().getName()); .getValue()), table.getTableType().getName());
tabResource.setTrId(trId); tabResource.setTrId(trId);
tabResource.setValid(serviceTR.isValid());
return tabResource; return tabResource;
} catch (Throwable e) { } catch (Throwable e) {
logger.error( logger.error(
@ -1764,9 +1781,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
new Long(trId.getId())); new Long(trId.getId()));
TabularResource tr = service.getTabularResource(tabularResourceId); TabularResource tr = service.getTabularResource(tabularResourceId);
Table table = service.getLastTable(tabularResourceId); Table table = service.getLastTable(tabularResourceId);
Table viewTable=null; Table viewTable = null;
if (table.contains(DatasetViewTableMetadata.class)) { if (table.contains(DatasetViewTableMetadata.class)) {
DatasetViewTableMetadata dwm = table DatasetViewTableMetadata dwm = table
.getMetadata(DatasetViewTableMetadata.class); .getMetadata(DatasetViewTableMetadata.class);
@ -1777,21 +1794,22 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.error("view table not found"); logger.error("view table not found");
} }
} }
TRId newTRId; TRId newTRId;
if (viewTable == null) { if (viewTable == null) {
newTRId = new TRId(String.valueOf(tr.getId().getValue()), newTRId = new TRId(String.valueOf(tr.getId().getValue()),
tr.getTableType(), String.valueOf(table.getId().getValue()), tr.getTableType(), String.valueOf(table.getId()
table.getTableType().getName()); .getValue()), table.getTableType().getName());
} else { } else {
newTRId = new TRId(String.valueOf(tr.getId().getValue()), newTRId = new TRId(String.valueOf(tr.getId().getValue()),
tr.getTableType(), String.valueOf(viewTable.getId().getValue()), tr.getTableType(), String.valueOf(viewTable.getId()
viewTable.getTableType().getName(), .getValue()), viewTable.getTableType()
String.valueOf(table.getId().getValue()),true); .getName(), String.valueOf(table.getId()
.getValue()), true);
} }
logger.debug("Retrieved TRId basic info:" + newTRId.toString()); logger.debug("Retrieved TRId basic info:" + newTRId.toString());
return newTRId; return newTRId;
@ -1840,8 +1858,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case SUCCEDED: case SUCCEDED:
importMonitor.setProgress(task.getProgress()); importMonitor.setProgress(task.getProgress());
logger.debug("Task Result: " + task.getResult()); logger.debug("Task Result: " + task.getResult());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
sdmxImportTabResource.setTrId(trId); sdmxImportTabResource.setTrId(trId);
SessionUtil.setSDMXImportTabResource(session, SessionUtil.setSDMXImportTabResource(session,
@ -1866,7 +1884,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case STOPPED: case STOPPED:
importMonitor.setProgress(task.getProgress()); importMonitor.setProgress(task.getProgress());
logger.debug("Task Result: " + task.getResult()); logger.debug("Task Result: " + task.getResult());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
sdmxImportTabResource.setTrId(trId); sdmxImportTabResource.setTrId(trId);
SessionUtil.setSDMXImportTabResource(session, SessionUtil.setSDMXImportTabResource(session,
@ -2078,9 +2096,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} }
String user = aslSession.getUsername(); String user = aslSession.getUsername();
logger.info("Session User:" + user); logger.info("Session User:" + user);
logger.debug("StartCSVImport: "+csvImportSession.toString()); logger.debug("StartCSVImport: " + csvImportSession.toString());
FileUploadSession fileUploadSession = SessionUtil FileUploadSession fileUploadSession = SessionUtil
.getFileUploadSession(session); .getFileUploadSession(session);
if (fileUploadSession == null) { if (fileUploadSession == null) {
@ -2118,7 +2136,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
parameterInstances.put(Constants.PARAMETER_HASHEADER, hasHeader);// true parameterInstances.put(Constants.PARAMETER_HASHEADER, hasHeader);// true
parameterInstances.put(Constants.PARAMETER_FIELDMASK, parameterInstances.put(Constants.PARAMETER_FIELDMASK,
csvImportSession.getColumnToImportMask());// Column Mask csvImportSession.getColumnToImportMask());// Column Mask
parameterInstances.put(Constants.PARAMETER_SKIPERROR, csvImportSession.isSkipInvalidLines()); parameterInstances.put(Constants.PARAMETER_SKIPERROR,
csvImportSession.isSkipInvalidLines());
return parameterInstances; return parameterInstances;
} }
@ -2234,7 +2253,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
importMonitor.setStatus(TaskStateMap.map(task importMonitor.setStatus(TaskStateMap.map(task
.getStatus())); .getStatus()));
switch (importMonitor.getStatus()) { switch (importMonitor.getStatus()) {
case FAILED: case FAILED:
if (task.getResult() != null) { if (task.getResult() != null) {
@ -2251,8 +2270,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case SUCCEDED: case SUCCEDED:
logger.debug("Task Result: " + task.getResult()); logger.debug("Task Result: " + task.getResult());
importMonitor.setProgress(task.getProgress()); importMonitor.setProgress(task.getProgress());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
csvImportTabResource.setTrId(trId); csvImportTabResource.setTrId(trId);
SessionUtil.setCSVImportTabResource(session, SessionUtil.setCSVImportTabResource(session,
csvImportTabResource); csvImportTabResource);
@ -2265,8 +2284,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case STOPPED: case STOPPED:
logger.debug("Task Result: " + task.getResult()); logger.debug("Task Result: " + task.getResult());
importMonitor.setProgress(task.getProgress()); importMonitor.setProgress(task.getProgress());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
csvImportTabResource.setTrId(trId); csvImportTabResource.setTrId(trId);
SessionUtil.setCSVImportTabResource(session, SessionUtil.setCSVImportTabResource(session,
csvImportTabResource); csvImportTabResource);
@ -2383,7 +2402,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
FileUtil.exceptionDetailMessage(e)); FileUtil.exceptionDetailMessage(e));
fileUploadSession.setFileUploadState(FileUploadState.FAILED); fileUploadSession.setFileUploadState(FileUploadState.FAILED);
SessionUtil.setFileUploadSession(session, fileUploadSession); SessionUtil.setFileUploadSession(session, fileUploadSession);
logger.error("Error elaborating the imput stream", e); logger.error("Error elaborating the input stream", e);
throw new TDGWTServiceException( throw new TDGWTServiceException(
"Error in importCSV getFileFromWorkspace: " "Error in importCSV getFileFromWorkspace: "
+ e.getLocalizedMessage(), e); + e.getLocalizedMessage(), e);
@ -2424,6 +2443,39 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
+ e.getLocalizedMessage()); + e.getLocalizedMessage());
} }
} }
/**
*
* @param trId
* @return
* @throws TDGWTServiceException
*/
public Boolean isTabularResourceValid(TRId trId) throws TDGWTServiceException {
try {
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getAslSession(session);
logger.debug("IsTabularResourceValid: " + trId.toString());
AuthorizationProvider.instance.set(new AuthorizationToken(
aslSession.getUsername()));
TabularDataService service = TabularDataServiceFactory.getService();
TabularResource tr = service
.getTabularResource(new TabularResourceId(Long.valueOf(trId
.getId())));
logger.debug("IsTabularResourceValid: " + tr.isValid());
return tr.isValid();
} catch (Throwable e) {
logger.error(
"Error checking if it is a valid tabular resource: " + e.getLocalizedMessage(),
e);
throw new TDGWTServiceException("Error checking if it is a valid tabular resource: "
+ e.getLocalizedMessage());
}
}
/** /**
* *
@ -2812,7 +2864,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case SUCCEDED: case SUCCEDED:
logger.debug("Task Result:" + task.getResult()); logger.debug("Task Result:" + task.getResult());
exportMonitor.setProgress(task.getProgress()); exportMonitor.setProgress(task.getProgress());
table = task.getResult().getPrimaryTable(); table = task.getResult().getPrimaryTable();
logger.debug("Table retrived: " + table.toString()); logger.debug("Table retrived: " + table.toString());
exportMetadata = table exportMetadata = table
@ -3557,7 +3609,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
trId = new TRId(); trId = new TRId();
trId.setId(changeColumnTypeSession.getColumnData() trId.setId(changeColumnTypeSession.getColumnData()
.getTrId().getId()); .getTrId().getId());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
changeColumnTypeMonitor.setTrId(trId); changeColumnTypeMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);
@ -3579,8 +3631,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
trId = new TRId(); trId = new TRId();
trId.setId(changeColumnTypeSession.getColumnData() trId.setId(changeColumnTypeSession.getColumnData()
.getTrId().getId()); .getTrId().getId());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
changeColumnTypeMonitor.setTrId(trId); changeColumnTypeMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);
@ -3700,7 +3752,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
trId = new TRId(); trId = new TRId();
trId.setId(deleteColumnSession.getColumnData() trId.setId(deleteColumnSession.getColumnData()
.getTrId().getId()); .getTrId().getId());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
deleteColumnMonitor.setTrId(trId); deleteColumnMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);
@ -3724,7 +3776,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
trId = new TRId(); trId = new TRId();
trId.setId(deleteColumnSession.getColumnData() trId.setId(deleteColumnSession.getColumnData()
.getTrId().getId()); .getTrId().getId());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
deleteColumnMonitor.setTrId(trId); deleteColumnMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);
@ -3843,7 +3895,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
trId = new TRId(); trId = new TRId();
trId.setId(labelColumnSession.getColumnData().getTrId() trId.setId(labelColumnSession.getColumnData().getTrId()
.getId()); .getId());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
labelColumnMonitor.setTrId(trId); labelColumnMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);
@ -3865,7 +3917,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
trId = new TRId(); trId = new TRId();
trId.setId(labelColumnSession.getColumnData().getTrId() trId.setId(labelColumnSession.getColumnData().getTrId()
.getId()); .getId());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
labelColumnMonitor.setTrId(trId); labelColumnMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);
@ -3987,8 +4039,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Table retrived: " + table.toString()); logger.debug("Table retrived: " + table.toString());
trId = new TRId(); trId = new TRId();
trId.setId(changeTableTypeSession.getTrId().getId()); trId.setId(changeTableTypeSession.getTrId().getId());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
changeTableTypeMonitor.setTrId(trId); changeTableTypeMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);
@ -4011,8 +4063,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Table retrived: " + table.toString()); logger.debug("Table retrived: " + table.toString());
trId = new TRId(); trId = new TRId();
trId.setId(changeTableTypeSession.getTrId().getId()); trId.setId(changeTableTypeSession.getTrId().getId());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
changeTableTypeMonitor.setTrId(trId); changeTableTypeMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);
@ -4221,7 +4273,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
trId = new TRId(); trId = new TRId();
trId.setId(deleteRowsSession.getTrId().getId()); trId.setId(deleteRowsSession.getTrId().getId());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
deleteRowsMonitor.setTrId(trId); deleteRowsMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);
@ -4242,7 +4294,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
deleteRowsMonitor.setProgress(task.getProgress()); deleteRowsMonitor.setProgress(task.getProgress());
trId = new TRId(); trId = new TRId();
trId.setId(deleteRowsSession.getTrId().getId()); trId.setId(deleteRowsSession.getTrId().getId());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
deleteRowsMonitor.setTrId(trId); deleteRowsMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);
@ -4293,9 +4345,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
TabularResource cloned = service.cloneTabularResource(serviceTR); TabularResource cloned = service.cloneTabularResource(serviceTR);
Table table = service.getLastTable(serviceTR); Table table = service.getLastTable(serviceTR);
Table viewTable=null; Table viewTable = null;
if (table.contains(DatasetViewTableMetadata.class)) { if (table.contains(DatasetViewTableMetadata.class)) {
DatasetViewTableMetadata dwm = table DatasetViewTableMetadata dwm = table
.getMetadata(DatasetViewTableMetadata.class); .getMetadata(DatasetViewTableMetadata.class);
@ -4306,24 +4358,21 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.error("view table not found"); logger.error("view table not found");
} }
} }
TRId trId; TRId trId;
if (viewTable == null) { if (viewTable == null) {
trId = new TRId( trId = new TRId(new Long(cloned.getId().getValue()).toString(),
new Long(cloned.getId().getValue()).toString(), cloned.getTableType(), new Long(table.getId()
cloned.getTableType(), .getValue()).toString(), table.getTableType()
new Long(table.getId().getValue()).toString(), table .getName());
.getTableType().getName());
} else { } else {
trId = new TRId(new Long(cloned.getId().getValue()).toString(), trId = new TRId(new Long(cloned.getId().getValue()).toString(),
cloned.getTableType(), cloned.getTableType(), String.valueOf(viewTable.getId()
String.valueOf(viewTable.getId().getValue()), .getValue()), viewTable.getTableType()
viewTable.getTableType().getName(), .getName(), String.valueOf(table.getId()
String.valueOf(table.getId().getValue()),true); .getValue()), true);
} }
TabResource tabResource = new TabResource(); TabResource tabResource = new TabResource();
tabResource.setTrId(trId); tabResource.setTrId(trId);
@ -4432,7 +4481,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Table retrived: " + table.toString()); logger.debug("Table retrived: " + table.toString());
trId = new TRId(); trId = new TRId();
trId.setId(duplicatesSession.getTrId().getId()); trId.setId(duplicatesSession.getTrId().getId());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
duplicatesMonitor.setTrId(trId); duplicatesMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);
@ -4455,8 +4504,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Table retrived: " + table.toString()); logger.debug("Table retrived: " + table.toString());
trId = new TRId(); trId = new TRId();
trId.setId(duplicatesSession.getTrId().getId()); trId.setId(duplicatesSession.getTrId().getId());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
duplicatesMonitor.setTrId(trId); duplicatesMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);
@ -4768,7 +4817,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
trId = new TRId(); trId = new TRId();
trId.setId(templateApplySession.getTrId().getId()); trId.setId(templateApplySession.getTrId().getId());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
templateApplyMonitor.setTrId(trId); templateApplyMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);
@ -4791,7 +4840,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
trId = new TRId(); trId = new TRId();
trId.setId(templateApplySession.getTrId().getId()); trId.setId(templateApplySession.getTrId().getId());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
templateApplyMonitor.setTrId(trId); templateApplyMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);
@ -4948,7 +4997,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
trId = new TRId(); trId = new TRId();
trId.setId(replaceColumnSession.getTrId().getId()); trId.setId(replaceColumnSession.getTrId().getId());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
replaceColumnMonitor.setTrId(trId); replaceColumnMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);
@ -4971,7 +5020,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
trId.setId(replaceColumnSession.getColumnData() trId.setId(replaceColumnSession.getColumnData()
.getTrId().getId()); .getTrId().getId());
trId=retrieveTabularResourceBasicData(trId); trId = retrieveTabularResourceBasicData(trId);
replaceColumnMonitor.setTrId(trId); replaceColumnMonitor.setTrId(trId);
tabResource = SessionUtil.getTabResource(session); tabResource = SessionUtil.getTabResource(session);

View File

@ -23,6 +23,7 @@ public class TabResource implements Serializable {
protected String agency; protected String agency;
protected String date; protected String date;
protected String right; protected String right;
protected boolean valid;
protected TRId trId; protected TRId trId;
public TabResource(){} public TabResource(){}
@ -100,13 +101,23 @@ public class TabResource implements Serializable {
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
public boolean isValid() {
return valid;
}
public void setValid(boolean valid) {
this.valid = valid;
}
@Override @Override
public String toString() { public String toString() {
return "TabResource [id=" + id + ", name=" + name + ", description=" return "TabResource [id=" + id + ", name=" + name + ", description="
+ description + ", agency=" + agency + ", date=" + date + description + ", agency=" + agency + ", date=" + date
+ ", right=" + right + ", trId=" + trId + "]"; + ", right=" + right + ", valid=" + valid + ", trId=" + trId
+ "]";
} }
} }