How To extend an authority or person built-in type

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2011 06:12 AM
Dear Gurus,
I have a requirement from certain of customers intended to customize authority or person built-in types.
Simply, i want to add properties to cm
erson such as "Position" and i walk through the same techniques for alfresco customization of "content types"; but unfortunately all tries are failed.
Also, i read two of posts talks about the same thing
- http://forums.alfresco.com/en/viewtopic.php?t=6553
- http://forums.alfresco.com/en/viewtopic.php?t=6246&start=0&postdays=0&postorder=asc
And may be i'm going in the wrong way, can any one please guide me if there are techniques related to the alfresco configuration file (web-client-config.xml, customModel.xml) because the development way is the final way i would go through to solve the problem.
Thanks In Advance.
Mohammed Amr
I have a requirement from certain of customers intended to customize authority or person built-in types.
Simply, i want to add properties to cm

Also, i read two of posts talks about the same thing
- http://forums.alfresco.com/en/viewtopic.php?t=6553
- http://forums.alfresco.com/en/viewtopic.php?t=6246&start=0&postdays=0&postorder=asc
And may be i'm going in the wrong way, can any one please guide me if there are techniques related to the alfresco configuration file (web-client-config.xml, customModel.xml) because the development way is the final way i would go through to solve the problem.
Thanks In Advance.
Mohammed Amr
Labels:
- Labels:
-
Archive
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2012 06:58 PM
You can define aspects and then add those aspects to cm
erson objects. As those other posts mention, you'll then have to do some work to make that change usable in the web client.
If you are using Share, here is the minimum of what you must do in an Alfresco 3.4 installation to add custom properties to a person object and then use those properties in Share:
1. Extend org.alfresco.web.site.SlingshotUser with your own User class, let's call it SomeUser. Add getters and setters for your properties.
2. Extend org.alfresco.web.site.SlingshotUserFactory with your own Factory class.
2a. Add a buildSomeUser method. Follow existing pattern to build your own.
2b. Add a constructSomeUser method. Follow existing pattern to build your own.
2c. Override constructUser to return SomeUser
2d. Implement saveUser
3. Wire in the custom user factory through Spring using parent="webframework.factory.base"
4. In share-config-custom, override the defaults, user-factory element with a pointer to the new user factory bean
5. Override Alfresco's profile.js with your own.
5a. Modify onEditProfile to include your custom props
6. Extend org/alfresco/components/profile/userprofile.get.html.ftl with your own that includes fields and labels for your custom properties.
There may be some steps I am leaving out but this will get you close.
I have no idea whether or not this has gotten easier in Alfresco 4.
Jeff

If you are using Share, here is the minimum of what you must do in an Alfresco 3.4 installation to add custom properties to a person object and then use those properties in Share:
1. Extend org.alfresco.web.site.SlingshotUser with your own User class, let's call it SomeUser. Add getters and setters for your properties.
2. Extend org.alfresco.web.site.SlingshotUserFactory with your own Factory class.
2a. Add a buildSomeUser method. Follow existing pattern to build your own.
2b. Add a constructSomeUser method. Follow existing pattern to build your own.
2c. Override constructUser to return SomeUser
2d. Implement saveUser
3. Wire in the custom user factory through Spring using parent="webframework.factory.base"
4. In share-config-custom, override the defaults, user-factory element with a pointer to the new user factory bean
5. Override Alfresco's profile.js with your own.
5a. Modify onEditProfile to include your custom props
6. Extend org/alfresco/components/profile/userprofile.get.html.ftl with your own that includes fields and labels for your custom properties.
There may be some steps I am leaving out but this will get you close.
I have no idea whether or not this has gotten easier in Alfresco 4.
Jeff
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2012 06:00 PM
Code that shows how to do this for 3.4.d Community lives here:
http://ecmarchitect.com/images/articles/alfresco-people/someco-people.zip
Jeff
http://ecmarchitect.com/images/articles/alfresco-people/someco-people.zip
Jeff

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2012 08:57 AM
Thanks, already i use the alfresco explorer and i use add aspect techniques.
Thanks.
Thanks.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2012 09:57 PM
Hi Jeff,
I know I'm being a bit of a thread necromancer here, but there seems to be some differences between the 2 posts you have here in this thread. On your post on the 16th Feb, it says that one must extend the SlingshotUser class. It also says that when extending SlingshotUserFactory that the buildUser, ConstructUser, and saveUser methods must be implemented/overridden. In the tutorial on your site and also in the sample code it is a much sparser process, with nothing to do with the SlingshotUser class, and only the constructUser and SaveUser methods implemented. Which of these is correct?
I know I'm being a bit of a thread necromancer here, but there seems to be some differences between the 2 posts you have here in this thread. On your post on the 16th Feb, it says that one must extend the SlingshotUser class. It also says that when extending SlingshotUserFactory that the buildUser, ConstructUser, and saveUser methods must be implemented/overridden. In the tutorial on your site and also in the sample code it is a much sparser process, with nothing to do with the SlingshotUser class, and only the constructUser and SaveUser methods implemented. Which of these is correct?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2012 03:10 PM
The difference is that in my Feb 15 post, I was outlining what was done on a project that was likely 3.4.x Enterprise.
A week or so later I felt bad that I hadn't provided a working example, but not owning the IP of the 3.4.x Enterprise example, I had to re-code it from scratch, and I chose to use 3.4.d Community Edition. As you observed, I was able to do that without touching SlingshotUser and with fewer method overrides.
This could be because:
- The two releases of Alfresco are different
- My contrived example was simpler than what we were doing in that original project
- My second attempt was simply more succinct than the first
I cannot tell which of these is the case without a deeper investigation which I don't have time to do at the moment.
I can say with certainty that both worked at the time they were written for the release they were written against.
Jeff
A week or so later I felt bad that I hadn't provided a working example, but not owning the IP of the 3.4.x Enterprise example, I had to re-code it from scratch, and I chose to use 3.4.d Community Edition. As you observed, I was able to do that without touching SlingshotUser and with fewer method overrides.
This could be because:
- The two releases of Alfresco are different
- My contrived example was simpler than what we were doing in that original project
- My second attempt was simply more succinct than the first
I cannot tell which of these is the case without a deeper investigation which I don't have time to do at the moment.
I can say with certainty that both worked at the time they were written for the release they were written against.
Jeff
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2012 06:00 PM
Hi Jeff,
That makes sense. I was worried that some of the extra stuff from the first post was just so obvious to people in the know that it didn't need to be in the tutorial. I wasn't able to figure out a way to get that solution to work in 4.0d, but produced a rather messy workaround in the end.
That makes sense. I was worried that some of the extra stuff from the first post was just so obvious to people in the know that it didn't need to be in the tutorial. I wasn't able to figure out a way to get that solution to work in 4.0d, but produced a rather messy workaround in the end.
