You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Nandana Mihindukulasooriya <na...@gmail.com> on 2007/08/16 12:22:17 UTC
jcr-mapping : can we map a node name to a bean field
Hi,
I am using ocm to map the content in the repository to Beans.My application
has a node type blog:user and
user nodes will be created using the usernames as their path.
Node Structure
/blogRoot/<username> [blog:user]
CND
[blog:user] > nt:folder, mix:referenceable
- blog:nickname (string) mandatory
- blog:email (string) mandatory
- blog:password (string) mandatory
So the Node type doesn't contain a property for username. But I want to map
the username in to one of the
String fields in the User Bean. is something like that possible ?
I tried to use a class implementing AtomicTypeConverter interface for this
purpose but failed as there was
no property in the blog:user type which corresponds to username.
These bean objects are passed to a JSP page where I use JSP taglibs to
present them.
At the moment, I am using following code in the User bean to get things done
but I think it is not the correct
way to go.
String path;
String username;
...
public String getUsername() {
return path.substring("/blogRoot/".length(),path.length());
}
Thanks in advance,
Nandana