Updated Rules

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@114344 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-04-22 16:56:08 +00:00
parent 5f2e145e3d
commit 4a8e427528
3 changed files with 46 additions and 11 deletions

View File

@ -7,6 +7,7 @@ import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
import org.gcube.portlets.user.td.gwtservice.shared.rule.AppliedRulesResponseData; import org.gcube.portlets.user.td.gwtservice.shared.rule.AppliedRulesResponseData;
import org.gcube.portlets.user.td.gwtservice.shared.rule.DetachColumnRulesSession;
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType; import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType;
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyColumnRulesSession; import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyColumnRulesSession;
@ -67,10 +68,13 @@ public interface ExpressionService extends RemoteService {
public void removeRulesById(ArrayList<RuleDescriptionData> rules) throws TDGWTServiceException; public void removeRulesById(ArrayList<RuleDescriptionData> rules) throws TDGWTServiceException;
public String startApplyColumnRules(ApplyColumnRulesSession ruleOnColumnApplySession) public String startApplyColumnRules(ApplyColumnRulesSession applyColumnRulesSession)
throws TDGWTServiceException; throws TDGWTServiceException;
public AppliedRulesResponseData getAppliedRulesByTabularResourceId(TRId trId) public void setDetachColumnRules(DetachColumnRulesSession detachColumnRulesSession)
throws TDGWTServiceException;
public AppliedRulesResponseData getActiveRulesByTabularResourceId(TRId trId)
throws TDGWTServiceException; throws TDGWTServiceException;
} }

View File

@ -7,6 +7,7 @@ import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.shared.rule.AppliedRulesResponseData; import org.gcube.portlets.user.td.gwtservice.shared.rule.AppliedRulesResponseData;
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyColumnRulesSession; import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyColumnRulesSession;
import org.gcube.portlets.user.td.gwtservice.shared.rule.DetachColumnRulesSession;
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType; import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.AddColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.AddColumnSession;
@ -58,7 +59,11 @@ public interface ExpressionServiceAsync {
ApplyColumnRulesSession ruleOnColumnApplySession, ApplyColumnRulesSession ruleOnColumnApplySession,
AsyncCallback<String> callback); AsyncCallback<String> callback);
void getAppliedRulesByTabularResourceId(TRId trId, void setDetachColumnRules(
DetachColumnRulesSession detachColumnRulesSession,
AsyncCallback<Void> callback);
void getActiveRulesByTabularResourceId(TRId trId,
AsyncCallback<AppliedRulesResponseData> callback); AsyncCallback<AppliedRulesResponseData> callback);
} }

View File

@ -30,6 +30,7 @@ import org.gcube.portlets.user.td.gwtservice.server.trservice.ColumnDataTypeMap;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
import org.gcube.portlets.user.td.gwtservice.shared.rule.AppliedRulesResponseData; import org.gcube.portlets.user.td.gwtservice.shared.rule.AppliedRulesResponseData;
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyColumnRulesSession; import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyColumnRulesSession;
import org.gcube.portlets.user.td.gwtservice.shared.rule.DetachColumnRulesSession;
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType; import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.AddColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.AddColumnSession;
@ -388,7 +389,7 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public AppliedRulesResponseData getAppliedRulesByTabularResourceId(TRId trId) public AppliedRulesResponseData getActiveRulesByTabularResourceId(TRId trId)
throws TDGWTServiceException { throws TDGWTServiceException {
try { try {
HttpSession session = this.getThreadLocalRequest().getSession(); HttpSession session = this.getThreadLocalRequest().getSession();
@ -400,9 +401,9 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
TabularDataService service = TabularDataServiceFactory.getService(); TabularDataService service = TabularDataServiceFactory.getService();
if (trId == null || trId.getId() == null || trId.getId().isEmpty()) { if (trId == null || trId.getId() == null || trId.getId().isEmpty()) {
logger.error("Error in getAppliedRulesByTabularResourceId(): No valid tabular resource id!"); logger.error("Error in getActiveRulesByTabularResourceId(): No valid tabular resource id!");
throw new TDGWTServiceException( throw new TDGWTServiceException(
"Error in get applied rules: invalid tabular resource id!"); "Error in get active rules: invalid tabular resource id!");
} }
TabularResourceId tabularResourceId = new TabularResourceId( TabularResourceId tabularResourceId = new TabularResourceId(
@ -411,11 +412,11 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
AppliedRulesResponse appliedRulesResponse = service AppliedRulesResponse appliedRulesResponse = service
.getAppliedRulesByTabularResourceId(tabularResourceId); .getAppliedRulesByTabularResourceId(tabularResourceId);
if (appliedRulesResponse == null) { if (appliedRulesResponse == null) {
logger.error("Invalid applied rules response from service: null"); logger.error("Invalid active rules response from service: null");
throw new TDGWTServiceException( throw new TDGWTServiceException(
"Invalid applied rules response from service: null"); "Invalid active rules response from service: null");
} else { } else {
logger.debug("Applied Rules Response: " + appliedRulesResponse); logger.debug("Active Rules Response: " + appliedRulesResponse);
} }
AppliedRulesResponseData appliedRulesResponseData = AppliedRulesResponseMap AppliedRulesResponseData appliedRulesResponseData = AppliedRulesResponseMap
@ -430,10 +431,10 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
e.printStackTrace(); e.printStackTrace();
throw e; throw e;
} catch (Throwable e) { } catch (Throwable e) {
logger.error("Error in getAppliedRulesByTabularResourceId(): " logger.error("Error in getActiveRulesByTabularResourceId(): "
+ e.getLocalizedMessage()); + e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
throw new TDGWTServiceException("Error retrieving applied rules: " throw new TDGWTServiceException("Error retrieving active rules: "
+ e.getLocalizedMessage()); + e.getLocalizedMessage());
} }
@ -572,6 +573,31 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
} }
} }
/**
*
* {@inheritDoc}
*/
@Override
public void setDetachColumnRules(
DetachColumnRulesSession detachColumnRulesSession)
throws TDGWTServiceException {
try {
HttpSession session = this.getThreadLocalRequest().getSession();
setDetachColumnnRules(detachColumnRulesSession,
session);
return;
} catch (TDGWTServiceException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(e.getLocalizedMessage());
}
}