deas / contentreich-alfresco-datalists

Datalist Extensions for Alfresco Share
16 stars 26 forks source link

Need tips to create my own datalist #37

Open Montagnard65 opened 9 years ago

Montagnard65 commented 9 years ago

Hi, I want to create my own datalist, so I try to customize the extension's code, but I'm faced to problems... I've modified the contentreich-extdl-datalist-model.xml file in contentreich-alfresco-datalists-master/contentreich-extdl-share/src/main/resources/alfresco/web-extension/, to add my own datalist :

    <!-- Essai de liste customisé : main courante!-->
        <type name="xdl:maincourante">
          <title>Main Courante</title>
          <parent>xdl:dataListItem</parent>
         <properties>
            <property name="xdl:mcTitre">
               <title>Nom de l'évènement</title>
               <type>d:text</type>
               <mandatory>true</mandatory>
            </property>
            <property name="xdl:mcDate">
               <title>Date d'évènement</title>
               <type>d:date</type>
               <mandatory>true</mandatory>
            </property>
            <property name="xdl:mcDescription">
               <title>Description</title>
               <type>d:text</type>
               <mandatory>true</mandatory>
            </property>
              <property name="xdl:mcTags">
                 <title>Tags</title>
                 <type>d:text</type>
                 <mandatory>false</mandatory>
              </property>
                 <property name="xdl:mcLiens">
                 <title>Lien vers documents externes</title>
                 <type>d:text</type>
                 <mandatory>false</mandatory>
              </property>
        </properties>       
          <mandatory-aspects>
             <aspect>cm:titled</aspect>
             <aspect>cm:attachable</aspect>
         </mandatory-aspects>
        </type>

and I modified the example file : my-custom-datalists-context.xml to place it (with the same name) in contentreich-alfresco-datalists-master\contentreich-extdl-share\src\main\resources\alfresco\web-extension

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
    <bean id="myExtension.dictionaryBootstrap" parent="dictionaryModelBootstrap"
        depends-on="dictionaryBootstrap, extension.dictionaryBootstrap">
        <property name="labels">
            <list>
                <value>alfresco/extension/model/my-custom-datalists-context</value><!-- FIXME THIS IS YOUR MODEL LABELS/MESSAGES-->
            </list>
        </property>
        <property name="models">
            <list>
                <value>alfresco/extension/model/my-custom-datalists-context.xml</value><!-- FIXME THIS IS YOUR MODEL DEFINING the my:datalist-->
            </list>
        </property>
    </bean>

  <bean id="dataListTypes" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" depends-on="datalistFormFilterNode">
        <property name="targetObject" >
            <ref bean="datalistFormFilterNode"/>
        </property>
        <property name="targetMethod" value="setDatalistTypes" />
        <property name="arguments">
            <!-- These are taken from the forms config for now --> 
            <set>
                 <value>xdl:maincourante</value><!-- FIXME THIS IS YOUR CUSTOM DATALIST DEFINED IN THE MODEL LOADED -->
                 <value>xdl:simpletask</value>
                 <value>xdl:contact</value>
                 <value>xdl:eventAgenda</value>
                 <value>xdl:todoList</value>
                 <value>xdl:task</value>
                 <value>xdl:issue</value>
                 <value>xdl:event</value>
                 <value>xdl:location</value>
                 <value>xdl:meetingAgenda</value>
             </set>
        </property>
    </bean>
      <bean id="dataListTypesType" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" depends-on="datalistFormFilterType">
        <property name="targetObject" >
            <ref bean="datalistFormFilterType"/>
        </property>
        <property name="targetMethod" value="setDatalistTypes" />
        <property name="arguments">
            <!-- These are taken from the forms config for now --> 
            <set>
                 <value>xdl:maincourante</value><!-- FIXME THIS IS YOUR CUSTOM DATALIST DEFINED IN THE MODEL LOADED -->
                 <value>xdl:simpletask</value>
                 <value>xdl:contact</value>
                 <value>xdl:eventAgenda</value>
                 <value>xdl:todoList</value>
                 <value>xdl:task</value>
                 <value>xdl:issue</value>
                 <value>xdl:event</value>
                 <value>xdl:location</value>
                 <value>xdl:meetingAgenda</value>
             </set>
        </property>
    </bean>
       <!-- Download a datalist as Excel XLS / XLSX -->
  <bean id="modelOrder" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" depends-on="webscript.de.contentreich.slingshot.datalists.list.get">
        <property name="targetObject" >
            <ref bean="webscript.de.contentreich.slingshot.datalists.list.get"/>
        </property>
        <property name="targetMethod" value="setModelOrder" />
        <property name="arguments">
            <!-- These are taken from the forms config for now --> 
           <map>
              <entry key="xdl:maincourante"> 
                <value>xdl:itemId,xdl:mcTitre,xdl:mcDate,xdl:mcDescription,xdl:mcTags,xdl:mcLiens,cm:titled,cm:attachable<!-- FIXME THIS IS YOUR CUSTOM DATALIST DEFINED IN THE MODEL LOADED, ADD THE FIELD YOU NEED EXPORTED --></value> 
              </entry>
[...]

but when I try to launch alfresco with the new jar files, I've this error :

2015-08-21 10:49:45,526  ERROR [web.context.ContextLoader] [localhost-startStop-1] Context initialization failed
 org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'myExtension.dictionaryBootstrap' defined in URL [jar:file:/opt/alfresco/tomcat/webapps/share/WEB-INF/lib/contentreich-extdl-share-2.0.0-SNAPSHOT.jar!/alfresco/web-extension/my-custom-datalists-context.xml]: Could not resolve parent bean definition 'dictionaryModelBootstrap'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'dictionaryModelBootstrap' is defined
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:1180)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:1125)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1111)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:612)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5524)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1081)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1877)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'dictionaryModelBootstrap' is defined
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:575)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1111)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:892)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:1166)
        ... 21 more

I think I've don't understand what is it expect in the customisation of this line in my-custom-datalists-context.xml :

property name="labels"> <list> <value>alfresco/extension/model/ ??
and 
<property name="models"> <list> <value>alfresco/extension/model/ ??

Could you help me ? Thanks!

Best regards

deas commented 9 years ago

Model extensions go in the repo webapp, not in share where you have put them. That's causing the problem you see. Besides, you should not make changes to this extension unless they are generic and opt-in - like the dialog you refer to in #36 .