cancel
Showing results for 
Search instead for 
Did you mean: 

Extending site presets via amps

peterzmlim
Champ in-the-making
Champ in-the-making
I'm currently developing 2 different amp modules that auto generate different sites designated for different purposes based on some data provided.

I already have an overridden shared/classes/alfresco/web-extension/site-data/presets/presets.xml that contains my different site presets.

Instead of adding the preset configuration to presets.xml, is there anyway for me to package the site presets within the individual amps? At the moment, I don't see a way to do it as each amp's presets.xml will overwrite each other which leads me to override it via shared/classes/alfresco/web-extension/site-data/presets/presets.xml.

Regards,
peterzmlim
9 REPLIES 9

peterzmlim
Champ in-the-making
Champ in-the-making
I'm currently looking into this blog regarding spring surf presets: http://blogs.alfresco.com/wp/ddraper/2011/11/01/spring-surf-presets/

Does this means that I'll have to override the PresetsManager in order to deploy custom presets? (ie web-extension/site-data/presets-custom.xml)
Will I need to override the ModelObjectService to reference to the local file system too?

lotharmärkle
Champ in-the-making
Champ in-the-making
Hi peterzmlim,

If you have solved this heavy question somehow, it would be great to know how you did it. FYI, this is the way I have done it http://thinkalfresco.blogspot.de/2012/06/alfresco-hack-5-how-to-add-custom-share.html to add multiple site presets by different amps without interference. Maybe you have found some other way?

Regards,
  lothar

ddraper
World-Class Innovator
World-Class Innovator
Hi,

Apologies for not spotting this question earlier!

We've actually made some changes to the default PresetsManager so that instead of just looking for the presets file "presets.xml" it will now process all files with the suffix "presets.xml"… this means that it is backwards compatible with earlier versions of Share configuration to process files just called "presets.xml" … but that you can now define additional presets files, such as "custom1_presets.xml", "custom2_presets.xml", etc and they will NOT overrwrite the default file.

However, you should be aware that individual presets can still be overridden by re-using previously specified preset ids.

Regards,
Dave

alejandrogarcia
Champ in-the-making
Champ in-the-making
Hi,

Apologies for not spotting this question earlier!

We've actually made some changes to the default PresetsManager so that instead of just looking for the presets file "presets.xml" it will now process all files with the suffix "presets.xml"… this means that it is backwards compatible with earlier versions of Share configuration to process files just called "presets.xml" … but that you can now define additional presets files, such as "custom1_presets.xml", "custom2_presets.xml", etc and they will NOT overrwrite the default file.

However, you should be aware that individual presets can still be overridden by re-using previously specified preset ids.

Regards,
Dave

Hi,

Dave, where should these "*presets.xml" files be placed in order to be deployed within a JAR file? I'm trying to deploy my custom presets file this way:

EDIT:
alfresco/site-data/presets/my-custom-presets.xml

Doesn't work… Perhaps should be deployed in the web-extension directory?

Regards.

ddraper
World-Class Innovator
World-Class Innovator
Presets are a first class Surf object type … therefore they should be placed at the root of the Surf configuration store, e.g:

alfresco/site-data/presets/my-custom-presets.xml

Note: I've removed "pages" from the path that you had.

Regards,
Dave

alejandrogarcia
Champ in-the-making
Champ in-the-making
Note: I've removed "pages" from the path that you had.

I have edited my post, I'm sorry I was wrong while writing the path, in my real example I don't have my presets XML in that path.

So Dave, do you mean that it should work the way I'm doing? Custom presets in the right directory within a JAR…

And another question, what does exactly mean:
Presets are a first class Surf object type

I'm sorry for my ignorance…

Regards.

ddraper
World-Class Innovator
World-Class Innovator
Actually… whilst the path I've provided is correct, my explanation is actually wrong…. the Surf PrestsManager bean (id: "webframework.presets.manager") uses a search path bean (id: "webframework.presets.searchpath") that specifies two stores…. one is: "alfresco/site-data/presets" and the other is "alfresco/web-extension/site-data/presets".

Presets aren't actually a first class Surf type at all… my apologies for that. Either way though, the "alfresco/site-data/presets" is where you should place addiontal presets files.

Regards,
Dave

ddraper
World-Class Innovator
World-Class Innovator
By first class object type I mean its a Surf object…. Pages, Template-Instances, Components, Component-Types, Template-Types, Chrome, etc are all Surf objects. So you would configure them under "alfresco/site-data/{object-type} (although you can reconfigure Surf to look for them in other places).

If your preset isn't being picked up then it's mostly likely that you're running with a version of Alfresco that doesn't a revision of Share with the updated feature…. I know for a fact that additional presets files do work from this location because we're using them in a DevCon session we're doing next week that I've been working on.

Regards,
Dave

alejandrogarcia
Champ in-the-making
Champ in-the-making
Thanks for the explanation Dave.

Well it is working as you said, my Alfresco version is 4.2.b. Now I'm having another problem that I'll post in a different thread, otherwise this thread is going to go more out of topic…

Regards.