jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nandana Mihindukulasooriya" <nandana....@gmail.com>
Subject jcr-mapping : can we map a node name to a bean field
Date Thu, 16 Aug 2007 10:22:17 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message