cancel
Showing results for 
Search instead for 
Did you mean: 

More presets files in share

Not applicable
Hi,
I create a module for share that implements a new site type. I create a presets file (presets.xml) and install it in /classes/alfresco/web-extensions/site-data/
All right for now.
After i create another module that implements another site type. I create another presets file (presets.xml), but i can't deploy it. I can't override the other presets.xml.
These modules are indipendent and i can't merge the two presets.xml.
From svn of record management i see that his preset file name is "rm-presets.xml". Perfect for me!!!!!
But if i rename my presets.xml site not work (Filename must be "presets.xml"). I work on alfresco 4.0. Do I must migrate to 4.2 for this feature?
How record management implements it???

By
Federico
8 REPLIES 8

afaust
Legendary Innovator
Legendary Innovator
Hello,

in order to define alternative preset file names - or change the search path - you need to override some default beans in your custom-slingshot-application-context.xml in /shared/classes/alfresco/web-extension

The following beans are of interest in this use case:

    <bean id="webframework.classpathstore.presets.custom" class="org.springframework.extensions.webscripts.ClassPathStore">
      <property name="mustExist"><value>false</value></property>
      <property name="classPath"><value>alfresco/web-extension/site-data/presets</value></property>
   </bean>
  
   <bean id="webframework.remotestore.presets" parent="webframework.store.remote.abstract">
      <property name="path"><value>alfresco/site-data/presets</value></property>
   </bean>
  
   <bean id="webframework.presets.searchpath" class="org.springframework.extensions.webscripts.SearchPath">
      <property name="searchPath">
         <list>
            <ref bean="webframework.classpathstore.presets.custom" />
            <ref bean="webframework.classpathstore.presets" />
         </list>
      </property>
   </bean>

    <!– Presets manager - configured to walk a search path for preset definition files –>
   <bean id="webframework.presets.manager" class="org.springframework.extensions.surf.PresetsManager">
      <property name="modelObjectService" ref="webframework.service.modelobject" />
      <property name="searchPath" ref="webframework.presets.searchpath" />
      <property name="files">
         <list>
            <value>presets.xml</value>
         </list>
      </property>
   </bean>

You can add another path for Surf to look for presets or simply add another file name, i.e. "my-custom-presets.xml".

Regards
Axel

Not applicable
Hi, I choose to create presets file with another name. This is the code:

<!– Add another Presets manager –>
   <bean id="custom.webframework.presets.manager" class="org.springframework.extensions.surf.PresetsManager">
      <property name="modelObjectService" ref="webframework.service.modelobject" />
      <property name="searchPath" ref="webframework.presets.searchpath" />
      <property name="files">
         <list>
            <value>my-presets.xml</value>
         </list>
      </property>
   </bean>

But, it not works (no errors at startup).
I'm using default searchpath with this code.
I would not override default beans, because the two projects are indipendent…
Any suggestions?

ddraper
World-Class Innovator
World-Class Innovator
It is actually not necessary to override the beans definitions any more… there have been some updates to Surf that mean that the any file ending in "presets.xml" will be processed (for example "my-presets.xml" would be processed). Depending upon what version (e.g. Community or Enterprise) and service pack of Alfresco 4.0 you have you may or may not have this feature.

Regards,
Dave

Not applicable
ok, perfect.
I'm using alfresco community 4.0.e (it has surf-1.0.0).
Which version of surf has this feature?

ddraper
World-Class Innovator
World-Class Innovator
The Surf version specified by the JAR file name has little meaning for Surf… if you open up the "spring-surf-core*.jar" and inspect the META-INF/manifest.mf file you will find an "SCM-Revision" property… this value indicates the revision of Surf that built the JAR.

Using "presets.xml" as a suffix rather than an explicit file was added in revision 1013 so as long as the SCM-Revision property in your manifest.mf file is equal to or greater than "1013" then you will have that feature.

Regards,
Dave

Not applicable
In fact alfresco 4.0.d surf revision number is 958.
Thank you Dave for your amazing support!!!

        -ft

gregheller2510
Champ in-the-making
Champ in-the-making
We are trying to override the preset for a user dashboard "<preset id="user-dashboard">" using a custom my-custom-presets.xml file stored under alfresco/web-extension/site-data/presets/my-custom-presets.xml. We are on alf version 4.0.2.9 and we package our customization's as a jar file. This override does not get picked up unless we modify the presets.xml under the WEB-INF/classes/

This is the preset ID we are trying to override - preset id="user-dashboard"

I tried to do the same and I have same problem. My preset define in my jar is not recognized. Does anybody have a solution?