81: TDM - Allow the creation and use of expressions on multi column in TDM portlet

Task-Url: https://support.d4science.org/issues/81

Updated Rules On Table

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@115307 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-06-10 16:35:06 +00:00
parent 2304a4d4fb
commit 197bc3f9a9
3 changed files with 4 additions and 7 deletions

View File

@ -6,7 +6,6 @@ import java.util.List;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.gcube.application.framework.core.session.ASLSession; import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.data.analysis.tabulardata.commons.rules.types.RuleColumnType;
import org.gcube.data.analysis.tabulardata.commons.rules.types.RuleType; import org.gcube.data.analysis.tabulardata.commons.rules.types.RuleType;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationProvider; import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationProvider;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationToken; import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationToken;
@ -466,6 +465,7 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
.getExpression()); .getExpression());
} catch (ExpressionParserException e) { } catch (ExpressionParserException e) {
logger.debug(e.getLocalizedMessage()); logger.debug(e.getLocalizedMessage());
e.printStackTrace();
throw new TDGWTServiceException(e.getLocalizedMessage()); throw new TDGWTServiceException(e.getLocalizedMessage());
} }
@ -474,14 +474,11 @@ public class ExpressionServiceImpl extends TDGWTServiceImpl implements
RuleType ruleType = RuleTypeMap RuleType ruleType = RuleTypeMap
.map(ruleDescriptionData.getTdRuleType()); .map(ruleDescriptionData.getTdRuleType());
if (ruleType == null) { if (ruleType == null) {
logger.error("Error saving rule, rule type is null!");
throw new TDGWTServiceException( throw new TDGWTServiceException(
"Error saving rule, rule type is null!"); "Error saving rule, rule type is null!");
} }
if (!(RuleColumnType.class.isAssignableFrom(ruleType.getClass()))){
throw new TDGWTServiceException(
"Error saving rule, rule type is not RuleColumnType!");
}
RuleId ruleId = service.saveRule( RuleId ruleId = service.saveRule(

View File

@ -74,7 +74,7 @@ public class RuleDescriptionMap {
String creationDate=""; String creationDate="";
try{ try{
creationDate = sdf.format(ruleDescription.getCreationDate()); creationDate = sdf.format(ruleDescription.getCreationDate().getTime());
} catch(IllegalArgumentException e){ } catch(IllegalArgumentException e){
logger.error("Error in rule description, creation date is not valid!"+ logger.error("Error in rule description, creation date is not valid!"+
ruleDescription.getCreationDate()); ruleDescription.getCreationDate());

View File

@ -75,7 +75,7 @@ public class RuleTypeMap {
ArrayList<RuleColumnPlaceHolderDescriptor> descriptors = tdRuleTableType.getRuleColumnPlaceHolderDescriptors(); ArrayList<RuleColumnPlaceHolderDescriptor> descriptors = tdRuleTableType.getRuleColumnPlaceHolderDescriptors();
for (RuleColumnPlaceHolderDescriptor ruleColumnPlaceHolderDescriptor:descriptors) { for (RuleColumnPlaceHolderDescriptor ruleColumnPlaceHolderDescriptor:descriptors) {
Class<? extends DataType> dataType=ColumnDataTypeMap.mapToDataTypeClass(ruleColumnPlaceHolderDescriptor.getColumnDataType()); Class<? extends DataType> dataType=ColumnDataTypeMap.mapToDataTypeClass(ruleColumnPlaceHolderDescriptor.getColumnDataType());
ruleColumnPlaceHolderDescriptorMap.put(ruleColumnPlaceHolderDescriptor.getId(), dataType); ruleColumnPlaceHolderDescriptorMap.put(ruleColumnPlaceHolderDescriptor.getLabel(), dataType);
} }
RuleTableType ruleTableType = new RuleTableType( RuleTableType ruleTableType = new RuleTableType(
ruleColumnPlaceHolderDescriptorMap); ruleColumnPlaceHolderDescriptorMap);