Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@94934 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
69cb564bcb
commit
46bbb61583
|
@ -245,6 +245,15 @@ public interface TDGWTService extends RemoteService {
|
||||||
public RollBackSessionMonitor getRollBackMonitor()
|
public RollBackSessionMonitor getRollBackMonitor()
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call discard operation on tabular resource
|
||||||
|
*
|
||||||
|
* @param trId
|
||||||
|
* @throws TDGWTServiceException
|
||||||
|
*/
|
||||||
|
public RollBackSession discard(TRId trId)
|
||||||
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
// Share
|
// Share
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -103,6 +103,7 @@ public interface TDGWTServiceAsync {
|
||||||
//RollBack
|
//RollBack
|
||||||
void rollBack(RollBackSession rollBackSession,AsyncCallback<Void> callback);
|
void rollBack(RollBackSession rollBackSession,AsyncCallback<Void> callback);
|
||||||
void getRollBackMonitor(AsyncCallback<RollBackSessionMonitor> callback);
|
void getRollBackMonitor(AsyncCallback<RollBackSessionMonitor> callback);
|
||||||
|
void discard(TRId trId,AsyncCallback<RollBackSession> callback);
|
||||||
|
|
||||||
//Share
|
//Share
|
||||||
void getShareInfo(TRId trId, AsyncCallback<ShareInfo> callback);
|
void getShareInfo(TRId trId, AsyncCallback<ShareInfo> callback);
|
||||||
|
|
|
@ -241,7 +241,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
@ -265,19 +265,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
throw new TDGWTServiceException(
|
throw new TDGWTServiceException(
|
||||||
"CURRENT_TABULAR_RESOURCE has TRId null");
|
"CURRENT_TABULAR_RESOURCE has TRId null");
|
||||||
}
|
}
|
||||||
logger.debug("getCurrentTRId():"+currentTR.getTrId());
|
logger.debug("getCurrentTRId():" + currentTR.getTrId());
|
||||||
return currentTR.getTrId();
|
return currentTR.getTrId();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error(
|
logger.error("getCurrentTRID(): " + e.getLocalizedMessage(), e);
|
||||||
"getCurrentTRID(): "
|
throw new TDGWTServiceException("Error retrieving TR id: "
|
||||||
+ e.getLocalizedMessage(), e);
|
+ e.getLocalizedMessage());
|
||||||
throw new TDGWTServiceException(
|
|
||||||
"Error retrieving TR id: "
|
|
||||||
+ e.getLocalizedMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
@ -422,12 +419,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
List<Column> cols = table.getColumns();
|
List<Column> cols = table.getColumns();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
//|| c.getColumnType() instanceof DimensionColumnType
|
// || c.getColumnType() instanceof DimensionColumnType
|
||||||
//|| c.getColumnType() instanceof TimeDimensionColumnType
|
// || c.getColumnType() instanceof TimeDimensionColumnType
|
||||||
for (Column c : cols) {
|
for (Column c : cols) {
|
||||||
if (c.getColumnType() instanceof IdColumnType
|
if (c.getColumnType() instanceof IdColumnType
|
||||||
|| c.getColumnType() instanceof ValidationColumnType
|
|| c.getColumnType() instanceof ValidationColumnType) {
|
||||||
) {
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (c.contains(ViewColumnMetadata.class)) {
|
if (c.contains(ViewColumnMetadata.class)) {
|
||||||
|
@ -676,14 +672,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
cData.setLabel("nolabel");
|
cData.setLabel("nolabel");
|
||||||
logger.debug("ColumnLabel no label in en");
|
logger.debug("ColumnLabel no label in en");
|
||||||
} else {
|
} else {
|
||||||
if (cl.getValue() == null
|
if (cl.getValue() == null || cl.getValue().isEmpty()) {
|
||||||
|| cl.getValue().isEmpty()) {
|
|
||||||
cData.setLabel("nolabel");
|
cData.setLabel("nolabel");
|
||||||
logger.debug("ColumnLabel no label in en");
|
logger.debug("ColumnLabel no label in en");
|
||||||
} else {
|
} else {
|
||||||
cData.setLabel(cl.getValue());
|
cData.setLabel(cl.getValue());
|
||||||
logger.debug("Column Set Label: "
|
logger.debug("Column Set Label: " + cl.getValue());
|
||||||
+ cl.getValue());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -787,14 +781,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
cData.setLabel("nolabel");
|
cData.setLabel("nolabel");
|
||||||
logger.debug("ColumnLabel no label in en");
|
logger.debug("ColumnLabel no label in en");
|
||||||
} else {
|
} else {
|
||||||
if (cl.getValue() == null
|
if (cl.getValue() == null || cl.getValue().isEmpty()) {
|
||||||
|| cl.getValue().isEmpty()) {
|
|
||||||
cData.setLabel("nolabel");
|
cData.setLabel("nolabel");
|
||||||
logger.debug("ColumnLabel no label in en");
|
logger.debug("ColumnLabel no label in en");
|
||||||
} else {
|
} else {
|
||||||
cData.setLabel(cl.getValue());
|
cData.setLabel(cl.getValue());
|
||||||
logger.debug("Column Set Label: "
|
logger.debug("Column Set Label: " + cl.getValue());
|
||||||
+ cl.getValue());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2888,14 +2880,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
+ e.getLocalizedMessage());
|
+ e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param trId
|
* @param trId
|
||||||
* @return
|
* @return
|
||||||
* @throws TDGWTServiceException
|
* @throws TDGWTServiceException
|
||||||
*/
|
*/
|
||||||
public TabValidationsMetadata getTableValidationsMetadata(TRId trId)
|
public TabValidationsMetadata getTableValidationsMetadata(TRId trId)
|
||||||
throws TDGWTServiceException {
|
throws TDGWTServiceException {
|
||||||
try {
|
try {
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
@ -2908,34 +2900,38 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
Table table = service.getTable(new TableId(Long.valueOf(trId
|
Table table = service.getTable(new TableId(Long.valueOf(trId
|
||||||
.getTableId())));
|
.getTableId())));
|
||||||
TabValidationsMetadata tabValidationsMetadata=new TabValidationsMetadata();
|
TabValidationsMetadata tabValidationsMetadata = new TabValidationsMetadata();
|
||||||
if(table.contains(ValidationsMetadata.class)){
|
if (table.contains(ValidationsMetadata.class)) {
|
||||||
ValidationsMetadata validationsMetadata=table.getMetadata(ValidationsMetadata.class);
|
ValidationsMetadata validationsMetadata = table
|
||||||
if(validationsMetadata!=null){
|
.getMetadata(ValidationsMetadata.class);
|
||||||
List<Validation> vals=validationsMetadata.getValidations();
|
if (validationsMetadata != null) {
|
||||||
if(vals!=null && vals.size()>0){
|
List<Validation> vals = validationsMetadata
|
||||||
Validations valid=null;
|
.getValidations();
|
||||||
ArrayList<Validations> vList=new ArrayList<Validations>();
|
if (vals != null && vals.size() > 0) {
|
||||||
int i=0;
|
Validations valid = null;
|
||||||
for(Validation v:vals){
|
ArrayList<Validations> vList = new ArrayList<Validations>();
|
||||||
valid=new Validations(i,v.getDescription(),v.isValid());
|
int i = 0;
|
||||||
|
for (Validation v : vals) {
|
||||||
|
valid = new Validations(i, v.getDescription(),
|
||||||
|
v.isValid());
|
||||||
vList.add(valid);
|
vList.add(valid);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
tabValidationsMetadata.setValidations(vList);
|
tabValidationsMetadata.setValidations(vList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("TabValidationsMetadata: "+tabValidationsMetadata);
|
logger.debug("TabValidationsMetadata: " + tabValidationsMetadata);
|
||||||
return tabValidationsMetadata;
|
return tabValidationsMetadata;
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error(
|
logger.error(
|
||||||
"Error in getTableValidationMetadata(): " + e.getLocalizedMessage(),
|
"Error in getTableValidationMetadata(): "
|
||||||
e);
|
+ e.getLocalizedMessage(), e);
|
||||||
throw new TDGWTServiceException("Error in getTableValidationMetadata: "
|
throw new TDGWTServiceException(
|
||||||
+ e.getLocalizedMessage());
|
"Error in getTableValidationMetadata: "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5738,8 +5734,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
@ -5758,42 +5753,47 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
"CURRENT_TABULAR_RESOURCE is null");
|
"CURRENT_TABULAR_RESOURCE is null");
|
||||||
}
|
}
|
||||||
TRId trId = currentTR.getTrId();
|
TRId trId = currentTR.getTrId();
|
||||||
|
|
||||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
aslSession.getUsername()));
|
aslSession.getUsername()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
|
||||||
|
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||||
|
Long.valueOf(trId.getId()));
|
||||||
|
TabularResource tabularResource = service
|
||||||
|
.getTabularResource(tabularResourceId);
|
||||||
|
List<HistoryStep> history = tabularResource.getHistory();
|
||||||
|
long historyId = 0;
|
||||||
|
String opDesc=null, opName=null;
|
||||||
|
HistoryStep lastStep = null;
|
||||||
|
OpHistory op = null;
|
||||||
|
|
||||||
TabularResourceId tabularResourceId=new TabularResourceId(Long.valueOf(trId.getId()));
|
if (history != null && history.size() > 0) {
|
||||||
TabularResource tabularResource=service.getTabularResource(tabularResourceId);
|
lastStep = history.get(0);
|
||||||
List<HistoryStep> history =tabularResource.getHistory();
|
if (lastStep != null) {
|
||||||
OperationDefinition lastOp=null;
|
opDesc = lastStep.getOperationDescription();
|
||||||
long historyId=0;
|
opName = opDesc;
|
||||||
HistoryStep lastStep=null;
|
historyId = lastStep.getId().getValue();
|
||||||
if(history!=null && history.size()>0){
|
op = new OpHistory(historyId, opName,
|
||||||
lastStep=history.get(0);
|
opDesc, sdf.format(lastStep
|
||||||
historyId=lastStep.getId().getValue();
|
.getExecutionDate().getTime()));
|
||||||
|
|
||||||
if(lastStep!=null){
|
|
||||||
lastOp=service.getCapability(lastStep.getOperationInvocation().getOperationId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
OpHistory op=null;
|
|
||||||
if(lastOp!=null){
|
|
||||||
op=new OpHistory(historyId,lastOp.getName(),lastOp.getDescription(),sdf.format(lastStep.getExecutionDate()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("Last Operation Info :" + op);
|
logger.debug("Last Operation Info :" + op);
|
||||||
return op;
|
return op;
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.debug("getLastOperationInfo(): " + e.getLocalizedMessage());
|
logger.debug("getLastOperationInfo(): " + e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new TDGWTServiceException("Error retrieving last operation info: "
|
throw new TDGWTServiceException(
|
||||||
+ e.getLocalizedMessage());
|
"Error retrieving last operation info: "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*
|
*
|
||||||
|
@ -5805,29 +5805,34 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
|
|
||||||
logger.debug("getLastOperationInfo: "+trId);
|
logger.debug("getLastOperationInfo: " + trId);
|
||||||
|
|
||||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
aslSession.getUsername()));
|
aslSession.getUsername()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
|
||||||
|
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||||
|
Long.valueOf(trId.getId()));
|
||||||
|
TabularResource tabularResource = service
|
||||||
|
.getTabularResource(tabularResourceId);
|
||||||
|
|
||||||
TabularResourceId tabularResourceId=new TabularResourceId(Long.valueOf(trId.getId()));
|
List<HistoryStep> history = tabularResource.getHistory();
|
||||||
TabularResource tabularResource=service.getTabularResource(tabularResourceId);
|
long historyId = 0;
|
||||||
List<HistoryStep> history =tabularResource.getHistory();
|
String opDesc=null, opName=null;
|
||||||
OperationDefinition lastOp=null;
|
HistoryStep lastStep = null;
|
||||||
long historyId=0;
|
OpHistory op = null;
|
||||||
HistoryStep lastStep=null;
|
|
||||||
if(history!=null && history.size()>0){
|
if (history != null && history.size() > 0) {
|
||||||
lastStep=history.get(0);
|
lastStep = history.get(0);
|
||||||
historyId=lastStep.getId().getValue();
|
if (lastStep != null) {
|
||||||
if(lastStep!=null){
|
opDesc = lastStep.getOperationDescription();
|
||||||
lastOp=service.getCapability(lastStep.getOperationInvocation().getOperationId());
|
opName = opDesc;
|
||||||
|
historyId = lastStep.getId().getValue();
|
||||||
|
op = new OpHistory(historyId, opName,
|
||||||
|
opDesc, sdf.format(lastStep
|
||||||
|
.getExecutionDate().getTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
OpHistory op=null;
|
|
||||||
if(lastOp!=null){
|
|
||||||
op=new OpHistory(historyId,lastOp.getName(),lastOp.getDescription(),sdf.format(lastStep.getExecutionDate()));
|
|
||||||
}
|
}
|
||||||
logger.debug("Last Operation Info :" + op);
|
logger.debug("Last Operation Info :" + op);
|
||||||
return op;
|
return op;
|
||||||
|
@ -5835,11 +5840,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.debug("getLastOperationInfo(): " + e.getLocalizedMessage());
|
logger.debug("getLastOperationInfo(): " + e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new TDGWTServiceException("Error retrieving last operation info: "
|
throw new TDGWTServiceException(
|
||||||
+ e.getLocalizedMessage());
|
"Error retrieving last operation info: "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
@ -5858,29 +5864,35 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
"CURRENT_TABULAR_RESOURCE is null");
|
"CURRENT_TABULAR_RESOURCE is null");
|
||||||
}
|
}
|
||||||
TRId trId = currentTR.getTrId();
|
TRId trId = currentTR.getTrId();
|
||||||
|
|
||||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
aslSession.getUsername()));
|
aslSession.getUsername()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
|
||||||
|
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||||
|
Long.valueOf(trId.getId()));
|
||||||
|
TabularResource tabularResource = service
|
||||||
|
.getTabularResource(tabularResourceId);
|
||||||
|
List<HistoryStep> history = tabularResource.getHistory();
|
||||||
|
|
||||||
|
ArrayList<OpHistory> opHistoryList = new ArrayList<OpHistory>();
|
||||||
|
|
||||||
TabularResourceId tabularResourceId=new TabularResourceId(Long.valueOf(trId.getId()));
|
long historyId = 0;
|
||||||
TabularResource tabularResource=service.getTabularResource(tabularResourceId);
|
String opDesc=null, opName=null;
|
||||||
List<HistoryStep> history =tabularResource.getHistory();
|
OpHistory op = null;
|
||||||
|
|
||||||
ArrayList<OpHistory> opHistoryList=new ArrayList<OpHistory>();
|
for (HistoryStep step : history) {
|
||||||
OperationDefinition lastOp=null;
|
if (step != null) {
|
||||||
long historyId=0;
|
historyId = step.getId().getValue();
|
||||||
OpHistory op=null;
|
opDesc = step.getOperationDescription();
|
||||||
|
opName = step.getOperationDescription();
|
||||||
for(HistoryStep step:history){
|
op = new OpHistory(historyId, opName,
|
||||||
if(step!=null){
|
opDesc, sdf.format(step
|
||||||
historyId=step.getId().getValue();
|
.getExecutionDate().getTime()));
|
||||||
lastOp=service.getCapability(step.getOperationInvocation().getOperationId());
|
|
||||||
op=new OpHistory(historyId,lastOp.getName(),lastOp.getDescription(), sdf.format(step.getExecutionDate()));
|
|
||||||
opHistoryList.add(op);
|
opHistoryList.add(op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("History :" + opHistoryList);
|
logger.debug("History :" + opHistoryList);
|
||||||
return opHistoryList;
|
return opHistoryList;
|
||||||
|
|
||||||
|
@ -5892,9 +5904,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
@ -5906,26 +5916,32 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
|
|
||||||
logger.debug("getHistory(): "+trId);
|
logger.debug("getHistory(): " + trId);
|
||||||
|
|
||||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
aslSession.getUsername()));
|
aslSession.getUsername()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
|
||||||
TabularResourceId tabularResourceId=new TabularResourceId(Long.valueOf(trId.getId()));
|
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||||
TabularResource tabularResource=service.getTabularResource(tabularResourceId);
|
Long.valueOf(trId.getId()));
|
||||||
List<HistoryStep> history =tabularResource.getHistory();
|
TabularResource tabularResource = service
|
||||||
|
.getTabularResource(tabularResourceId);
|
||||||
ArrayList<OpHistory> opHistoryList=new ArrayList<OpHistory>();
|
List<HistoryStep> history = tabularResource.getHistory();
|
||||||
OperationDefinition lastOp=null;
|
|
||||||
long historyId=0;
|
ArrayList<OpHistory> opHistoryList = new ArrayList<OpHistory>();
|
||||||
OpHistory op=null;
|
|
||||||
|
long historyId = 0;
|
||||||
for(HistoryStep step:history){
|
String opDesc=null, opName=null;
|
||||||
if(step!=null){
|
OpHistory op = null;
|
||||||
historyId=step.getId().getValue();
|
|
||||||
lastOp=service.getCapability(step.getOperationInvocation().getOperationId());
|
for (HistoryStep step : history) {
|
||||||
op=new OpHistory(historyId,lastOp.getName(),lastOp.getDescription(), sdf.format(step.getExecutionDate()));
|
if (step != null) {
|
||||||
|
historyId = step.getId().getValue();
|
||||||
|
opDesc = step.getOperationDescription();
|
||||||
|
opName = step.getOperationDescription();
|
||||||
|
op = new OpHistory(historyId, opName,
|
||||||
|
opDesc, sdf.format(step
|
||||||
|
.getExecutionDate().getTime()));
|
||||||
opHistoryList.add(op);
|
opHistoryList.add(op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5940,12 +5956,68 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
+ e.getLocalizedMessage());
|
+ e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
|
public RollBackSession discard(TRId trId) throws TDGWTServiceException {
|
||||||
|
try {
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
|
|
||||||
|
logger.debug("discard(): " + trId);
|
||||||
|
|
||||||
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
|
aslSession.getUsername()));
|
||||||
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
|
||||||
|
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||||
|
Long.valueOf(trId.getId()));
|
||||||
|
TabularResource tabularResource = service
|
||||||
|
.getTabularResource(tabularResourceId);
|
||||||
|
List<HistoryStep> history = tabularResource.getHistory();
|
||||||
|
|
||||||
|
long historyId = 0;
|
||||||
|
String opDesc=null, opName=null;
|
||||||
|
OpHistory op = null;
|
||||||
|
RollBackSession rollBackSession=null;
|
||||||
|
if (history != null) {
|
||||||
|
HistoryStep step = history.get(1);
|
||||||
|
if (step != null) {
|
||||||
|
historyId = step.getId().getValue();
|
||||||
|
opDesc= step.getOperationDescription();
|
||||||
|
opName= opDesc;
|
||||||
|
op = new OpHistory(historyId, opName,
|
||||||
|
opDesc, sdf.format(step
|
||||||
|
.getExecutionDate().getTime()));
|
||||||
|
logger.debug("Discard :"+op);
|
||||||
|
rollBackSession=new RollBackSession(trId,historyId);
|
||||||
|
rollBack(rollBackSession);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
logger.debug("Discard : no previous step exist");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
logger.debug("Discard : not present");
|
||||||
|
}
|
||||||
|
|
||||||
|
return rollBackSession;
|
||||||
|
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.debug("discard(): " + e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new TDGWTServiceException("Error in discard: "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void rollBack(RollBackSession rollBackSession)
|
public void rollBack(RollBackSession rollBackSession)
|
||||||
throws TDGWTServiceException {
|
throws TDGWTServiceException {
|
||||||
|
@ -5953,23 +6025,25 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
|
|
||||||
logger.debug("rollBack(): "+rollBackSession);
|
logger.debug("rollBack(): " + rollBackSession);
|
||||||
SessionUtil.setRollBackSession(session, rollBackSession);
|
SessionUtil.setRollBackSession(session, rollBackSession);
|
||||||
|
|
||||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
aslSession.getUsername()));
|
aslSession.getUsername()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
|
||||||
TabularResourceId tabularResourceId=new TabularResourceId(Long.valueOf(rollBackSession.getTrId().getId()));
|
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||||
HistoryStepId historyStepId=new HistoryStepId(rollBackSession.getHistoryId());
|
Long.valueOf(rollBackSession.getTrId().getId()));
|
||||||
|
HistoryStepId historyStepId = new HistoryStepId(
|
||||||
Task trTask=service.rollbackTo(tabularResourceId, historyStepId);
|
rollBackSession.getHistoryId());
|
||||||
|
|
||||||
|
Task trTask = service.rollbackTo(tabularResourceId, historyStepId);
|
||||||
if (trTask == null) {
|
if (trTask == null) {
|
||||||
logger.error("Error on service Task null");
|
logger.error("Error on service Task null");
|
||||||
throw new TDGWTServiceException("Task not started");
|
throw new TDGWTServiceException("Task not started");
|
||||||
}
|
}
|
||||||
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||||
SessionUtil.setRollBackSessionTask(session, trTask);
|
SessionUtil.setRollBackSessionTask(session, trTask);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -5979,8 +6053,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
+ e.getLocalizedMessage());
|
+ e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
@ -6009,8 +6082,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Services TaskStatus: " + task.getStatus());
|
logger.debug("Services TaskStatus: " + task.getStatus());
|
||||||
|
|
||||||
rollBackMonitor.setStatus(TaskStateMap.map(task
|
rollBackMonitor
|
||||||
.getStatus()));
|
.setStatus(TaskStateMap.map(task.getStatus()));
|
||||||
|
|
||||||
TRId trId;
|
TRId trId;
|
||||||
TabResource tabResource;
|
TabResource tabResource;
|
||||||
|
@ -6019,20 +6092,18 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
if (task.getResult() != null) {
|
if (task.getResult() != null) {
|
||||||
logger.debug("Task exception:"
|
logger.debug("Task exception:"
|
||||||
+ task.getErrorCause());
|
+ task.getErrorCause());
|
||||||
rollBackMonitor.setError(new Throwable(
|
rollBackMonitor.setError(new Throwable(task
|
||||||
task.getErrorCause()));
|
.getErrorCause()));
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Task exception: Error In RollBackSessionMonitor");
|
logger.debug("Task exception: Error In RollBackSessionMonitor");
|
||||||
rollBackMonitor.setError(new Throwable(
|
rollBackMonitor.setError(new Throwable(
|
||||||
"Error in roll back"));
|
"Error in roll back"));
|
||||||
}
|
}
|
||||||
rollBackMonitor.setProgress(task
|
rollBackMonitor.setProgress(task.getProgress());
|
||||||
.getProgress());
|
|
||||||
break;
|
break;
|
||||||
case SUCCEDED:
|
case SUCCEDED:
|
||||||
logger.debug("Task Result:" + task.getResult());
|
logger.debug("Task Result:" + task.getResult());
|
||||||
rollBackMonitor.setProgress(task
|
rollBackMonitor.setProgress(task.getProgress());
|
||||||
.getProgress());
|
|
||||||
trId = new TRId();
|
trId = new TRId();
|
||||||
trId.setId(rollBackSession.getTrId().getId());
|
trId.setId(rollBackSession.getTrId().getId());
|
||||||
|
|
||||||
|
@ -6045,21 +6116,19 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
SessionUtil.setTRId(session, trId);
|
SessionUtil.setTRId(session, trId);
|
||||||
break;
|
break;
|
||||||
case IN_PROGRESS:
|
case IN_PROGRESS:
|
||||||
rollBackMonitor.setProgress(task
|
rollBackMonitor.setProgress(task.getProgress());
|
||||||
.getProgress());
|
|
||||||
break;
|
break;
|
||||||
case VALIDATING_RULES:
|
case VALIDATING_RULES:
|
||||||
rollBackMonitor.setProgress(task
|
rollBackMonitor.setProgress(task.getProgress());
|
||||||
.getProgress());
|
|
||||||
break;
|
break;
|
||||||
case ABORTED:
|
case ABORTED:
|
||||||
break;
|
break;
|
||||||
case STOPPED:
|
case STOPPED:
|
||||||
logger.debug("Task Result:" + task.getResult());
|
logger.debug("Task Result:" + task.getResult());
|
||||||
rollBackMonitor.setProgress(task
|
rollBackMonitor.setProgress(task.getProgress());
|
||||||
.getProgress());
|
|
||||||
|
trId = retrieveTabularResourceBasicData(rollBackSession
|
||||||
trId = retrieveTabularResourceBasicData(rollBackSession.getTrId());
|
.getTrId());
|
||||||
|
|
||||||
rollBackMonitor.setTrId(trId);
|
rollBackMonitor.setTrId(trId);
|
||||||
tabResource = SessionUtil.getTabResource(session);
|
tabResource = SessionUtil.getTabResource(session);
|
||||||
|
@ -6076,8 +6145,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
SessionUtil.setRollBackSessionTask(session, task);
|
SessionUtil.setRollBackSessionTask(session, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("RollBackSessionMonitor(): "
|
logger.info("RollBackSessionMonitor(): " + rollBackMonitor);
|
||||||
+ rollBackMonitor);
|
|
||||||
return rollBackMonitor;
|
return rollBackMonitor;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.debug("Error in RollBackSessionMonitor: "
|
logger.debug("Error in RollBackSessionMonitor: "
|
||||||
|
@ -6090,5 +6158,4 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue