-
1. Re: Please give me a brief idea about navigationServiceImpl
vstorm83 Aug 15, 2013 3:33 AM (in response to anishantony)Hi, IMO, the best way for you to study about navigation service is using the unit test, you'll find them here: https://github.com/gatein/gatein-portal/tree/3.2.0-GA/component/portal/src/test/java/org/exoplatform/portal/mop/navigation
To understand about object models used in navigation service, you need to know about GateIn navigation structure:
- UserNode : like home, sitemap ... --> belong to one navigation
- NavigationContext, NavigationData are 2 classes that describe navigation, each navigation belongs to Site
- SiteKey --> help to indentify a Site (portal site, group site, user site) that a navigation belongs to
GateIn navigation system can be configured with xml file, details in the doc http://docs.jboss.org/gatein/portal/3.2.0.Final/reference-guide/en-US/html_single/#sect-Reference_Guide-Portal_Navigation_Configuration
Best thing I like at NavigationService is that it will help to work effectively with big navigation data, it allow to load navigation nodes lazily. For example, when you use this
navService.loadNode(Node.MODEL, nav, Scope.CHILDREN, null) --> it only load node with its children, but not the grand childs... (only one level)
Nav service also provide "rebase" machanism that allow update the current node with the lastest changes in DB
The cached used in nav service is cool too, it help to reduce queries to DB, and it works in clustering environment
If you work with navigation in Portal context. You may want to use this class org.exoplatform.portal.mop.user.UserPortal. It's easier to work with this class than directly with NavigationService (service api is more flexible but harder to use). The unit test is here: https://github.com/gatein/gatein-portal/blob/3.2.0-GA/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java
You can also find examples in GateIn's portlet like: sitemap, navigation management portlet https://github.com/gatein/gatein-portal/tree/3.2.0-GA/portlet
This is actually internal api, that is flexible but hard to use. We provide gatein public API from GateIn 3.5. That is easy to use, read more here: https://community.jboss.org/thread/215521
-
2. Re: Please give me a brief idea about navigationServiceImpl
theute Aug 21, 2013 4:26 AM (in response to anishantony)Indeed, use the public API instead (upgrade if necessary)
-
3. Re: Please give me a brief idea about navigationServiceImpl
anishantony Sep 18, 2013 3:12 AM (in response to theute)Hi Thomas
I Upgraded my gateIn with 3.6 version, and i deployed following sample navigation portlet on that GateIn 3.6
https://github.com/gatein/gatein-portal-quickstart/tree/master/navigation-api-portlet
The following image shows the navigation created from public api and the orginal navigation
What i need is, create an additional node in public api navigation (say "My Menu") programatically
Here follows the problems happens while creating a node pragmatically:-
For creating a navigation node need to create a Node object which is implemented by org.gatein.api.navigation.Node . When i inspect the above sample code the nodes are created by org.gatein.api.navigation.ApiNode Object. But i cannot import org.gatein.api.navigation.ApiNode on above sample code (https://github.com/gatein/gatein-portal-quickstart/tree/master/navigation-api-portlet). means ApiNode class not available on gatein-api-1.0.1.Final.jar.
Is it my approach is correct?
Is there is any other way or example is available to create a new node programatically?
regards
Anish Antony
-
4. Re: Please give me a brief idea about navigationServiceImpl
vstorm83 Sep 18, 2013 10:37 PM (in response to anishantony)Here is the Dev guide about GateIn public API: https://docs.jboss.org/author/display/GTNPORTAL36/Portal+API#PortalAPI-CreatingaNavigationNode
You can use this to create a node "/home/mynode" --> this node point to "portal::classic::mypage" Page
Navigation navigation = PortalRequest.getInstance().getNavigation();
Node home = navigation.getNode(NodePath.path(
"home"
));
Node child = home.addChild(
"mynode"
);
child.setDisplayName(
"My Node"
);
child.setPageId(
new
PageId(
"classic"
,
"mypage"
));
navigation.saveNode(home);
-
5. Re: Please give me a brief idea about navigationServiceImpl
anishantony Sep 20, 2013 8:55 AM (in response to vstorm83)Thanks Vu Viet Phuong
How to set uri of "my Node"