YourKit Java Profiler |
JFacets /
SimpleProfileRepositoryThe SimpleProfileRepository is an implementation of the ProfileRepository included by default in JFacets. You can use it directly when starting a new project ("fake" the future graph in a few minutes to start developing, and build the real implementation later or in parallel). It's also used in the examples. Default profilesThe SimpleProfileRepository creates a default profiles tree if you don't override its
Defining your own profilesThe use of the SimpleProfileRepository is easy. You simply have to do 2 things :
package com.xyz.myapp.jfacets; public class MyProfileRepository extends SimpleProfileRepository { @Override protected void feed() { // create the graph (erf, here it's a tree) SimpleProfile root_profile = createProfile("root_profile"); SimpleProfile admin_role = createProfile("admin_role"); root_profile.addChild(admin_role); SimpleProfile ivar = createProfile("ivar"); admin_role.addChild(ivar); SimpleProfile standard_role = createProfile("standard_role"); root_profile.addChild(standard_role); SimpleProfile john = createProfile("john"); standard_role.addChild(john); } }
<bean id="profileRepository" singleton="true" class="com.xyz.myapp.jfacets.MyProfileRepository"> </bean> Then, you can start assigning facets to profiles in the graph and retrieve them. |