Jerry Niu 16 Years Ago This is awesome Ray. Thanks for the explanation and sample code! Please sign in to reply. Reply as... Cancel Ray Augé Jerry Niu 16 Years Ago Thanks Jerry! Please sign in to reply. Reply as... Cancel
Tobias S. Käfer 16 Years Ago Nice feature!In (since) which version is that available?GreatsTobias Please sign in to reply. Reply as... Cancel Ray Augé Tobias S. Käfer 16 Years Ago It's currently in trunk, and should be in 5.0.2. Please sign in to reply. Reply as... Cancel Alvaro Del Castillo Ray Augé 15 Years Ago Ray, I would update the title of the blog post to something like (Liferay Portal 5.0.2) because currently you can not use Expandos with any LRP released and the first experience from a developer trying it could be that it does not work. 5.0.2 is around the corner but ...Really nice article in any case and a very useful feature, Please sign in to reply. Reply as... Cancel Ray Augé Alvaro Del Castillo 15 Years Ago It's updated now.Thanks Alvaro! Please sign in to reply. Reply as... Cancel
Ray Augé Tobias S. Käfer 16 Years Ago It's currently in trunk, and should be in 5.0.2. Please sign in to reply. Reply as... Cancel Alvaro Del Castillo Ray Augé 15 Years Ago Ray, I would update the title of the blog post to something like (Liferay Portal 5.0.2) because currently you can not use Expandos with any LRP released and the first experience from a developer trying it could be that it does not work. 5.0.2 is around the corner but ...Really nice article in any case and a very useful feature, Please sign in to reply. Reply as... Cancel Ray Augé Alvaro Del Castillo 15 Years Ago It's updated now.Thanks Alvaro! Please sign in to reply. Reply as... Cancel
Alvaro Del Castillo Ray Augé 15 Years Ago Ray, I would update the title of the blog post to something like (Liferay Portal 5.0.2) because currently you can not use Expandos with any LRP released and the first experience from a developer trying it could be that it does not work. 5.0.2 is around the corner but ...Really nice article in any case and a very useful feature, Please sign in to reply. Reply as... Cancel Ray Augé Alvaro Del Castillo 15 Years Ago It's updated now.Thanks Alvaro! Please sign in to reply. Reply as... Cancel
Ray Augé Alvaro Del Castillo 15 Years Ago It's updated now.Thanks Alvaro! Please sign in to reply. Reply as... Cancel
Gabor Nagy 15 Years Ago Great work Ray, thanks! I was searching for a solution extend dynamically Liferay tables and I found your solution. You show an example with new table, column, etc. But what about adding an expando column/value to an existing table? Is it possible? I tried to add an expando column 'foo' to user_ table and store value 'bar' for the specified user as the following way:User user = UserLocalServiceUtil.getUserByEmailAddress(...);ExpandoTable table = ExpandoTableLocalServiceUtil.addTable(PortalUtil.getClassNameId(user.getClass().getName()), "user_");if(table!=null) { ExpandoColumn column = ExpandoColumnLocalServiceUtil.getColumn(table.getTableId(), "foo"); if(column!=null){ ExpandoValueLocalServiceUtil.addValue(column.getColumnId(), user.getUSerId(), user.getUserId(), "bar"); }}Is this correct? I'm afraid the second parameter of addValue (rowid) isn't correct, but what should I write there? And what about the third parameter (classPK), is that right? classPK is the primary key of the user?If my code/idea is correct, I would like to ask you about deleting a "parent" record. I'll try to explain what I think :-) I put the value 'bar' into expando table for the user Joe Blogs. When I delete Joe Blogs from Liferay the 'bar' value from expando tables will not be deleted. Is this right? Should I delete manually expando records? There isn't a way to do this automatically? Do you have any idea? Or I misunderstood the whole expando-thing? :-)Thanks,Gabor Please sign in to reply. Reply as... Cancel Ray Augé Gabor Nagy 15 Years Ago Hello Gabor,The API has changed slightly. Have a look at:http://lportal.svn.sourceforge.net/svnroot/lportal/portal/trunk/portal-impl/src/com/liferay/portlet/expando/service/impl/ExpandoValueLocalServiceImpl.javayou'll notice that the final API is a little more intuitive and easier to work with. Also, the final (stable) API will officially be available in the upcomming 5.0.2 release, due out next week. For example, you don't need to worry about rowIds as these are more for internal management than external (though it is available for use in iterating over table rows...).Also, at least for users, any ExpandoValue associated directly with the User object and referenced by User's primary key will be deleted when the user is deleted, regardless of what table it's in... so you can have 100 tables associated with the User class and when a user is deleted... all the values associated with that user, in every table, go with it.HTH! Please sign in to reply. Reply as... Cancel Gabor Nagy Ray Augé 15 Years Ago Thank you Ray! It sounds good! We waiting for 5.0.2 :-)However, I found a solution for delete problem. I added this line to portal/ext.properties:value.object.listener.com.liferay.portal.model.User=com.liferay.portal.model.UserListener,com.liferay.portal.model.MyUserListenerThen I created a new class MyUserListener and in onAfterRemove method:User user = (User)model;ExpandoValueLocalServiceUtil.deleteValues(PortalUtil.getClassNameId(user.getClass().getName()), user.getUserId());This removes all records belonging to the deleted user.But, I'll take a look at the new API and rewrite my code with the official solution. Please sign in to reply. Reply as... Cancel
Ray Augé Gabor Nagy 15 Years Ago Hello Gabor,The API has changed slightly. Have a look at:http://lportal.svn.sourceforge.net/svnroot/lportal/portal/trunk/portal-impl/src/com/liferay/portlet/expando/service/impl/ExpandoValueLocalServiceImpl.javayou'll notice that the final API is a little more intuitive and easier to work with. Also, the final (stable) API will officially be available in the upcomming 5.0.2 release, due out next week. For example, you don't need to worry about rowIds as these are more for internal management than external (though it is available for use in iterating over table rows...).Also, at least for users, any ExpandoValue associated directly with the User object and referenced by User's primary key will be deleted when the user is deleted, regardless of what table it's in... so you can have 100 tables associated with the User class and when a user is deleted... all the values associated with that user, in every table, go with it.HTH! Please sign in to reply. Reply as... Cancel Gabor Nagy Ray Augé 15 Years Ago Thank you Ray! It sounds good! We waiting for 5.0.2 :-)However, I found a solution for delete problem. I added this line to portal/ext.properties:value.object.listener.com.liferay.portal.model.User=com.liferay.portal.model.UserListener,com.liferay.portal.model.MyUserListenerThen I created a new class MyUserListener and in onAfterRemove method:User user = (User)model;ExpandoValueLocalServiceUtil.deleteValues(PortalUtil.getClassNameId(user.getClass().getName()), user.getUserId());This removes all records belonging to the deleted user.But, I'll take a look at the new API and rewrite my code with the official solution. Please sign in to reply. Reply as... Cancel
Gabor Nagy Ray Augé 15 Years Ago Thank you Ray! It sounds good! We waiting for 5.0.2 :-)However, I found a solution for delete problem. I added this line to portal/ext.properties:value.object.listener.com.liferay.portal.model.User=com.liferay.portal.model.UserListener,com.liferay.portal.model.MyUserListenerThen I created a new class MyUserListener and in onAfterRemove method:User user = (User)model;ExpandoValueLocalServiceUtil.deleteValues(PortalUtil.getClassNameId(user.getClass().getName()), user.getUserId());This removes all records belonging to the deleted user.But, I'll take a look at the new API and rewrite my code with the official solution. Please sign in to reply. Reply as... Cancel
b v j 15 Years Ago Thanks for the post. I initially approached this as an "oh carp, yet another thing to learn about Liferay". Well, I'm glad I read through your post. Journal templates are fantastic! There was some initial confusion about default variables. I discovered the JT VM instances get initialized differently than regular portlet VM instances. For example, getting the user id was a bit difficult and I finally pulled it from the request tree. It would probably be beneficial to provide privileged based access to services instead of using hard filters in the boot properties file. Nonetheless, it was all a worthwhile experience that exposed some great functionality!Is it possible to create reusable VM libraries within the JT paradigm? Please sign in to reply. Reply as... Cancel Ray Augé b v j 15 Years Ago It is possible in Journal to create reusable VM libraries. You simply place your library code in standalone JTs (JT's not associated with any JStructure). Then you can refer to these "library templates" directly from others using the VM #parse method. The only catch is that you must prepend the name of the Template with "$journalTemplatesPath".e.g.#parse ("$journalTemplatesPath/MY_VM_LIB") Please sign in to reply. Reply as... Cancel b v j Ray Augé 15 Years Ago Perfect - thank you. Please sign in to reply. Reply as... Cancel
Ray Augé b v j 15 Years Ago It is possible in Journal to create reusable VM libraries. You simply place your library code in standalone JTs (JT's not associated with any JStructure). Then you can refer to these "library templates" directly from others using the VM #parse method. The only catch is that you must prepend the name of the Template with "$journalTemplatesPath".e.g.#parse ("$journalTemplatesPath/MY_VM_LIB") Please sign in to reply. Reply as... Cancel b v j Ray Augé 15 Years Ago Perfect - thank you. Please sign in to reply. Reply as... Cancel
Josh Asbury 15 Years Ago Thanks for this, Ray! I have just gotten around to playing with this functionality, and it's awesome. Question, though: is it possible in the current model to return only rows that have been created by the signed-in user? I am looking at:public java.util.List<com.liferay.portlet.expando.model.ExpandoRow> getRows( long tableId, int start, int end) throws com.liferay.portal.SystemException;and don't think I see a way to extract that data. I have modified your code slightly to add the current user ID as a column.Thanks! Please sign in to reply. Reply as... Cancel nidhi singh Josh Asbury 15 Years Ago Hi Ray!I am using UserGroupLocalService in VM file.I want to get userGroupId from the usergroup table which in database, but in UserGroupLocalService does'nt have any method for getting userGroupId.$userGroupLocalService.getUserUserGroups()how will i get?please help me.thanks Please sign in to reply. Reply as... Cancel
nidhi singh Josh Asbury 15 Years Ago Hi Ray!I am using UserGroupLocalService in VM file.I want to get userGroupId from the usergroup table which in database, but in UserGroupLocalService does'nt have any method for getting userGroupId.$userGroupLocalService.getUserUserGroups()how will i get?please help me.thanks Please sign in to reply. Reply as... Cancel
Thomas Kellerer 15 Years Ago I'm trying to use this feature to display data that is saved to the database through a "Request Form". I retrieved the generated table name (109_INSTANCE_98OX_201, basically the instance-id of the portlet) from the EXPANDOTABLE table, but when trying to access the table it fails. Basically the #set ($accountsTable = $expandoTableLocalService.getTable($accountsTableName, $accountsTableName))does not work even though $accountsTableName contains the correct table name I veried that the feature itself was working by creating a table manually through the API.What am I missing? Please sign in to reply. Reply as... Cancel Ray Augé Thomas Kellerer 15 Years Ago Try:#set ($accountsTable = $expandoTableLocalService.getTable("com.liferay.portlet.webform.util.WebFormUtil", $accountsTableName)) Please sign in to reply. Reply as... Cancel Thomas Kellerer Ray Augé 15 Years Ago Great that worked, thanks a lot Please sign in to reply. Reply as... Cancel Jonas Yuan Ray Augé 15 Years Ago Hi Ray, great!On question, do the attribute name and value support locale?It was notified that portlet 139 Expando was applied on users and organizations. Logically, it should be possible to apply portlet 139 Expando on user groups, communities, roles, etc. Is it right?Thanks Jonas Yuan Please sign in to reply. Reply as... Cancel Ray Augé Jonas Yuan 15 Years Ago If there exists a localization for the attribute name it will be used. Thus you can localize the names by adding the key to the locale files. The values themselves are not localized.Custom attributes can be applied to any entity generated via service builder, as such the Expando portlet can be used to manage those. No changes are required to the portlet, juswt create a portletURL as you find in the User and Organization management. Please sign in to reply. Reply as... Cancel Jonas Yuan Ray Augé 15 Years Ago Hi Ray, Thank you! How about custom types in custom attributes? That is, adding custom types (Image Gallery images and Document Library documents) in custom attributes (Expando).http://issues.liferay.com/browse/LPS-2087Any comments or suggestions? Please sign in to reply. Reply as... Cancel Ray Augé Jonas Yuan 15 Years Ago - Edited Why don't you just store a reference to one of those types?e.g. a custom attribute called "favorite-pic" of type string stores an url to the image, or of type long, stores the primaryKey of the image, etc... All you need to provide is the selection and rendering logic. Both very easy to implement based on existing examples. Please sign in to reply. Reply as... Cancel Thomas Kellerer Ray Augé 15 Years Ago Hi, I tried this again with 5.2.1, and it does not seem to work any longer. I have a webform and data is submitted. So I looked up the generated table in the database (EXPANDOTABLE). The entry there gave me the tableanme: 1_WAR_webformportlet_INSTANCE_y0Ik_2But the following code does not return a rowcount:#set ($tableName = "1_WAR_webformportlet_INSTANCE_y0Ik_2")#set ($tableType = "com.liferay.portlet.webform.util.WebFormUtil")#set ($rowCount = $expandoRowLocalService.getRowsCount($tableType, $tableName))what am I missing here? Please sign in to reply. Reply as... Cancel Thomas Kellerer Thomas Kellerer 15 Years Ago I found my error. Apparently the table type has change fromcom.liferay.portlet.webform.util.WebFormUtilto com.liferay.webform.util.WebFormUtilNow it's working again Please sign in to reply. Reply as... Cancel
Ray Augé Thomas Kellerer 15 Years Ago Try:#set ($accountsTable = $expandoTableLocalService.getTable("com.liferay.portlet.webform.util.WebFormUtil", $accountsTableName)) Please sign in to reply. Reply as... Cancel Thomas Kellerer Ray Augé 15 Years Ago Great that worked, thanks a lot Please sign in to reply. Reply as... Cancel Jonas Yuan Ray Augé 15 Years Ago Hi Ray, great!On question, do the attribute name and value support locale?It was notified that portlet 139 Expando was applied on users and organizations. Logically, it should be possible to apply portlet 139 Expando on user groups, communities, roles, etc. Is it right?Thanks Jonas Yuan Please sign in to reply. Reply as... Cancel Ray Augé Jonas Yuan 15 Years Ago If there exists a localization for the attribute name it will be used. Thus you can localize the names by adding the key to the locale files. The values themselves are not localized.Custom attributes can be applied to any entity generated via service builder, as such the Expando portlet can be used to manage those. No changes are required to the portlet, juswt create a portletURL as you find in the User and Organization management. Please sign in to reply. Reply as... Cancel Jonas Yuan Ray Augé 15 Years Ago Hi Ray, Thank you! How about custom types in custom attributes? That is, adding custom types (Image Gallery images and Document Library documents) in custom attributes (Expando).http://issues.liferay.com/browse/LPS-2087Any comments or suggestions? Please sign in to reply. Reply as... Cancel Ray Augé Jonas Yuan 15 Years Ago - Edited Why don't you just store a reference to one of those types?e.g. a custom attribute called "favorite-pic" of type string stores an url to the image, or of type long, stores the primaryKey of the image, etc... All you need to provide is the selection and rendering logic. Both very easy to implement based on existing examples. Please sign in to reply. Reply as... Cancel Thomas Kellerer Ray Augé 15 Years Ago Hi, I tried this again with 5.2.1, and it does not seem to work any longer. I have a webform and data is submitted. So I looked up the generated table in the database (EXPANDOTABLE). The entry there gave me the tableanme: 1_WAR_webformportlet_INSTANCE_y0Ik_2But the following code does not return a rowcount:#set ($tableName = "1_WAR_webformportlet_INSTANCE_y0Ik_2")#set ($tableType = "com.liferay.portlet.webform.util.WebFormUtil")#set ($rowCount = $expandoRowLocalService.getRowsCount($tableType, $tableName))what am I missing here? Please sign in to reply. Reply as... Cancel Thomas Kellerer Thomas Kellerer 15 Years Ago I found my error. Apparently the table type has change fromcom.liferay.portlet.webform.util.WebFormUtilto com.liferay.webform.util.WebFormUtilNow it's working again Please sign in to reply. Reply as... Cancel
Thomas Kellerer Ray Augé 15 Years Ago Great that worked, thanks a lot Please sign in to reply. Reply as... Cancel
Jonas Yuan Ray Augé 15 Years Ago Hi Ray, great!On question, do the attribute name and value support locale?It was notified that portlet 139 Expando was applied on users and organizations. Logically, it should be possible to apply portlet 139 Expando on user groups, communities, roles, etc. Is it right?Thanks Jonas Yuan Please sign in to reply. Reply as... Cancel Ray Augé Jonas Yuan 15 Years Ago If there exists a localization for the attribute name it will be used. Thus you can localize the names by adding the key to the locale files. The values themselves are not localized.Custom attributes can be applied to any entity generated via service builder, as such the Expando portlet can be used to manage those. No changes are required to the portlet, juswt create a portletURL as you find in the User and Organization management. Please sign in to reply. Reply as... Cancel Jonas Yuan Ray Augé 15 Years Ago Hi Ray, Thank you! How about custom types in custom attributes? That is, adding custom types (Image Gallery images and Document Library documents) in custom attributes (Expando).http://issues.liferay.com/browse/LPS-2087Any comments or suggestions? Please sign in to reply. Reply as... Cancel Ray Augé Jonas Yuan 15 Years Ago - Edited Why don't you just store a reference to one of those types?e.g. a custom attribute called "favorite-pic" of type string stores an url to the image, or of type long, stores the primaryKey of the image, etc... All you need to provide is the selection and rendering logic. Both very easy to implement based on existing examples. Please sign in to reply. Reply as... Cancel
Ray Augé Jonas Yuan 15 Years Ago If there exists a localization for the attribute name it will be used. Thus you can localize the names by adding the key to the locale files. The values themselves are not localized.Custom attributes can be applied to any entity generated via service builder, as such the Expando portlet can be used to manage those. No changes are required to the portlet, juswt create a portletURL as you find in the User and Organization management. Please sign in to reply. Reply as... Cancel Jonas Yuan Ray Augé 15 Years Ago Hi Ray, Thank you! How about custom types in custom attributes? That is, adding custom types (Image Gallery images and Document Library documents) in custom attributes (Expando).http://issues.liferay.com/browse/LPS-2087Any comments or suggestions? Please sign in to reply. Reply as... Cancel Ray Augé Jonas Yuan 15 Years Ago - Edited Why don't you just store a reference to one of those types?e.g. a custom attribute called "favorite-pic" of type string stores an url to the image, or of type long, stores the primaryKey of the image, etc... All you need to provide is the selection and rendering logic. Both very easy to implement based on existing examples. Please sign in to reply. Reply as... Cancel
Jonas Yuan Ray Augé 15 Years Ago Hi Ray, Thank you! How about custom types in custom attributes? That is, adding custom types (Image Gallery images and Document Library documents) in custom attributes (Expando).http://issues.liferay.com/browse/LPS-2087Any comments or suggestions? Please sign in to reply. Reply as... Cancel Ray Augé Jonas Yuan 15 Years Ago - Edited Why don't you just store a reference to one of those types?e.g. a custom attribute called "favorite-pic" of type string stores an url to the image, or of type long, stores the primaryKey of the image, etc... All you need to provide is the selection and rendering logic. Both very easy to implement based on existing examples. Please sign in to reply. Reply as... Cancel
Ray Augé Jonas Yuan 15 Years Ago - Edited Why don't you just store a reference to one of those types?e.g. a custom attribute called "favorite-pic" of type string stores an url to the image, or of type long, stores the primaryKey of the image, etc... All you need to provide is the selection and rendering logic. Both very easy to implement based on existing examples. Please sign in to reply. Reply as... Cancel
Thomas Kellerer Ray Augé 15 Years Ago Hi, I tried this again with 5.2.1, and it does not seem to work any longer. I have a webform and data is submitted. So I looked up the generated table in the database (EXPANDOTABLE). The entry there gave me the tableanme: 1_WAR_webformportlet_INSTANCE_y0Ik_2But the following code does not return a rowcount:#set ($tableName = "1_WAR_webformportlet_INSTANCE_y0Ik_2")#set ($tableType = "com.liferay.portlet.webform.util.WebFormUtil")#set ($rowCount = $expandoRowLocalService.getRowsCount($tableType, $tableName))what am I missing here? Please sign in to reply. Reply as... Cancel Thomas Kellerer Thomas Kellerer 15 Years Ago I found my error. Apparently the table type has change fromcom.liferay.portlet.webform.util.WebFormUtilto com.liferay.webform.util.WebFormUtilNow it's working again Please sign in to reply. Reply as... Cancel
Thomas Kellerer Thomas Kellerer 15 Years Ago I found my error. Apparently the table type has change fromcom.liferay.portlet.webform.util.WebFormUtilto com.liferay.webform.util.WebFormUtilNow it's working again Please sign in to reply. Reply as... Cancel
nidhi singh 15 Years Ago Hi Ray,I read this blog, and create new table user in expando it has 2 coulumn userid and points,but i want to map userid of this table to userID of user table.when we delete any user in liferay, same user is also deleted in expando user table.how will i do please reply Please sign in to reply. Reply as... Cancel Ray Augé nidhi singh 15 Years Ago When you set the className of the table to 'com.liferay.portal.model.User' and the primaryKey to that of a given user, the data will be deleted when the user is deleted automatically. Please sign in to reply. Reply as... Cancel
Ray Augé nidhi singh 15 Years Ago When you set the className of the table to 'com.liferay.portal.model.User' and the primaryKey to that of a given user, the data will be deleted when the user is deleted automatically. Please sign in to reply. Reply as... Cancel
auditya manikanta vadrevu 15 Years Ago HI RAY,iam trying expandos thing in portal 5.1.1 but it is not performing well.there is no error in code, i have copied the template as specifed.when i click save the values are not saving. and there is no error in logs also .what can be the problem? Please sign in to reply. Reply as... Cancel Ray Augé auditya manikanta vadrevu 15 Years Ago The API has changed slightly. (I have not updated the Post, sorry!)Try:$expandoValueServiceUtil.addValue( $className, $tableName, $columnName, $classPK, $columnValue) Please sign in to reply. Reply as... Cancel
Ray Augé auditya manikanta vadrevu 15 Years Ago The API has changed slightly. (I have not updated the Post, sorry!)Try:$expandoValueServiceUtil.addValue( $className, $tableName, $columnName, $classPK, $columnValue) Please sign in to reply. Reply as... Cancel
Thomas Kellerer 15 Years Ago After getting it to work with 5.2 I have a problem with caching. I can see four entries in the database but the template only shows 3 of them. The "Cacheable" attribute is disabled for my VM template, but I even restarted Liferay but still can't see the new row. Is there another level of caching? But after restarting the server all those caches should be empty, right? Please sign in to reply. Reply as... Cancel Ray Augé Thomas Kellerer 15 Years Ago I'll have to test this. Can you file a bug and provide a minimal test case? Thanks! Please sign in to reply. Reply as... Cancel Thomas Kellerer Ray Augé 15 Years Ago Thanks for the answer. It's hard do create a test case (because some rows are show) but I'll try. Is there anything I can turn on in Liferay to debug that in my environment? e.g. log messages to find out what's going on? Please sign in to reply. Reply as... Cancel Chris Whittle Ray Augé 15 Years Ago This is very cool.. we are hoping to use it to replace some of our sharepoint lists... my problem is when I copy the template you have and try to use it in a content it doesn't show.. all my other do... am I missing a step? (Using 5.1.2) Please sign in to reply. Reply as... Cancel Chris Whittle Chris Whittle 15 Years Ago nevermind I missed the structure.... Heres the rub now... It renders but when I hit the create button it thinks and the does nothing... Please sign in to reply. Reply as... Cancel Chris Whittle Chris Whittle 15 Years Ago nevermind I missed the structure.... Heres the rub now... It renders but when I hit the create button it thinks and the does nothing... Please sign in to reply. Reply as... Cancel Ray Augé Chris Whittle 15 Years Ago Not exactly sure what you mean. Can you clarify? Please sign in to reply. Reply as... Cancel
Ray Augé Thomas Kellerer 15 Years Ago I'll have to test this. Can you file a bug and provide a minimal test case? Thanks! Please sign in to reply. Reply as... Cancel Thomas Kellerer Ray Augé 15 Years Ago Thanks for the answer. It's hard do create a test case (because some rows are show) but I'll try. Is there anything I can turn on in Liferay to debug that in my environment? e.g. log messages to find out what's going on? Please sign in to reply. Reply as... Cancel Chris Whittle Ray Augé 15 Years Ago This is very cool.. we are hoping to use it to replace some of our sharepoint lists... my problem is when I copy the template you have and try to use it in a content it doesn't show.. all my other do... am I missing a step? (Using 5.1.2) Please sign in to reply. Reply as... Cancel Chris Whittle Chris Whittle 15 Years Ago nevermind I missed the structure.... Heres the rub now... It renders but when I hit the create button it thinks and the does nothing... Please sign in to reply. Reply as... Cancel Chris Whittle Chris Whittle 15 Years Ago nevermind I missed the structure.... Heres the rub now... It renders but when I hit the create button it thinks and the does nothing... Please sign in to reply. Reply as... Cancel Ray Augé Chris Whittle 15 Years Ago Not exactly sure what you mean. Can you clarify? Please sign in to reply. Reply as... Cancel
Thomas Kellerer Ray Augé 15 Years Ago Thanks for the answer. It's hard do create a test case (because some rows are show) but I'll try. Is there anything I can turn on in Liferay to debug that in my environment? e.g. log messages to find out what's going on? Please sign in to reply. Reply as... Cancel
Chris Whittle Ray Augé 15 Years Ago This is very cool.. we are hoping to use it to replace some of our sharepoint lists... my problem is when I copy the template you have and try to use it in a content it doesn't show.. all my other do... am I missing a step? (Using 5.1.2) Please sign in to reply. Reply as... Cancel Chris Whittle Chris Whittle 15 Years Ago nevermind I missed the structure.... Heres the rub now... It renders but when I hit the create button it thinks and the does nothing... Please sign in to reply. Reply as... Cancel Chris Whittle Chris Whittle 15 Years Ago nevermind I missed the structure.... Heres the rub now... It renders but when I hit the create button it thinks and the does nothing... Please sign in to reply. Reply as... Cancel Ray Augé Chris Whittle 15 Years Ago Not exactly sure what you mean. Can you clarify? Please sign in to reply. Reply as... Cancel
Chris Whittle Chris Whittle 15 Years Ago nevermind I missed the structure.... Heres the rub now... It renders but when I hit the create button it thinks and the does nothing... Please sign in to reply. Reply as... Cancel
Chris Whittle Chris Whittle 15 Years Ago nevermind I missed the structure.... Heres the rub now... It renders but when I hit the create button it thinks and the does nothing... Please sign in to reply. Reply as... Cancel Ray Augé Chris Whittle 15 Years Ago Not exactly sure what you mean. Can you clarify? Please sign in to reply. Reply as... Cancel
Ray Augé Chris Whittle 15 Years Ago Not exactly sure what you mean. Can you clarify? Please sign in to reply. Reply as... Cancel
delang j 15 Years Ago im confused to set pagination, could you explain more details. Please sign in to reply. Reply as... Cancel
delang j 15 Years Ago hi ray,why it didnt works on my office's computer(linux) but perfectly works on my personal computer(window) and my friend's computer(linux).the table name,column name perfectly created but i cant insert any value. Please sign in to reply. Reply as... Cancel Ray Augé delang j 15 Years Ago hmm... Which version of the portal. We had a small API change in a latter version of 5.1 (I know API changes are bad... but it was a sever limitation which incurred the change, I suspect that's the problem). Please sign in to reply. Reply as... Cancel delang j Ray Augé 15 Years Ago problem solved. i just playing with the codes.LOL.what about pagination, im big confused how to implement it Please sign in to reply. Reply as... Cancel
Ray Augé delang j 15 Years Ago hmm... Which version of the portal. We had a small API change in a latter version of 5.1 (I know API changes are bad... but it was a sever limitation which incurred the change, I suspect that's the problem). Please sign in to reply. Reply as... Cancel delang j Ray Augé 15 Years Ago problem solved. i just playing with the codes.LOL.what about pagination, im big confused how to implement it Please sign in to reply. Reply as... Cancel
delang j Ray Augé 15 Years Ago problem solved. i just playing with the codes.LOL.what about pagination, im big confused how to implement it Please sign in to reply. Reply as... Cancel
delang j 15 Years Ago what about to display 10 latest data only Please sign in to reply. Reply as... Cancel
Peter Mesotten 15 Years Ago Apparently (and logically), Users' and Organizations' Custom Attributes are implemented with Expandos. For a Project, we need custom attributes on other entities such as events and communities as well.I've already managed to create an expandotable that refers to f.e. the CalEvent class and added fields to it. Now I want to include this extra fields in the form of the Create Event page. I found the <liferay-ui:custom-attribute-list /> JSP tag, but, f.e. for CalEvent, where do I put this tag, and will the service layer know what to do with the "extra" inputfields? Please sign in to reply. Reply as... Cancel Ray Augé Peter Mesotten 15 Years Ago The service layer will automatically know what to do with the input fields as far as collecting them and passing them along to the service implementation layer... But unfortunately, it appears that the operation to persist them was not called in the add/update methods, specifically w.r.t. CalEvent.What version are you using? It's simple to patch, add these two lines later in the add/update methods: ExpandoBridge expandoBridge = event.getExpandoBridge(); expandoBridge.setAttributes(serviceContext); Please sign in to reply. Reply as... Cancel Ray Augé Ray Augé 15 Years Ago I'll have to audit all the services which have support for this, but aren't persisting the custom attributes. Please sign in to reply. Reply as... Cancel
Ray Augé Peter Mesotten 15 Years Ago The service layer will automatically know what to do with the input fields as far as collecting them and passing them along to the service implementation layer... But unfortunately, it appears that the operation to persist them was not called in the add/update methods, specifically w.r.t. CalEvent.What version are you using? It's simple to patch, add these two lines later in the add/update methods: ExpandoBridge expandoBridge = event.getExpandoBridge(); expandoBridge.setAttributes(serviceContext); Please sign in to reply. Reply as... Cancel Ray Augé Ray Augé 15 Years Ago I'll have to audit all the services which have support for this, but aren't persisting the custom attributes. Please sign in to reply. Reply as... Cancel
Ray Augé Ray Augé 15 Years Ago I'll have to audit all the services which have support for this, but aren't persisting the custom attributes. Please sign in to reply. Reply as... Cancel
Peter Mesotten 15 Years Ago Thanks alot for your quick response. I'm using 5.2.1.I tried using <liferay-ui:custom-attribute-list ... /> in edit_event.jsp and it showed the expando fields, awesome! Values are not yet persisted like you said. But where exactly should I put your lines of code? I'm pretty new to Liferay development...Thanks in advance! Very exciting this Expando stuff Please sign in to reply. Reply as... Cancel Ray Augé Peter Mesotten 15 Years Ago I'd have to say just before the comment:// SocialBut I've already committed the fix to the CalEvent service here http://issues.liferay.com/browse/LPS-2317and requested for backport to 5.2.x. Please sign in to reply. Reply as... Cancel
Ray Augé Peter Mesotten 15 Years Ago I'd have to say just before the comment:// SocialBut I've already committed the fix to the CalEvent service here http://issues.liferay.com/browse/LPS-2317and requested for backport to 5.2.x. Please sign in to reply. Reply as... Cancel
Max Gabrielsson 15 Years Ago This is exactly what I'm looking for!I get "No ExpandoColumn exists with the primary key 0" when I use ExpandoColumnLocalServiceUtil.addColumn(...) and (Since I am not logged in during the startup hook) "PermissionChecker not initialized" when I use ExpandoColumnServiceUtil.addColumn(...)Is there a way to create Custom Attributes during the startup hook?Here is the code://in startupaction.javaaddAttribute(myUser, "myStringAttribute", 15, "default");//in myUtilClass.javapublic static void addAttribute(User liferayUser, String name, int type, Serializable defaultValue) throws PortalException { //String className = liferayUser.getClass().getName(); String className = com.liferay.portal.model.User.class.getName(); try { ExpandoTable table = null; try { table = ExpandoTableLocalServiceUtil.getDefaultTable( className); } catch (NoSuchTableException nste) { table = ExpandoTableLocalServiceUtil.addDefaultTable( className); } ExpandoColumnLocalServiceUtil.addColumn( table.getTableId(), name, type, defaultValue); } catch (Exception e) { if (e instanceof PortalException) { throw (PortalException)e; } else { } } } Please sign in to reply. Reply as... Cancel Ray Augé Max Gabrielsson 15 Years Ago To start, which version of the portal are you using? Please sign in to reply. Reply as... Cancel Max Gabrielsson Ray Augé 15 Years Ago I use 5.2.1. Please sign in to reply. Reply as... Cancel Ray Augé Max Gabrielsson 15 Years Ago Great! You can reduce all that code by alot using the convenience API called ExpandoBridge.liferayUser.getExpandoBridge().addAttribute(name, type, defaultValue);If you don't have a user at that time, use:ExpandoBridge eb = new ExpandoBridgeImpl(User.class.getName(), 0);eb.addAttribute(name, type, defaultValue);Later to get/set those values for any user simply:Object attr = someUser.getExpandoBridge().getAttribute(name);someUser.getExpandoBridge().setAttribute(name, someValue); Please sign in to reply. Reply as... Cancel Ray Augé Ray Augé 15 Years Ago This is the API that "Custom Attributes" are based on. Please sign in to reply. Reply as... Cancel Max Gabrielsson Ray Augé 15 Years Ago Many thanks for your answer Ray!But I still got the problem with the PermissionChecker not initialized. After I create the appropriate role and user in the startupaction.java (on application.startup.events) i try the:liferayUser.getExpandoBridge().addAttribute(name, type, defaultValue); Which gives the PrincipalException: PermissionChecker not initialized. Also the:ExpandoBridge eb = new ExpandoBridgeImpl(User.class.getName(), 0);eb.addAttribute(name, type, defaultValue); <------------- gives the same exception.Is it possible to create custom attributes in the startupaction hook? Please sign in to reply. Reply as... Cancel Ray Augé Max Gabrielsson 15 Years Ago It should be! We're doing that very thing in the project I'm currently tasked on. Please sign in to reply. Reply as... Cancel Alexey Kakunin Ray Augé 14 Years Ago Hi! I meet same problem in Liferay 5.2.3 - I'm trying to add new attribute (in my case for BlogsEntry) in portlet StartUpAction (configured via hooks-propeties).I'm doing very similar: ExpandoBridgeImpl blogExpandoBridge = new ExpandoBridgeImpl(BlogsEntry.class.getName()); // shareWith if (blogExpandoBridge.hasAttribute("shareWith")) { _log.debug("attribute shareWith already exists"); } else { _log.info("adding shareWith attribute"); blogExpandoBridge.addAttribute("shareWith"); }But got PermissionChecker is not initialized exception. I think it happens, because during adding new column Liferay tried to identify - is current user allowed to add expando columns, but, since this code exeucted in StartUpAction - no current user and as result - no any PermissionChecker.Any solution for this?BTW - Expando looks like a great solution which should resolve many problems for extending default liferay objects! Please sign in to reply. Reply as... Cancel Alexey Kakunin Alexey Kakunin 14 Years Ago Probably, problem in fact, Expando has services, but has no LocalServices - as far as I understand - one of the biggest difference - LocalServices did not do permission checking.So, ExpandoServices always tried to do permission-checks, and in case they are called in (for example) startup action, since we do not have any user in context, permission checker is not initialized.Having Expando LocalServices will allow to perform Expando operations without permission checking (supposing all permissions are already checked on top-level) Please sign in to reply. Reply as... Cancel Alexey Kakunin Alexey Kakunin 14 Years Ago uups - sorry! Exando has local services as well, and, as I expected - their usage allow o perform exapndo attributes operations without checking permissions (for example in startup event). Please sign in to reply. Reply as... Cancel Sven Ehlert Alexey Kakunin 14 Years Ago Hi Alexey,I'm also trying to add an attribute in a Startup hook (Liferay 5.2.3) like in your example and I also got this PermissionChecker not initialized exception.I'm not really getting your later comments with the Local service. Have you been able to fix your problem using local service? If so, would you mind posting your code here?Thanks a lot! Please sign in to reply. Reply as... Cancel Harry Ostreicker Sven Ehlert 14 Years Ago Hi Ray, brilliant blog thread!I have a simple question regarding posting data using the "web form" portlet and reading the entries using the velocity template approach.My Web Form portlet instance works well and I can see all of the data in the Expando tables. But I'm trying to create a very simple way to read these values into a table with pagination using a velocity template.Any ideas how I can accomplish this using the last portion of your code here?Thanks!-HarryO Please sign in to reply. Reply as... Cancel
Ray Augé Max Gabrielsson 15 Years Ago To start, which version of the portal are you using? Please sign in to reply. Reply as... Cancel Max Gabrielsson Ray Augé 15 Years Ago I use 5.2.1. Please sign in to reply. Reply as... Cancel Ray Augé Max Gabrielsson 15 Years Ago Great! You can reduce all that code by alot using the convenience API called ExpandoBridge.liferayUser.getExpandoBridge().addAttribute(name, type, defaultValue);If you don't have a user at that time, use:ExpandoBridge eb = new ExpandoBridgeImpl(User.class.getName(), 0);eb.addAttribute(name, type, defaultValue);Later to get/set those values for any user simply:Object attr = someUser.getExpandoBridge().getAttribute(name);someUser.getExpandoBridge().setAttribute(name, someValue); Please sign in to reply. Reply as... Cancel Ray Augé Ray Augé 15 Years Ago This is the API that "Custom Attributes" are based on. Please sign in to reply. Reply as... Cancel Max Gabrielsson Ray Augé 15 Years Ago Many thanks for your answer Ray!But I still got the problem with the PermissionChecker not initialized. After I create the appropriate role and user in the startupaction.java (on application.startup.events) i try the:liferayUser.getExpandoBridge().addAttribute(name, type, defaultValue); Which gives the PrincipalException: PermissionChecker not initialized. Also the:ExpandoBridge eb = new ExpandoBridgeImpl(User.class.getName(), 0);eb.addAttribute(name, type, defaultValue); <------------- gives the same exception.Is it possible to create custom attributes in the startupaction hook? Please sign in to reply. Reply as... Cancel Ray Augé Max Gabrielsson 15 Years Ago It should be! We're doing that very thing in the project I'm currently tasked on. Please sign in to reply. Reply as... Cancel Alexey Kakunin Ray Augé 14 Years Ago Hi! I meet same problem in Liferay 5.2.3 - I'm trying to add new attribute (in my case for BlogsEntry) in portlet StartUpAction (configured via hooks-propeties).I'm doing very similar: ExpandoBridgeImpl blogExpandoBridge = new ExpandoBridgeImpl(BlogsEntry.class.getName()); // shareWith if (blogExpandoBridge.hasAttribute("shareWith")) { _log.debug("attribute shareWith already exists"); } else { _log.info("adding shareWith attribute"); blogExpandoBridge.addAttribute("shareWith"); }But got PermissionChecker is not initialized exception. I think it happens, because during adding new column Liferay tried to identify - is current user allowed to add expando columns, but, since this code exeucted in StartUpAction - no current user and as result - no any PermissionChecker.Any solution for this?BTW - Expando looks like a great solution which should resolve many problems for extending default liferay objects! Please sign in to reply. Reply as... Cancel Alexey Kakunin Alexey Kakunin 14 Years Ago Probably, problem in fact, Expando has services, but has no LocalServices - as far as I understand - one of the biggest difference - LocalServices did not do permission checking.So, ExpandoServices always tried to do permission-checks, and in case they are called in (for example) startup action, since we do not have any user in context, permission checker is not initialized.Having Expando LocalServices will allow to perform Expando operations without permission checking (supposing all permissions are already checked on top-level) Please sign in to reply. Reply as... Cancel Alexey Kakunin Alexey Kakunin 14 Years Ago uups - sorry! Exando has local services as well, and, as I expected - their usage allow o perform exapndo attributes operations without checking permissions (for example in startup event). Please sign in to reply. Reply as... Cancel Sven Ehlert Alexey Kakunin 14 Years Ago Hi Alexey,I'm also trying to add an attribute in a Startup hook (Liferay 5.2.3) like in your example and I also got this PermissionChecker not initialized exception.I'm not really getting your later comments with the Local service. Have you been able to fix your problem using local service? If so, would you mind posting your code here?Thanks a lot! Please sign in to reply. Reply as... Cancel Harry Ostreicker Sven Ehlert 14 Years Ago Hi Ray, brilliant blog thread!I have a simple question regarding posting data using the "web form" portlet and reading the entries using the velocity template approach.My Web Form portlet instance works well and I can see all of the data in the Expando tables. But I'm trying to create a very simple way to read these values into a table with pagination using a velocity template.Any ideas how I can accomplish this using the last portion of your code here?Thanks!-HarryO Please sign in to reply. Reply as... Cancel
Max Gabrielsson Ray Augé 15 Years Ago I use 5.2.1. Please sign in to reply. Reply as... Cancel Ray Augé Max Gabrielsson 15 Years Ago Great! You can reduce all that code by alot using the convenience API called ExpandoBridge.liferayUser.getExpandoBridge().addAttribute(name, type, defaultValue);If you don't have a user at that time, use:ExpandoBridge eb = new ExpandoBridgeImpl(User.class.getName(), 0);eb.addAttribute(name, type, defaultValue);Later to get/set those values for any user simply:Object attr = someUser.getExpandoBridge().getAttribute(name);someUser.getExpandoBridge().setAttribute(name, someValue); Please sign in to reply. Reply as... Cancel Ray Augé Ray Augé 15 Years Ago This is the API that "Custom Attributes" are based on. Please sign in to reply. Reply as... Cancel Max Gabrielsson Ray Augé 15 Years Ago Many thanks for your answer Ray!But I still got the problem with the PermissionChecker not initialized. After I create the appropriate role and user in the startupaction.java (on application.startup.events) i try the:liferayUser.getExpandoBridge().addAttribute(name, type, defaultValue); Which gives the PrincipalException: PermissionChecker not initialized. Also the:ExpandoBridge eb = new ExpandoBridgeImpl(User.class.getName(), 0);eb.addAttribute(name, type, defaultValue); <------------- gives the same exception.Is it possible to create custom attributes in the startupaction hook? Please sign in to reply. Reply as... Cancel Ray Augé Max Gabrielsson 15 Years Ago It should be! We're doing that very thing in the project I'm currently tasked on. Please sign in to reply. Reply as... Cancel Alexey Kakunin Ray Augé 14 Years Ago Hi! I meet same problem in Liferay 5.2.3 - I'm trying to add new attribute (in my case for BlogsEntry) in portlet StartUpAction (configured via hooks-propeties).I'm doing very similar: ExpandoBridgeImpl blogExpandoBridge = new ExpandoBridgeImpl(BlogsEntry.class.getName()); // shareWith if (blogExpandoBridge.hasAttribute("shareWith")) { _log.debug("attribute shareWith already exists"); } else { _log.info("adding shareWith attribute"); blogExpandoBridge.addAttribute("shareWith"); }But got PermissionChecker is not initialized exception. I think it happens, because during adding new column Liferay tried to identify - is current user allowed to add expando columns, but, since this code exeucted in StartUpAction - no current user and as result - no any PermissionChecker.Any solution for this?BTW - Expando looks like a great solution which should resolve many problems for extending default liferay objects! Please sign in to reply. Reply as... Cancel Alexey Kakunin Alexey Kakunin 14 Years Ago Probably, problem in fact, Expando has services, but has no LocalServices - as far as I understand - one of the biggest difference - LocalServices did not do permission checking.So, ExpandoServices always tried to do permission-checks, and in case they are called in (for example) startup action, since we do not have any user in context, permission checker is not initialized.Having Expando LocalServices will allow to perform Expando operations without permission checking (supposing all permissions are already checked on top-level) Please sign in to reply. Reply as... Cancel Alexey Kakunin Alexey Kakunin 14 Years Ago uups - sorry! Exando has local services as well, and, as I expected - their usage allow o perform exapndo attributes operations without checking permissions (for example in startup event). Please sign in to reply. Reply as... Cancel Sven Ehlert Alexey Kakunin 14 Years Ago Hi Alexey,I'm also trying to add an attribute in a Startup hook (Liferay 5.2.3) like in your example and I also got this PermissionChecker not initialized exception.I'm not really getting your later comments with the Local service. Have you been able to fix your problem using local service? If so, would you mind posting your code here?Thanks a lot! Please sign in to reply. Reply as... Cancel Harry Ostreicker Sven Ehlert 14 Years Ago Hi Ray, brilliant blog thread!I have a simple question regarding posting data using the "web form" portlet and reading the entries using the velocity template approach.My Web Form portlet instance works well and I can see all of the data in the Expando tables. But I'm trying to create a very simple way to read these values into a table with pagination using a velocity template.Any ideas how I can accomplish this using the last portion of your code here?Thanks!-HarryO Please sign in to reply. Reply as... Cancel
Ray Augé Max Gabrielsson 15 Years Ago Great! You can reduce all that code by alot using the convenience API called ExpandoBridge.liferayUser.getExpandoBridge().addAttribute(name, type, defaultValue);If you don't have a user at that time, use:ExpandoBridge eb = new ExpandoBridgeImpl(User.class.getName(), 0);eb.addAttribute(name, type, defaultValue);Later to get/set those values for any user simply:Object attr = someUser.getExpandoBridge().getAttribute(name);someUser.getExpandoBridge().setAttribute(name, someValue); Please sign in to reply. Reply as... Cancel Ray Augé Ray Augé 15 Years Ago This is the API that "Custom Attributes" are based on. Please sign in to reply. Reply as... Cancel Max Gabrielsson Ray Augé 15 Years Ago Many thanks for your answer Ray!But I still got the problem with the PermissionChecker not initialized. After I create the appropriate role and user in the startupaction.java (on application.startup.events) i try the:liferayUser.getExpandoBridge().addAttribute(name, type, defaultValue); Which gives the PrincipalException: PermissionChecker not initialized. Also the:ExpandoBridge eb = new ExpandoBridgeImpl(User.class.getName(), 0);eb.addAttribute(name, type, defaultValue); <------------- gives the same exception.Is it possible to create custom attributes in the startupaction hook? Please sign in to reply. Reply as... Cancel Ray Augé Max Gabrielsson 15 Years Ago It should be! We're doing that very thing in the project I'm currently tasked on. Please sign in to reply. Reply as... Cancel Alexey Kakunin Ray Augé 14 Years Ago Hi! I meet same problem in Liferay 5.2.3 - I'm trying to add new attribute (in my case for BlogsEntry) in portlet StartUpAction (configured via hooks-propeties).I'm doing very similar: ExpandoBridgeImpl blogExpandoBridge = new ExpandoBridgeImpl(BlogsEntry.class.getName()); // shareWith if (blogExpandoBridge.hasAttribute("shareWith")) { _log.debug("attribute shareWith already exists"); } else { _log.info("adding shareWith attribute"); blogExpandoBridge.addAttribute("shareWith"); }But got PermissionChecker is not initialized exception. I think it happens, because during adding new column Liferay tried to identify - is current user allowed to add expando columns, but, since this code exeucted in StartUpAction - no current user and as result - no any PermissionChecker.Any solution for this?BTW - Expando looks like a great solution which should resolve many problems for extending default liferay objects! Please sign in to reply. Reply as... Cancel Alexey Kakunin Alexey Kakunin 14 Years Ago Probably, problem in fact, Expando has services, but has no LocalServices - as far as I understand - one of the biggest difference - LocalServices did not do permission checking.So, ExpandoServices always tried to do permission-checks, and in case they are called in (for example) startup action, since we do not have any user in context, permission checker is not initialized.Having Expando LocalServices will allow to perform Expando operations without permission checking (supposing all permissions are already checked on top-level) Please sign in to reply. Reply as... Cancel Alexey Kakunin Alexey Kakunin 14 Years Ago uups - sorry! Exando has local services as well, and, as I expected - their usage allow o perform exapndo attributes operations without checking permissions (for example in startup event). Please sign in to reply. Reply as... Cancel Sven Ehlert Alexey Kakunin 14 Years Ago Hi Alexey,I'm also trying to add an attribute in a Startup hook (Liferay 5.2.3) like in your example and I also got this PermissionChecker not initialized exception.I'm not really getting your later comments with the Local service. Have you been able to fix your problem using local service? If so, would you mind posting your code here?Thanks a lot! Please sign in to reply. Reply as... Cancel Harry Ostreicker Sven Ehlert 14 Years Ago Hi Ray, brilliant blog thread!I have a simple question regarding posting data using the "web form" portlet and reading the entries using the velocity template approach.My Web Form portlet instance works well and I can see all of the data in the Expando tables. But I'm trying to create a very simple way to read these values into a table with pagination using a velocity template.Any ideas how I can accomplish this using the last portion of your code here?Thanks!-HarryO Please sign in to reply. Reply as... Cancel
Ray Augé Ray Augé 15 Years Ago This is the API that "Custom Attributes" are based on. Please sign in to reply. Reply as... Cancel
Max Gabrielsson Ray Augé 15 Years Ago Many thanks for your answer Ray!But I still got the problem with the PermissionChecker not initialized. After I create the appropriate role and user in the startupaction.java (on application.startup.events) i try the:liferayUser.getExpandoBridge().addAttribute(name, type, defaultValue); Which gives the PrincipalException: PermissionChecker not initialized. Also the:ExpandoBridge eb = new ExpandoBridgeImpl(User.class.getName(), 0);eb.addAttribute(name, type, defaultValue); <------------- gives the same exception.Is it possible to create custom attributes in the startupaction hook? Please sign in to reply. Reply as... Cancel Ray Augé Max Gabrielsson 15 Years Ago It should be! We're doing that very thing in the project I'm currently tasked on. Please sign in to reply. Reply as... Cancel Alexey Kakunin Ray Augé 14 Years Ago Hi! I meet same problem in Liferay 5.2.3 - I'm trying to add new attribute (in my case for BlogsEntry) in portlet StartUpAction (configured via hooks-propeties).I'm doing very similar: ExpandoBridgeImpl blogExpandoBridge = new ExpandoBridgeImpl(BlogsEntry.class.getName()); // shareWith if (blogExpandoBridge.hasAttribute("shareWith")) { _log.debug("attribute shareWith already exists"); } else { _log.info("adding shareWith attribute"); blogExpandoBridge.addAttribute("shareWith"); }But got PermissionChecker is not initialized exception. I think it happens, because during adding new column Liferay tried to identify - is current user allowed to add expando columns, but, since this code exeucted in StartUpAction - no current user and as result - no any PermissionChecker.Any solution for this?BTW - Expando looks like a great solution which should resolve many problems for extending default liferay objects! Please sign in to reply. Reply as... Cancel Alexey Kakunin Alexey Kakunin 14 Years Ago Probably, problem in fact, Expando has services, but has no LocalServices - as far as I understand - one of the biggest difference - LocalServices did not do permission checking.So, ExpandoServices always tried to do permission-checks, and in case they are called in (for example) startup action, since we do not have any user in context, permission checker is not initialized.Having Expando LocalServices will allow to perform Expando operations without permission checking (supposing all permissions are already checked on top-level) Please sign in to reply. Reply as... Cancel Alexey Kakunin Alexey Kakunin 14 Years Ago uups - sorry! Exando has local services as well, and, as I expected - their usage allow o perform exapndo attributes operations without checking permissions (for example in startup event). Please sign in to reply. Reply as... Cancel Sven Ehlert Alexey Kakunin 14 Years Ago Hi Alexey,I'm also trying to add an attribute in a Startup hook (Liferay 5.2.3) like in your example and I also got this PermissionChecker not initialized exception.I'm not really getting your later comments with the Local service. Have you been able to fix your problem using local service? If so, would you mind posting your code here?Thanks a lot! Please sign in to reply. Reply as... Cancel Harry Ostreicker Sven Ehlert 14 Years Ago Hi Ray, brilliant blog thread!I have a simple question regarding posting data using the "web form" portlet and reading the entries using the velocity template approach.My Web Form portlet instance works well and I can see all of the data in the Expando tables. But I'm trying to create a very simple way to read these values into a table with pagination using a velocity template.Any ideas how I can accomplish this using the last portion of your code here?Thanks!-HarryO Please sign in to reply. Reply as... Cancel
Ray Augé Max Gabrielsson 15 Years Ago It should be! We're doing that very thing in the project I'm currently tasked on. Please sign in to reply. Reply as... Cancel Alexey Kakunin Ray Augé 14 Years Ago Hi! I meet same problem in Liferay 5.2.3 - I'm trying to add new attribute (in my case for BlogsEntry) in portlet StartUpAction (configured via hooks-propeties).I'm doing very similar: ExpandoBridgeImpl blogExpandoBridge = new ExpandoBridgeImpl(BlogsEntry.class.getName()); // shareWith if (blogExpandoBridge.hasAttribute("shareWith")) { _log.debug("attribute shareWith already exists"); } else { _log.info("adding shareWith attribute"); blogExpandoBridge.addAttribute("shareWith"); }But got PermissionChecker is not initialized exception. I think it happens, because during adding new column Liferay tried to identify - is current user allowed to add expando columns, but, since this code exeucted in StartUpAction - no current user and as result - no any PermissionChecker.Any solution for this?BTW - Expando looks like a great solution which should resolve many problems for extending default liferay objects! Please sign in to reply. Reply as... Cancel Alexey Kakunin Alexey Kakunin 14 Years Ago Probably, problem in fact, Expando has services, but has no LocalServices - as far as I understand - one of the biggest difference - LocalServices did not do permission checking.So, ExpandoServices always tried to do permission-checks, and in case they are called in (for example) startup action, since we do not have any user in context, permission checker is not initialized.Having Expando LocalServices will allow to perform Expando operations without permission checking (supposing all permissions are already checked on top-level) Please sign in to reply. Reply as... Cancel Alexey Kakunin Alexey Kakunin 14 Years Ago uups - sorry! Exando has local services as well, and, as I expected - their usage allow o perform exapndo attributes operations without checking permissions (for example in startup event). Please sign in to reply. Reply as... Cancel Sven Ehlert Alexey Kakunin 14 Years Ago Hi Alexey,I'm also trying to add an attribute in a Startup hook (Liferay 5.2.3) like in your example and I also got this PermissionChecker not initialized exception.I'm not really getting your later comments with the Local service. Have you been able to fix your problem using local service? If so, would you mind posting your code here?Thanks a lot! Please sign in to reply. Reply as... Cancel Harry Ostreicker Sven Ehlert 14 Years Ago Hi Ray, brilliant blog thread!I have a simple question regarding posting data using the "web form" portlet and reading the entries using the velocity template approach.My Web Form portlet instance works well and I can see all of the data in the Expando tables. But I'm trying to create a very simple way to read these values into a table with pagination using a velocity template.Any ideas how I can accomplish this using the last portion of your code here?Thanks!-HarryO Please sign in to reply. Reply as... Cancel
Alexey Kakunin Ray Augé 14 Years Ago Hi! I meet same problem in Liferay 5.2.3 - I'm trying to add new attribute (in my case for BlogsEntry) in portlet StartUpAction (configured via hooks-propeties).I'm doing very similar: ExpandoBridgeImpl blogExpandoBridge = new ExpandoBridgeImpl(BlogsEntry.class.getName()); // shareWith if (blogExpandoBridge.hasAttribute("shareWith")) { _log.debug("attribute shareWith already exists"); } else { _log.info("adding shareWith attribute"); blogExpandoBridge.addAttribute("shareWith"); }But got PermissionChecker is not initialized exception. I think it happens, because during adding new column Liferay tried to identify - is current user allowed to add expando columns, but, since this code exeucted in StartUpAction - no current user and as result - no any PermissionChecker.Any solution for this?BTW - Expando looks like a great solution which should resolve many problems for extending default liferay objects! Please sign in to reply. Reply as... Cancel Alexey Kakunin Alexey Kakunin 14 Years Ago Probably, problem in fact, Expando has services, but has no LocalServices - as far as I understand - one of the biggest difference - LocalServices did not do permission checking.So, ExpandoServices always tried to do permission-checks, and in case they are called in (for example) startup action, since we do not have any user in context, permission checker is not initialized.Having Expando LocalServices will allow to perform Expando operations without permission checking (supposing all permissions are already checked on top-level) Please sign in to reply. Reply as... Cancel Alexey Kakunin Alexey Kakunin 14 Years Ago uups - sorry! Exando has local services as well, and, as I expected - their usage allow o perform exapndo attributes operations without checking permissions (for example in startup event). Please sign in to reply. Reply as... Cancel Sven Ehlert Alexey Kakunin 14 Years Ago Hi Alexey,I'm also trying to add an attribute in a Startup hook (Liferay 5.2.3) like in your example and I also got this PermissionChecker not initialized exception.I'm not really getting your later comments with the Local service. Have you been able to fix your problem using local service? If so, would you mind posting your code here?Thanks a lot! Please sign in to reply. Reply as... Cancel Harry Ostreicker Sven Ehlert 14 Years Ago Hi Ray, brilliant blog thread!I have a simple question regarding posting data using the "web form" portlet and reading the entries using the velocity template approach.My Web Form portlet instance works well and I can see all of the data in the Expando tables. But I'm trying to create a very simple way to read these values into a table with pagination using a velocity template.Any ideas how I can accomplish this using the last portion of your code here?Thanks!-HarryO Please sign in to reply. Reply as... Cancel
Alexey Kakunin Alexey Kakunin 14 Years Ago Probably, problem in fact, Expando has services, but has no LocalServices - as far as I understand - one of the biggest difference - LocalServices did not do permission checking.So, ExpandoServices always tried to do permission-checks, and in case they are called in (for example) startup action, since we do not have any user in context, permission checker is not initialized.Having Expando LocalServices will allow to perform Expando operations without permission checking (supposing all permissions are already checked on top-level) Please sign in to reply. Reply as... Cancel Alexey Kakunin Alexey Kakunin 14 Years Ago uups - sorry! Exando has local services as well, and, as I expected - their usage allow o perform exapndo attributes operations without checking permissions (for example in startup event). Please sign in to reply. Reply as... Cancel Sven Ehlert Alexey Kakunin 14 Years Ago Hi Alexey,I'm also trying to add an attribute in a Startup hook (Liferay 5.2.3) like in your example and I also got this PermissionChecker not initialized exception.I'm not really getting your later comments with the Local service. Have you been able to fix your problem using local service? If so, would you mind posting your code here?Thanks a lot! Please sign in to reply. Reply as... Cancel Harry Ostreicker Sven Ehlert 14 Years Ago Hi Ray, brilliant blog thread!I have a simple question regarding posting data using the "web form" portlet and reading the entries using the velocity template approach.My Web Form portlet instance works well and I can see all of the data in the Expando tables. But I'm trying to create a very simple way to read these values into a table with pagination using a velocity template.Any ideas how I can accomplish this using the last portion of your code here?Thanks!-HarryO Please sign in to reply. Reply as... Cancel
Alexey Kakunin Alexey Kakunin 14 Years Ago uups - sorry! Exando has local services as well, and, as I expected - their usage allow o perform exapndo attributes operations without checking permissions (for example in startup event). Please sign in to reply. Reply as... Cancel Sven Ehlert Alexey Kakunin 14 Years Ago Hi Alexey,I'm also trying to add an attribute in a Startup hook (Liferay 5.2.3) like in your example and I also got this PermissionChecker not initialized exception.I'm not really getting your later comments with the Local service. Have you been able to fix your problem using local service? If so, would you mind posting your code here?Thanks a lot! Please sign in to reply. Reply as... Cancel Harry Ostreicker Sven Ehlert 14 Years Ago Hi Ray, brilliant blog thread!I have a simple question regarding posting data using the "web form" portlet and reading the entries using the velocity template approach.My Web Form portlet instance works well and I can see all of the data in the Expando tables. But I'm trying to create a very simple way to read these values into a table with pagination using a velocity template.Any ideas how I can accomplish this using the last portion of your code here?Thanks!-HarryO Please sign in to reply. Reply as... Cancel
Sven Ehlert Alexey Kakunin 14 Years Ago Hi Alexey,I'm also trying to add an attribute in a Startup hook (Liferay 5.2.3) like in your example and I also got this PermissionChecker not initialized exception.I'm not really getting your later comments with the Local service. Have you been able to fix your problem using local service? If so, would you mind posting your code here?Thanks a lot! Please sign in to reply. Reply as... Cancel Harry Ostreicker Sven Ehlert 14 Years Ago Hi Ray, brilliant blog thread!I have a simple question regarding posting data using the "web form" portlet and reading the entries using the velocity template approach.My Web Form portlet instance works well and I can see all of the data in the Expando tables. But I'm trying to create a very simple way to read these values into a table with pagination using a velocity template.Any ideas how I can accomplish this using the last portion of your code here?Thanks!-HarryO Please sign in to reply. Reply as... Cancel
Harry Ostreicker Sven Ehlert 14 Years Ago Hi Ray, brilliant blog thread!I have a simple question regarding posting data using the "web form" portlet and reading the entries using the velocity template approach.My Web Form portlet instance works well and I can see all of the data in the Expando tables. But I'm trying to create a very simple way to read these values into a table with pagination using a velocity template.Any ideas how I can accomplish this using the last portion of your code here?Thanks!-HarryO Please sign in to reply. Reply as... Cancel