AnsweredAssumed Answered

Running excample for xf:switch with xs:complexContent ???

Question asked by cotech on Jan 28, 2010
Latest reply on Oct 18, 2011 by skingsland
Hi all,

i have a another problem :-)

I want to create a WebForm with have one abstract type and two other subtypers with are subclasses from the abstract type.
What i want to do is to create a UI Component, where i can select different types.


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:abc="http://www.myCompany.de/abc" targetNamespace="http://www.myCompany.de/abc"
   xmlns:alf="http://www.alfresco.org" elementFormDefault="qualified">
   
   <!– Abstract 1 –>
   <xs:complexType name="AbtractTextType" abstract="true"  >
      <xs:sequence>
         <xs:element name="AttributeAbstract1" type="xs:normalizedString" minOccurs="1" maxOccurs="1"/>
      </xs:sequence>
   </xs:complexType>
   
   
   <!– Sub 1 –>
   <xs:complexType name="Sub1TextType">
      <xs:complexContent>
         <xs:extension base="abc:AbtractTextType">
            <xs:sequence>
               <xs:element name="AttributeSub1_1" type="xs:normalizedString" minOccurs="1" maxOccurs="1" />
               <xs:element name="AttributeSub1_2" type="xs:normalizedString" minOccurs="1" maxOccurs="1"/>
            </xs:sequence>
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>
   
   
   <!– Sub 2 –>
   <xs:complexType name="Sub2TextType">
      <xs:complexContent>
         <xs:extension base="abc:AbtractTextType">
            <xs:sequence>
               <xs:element name="AttributeSub2_1" type="xs:normalizedString" minOccurs="1" maxOccurs="1"/>
               <xs:element name="AttributeSub2_2" type="xs:normalizedString" minOccurs="1" maxOccurs="1" />
            </xs:sequence>
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>

   
   <xs:complexType name="ArticleTestType">
      <xs:sequence>
         <xs:element name="TextTypes"  type="abc:AbtractTextType" minOccurs="1" maxOccurs="unbounded"/>
      </xs:sequence>
   </xs:complexType>
   
   <xs:element name="ArticleTest" type="tcp:ArticleTestType" />
   
</xs:schema>

If i try to create a WebContent for the given WebForm, then a exception is throwm from alfreso chiba engine:

10:45:14,304 User:admin WARN  [forms.xforms.Schema2XForms] Corresponding control not found
10:45:14,315 User:admin ERROR [xforms.core.Bind] [xf:bind:bind_6] binding exception: bind_6
10:45:14,315 User:admin ERROR [xml.xforms.Container] dispatch: exception during event flow
org.chiba.xml.xforms.exception.XFormsBindingException: property 'type' already present at model item
        at org.chiba.xml.xforms.core.Bind.initializeModelItemProperties(Bind.java:470)
        at org.chiba.xml.xforms.core.Bind.initializeModelItems(Bind.java:454)
        at org.chiba.xml.xforms.core.Bind.init(Bind.java:367)
        at org.chiba.xml.xforms.Initializer.initializeBindElements(Initializer.java:214)
        at org.chiba.xml.xforms.core.Bind.init(Bind.java:368)
        at org.chiba.xml.xforms.Initializer.initializeBindElements(Initializer.java:214)
        at org.chiba.xml.xforms.core.Bind.init(Bind.java:368)
        at org.chiba.xml.xforms.Initializer.initializeBindElements(Initializer.java:214)
        at org.chiba.xml.xforms.core.Model.modelConstruct(Model.java:853)
        at org.chiba.xml.xforms.core.Model.performDefault(Model.java:746)
        at org.chiba.xml.events.impl.DefaultXMLEventService.dispatch(DefaultXMLEventService.java:286)
        at org.chiba.xml.xforms.Container.dispatch(Container.java:501)
        at org.chiba.xml.xforms.Container.dispatch(Container.java:479)
        at org.chiba.xml.xforms.Container.initModels(Container.java:719)
        at org.chiba.xml.xforms.Container.init(Container.java:345)
        at org.chiba.xml.xforms.ChibaBean.init(ChibaBean.java:429)
        at org.alfresco.web.forms.xforms.XFormsBean.setXFormsSession(XFormsBean.java:267)
        at org.alfresco.web.forms.xforms.XFormsProcessor.process(XFormsProcessor.java:147)
        at org.alfresco.web.forms.xforms.XFormsProcessor.process(XFormsProcessor.java:128)
        at org.alfresco.web.ui.wcm.component.UIFormProcessor.encodeBegin(UIFormProcessor.java:123)
        at javax.faces.webapp.UIComponentTag.encodeBegin(UIComponentTag.java:467)
        at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:320)
        at org.apache.jsp.jsp.wcm.create_002dweb_002dcontent_002dwizard.create_002dxml_jsp._jspx_meth_wcm_005fformProcessor_005f0(create_002dxml_jsp.java:107)
        at org.apache.jsp.jsp.wcm.create_002dweb_002dcontent_002dwizard.create_002dxml_jsp._jspService(create_002dxml_jsp.java:75)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
        at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:535)
        at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:472)
        at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
        at org.apache.jsp.jsp.wizard.container_jsp._jspService(container_jsp.java:558)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
        at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
        at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
        at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
        at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:110)
        at sun.reflect.GeneratedMethodAccessor502.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy188.doFilter(Unknown Source)
        at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:74)
        at sun.reflect.GeneratedMethodAccessor502.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy188.doFilter(Unknown Source)
        at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)
10:45:14,316 User:admin ERROR [forms.xforms.XFormsProcessor] org.chiba.xml.xforms.exception.XFormsBindingException: property 'type' already present at model item
10:45:14,316 User:admin ERROR [ui.common.Utils] org.chiba.xml.xforms.exception.XFormsBindingException: property 'type' already present at model item
org.alfresco.web.forms.FormProcessor$ProcessingException: org.chiba.xml.xforms.exception.XFormsBindingException: property 'type' already present at model item
        at org.alfresco.web.forms.xforms.XFormsProcessor.process(XFormsProcessor.java:157)
        at org.alfresco.web.forms.xforms.XFormsProcessor.process(XFormsProcessor.java:128)
        at org.alfresco.web.ui.wcm.component.UIFormProcessor.encodeBegin(UIFormProcessor.java:123)
        at javax.faces.webapp.UIComponentTag.encodeBegin(UIComponentTag.java:467)
        at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:320)
        at org.apache.jsp.jsp.wcm.create_002dweb_002dcontent_002dwizard.create_002dxml_jsp._jspx_meth_wcm_005fformProcessor_005f0(create_002dxml_jsp.java:107)
        at org.apache.jsp.jsp.wcm.create_002dweb_002dcontent_002dwizard.create_002dxml_jsp._jspService(create_002dxml_jsp.java:75)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
        at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:535)
        at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:472)
        at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
        at org.apache.jsp.jsp.wizard.container_jsp._jspService(container_jsp.java:558)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
        at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
        at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
        at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
        at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:110)
        at sun.reflect.GeneratedMethodAccessor502.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy188.doFilter(Unknown Source)
        at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:74)
        at sun.reflect.GeneratedMethodAccessor502.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy188.doFilter(Unknown Source)
        at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.chiba.xml.xforms.exception.XFormsBindingException: property 'type' already present at model item
        at org.chiba.xml.xforms.core.Bind.initializeModelItemProperties(Bind.java:470)
        at org.chiba.xml.xforms.core.Bind.initializeModelItems(Bind.java:454)
        at org.chiba.xml.xforms.core.Bind.init(Bind.java:367)
        at org.chiba.xml.xforms.Initializer.initializeBindElements(Initializer.java:214)
        at org.chiba.xml.xforms.core.Bind.init(Bind.java:368)
        at org.chiba.xml.xforms.Initializer.initializeBindElements(Initializer.java:214)
        at org.chiba.xml.xforms.core.Bind.init(Bind.java:368)
        at org.chiba.xml.xforms.Initializer.initializeBindElements(Initializer.java:214)
        at org.chiba.xml.xforms.core.Model.modelConstruct(Model.java:853)
        at org.chiba.xml.xforms.core.Model.performDefault(Model.java:746)
        at org.chiba.xml.events.impl.DefaultXMLEventService.dispatch(DefaultXMLEventService.java:286)
        at org.chiba.xml.xforms.Container.dispatch(Container.java:501)
        at org.chiba.xml.xforms.Container.dispatch(Container.java:479)
        at org.chiba.xml.xforms.Container.initModels(Container.java:719)
        at org.chiba.xml.xforms.Container.init(Container.java:345)
        at org.chiba.xml.xforms.ChibaBean.init(ChibaBean.java:429)
        at org.alfresco.web.forms.xforms.XFormsBean.setXFormsSession(XFormsBean.java:267)
        at org.alfresco.web.forms.xforms.XFormsProcessor.process(XFormsProcessor.java:147)
        … 70 more

I think my WebForm is correc but alfresco returns a exception.

I hope someone have a running WebFrom definition to create xf:switch UI Componnents.

Thanks and regarding
CoTech

Outcomes