1 25 package org.riotfamily.website.generic.config; 26 27 28 import org.riotfamily.common.beans.xml.GenericNamespaceHandlerSupport; 29 import org.riotfamily.common.beans.xml.NestedListDecorator; 30 import org.riotfamily.common.beans.xml.NestedPropertyDecorator; 31 import org.riotfamily.website.generic.GenericController; 32 import org.riotfamily.website.generic.GenericViewController; 33 import org.riotfamily.website.generic.model.hibernate.CurrentDateResolver; 34 import org.riotfamily.website.generic.model.hibernate.CurrentLanguageResolver; 35 import org.riotfamily.website.generic.model.hibernate.CurrentLocaleResolver; 36 import org.riotfamily.website.generic.model.hibernate.DefaultParameterResolver; 37 import org.riotfamily.website.generic.model.hibernate.HqlListModelBuilder; 38 import org.riotfamily.website.generic.model.hibernate.HqlModelBuilder; 39 import org.riotfamily.website.generic.model.hibernate.HqlPagedListModelBuilder; 40 import org.riotfamily.website.generic.model.hibernate.RiotUserResolver; 41 import org.riotfamily.website.generic.model.hibernate.SplitDateParameterResolver; 42 import org.riotfamily.website.generic.model.hibernate.StringToPrimitiveResolver; 43 import org.springframework.beans.factory.xml.BeanDefinitionDecorator; 44 45 49 public class GenericNamespaceHandler extends GenericNamespaceHandlerSupport { 50 51 public void init() { 52 register("controller", GenericController.class).addReference("model-builder"); 53 register("view", GenericViewController.class); 54 55 BeanDefinitionDecorator setModelBuilder = new NestedPropertyDecorator("modelBuilder"); 56 register("hql", HqlModelBuilder.class, setModelBuilder).addTranslation("time-to-live", "ttlPeriod"); 57 register("hql-list", HqlListModelBuilder.class, setModelBuilder).addTranslation("time-to-live", "ttlPeriod"); 58 register("hql-paged-list", HqlPagedListModelBuilder.class, setModelBuilder).addTranslation("time-to-live", "ttlPeriod"); 59 registerSpringBeanDefinitionParser("model-builder", setModelBuilder); 60 61 BeanDefinitionDecorator addParameterResolver = new NestedListDecorator("parameterResolvers"); 62 register("attribute", DefaultParameterResolver.class, addParameterResolver); 63 register("current-date", CurrentDateResolver.class, addParameterResolver); 64 register("current-locale", CurrentLocaleResolver.class, addParameterResolver); 65 register("current-language", CurrentLanguageResolver.class, addParameterResolver); 66 register("riot-user", RiotUserResolver.class, addParameterResolver); 67 register("string-to-primitive", StringToPrimitiveResolver.class, addParameterResolver); 68 register("split-date", SplitDateParameterResolver.class, addParameterResolver); 69 registerSpringBeanDefinitionParser("custom-resolver", addParameterResolver); 70 } 71 72 } 73 | Popular Tags |