掲示板

How to manage page links in navigation bar programatically

11年前 に Karthik Baskaran によって更新されました。

How to manage page links in navigation bar programatically

Junior Member 投稿: 31 参加年月日: 12/05/04 最新の投稿
Hi,

When we add pages to the portal, these new pages get added next to "Welcome" page. Is it possible to hide/display based on certain condition ? The condition to be checked will depend on the webservice response returned by our customised ldap server. I would like to know, if it is possible to do this programatically, some kind of java class invocation, before we show the page links at the top.

Thanks
Karthik
thumbnail
11年前 に Amit Doshi によって更新されました。

RE: How to manage page links in navigation bar programatically

Liferay Master 投稿: 550 参加年月日: 10/12/29 最新の投稿
Hi Karthik,

You can do one thing is that you consume that Web Service in liferay.

And access that web service in theme portal_normal.vm and Depending upon the output of that particular webservice you can hide or show your pages as you required by putting condition in it.

Hope it helps.

Thanks & Regards,
Amit Doshi
11年前 に Karthik Baskaran によって更新されました。

RE: How to manage page links in navigation bar programatically

Junior Member 投稿: 31 参加年月日: 12/05/04 最新の投稿
Hi Amit,

I am new to Liferay portal. Can you point me to the exact location, where I can find details on your implementation approach.

Thanks
Karthik
11年前 に Karthik Baskaran によって更新されました。

RE: How to manage page links in navigation bar programatically

Junior Member 投稿: 31 参加年月日: 12/05/04 最新の投稿
Hi,

Can anyone point me to the exact resource for me to proceed on this ?

Thanks
Karthik
thumbnail
11年前 に Amit Doshi によって更新されました。

RE: How to manage page links in navigation bar programatically

Liferay Master 投稿: 550 参加年月日: 10/12/29 最新の投稿
Create the simple java project and do simple webservice consumption in eclipse and create jar file for it.
And put that jar file in tomcat/lib/ext/ folder.

And now use that Service method in theme portal_normal.vm using the following code.

#set ($customLocalService = $serviceLocator.findService('com.sample.portlet.myprofile.service.MyProfileDataLocalService'))
#set ($number=$customLocalService.getMyProfileDatasCount())


Here I given example of my class that I am going to call and use it's function.

The above is starting point for you to begin, now call your's function from portal_normal.vm as shown above and get values from the service and depend on it put conditions for hiding and showing the page in navigation.vm.

Hope it helps.

Thanks & Regards,
Amit Doshi
thumbnail
11年前 に David H Nebinger によって更新されました。

RE: How to manage page links in navigation bar programatically

Liferay Legend 投稿: 14916 参加年月日: 06/09/02 最新の投稿
Amit Doshi:
Create the simple java project and do simple webservice consumption in eclipse and create jar file for it.
And put that jar file in tomcat/lib/ext/ folder.


Bad advice. Dropping code in lib/ext means you're binding yourself to server restarts whenever you need to update the code, and that's not a good idea.

Instead bundle the jar w/ the deployment artifact(s).

And now use that Service method in theme portal_normal.vm using the following code.

#set ($customLocalService = $serviceLocator.findService('com.sample.portlet.myprofile.service.MyProfileDataLocalService'))
#set ($number=$customLocalService.getMyProfileDatasCount())


Here I given example of my class that I am going to call and use it's function.


How does your "simple java project" map over to the architecture that is Service Builder? SB creates all of the stuff that you can leverage in the velocity macros in this way, no "simple java project" is going to plug into the same architecture.
thumbnail
11年前 に Amit Doshi によって更新されました。

RE: How to manage page links in navigation bar programatically

Liferay Master 投稿: 550 参加年月日: 10/12/29 最新の投稿
Hi David,

I agree with your suggestion that putting the jar file in tomcat/lib/ext will binds us to the server restart.

Can you please suggest then how can we access our own custom web service which was build with the help of service builder in theme without putting the jar file in tomcat/lib/ext folder ?

And on second point I agree with you on that too.. Directly putting the jar file of building simple java project will not give build Environment for the SB. There is couple of entries in the different xml like springs,context etc files need to be there in order to build SB environment then only one can consume the Service.

Sorry, for my post for building java project.

But according to karthik post that they have already have web service for LDAP, which they want to access it.
So, I don't think then there will be any requirement for service builder now.

Now the question remains the same How can we access that webservice which was build in any platform and use it in theme ?

Thanks & Regards,
Amit Doshi
thumbnail
11年前 に David H Nebinger によって更新されました。

RE: How to manage page links in navigation bar programatically

Liferay Legend 投稿: 14916 参加年月日: 06/09/02 最新の投稿
Amit Doshi:
Can you please suggest then how can we access our own custom web service which was build with the help of service builder in theme without putting the jar file in tomcat/lib/ext folder ?


You declare the required deployment context in the plugin consuming the SB service in the liferay-plugin-package.properties file. When service is rebuilt in the plugin providing the SB service, the service jar will be automatically copied to the plugins that have it listed as required deployment contexts (all of this should be done in the IDE).

Now the question remains the same How can we access that webservice which was build in any platform and use it in theme ?


The same way you'd access any web service in java - you can use jaxb, axis, etc. Generate the necessary client code to invoke the web service. Wrap all of the stuff into a nice little utility class and call that utility class from the navigation.vm velocity template.
thumbnail
11年前 に Amit Doshi によって更新されました。

RE: How to manage page links in navigation bar programatically

Liferay Master 投稿: 550 参加年月日: 10/12/29 最新の投稿

You declare the required deployment context in the plugin consuming the SB service in the liferay-plugin-package.properties file. When service is rebuilt in the plugin providing the SB service, the service jar will be automatically copied to the plugins that have it listed as required deployment contexts (all of this should be done in the IDE).


Thanks David . Actually in my mind i was thinking of Web content (Velocity and Templates) not of theme that made me mistake to identify. I hope we require to put jar file in tomcat/lib/ext, when we want to use custom service in templates as show in code above. Make me correct if i am wrong?


The same way you'd access any web service in java - you can use jaxb, axis, etc. Generate the necessary client code to invoke the web service. Wrap all of the stuff into a nice little utility class and call that utility class from the navigation.vm velocity template.


Like to know more on above. Because as we discussed if we make simple jar files then it will not give us SB portablity. Then If we are making utility class then it will be of SB type or normal portlet or jar of jaxb etc.
11年前 に Karthik Baskaran によって更新されました。

RE: How to manage page links in navigation bar programatically

Junior Member 投稿: 31 参加年月日: 12/05/04 最新の投稿
Hi,

Can any one of you please guide me to the location where I can learn more about this and try to apply this approach ?

Thanks
Karthik
thumbnail
11年前 に David H Nebinger によって更新されました。

RE: How to manage page links in navigation bar programatically

Liferay Legend 投稿: 14916 参加年月日: 06/09/02 最新の投稿
Karthik Baskaran:
Hi,

When we add pages to the portal, these new pages get added next to "Welcome" page. Is it possible to hide/display based on certain condition ? The condition to be checked will depend on the webservice response returned by our customised ldap server. I would like to know, if it is possible to do this programatically, some kind of java class invocation, before we show the page links at the top.

Thanks
Karthik



You're going to implement a custom theme. Override the navigation.vm file to invoke your own class. Your class will use jaxb (or whatever) to access the remote web service. Your class will want to cache the data so moving around in the portal doesn't slow to a crawl.