Updated Rules
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@114360 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3f208a8026
commit
124511bc5e
|
@ -5283,7 +5283,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
checkTabularResourceIsFinal(tabularResource);
|
||||
|
||||
OpExecution4AddColumn opEx = new OpExecution4AddColumn(service,
|
||||
addColumnSession,expression);
|
||||
addColumnSession, expression);
|
||||
OpExecutionDirector director = new OpExecutionDirector();
|
||||
director.setOperationExecutionBuilder(opEx);
|
||||
director.constructOperationExecution();
|
||||
|
@ -5321,9 +5321,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
*/
|
||||
@Override
|
||||
public String startAddColumn(AddColumnSession addColumnSession)
|
||||
throws TDGWTServiceException {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
return startAddColumn(addColumnSession,null,session);
|
||||
throws TDGWTServiceException {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
return startAddColumn(addColumnSession, null, session);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6129,15 +6129,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
throw new TDGWTServiceException("Error on service");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setShareRule(ShareRule shareRule)
|
||||
throws TDGWTServiceException {
|
||||
public void setShareRule(ShareRule shareRule) throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
@ -6146,8 +6144,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
aslSession.getUsername(), aslSession.getScope()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
RuleId ruleId = new RuleId(Long.valueOf(shareRule.getRuleDescriptionData()
|
||||
.getId()));
|
||||
RuleId ruleId = new RuleId(Long.valueOf(shareRule
|
||||
.getRuleDescriptionData().getId()));
|
||||
|
||||
List<AuthorizationToken> users = new ArrayList<AuthorizationToken>();
|
||||
for (Contacts cont : shareRule.getContacts()) {
|
||||
|
@ -6175,7 +6173,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
throw new TDGWTServiceException("Error on service");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean checkTabularResourceNotFinal(TRId trId)
|
||||
throws TDGWTServiceException {
|
||||
|
@ -6523,11 +6520,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
|
@ -9250,7 +9243,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
.getId()));
|
||||
TabularResource tabularResource = service
|
||||
.getTabularResource(tabularResourceId);
|
||||
|
||||
|
||||
checkTabularResourceIsFlow(tabularResource);
|
||||
checkTabularResourceLocked(tabularResource);
|
||||
checkTabularResourceIsFinal(tabularResource);
|
||||
|
@ -9438,7 +9431,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param applyColumnRulesSession
|
||||
|
@ -9447,14 +9440,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public String startApplyColumnnRules(
|
||||
ApplyColumnRulesSession applyColumnRulesSession,
|
||||
HttpSession session) throws TDGWTServiceException {
|
||||
ApplyColumnRulesSession applyColumnRulesSession, HttpSession session)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
// HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
SessionUtil.setRulesOnColumnApplySession(session, applyColumnRulesSession);
|
||||
|
||||
|
||||
SessionUtil.setRulesOnColumnApplySession(session,
|
||||
applyColumnRulesSession);
|
||||
|
||||
if (applyColumnRulesSession == null) {
|
||||
logger.error("ApplyColumnRulesSession is null");
|
||||
throw new TDGWTServiceException(
|
||||
|
@ -9468,42 +9462,47 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
checkTRId(applyColumnRulesSession.getTrId());
|
||||
|
||||
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||
Long.valueOf(applyColumnRulesSession
|
||||
.getTrId().getId()));
|
||||
Long.valueOf(applyColumnRulesSession.getTrId().getId()));
|
||||
TabularResource tabularResource = service
|
||||
.getTabularResource(tabularResourceId);
|
||||
|
||||
checkTabularResourceIsFlow(tabularResource);
|
||||
checkTabularResourceLocked(tabularResource);
|
||||
checkTabularResourceIsFinal(tabularResource);
|
||||
|
||||
ColumnData column=applyColumnRulesSession.getColumn();
|
||||
if(column==null){
|
||||
|
||||
ColumnData column = applyColumnRulesSession.getColumn();
|
||||
if (column == null) {
|
||||
logger.error("Error in apply rules on column: No column selected.");
|
||||
throw new TDGWTServiceException(
|
||||
"Error in apply rules on column: No column selected.");
|
||||
}
|
||||
|
||||
ColumnLocalId columnLocalId=new ColumnLocalId(column.getColumnId());
|
||||
|
||||
ArrayList<RuleDescriptionData> rulesThatWillBeDetach=applyColumnRulesSession.getRulesThatWillBeDetached();
|
||||
ArrayList<RuleId> ruleIdsDetach=new ArrayList<RuleId>();
|
||||
for(RuleDescriptionData r:rulesThatWillBeDetach){
|
||||
RuleId ruleDetachId=new RuleId(r.getId());
|
||||
ruleIdsDetach.add(ruleDetachId);
|
||||
}
|
||||
service.detachColumnRules(tabularResourceId, columnLocalId,ruleIdsDetach );
|
||||
|
||||
|
||||
ArrayList<RuleDescriptionData> rulesThatWillBeApplied=applyColumnRulesSession.getRulesThatWillBeApplied();
|
||||
ArrayList<RuleId> ruleIdsApplied=new ArrayList<RuleId>();
|
||||
for(RuleDescriptionData r:rulesThatWillBeApplied){
|
||||
RuleId ruleAppliedId=new RuleId(r.getId());
|
||||
|
||||
ColumnLocalId columnLocalId = new ColumnLocalId(
|
||||
column.getColumnId());
|
||||
|
||||
ArrayList<RuleDescriptionData> rulesThatWillBeDetach = applyColumnRulesSession
|
||||
.getRulesThatWillBeDetached();
|
||||
if (rulesThatWillBeDetach != null
|
||||
&& rulesThatWillBeDetach.size() > 0) {
|
||||
ArrayList<RuleId> ruleIdsDetach = new ArrayList<RuleId>();
|
||||
for (RuleDescriptionData r : rulesThatWillBeDetach) {
|
||||
RuleId ruleDetachId = new RuleId(r.getId());
|
||||
ruleIdsDetach.add(ruleDetachId);
|
||||
}
|
||||
service.detachColumnRules(tabularResourceId, columnLocalId,
|
||||
ruleIdsDetach);
|
||||
}
|
||||
|
||||
ArrayList<RuleDescriptionData> rulesThatWillBeApplied = applyColumnRulesSession
|
||||
.getRulesThatWillBeApplied();
|
||||
ArrayList<RuleId> ruleIdsApplied = new ArrayList<RuleId>();
|
||||
for (RuleDescriptionData r : rulesThatWillBeApplied) {
|
||||
RuleId ruleAppliedId = new RuleId(r.getId());
|
||||
ruleIdsApplied.add(ruleAppliedId);
|
||||
}
|
||||
Task trTask = service.applyColumnRule(tabularResourceId, columnLocalId,ruleIdsApplied );
|
||||
logger.debug("Rules On Column Apply: TaskId "
|
||||
+ trTask.getId());
|
||||
Task trTask = service.applyColumnRule(tabularResourceId,
|
||||
columnLocalId, ruleIdsApplied);
|
||||
logger.debug("Rules On Column Apply: TaskId " + trTask.getId());
|
||||
|
||||
TaskWrapper taskWrapper = new TaskWrapper(trTask,
|
||||
UIOperationsId.RuleOnColumnApply,
|
||||
|
@ -9518,14 +9517,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Error in apply rules on column: "
|
||||
+ e.getLocalizedMessage());
|
||||
throw new TDGWTServiceException("Error in apply rules on column: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param detachColumnRulesSession
|
||||
|
@ -9539,9 +9536,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
try {
|
||||
// HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
SessionUtil.setDetachColumnRulesSession(session, detachColumnRulesSession);
|
||||
|
||||
|
||||
SessionUtil.setDetachColumnRulesSession(session,
|
||||
detachColumnRulesSession);
|
||||
|
||||
if (detachColumnRulesSession == null) {
|
||||
logger.error("DetachColumnRulesSession is null");
|
||||
throw new TDGWTServiceException(
|
||||
|
@ -9555,34 +9553,36 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
checkTRId(detachColumnRulesSession.getTrId());
|
||||
|
||||
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||
Long.valueOf(detachColumnRulesSession
|
||||
.getTrId().getId()));
|
||||
Long.valueOf(detachColumnRulesSession.getTrId().getId()));
|
||||
TabularResource tabularResource = service
|
||||
.getTabularResource(tabularResourceId);
|
||||
|
||||
checkTabularResourceIsFlow(tabularResource);
|
||||
checkTabularResourceLocked(tabularResource);
|
||||
checkTabularResourceIsFinal(tabularResource);
|
||||
|
||||
ColumnData column=detachColumnRulesSession.getColumn();
|
||||
if(column==null){
|
||||
|
||||
ColumnData column = detachColumnRulesSession.getColumn();
|
||||
if (column == null) {
|
||||
logger.error("Error in detach rules on column: No column selected.");
|
||||
throw new TDGWTServiceException(
|
||||
"Error in detach rules on column: No column selected.");
|
||||
}
|
||||
|
||||
ArrayList<RuleDescriptionData> rules=detachColumnRulesSession.getRules();
|
||||
ArrayList<RuleId> ruleIds=new ArrayList<RuleId>();
|
||||
for(RuleDescriptionData r:rules){
|
||||
RuleId ruleId=new RuleId(r.getId());
|
||||
ruleIds.add(ruleId);
|
||||
ColumnLocalId columnLocalId = new ColumnLocalId(
|
||||
column.getColumnId());
|
||||
|
||||
ArrayList<RuleDescriptionData> rules = detachColumnRulesSession
|
||||
.getRules();
|
||||
ArrayList<RuleId> ruleIds = new ArrayList<RuleId>();
|
||||
if (rules != null && rules.size() > 0) {
|
||||
for (RuleDescriptionData r : rules) {
|
||||
RuleId ruleId = new RuleId(r.getId());
|
||||
ruleIds.add(ruleId);
|
||||
}
|
||||
service.detachColumnRules(tabularResourceId, columnLocalId, ruleIds);
|
||||
}
|
||||
|
||||
ColumnLocalId columnLocalId=new ColumnLocalId(column.getColumnId());
|
||||
|
||||
service.detachColumnRules(tabularResourceId, columnLocalId,ruleIds );
|
||||
return;
|
||||
|
||||
|
||||
} catch (TDGWTServiceException e) {
|
||||
throw e;
|
||||
} catch (SecurityException e) {
|
||||
|
@ -9590,11 +9590,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Error in detach rules on column: "
|
||||
+ e.getLocalizedMessage());
|
||||
throw new TDGWTServiceException("Error in detach rules on column: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue