81: Allow the creation and use of expressions on multi column in TDM portlet
Task-Url: https://support.d4science.org/issues/81 Added Detach rule on table git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@115125 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
37e88a0598
commit
3a66603b77
|
@ -123,5 +123,6 @@ public class SessionConstants {
|
|||
|
||||
public static final String RULES_ON_TABLE_APPLY_SESSION = "RULES_ON_TABLE_APPLY_SESSION";
|
||||
|
||||
public static final String RULES_ON_TABLE_DETACH_SESSION = "RULES_ON_TABLE_DETACH_SESSION";
|
||||
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyAndDetachColumnRulesSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyTableRuleSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.DetachColumnRulesSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.DetachTableRulesSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
|
||||
|
@ -1188,6 +1189,38 @@ public class SessionUtil {
|
|||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
public static DetachTableRulesSession getDetachTableRulesSession(
|
||||
HttpSession httpSession) {
|
||||
DetachTableRulesSession detachTableRulesSession = (DetachTableRulesSession) httpSession
|
||||
.getAttribute(SessionConstants.RULES_ON_TABLE_DETACH_SESSION);
|
||||
if (detachTableRulesSession != null) {
|
||||
return detachTableRulesSession;
|
||||
} else {
|
||||
detachTableRulesSession = new DetachTableRulesSession();
|
||||
httpSession.setAttribute(
|
||||
SessionConstants.RULES_ON_TABLE_DETACH_SESSION,
|
||||
detachTableRulesSession);
|
||||
return detachTableRulesSession;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setDetachTableRulesSession(
|
||||
HttpSession httpSession,
|
||||
DetachTableRulesSession detachTableRulesSession) {
|
||||
DetachTableRulesSession rules = (DetachTableRulesSession) httpSession
|
||||
.getAttribute(SessionConstants.RULES_ON_TABLE_DETACH_SESSION);
|
||||
if (rules != null) {
|
||||
httpSession
|
||||
.removeAttribute(SessionConstants.RULES_ON_TABLE_DETACH_SESSION);
|
||||
}
|
||||
httpSession.setAttribute(
|
||||
SessionConstants.RULES_ON_TABLE_DETACH_SESSION,
|
||||
detachTableRulesSession);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
public static TaskResubmitSession getTaskResubmitSession(
|
||||
|
|
|
@ -198,6 +198,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSess
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyAndDetachColumnRulesSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyTableRuleSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.DetachColumnRulesSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.DetachTableRulesSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
||||
|
@ -9700,5 +9701,72 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param detachTableRulesSession
|
||||
* @param session
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public void setDetachTableRules(
|
||||
DetachTableRulesSession detachTableRulesSession,
|
||||
HttpSession session) throws TDGWTServiceException {
|
||||
try {
|
||||
// HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
SessionUtil.setDetachTableRulesSession(session,
|
||||
detachTableRulesSession);
|
||||
|
||||
if (detachTableRulesSession == null) {
|
||||
logger.error("DetachTableRulesSession is null");
|
||||
throw new TDGWTServiceException(
|
||||
"Error in detach rules on table: DetachTableRulesSession is null");
|
||||
}
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername(), aslSession.getScope()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
checkTRId(detachTableRulesSession.getTrId());
|
||||
|
||||
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||
Long.valueOf(detachTableRulesSession.getTrId().getId()));
|
||||
TabularResource tabularResource = service
|
||||
.getTabularResource(tabularResourceId);
|
||||
|
||||
checkTabularResourceIsFlow(tabularResource);
|
||||
checkTabularResourceLocked(tabularResource);
|
||||
checkTabularResourceIsFinal(tabularResource);
|
||||
|
||||
|
||||
ArrayList<RuleDescriptionData> rules = detachTableRulesSession
|
||||
.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);
|
||||
}
|
||||
//TODO
|
||||
/*service.detachTableRules(tabularResourceId,
|
||||
ruleIds);*/
|
||||
}
|
||||
return;
|
||||
|
||||
} catch (TDGWTServiceException e) {
|
||||
throw e;
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException("Error in detach rules on column: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.rule;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class DetachTableRulesSession implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -7746819321348425711L;
|
||||
private TRId trId;
|
||||
private ArrayList<RuleDescriptionData> rules;
|
||||
|
||||
public DetachTableRulesSession() {
|
||||
super();
|
||||
}
|
||||
|
||||
public DetachTableRulesSession(TRId trId,
|
||||
ArrayList<RuleDescriptionData> rules) {
|
||||
super();
|
||||
this.trId = trId;
|
||||
this.rules = rules;
|
||||
}
|
||||
|
||||
public TRId getTrId() {
|
||||
return trId;
|
||||
}
|
||||
|
||||
public void setTrId(TRId trId) {
|
||||
this.trId = trId;
|
||||
}
|
||||
|
||||
public ArrayList<RuleDescriptionData> getRules() {
|
||||
return rules;
|
||||
}
|
||||
|
||||
public void setRules(ArrayList<RuleDescriptionData> rules) {
|
||||
this.rules = rules;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DetachTableRulesSession [trId=" + trId + ", rules=" + rules
|
||||
+ "]";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue