cancel
Showing results for 
Search instead for 
Did you mean: 

Constraints create bug?

konda
Champ in-the-making
Champ in-the-making
Hi all,

I create a custom content model and it works until I introduce the constraints in the aspect elements. In fact, in this case, when I try (from share) to change the type of a document in the custom type, I get the following error:

"Internal server error".

Here is the content of tomcat log:

<blockcode>
ERROR [extensions.webscripts.AbstractRuntime] [http-apr-8080-exec-2] Exception from executeScript - redirecting to status template error: 00310000 Wrapped Exception (with status template): null
org.springframework.extensions.webscripts.WebScriptException: 00310000 Wrapped Exception (with status template): null
   at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1067)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
   at org.springframework.extensions.webscripts.PresentationContainer.executeScript(PresentationContainer.java:70)
   at org.springframework.extensions.webscripts.LocalWebScriptRuntimeContainer.executeScript(LocalWebScriptRuntimeContainer.java:240)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:377)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
   at org.springframework.extensions.webscripts.servlet.mvc.WebScriptView.renderMergedOutputModel(WebScriptView.java:104)
   at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
   at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
   at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:195)
   at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:159)
   at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
   at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
   at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:417)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
   at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1813)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
   at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NullPointerException
   at org.alfresco.web.scripts.forms.FormUIGet.processFieldConstraintControl(FormUIGet.java:1956)
   at org.alfresco.web.scripts.forms.FormUIGet.generateConstraintModel(FormUIGet.java:1816)
   at org.alfresco.web.scripts.forms.FormUIGet.processFieldConstraints(FormUIGet.java:1701)
   at org.alfresco.web.scripts.forms.FormUIGet.generateFieldModel(FormUIGet.java:1315)
   at org.alfresco.web.scripts.forms.FormUIGet.generateDefaultSetModelUsingServerFields(FormUIGet.java:1255)
   at org.alfresco.web.scripts.forms.FormUIGet.processServerFields(FormUIGet.java:1117)
   at org.alfresco.web.scripts.forms.FormUIGet.processFields(FormUIGet.java:1058)
   at org.alfresco.web.scripts.forms.FormUIGet.generateFormUIModel(FormUIGet.java:666)
   at org.alfresco.web.scripts.forms.FormUIGet.generateFormModel(FormUIGet.java:609)
   at org.alfresco.web.scripts.forms.FormUIGet.generateModel(FormUIGet.java:265)
   at org.alfresco.web.scripts.forms.FormUIGet.executeImpl(FormUIGet.java:220)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)
   … 40 more
</blockcode>

Here is my content model

<blockcode>
<model name="ax:axa" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <description>Modello Axa</description>
   <author/>
   <version>1.0</version>
   <imports>
      <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>
   <namespaces>
      <!– Define a Namespace for my new definitions –>
      <namespace uri="http://www.olivetti.com/model/custom/ax/content/1.0" prefix="ax"/>
   </namespaces>
   <constraints>
      <constraint name="axSmiley FrustratedTATO_PRATICA" type="LIST">
         <parameter name="allowedValues">
            <list>
               <value>0</value>
               <value>1</value>
            </list>
         </parameter>
         <parameter name="caseSensitive">
            <value>false</value>
         </parameter>
      </constraint>
   </constraints>
   <types>
      <type name="axSmiley TongueRATICA">
         <title>Dossier_Pratica</title>
         <parent>cm:content</parent>
         <mandatory-aspects>
            <aspect>axSmiley TongueropertiesPRATICA</aspect>
            <aspect>axSmiley TongueropertiesSTATUSPRATICA</aspect>
         </mandatory-aspects>
      </type>
   </types>
   <aspects>

      <aspect name="axSmiley TongueropertiesPRATICA">
         <title>Proprieta Pratica</title>
         <properties>
            <property name="ax:codAdesione_PRATICA">
               <title>CODICE_ADESIONE</title>
               <type>d:text</type>
               <constraints>
                  <constraint type="LENGTH">
                     <parameter name="maxLength">
                        <value>20</value>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
            <property name="ax:codCompagnia_PRATICA">
               <title>CODICE_COMPAGNIA</title>
               <type>d:text</type>
               <constraints>
                  <constraint type="LENGTH">
                     <parameter name="maxLength">
                        <value>3</value>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
            <property name="ax:codPolizza_PRATICA">
               <title>CODICE_POLIZZA</title>
               <type>d:text</type>
               <constraints>
                  <constraint type="LENGTH">
                     <parameter name="maxLength">
                        <value>10</value>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
            <property name="ax:codProdotto_PRATICA">
               <title>CODICE_PRODOTTO</title>
               <type>d:text</type>
               <constraints>
                  <constraint type="LENGTH">
                     <parameter name="maxLength">
                        <value>3</value>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
            <property name="ax:tipoMovimento_PRATICA">
               <title>TIPO_MOVIMENTO</title>         
               <type>d:text</type>
               <constraints>
                  <constraint type="LENGTH">
                     <parameter name="maxLength">
                        <value>2</value>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
         </properties>
      </aspect>
      <aspect name="axSmiley TongueropertiesSTATUSPRATICA">
         <title>Proprieta Stato Pratica</title>
         <properties>
            <property name="ax:stato_STATUSPRATICA">
               <title>STATO_PRATICA</title>
               <type>d:int</type>
               <mandatory>true</mandatory>
               <default>0</default>
               <constraints>
                  <constraint ref="axSmiley FrustratedTATO_PRATICA"/>
               </constraints>
            </property>
            <property name="ax:versione_STATUSPRATICA">
               <title>VERSIONE_PRATICA</title>
               <type>d:int</type>
            </property>
         </properties>
      </aspect>
   </aspects>
</model>
</blockcode>

If I comment the <constraint ref="axSmiley FrustratedTATO_PRATICA"/> block (only) I can change the document type correctly!

Am i making some mistakes? If you need more elements to understand the issue feel free to ask.

I'm using the latest Alfresco community edition.
3 REPLIES 3

konda
Champ in-the-making
Champ in-the-making
Thanks for the answer, I read.


Regards

andy
Champ on-the-rise
Champ on-the-rise
Hi

I think you want a numeric range instead of a list of values.
I see no reason why a valid list of integers would not be allowed.

Andy