Fixed ClassCastException when rules run in an ML-enabled space.

Instead of using casts to String for cm:title and cm:description, the DefaultTypeConverter is required.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6107 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-06-26 13:14:57 +00:00
parent cf0685b7ef
commit c303724297

View File

@@ -44,6 +44,7 @@ import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.cmr.rule.Rule;
import org.alfresco.service.cmr.rule.RuleService;
import org.alfresco.service.cmr.rule.RuleServiceException;
@@ -540,8 +541,10 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
Rule rule = new Rule(ruleNodeRef);
// Set the title and description
rule.setTitle((String)props.get(ContentModel.PROP_TITLE));
rule.setDescription((String)props.get(ContentModel.PROP_DESCRIPTION));
String title = DefaultTypeConverter.INSTANCE.convert(String.class, props.get(ContentModel.PROP_TITLE));
String description = DefaultTypeConverter.INSTANCE.convert(String.class, props.get(ContentModel.PROP_DESCRIPTION));
rule.setTitle(title);
rule.setDescription(description);
// Set the rule types
rule.setRuleTypes((List<String>)props.get(RuleModel.PROP_RULE_TYPE));