Amos Fong 13年 前 I ran into this issue as well and found this same solution. However, you can't pass any parameters so you can't do ascending obc's. 投票するためにはログインが必要です。 次として送信する: キャンセル Ray Augé Amos Fong 13年 前 Ah, but you can my friend!#set ($obcClass = $portal.getClass().forName("com.liferay.portlet.journal.util.comparator.ArticleDisplayDateComparator"))#set ($booleanType = $portal.getClass().forName('java.lang.Boolean'))#set ($obcConstructor = $obcClass.getConstructor($booleanType.getField('TYPE').staticValue))#set ($obc = $obcConstructor.newInstance(true)) 投票するためにはログインが必要です。 次として送信する: キャンセル Ray Augé Ray Augé 13年 前 Note, this is complicated by the fact that it's a constructor having primitive args, on top of which you can't directly reference static fields in velocity, so getting the primitive type of a class required more reflection tricks. But this example demonstrates all of that! 投票するためにはログインが必要です。 次として送信する: キャンセル Amos Fong Ray Augé 13年 前 wow cool, velocity java magic! thanks for the lesson 投票するためにはログインが必要です。 次として送信する: キャンセル
Ray Augé Amos Fong 13年 前 Ah, but you can my friend!#set ($obcClass = $portal.getClass().forName("com.liferay.portlet.journal.util.comparator.ArticleDisplayDateComparator"))#set ($booleanType = $portal.getClass().forName('java.lang.Boolean'))#set ($obcConstructor = $obcClass.getConstructor($booleanType.getField('TYPE').staticValue))#set ($obc = $obcConstructor.newInstance(true)) 投票するためにはログインが必要です。 次として送信する: キャンセル Ray Augé Ray Augé 13年 前 Note, this is complicated by the fact that it's a constructor having primitive args, on top of which you can't directly reference static fields in velocity, so getting the primitive type of a class required more reflection tricks. But this example demonstrates all of that! 投票するためにはログインが必要です。 次として送信する: キャンセル Amos Fong Ray Augé 13年 前 wow cool, velocity java magic! thanks for the lesson 投票するためにはログインが必要です。 次として送信する: キャンセル
Ray Augé Ray Augé 13年 前 Note, this is complicated by the fact that it's a constructor having primitive args, on top of which you can't directly reference static fields in velocity, so getting the primitive type of a class required more reflection tricks. But this example demonstrates all of that! 投票するためにはログインが必要です。 次として送信する: キャンセル
Amos Fong Ray Augé 13年 前 wow cool, velocity java magic! thanks for the lesson 投票するためにはログインが必要です。 次として送信する: キャンセル
jelmer kuperus 13年 前 I posted something similar to the forums a while back that was even hackier (due to the difficulty of getting to int.class)http://www.liferay.com/community/forums/-/message_boards/message/5514892these are pretty dirty tricks tho 投票するためにはログインが必要です。 次として送信する: キャンセル Ian White jelmer kuperus 12年 前 Until recently (I just did a svn update of the portal trunk) the velocity hook approach was working well, whereby you simply defined your java interface + impl pair in an applicationContext.xml file. See Ray's test-velotool-hook sample.Alas, with the latest trunk code, your beans are not able to be loaded. Fingers crossed this is just a bug and not a decision to stop supporting velocity hooks. 投票するためにはログインが必要です。 次として送信する: キャンセル Ray Augé Ian White 12年 前 Hey Ian,I tried this with the same old test velo hook:#set ($myTool = $utilLocator.findUtil('test-velotool-hook','com.mytool.MyTool'))$myTool<br />$myTool.operationOne()<br/>$myTool.operationTwo($text.data)and got back:com.mytool.MyToolImpl@5741bf0e Hello out there! Hello Ray!Is it still not working? 投票するためにはログインが必要です。 次として送信する: キャンセル Arya Nugroho Ray Augé 12年 前 hello ray, how to get value from a field which is characterized by a specific tags on the article?thanks 投票するためにはログインが必要です。 次として送信する: キャンセル Ray Augé Arya Nugroho 12年 前 Hey Arya,Can you clarify a little? I'm not exactly sure what you mean! 投票するためにはログインが必要です。 次として送信する: キャンセル
Ian White jelmer kuperus 12年 前 Until recently (I just did a svn update of the portal trunk) the velocity hook approach was working well, whereby you simply defined your java interface + impl pair in an applicationContext.xml file. See Ray's test-velotool-hook sample.Alas, with the latest trunk code, your beans are not able to be loaded. Fingers crossed this is just a bug and not a decision to stop supporting velocity hooks. 投票するためにはログインが必要です。 次として送信する: キャンセル Ray Augé Ian White 12年 前 Hey Ian,I tried this with the same old test velo hook:#set ($myTool = $utilLocator.findUtil('test-velotool-hook','com.mytool.MyTool'))$myTool<br />$myTool.operationOne()<br/>$myTool.operationTwo($text.data)and got back:com.mytool.MyToolImpl@5741bf0e Hello out there! Hello Ray!Is it still not working? 投票するためにはログインが必要です。 次として送信する: キャンセル Arya Nugroho Ray Augé 12年 前 hello ray, how to get value from a field which is characterized by a specific tags on the article?thanks 投票するためにはログインが必要です。 次として送信する: キャンセル Ray Augé Arya Nugroho 12年 前 Hey Arya,Can you clarify a little? I'm not exactly sure what you mean! 投票するためにはログインが必要です。 次として送信する: キャンセル
Ray Augé Ian White 12年 前 Hey Ian,I tried this with the same old test velo hook:#set ($myTool = $utilLocator.findUtil('test-velotool-hook','com.mytool.MyTool'))$myTool<br />$myTool.operationOne()<br/>$myTool.operationTwo($text.data)and got back:com.mytool.MyToolImpl@5741bf0e Hello out there! Hello Ray!Is it still not working? 投票するためにはログインが必要です。 次として送信する: キャンセル Arya Nugroho Ray Augé 12年 前 hello ray, how to get value from a field which is characterized by a specific tags on the article?thanks 投票するためにはログインが必要です。 次として送信する: キャンセル Ray Augé Arya Nugroho 12年 前 Hey Arya,Can you clarify a little? I'm not exactly sure what you mean! 投票するためにはログインが必要です。 次として送信する: キャンセル
Arya Nugroho Ray Augé 12年 前 hello ray, how to get value from a field which is characterized by a specific tags on the article?thanks 投票するためにはログインが必要です。 次として送信する: キャンセル Ray Augé Arya Nugroho 12年 前 Hey Arya,Can you clarify a little? I'm not exactly sure what you mean! 投票するためにはログインが必要です。 次として送信する: キャンセル
Ray Augé Arya Nugroho 12年 前 Hey Arya,Can you clarify a little? I'm not exactly sure what you mean! 投票するためにはログインが必要です。 次として送信する: キャンセル
oscar caro puerto 12年 前 Hello!I also tried Ray's test-velotool-hook sample in liferay 6.0.6 and is working fine, but I recently downloaded liferay-portal-6.1.0-ce-ga1 bundled with tomcat, deployed the hook, and tested from a velocity template, but in this version I'm getting:NoSuchBeanDefinitionException: No bean named 'com.mytool.MyTool' is defined 投票するためにはログインが必要です。 次として送信する: キャンセル
Mehdi Khan 11年 前 Hi, I am facing on problem with the Caroussel ,(1)when i refresh the page Caroussel loading slowly some time its take more than 5 minutes to load the message Caroussel.(2).Sometimes when I log on, the caroussel is just blank. It takes around 2 - 5 minutes till the caroussel loads on the page. And its happening only on Ineternet Explorer(IE) 投票するためにはログインが必要です。 次として送信する: キャンセル Ray Augé Mehdi Khan 11年 前 I don't think that relates to the post. If so, can you explain how? 投票するためにはログインが必要です。 次として送信する: キャンセル
Ray Augé Mehdi Khan 11年 前 I don't think that relates to the post. If so, can you explain how? 投票するためにはログインが必要です。 次として送信する: キャンセル
Matej Dolanc 10年 前 Hello!I've tried velocity class loading in LIferay 6.2 (liferay-portal-6.2.0-ce-ga1) and it doesn't work for me. It works fine in LIferay 6.1. Example:#set ($obc = $portal.getClass().forName("com.liferay.portlet.journal.util.comparator.ArticleDisplayDateComparator").newInstance()) $obcI get the following warning message ( LIferay 6.2):21:44:52,996 WARN [RuntimePageImpl-3][velocity:145] Cannot retrieve method forName from object of class java.lang.Class due to security restrictions.21:44:52,997 DEBUG [RuntimePageImpl-3][velocity:155] RHS of #set statement is null. Context will not be modified. 10157#10197#11456[line 1, column 1]Does anyone know where could be the issue?ThanksMatej 投票するためにはログインが必要です。 次として送信する: キャンセル Ray Augé Matej Dolanc 10年 前 We added some security around classloading. You can adjust the settings to your usage. http://docs.liferay.com/portal/6.2/propertiesdoc/portal.properties.html#Velocity%20Engine 投票するためにはログインが必要です。 次として送信する: キャンセル Matej Dolanc Ray Augé 10年 前 Thank you very much... 投票するためにはログインが必要です。 次として送信する: キャンセル
Ray Augé Matej Dolanc 10年 前 We added some security around classloading. You can adjust the settings to your usage. http://docs.liferay.com/portal/6.2/propertiesdoc/portal.properties.html#Velocity%20Engine 投票するためにはログインが必要です。 次として送信する: キャンセル Matej Dolanc Ray Augé 10年 前 Thank you very much... 投票するためにはログインが必要です。 次として送信する: キャンセル
Nasir Hussain 8年 前 Hi Ray,Somehow this is not working in 6.1+ Java 6 for this particular class#set ($inetAddressClass = $portal.getClass().forName("javax.mail.internet.InternetAddress"))#set ($stringType = $portal.getClass().forName('java.lang.String'))#set ($inetAddressConstructor = $inetAddressClass.getConstructor($stringType.getField('TYPE').staticValue))#set ($toAddress = $inetAddressConstructor.newInstance("abc@gmail.com"))$toAddress, $inetAddressConstructor, $inetAddressClasshere the $toAddress is not working other variables are fine 投票するためにはログインが必要です。 次として送信する: キャンセル Nasir Hussain Nasir Hussain 8年 前 My bad... got it working, wrong constructor invokation#set ($inetAddressConstructor = $inetAddressClass.getConstructor($stringType)) 投票するためにはログインが必要です。 次として送信する: キャンセル
Nasir Hussain Nasir Hussain 8年 前 My bad... got it working, wrong constructor invokation#set ($inetAddressConstructor = $inetAddressClass.getConstructor($stringType)) 投票するためにはログインが必要です。 次として送信する: キャンセル
Dave Weitzel 8年 前 Any idea how to create the obc to be driven by a custom Date field in the structure of the articles?Seems expensive to get alist here, create another list wioth data from the xml content and then resort that list and then get more data for each article when listing the now correctly sorted list 投票するためにはログインが必要です。 次として送信する: キャンセル
André Fabbro 6年 前 Great post! Thanks!However, it doesn't work in Liferay 7, right? I tried:#set ($mbMessageClass = $portal.getClass().forName("com.liferay.message.boards.kernel.model.MBMessage"))and got:ERROR [http-nio-8080-exec-6][LiferayMethodExceptionEventHandler:54] Unable to execute method forName {exception=java.lang.ClassNotFoundException: com.liferay.message.boards.kernel.model.MBMessage cannot be found by com.liferay.portal.template.velocity_2.0.17, className=java.lang.Class}java.lang.ClassNotFoundException: com.liferay.message.boards.kernel.model.MBMessage cannot be found by com.liferay.portal.template.velocity_2.0.17Do you know if is there some workaround for use it on Liferay 7? 投票するためにはログインが必要です。 次として送信する: キャンセル David Weitzel André Fabbro 6年 前 In liferay 7 all the old portlets ar enow stand alone "apps" Messaeg boards part fo the collaboration package. the right class would be :com.liferay.portlet.messageboards.model.MBMessageModel the new APIs are all linked from https://dev.liferay.com/develop/reference but harder to find as there are now 8 or more javadocs to check 投票するためにはログインが必要です。 次として送信する: キャンセル André Fabbro David Weitzel 6年 前 Also tried that, didn't work though... I've found a workaround which is the following:#* @vtlvariable name="mbMessageObj" type="com.liferay.message.boards.kernel.model.MBMessageModel" *##set ($mbMessageClass = $mbMessageObj.getClass()) 投票するためにはログインが必要です。 次として送信する: キャンセル
David Weitzel André Fabbro 6年 前 In liferay 7 all the old portlets ar enow stand alone "apps" Messaeg boards part fo the collaboration package. the right class would be :com.liferay.portlet.messageboards.model.MBMessageModel the new APIs are all linked from https://dev.liferay.com/develop/reference but harder to find as there are now 8 or more javadocs to check 投票するためにはログインが必要です。 次として送信する: キャンセル André Fabbro David Weitzel 6年 前 Also tried that, didn't work though... I've found a workaround which is the following:#* @vtlvariable name="mbMessageObj" type="com.liferay.message.boards.kernel.model.MBMessageModel" *##set ($mbMessageClass = $mbMessageObj.getClass()) 投票するためにはログインが必要です。 次として送信する: キャンセル
André Fabbro David Weitzel 6年 前 Also tried that, didn't work though... I've found a workaround which is the following:#* @vtlvariable name="mbMessageObj" type="com.liferay.message.boards.kernel.model.MBMessageModel" *##set ($mbMessageClass = $mbMessageObj.getClass()) 投票するためにはログインが必要です。 次として送信する: キャンセル