Author: chatellier Date: 2009-03-18 11:01:54 +0000 (Wed, 18 Mar 2009) New Revision: 1996 Modified: isis-fish/trunk/src/main/resources/templates/prescript/factorprescript.ftl Log: Fix MatrixContinuousDomain Modified: isis-fish/trunk/src/main/resources/templates/prescript/factorprescript.ftl =================================================================== --- isis-fish/trunk/src/main/resources/templates/prescript/factorprescript.ftl 2009-03-18 10:56:07 UTC (rev 1995) +++ isis-fish/trunk/src/main/resources/templates/prescript/factorprescript.ftl 2009-03-18 11:01:54 UTC (rev 1996) @@ -29,25 +29,31 @@ context.setValue("K1", 2, "-"); --> +<#compress> import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.ConvertUtilsBean; import fr.ifremer.isisfish.util.ConverterUtil; ConvertUtilsBean beanUtils = ConverterUtil.getConverter(null); <#list scenario.factors as factor> -// Factor : ${factor.name} -<#-- Following is java instanceof equivalent --> -<#if factor.domain.class.simpleName.equals("EquationContinuousDomain")> -context.setValue("${factor.domain.variableName}", ${factor.value}, "${factor.domain.operator}"); -<#else> -<#assign value=factor.value /> -<#assign serializedValue=beanUtils.convert(value)/> -<#assign path=factor.path /> -<#assign topiaId=path?substring(0, path?last_index_of("#"))/> -<#assign propertyName=path?substring(path?last_index_of("#") + 1)/> -Object value = beanUtils.convert("${serializedValue}", ${value.class.name}.class); -TopiaEntity entity = db.findByTopiaId("${topiaId}"); -BeanUtils.setProperty(entity, "${propertyName}", value); -</#if> + // Factor : ${factor.name} + <#-- Following is java instanceof equivalent --> + <#if factor.domain.class.simpleName.equals("EquationContinuousDomain")> + context.setValue("${factor.domain.variableName}", ${factor.value}, "${factor.domain.operator}"); + <#else> + <#if factor.domain.class.simpleName.equals("MatrixContinuousDomain")> + <#assign value=factor.domain.matrix /> + <#else> + <#assign value=factor.value /> + </#if> + <#assign serializedValue=beanUtils.convert(value)/> + <#assign path=factor.path /> + <#assign topiaId=path?substring(0, path?last_index_of("#"))/> + <#assign propertyName=path?substring(path?last_index_of("#") + 1)/> + Object value = beanUtils.convert("${serializedValue}", ${value.class.name}.class); + TopiaEntity entity = db.findByTopiaId("${topiaId}"); + BeanUtils.setProperty(entity, "${propertyName}", value); + </#if> </#list> +</#compress> \ No newline at end of file