cancel
Showing results for 
Search instead for 
Did you mean: 

Customize User Profile on 4.2e

riccardog
Champ in-the-making
Champ in-the-making
Hi everybody,

As many other people, I need to add some custom data to cmSmiley Tongueerson.

After some browsing, I've found that jpotts' post  http://ecmarchitect.com/archives/2012/02/27/1555 but it is for Alfresco 3.4, while I am using <strong>Alfresco 4.2e Community</strong>

I 've done some adaptations,  but the only goal I got is: to see my brand new text fields in the form. Custom data is not written.

In effects, I am not sure that my bean that overrides SlingshotUserFactory is called. Indeed I am almost sure it is not.

I explain what I've done, hoping someone will show me my errors…

By the way, I'm doing it into a specific AMP.

I don't mention the parts about the aspect and the client side, because they are working.


First of all, I've declared my bean into a custom share config, called kl-custom_users-share-config.xml

<alfresco-config>

   <config evaluator="string-compare" condition="WebFramework">
      <web-framework>
         <defaults>
            <user-factory>webframework.factory.user.kitelabs</user-factory>
         </defaults>
      </web-framework>
   </config>
</alfresco-config>


then loaded it by a -context:

<bean id="it.kitelabs.alf.kl-custom_users-config" class="org.springframework.extensions.config.ConfigBootstrap"
      init-method="register">
      <property name="configService" ref="web.config" />
      <property name="configs">
         <list>
               <!– KiteLabs custom config –>
            <value>classpath:alfresco/kl-custom_users-share-config.xml</value>
            
         </list>
      </property>
   </bean>

   
   <bean id="webframework.factory.user.kitelabs" class="it.kitelabs.alf.custom_users.KLUserFactory" parent="webframework.factory.base" />


I think It doesn't work because  my java code should write some debug lines in catalina.out and in my own textile: I never seen that text.
Where could be my mistake? maybe user-factory is not the correct key? or maybe  submitting data no more uses the java implementation? Or there is a typo I can't see?

Thank you,
RIc
6 REPLIES 6

jottley
Confirmed Champ
Confirmed Champ
A quick check to make sure that it is at least loading is to introduce an error into the config.  Can you change your class name in the kl-custom_users-share-config.xml for webframework.factory.user.kitelabs to something like webframework.factory.user.k

If you see a parsing error then we know that it is at least loading pulling the bean.  I am wondering if that file is in the correct place with the correct name.  I've done a similar change for a personal project: https://github.com/jottley/alfresco-rumors.  It was against 4.2d but should be pretty similar.

riccardog
Champ in-the-making
Champ in-the-making
Hi Jared,
Thanks for your answer Smiley Happy

I did as you suggested: introduced an error into the config; the result is:
NO errors raised into catalina.out .

Anyway I am sure that the file -context.xml is loaded and parsed, because it also contains another bean (relative to  the files containing the I18N messages), and this is working.

Moreover, if I  introduce the error into this one bean,  then I get the parse error.

I've seen in your alfresco-rumors that you bean refers   to       "org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent"
while mine  is
"org.springframework.extensions.config.ConfigBootstrap"
Is it possible that my bean is not loaded because  it does not have the correct class?

If so how -or where- can I get the correct parameters I should use?

Thank you,
RIc

jottley
Confirmed Champ
Confirmed Champ
Hi Ric,

I would reference Jeff Potts example in http://ecmarchitect.com/images/articles/alfresco-content/content-article-2ed.pdf.  His example on page 27 uses the newer class to load the resource bundles.

Jared

riccardog
Champ in-the-making
Champ in-the-making
Ciao Jared,
I have resolved (that piece of)  my problem:
the thing works if I put the config-evaluator into  META-INF/share-config-custom.xml
that is, in the standard directory, with the standard name.
if I use META-INF/another-file-config-custom.xml it does not work.
if I use another_place/share-config-custom.xml  it does not work.

My conundrum is:
I use various  AMPs for different pieces of customization; what happens if more than one MAP needs to write in the same share-config-custom.xml  file?

Do  am  I missing something else?

thanks,
RIccardo

jottley
Confirmed Champ
Confirmed Champ
The best practice for share-config-custom.xml is that it is packaged in a jar file.

For example:  In the alfresco rumors project you'll find the share-config-custom.xml file in the META-INF directory.  When the maven build process runs it includes that directory in the jar file that is produced.  Alfresco Share will look for the custom config file in the jars included in the share war file.  This allows you to include multiple custom share configs and not need to worry that someone else's customization is going to overwrite the config of yours.


Jared

riccardog
Champ in-the-making
Champ in-the-making
Thank you very much, Jared,
You have solved a number of my doubts

For now I have only another problem:

I need to customize site-index.jsp but I don't 'know how to deploy it by the AMP structure.
The reference
http://docs.alfresco.com/4.2/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Fconcepts%2Fdev-extensi...
says I can put JSP files into a config//web/jsp directory but it doesn't work.
I suppose the structure for Share is a bit different from the Alfresco one.

So the question is:
is it possible to deploy the site-index.jsp using an AMP? how?
Thank you,

RIccardo