John Feeney Hace 7 años Thanks David, this is fantastic stuff.For anyone else who might make the same mistake that I did -Don't forget to add the Admin Login Notification portlet to a page (on your dashboard for example) and click on the Subscribe button. Por favor identifíquese para votar. Contestar como... Cancelar Fernando Fernandez John Feeney Hace 5 años It seems to me that this example is not integrated with the 7.0 user notification management, based on UserNotificationDeliveryService. If a user goes to his Notifications/Configuration panel and subscribes email or website notifications, these subscriptions are ignored. That's why you need to have the portlet and subscribe through it, storing the subscription on the SubscriptionService. Por favor identifíquese para votar. Contestar como... Cancelar
Fernando Fernandez John Feeney Hace 5 años It seems to me that this example is not integrated with the 7.0 user notification management, based on UserNotificationDeliveryService. If a user goes to his Notifications/Configuration panel and subscribes email or website notifications, these subscriptions are ignored. That's why you need to have the portlet and subscribe through it, storing the subscription on the SubscriptionService. Por favor identifíquese para votar. Contestar como... Cancelar
mohit mehral Hace 7 años Hi,Even i am looking for the similar functionality, butI want to notify all site users when a content is created and added on page for a particular site by a Content Management team.please help.Thanks & regards,Mohit Mehral Por favor identifíquese para votar. Contestar como... Cancelar Waheed Khan mohit mehral Hace 6 años Hi Mohit,Did you find any solution for this??If yes then please share as I am having the same requirement.Regards,Waheed Khan Por favor identifíquese para votar. Contestar como... Cancelar ronak vora mohit mehral Hace 5 años Hii Mohit, Did you find any solution for this?? If yes then please share as I am having the same requirement. Thanks & regards, Ronak Patel Por favor identifíquese para votar. Contestar como... Cancelar David H Nebinger ronak vora Hace 5 años There are two parts to sending a notification: 1) sending the notification, that's covered by this blog and 2) identifying when to send a notification. That's not covered by this blog, but it is something that you need to figure out per your own requirement. I will say that doing a notification when content is added to a page is actually pretty hard, mostly because there are legitimate ways to add content that appear on a page but are not placed there. An asset publisher is a typical example; if you add an AP, you configure it for the content to display, sometimes you cast a wide net and get a list, but you can also be rather narrow and come up with a handful or even a single asset. Carousels built around AP are like this. But the important part is that content can be created, will appear on a page, but won't be directly placed there by an admin. Display pages on content can be another example. A final example is content versioning; you can create a new version of content, but Liferay will typically display the most recent version. So changing a content can change the page w/o direct intervention. This is not like an old html site where developers have to directly place content on pages and therefore, on page change, you can issue notifications. Liferay is designed from the ground up to be a dynamic system, and changes can be added/updated/removed without touching a page. Por favor identifíquese para votar. Contestar como... Cancelar
Waheed Khan mohit mehral Hace 6 años Hi Mohit,Did you find any solution for this??If yes then please share as I am having the same requirement.Regards,Waheed Khan Por favor identifíquese para votar. Contestar como... Cancelar
ronak vora mohit mehral Hace 5 años Hii Mohit, Did you find any solution for this?? If yes then please share as I am having the same requirement. Thanks & regards, Ronak Patel Por favor identifíquese para votar. Contestar como... Cancelar David H Nebinger ronak vora Hace 5 años There are two parts to sending a notification: 1) sending the notification, that's covered by this blog and 2) identifying when to send a notification. That's not covered by this blog, but it is something that you need to figure out per your own requirement. I will say that doing a notification when content is added to a page is actually pretty hard, mostly because there are legitimate ways to add content that appear on a page but are not placed there. An asset publisher is a typical example; if you add an AP, you configure it for the content to display, sometimes you cast a wide net and get a list, but you can also be rather narrow and come up with a handful or even a single asset. Carousels built around AP are like this. But the important part is that content can be created, will appear on a page, but won't be directly placed there by an admin. Display pages on content can be another example. A final example is content versioning; you can create a new version of content, but Liferay will typically display the most recent version. So changing a content can change the page w/o direct intervention. This is not like an old html site where developers have to directly place content on pages and therefore, on page change, you can issue notifications. Liferay is designed from the ground up to be a dynamic system, and changes can be added/updated/removed without touching a page. Por favor identifíquese para votar. Contestar como... Cancelar
David H Nebinger ronak vora Hace 5 años There are two parts to sending a notification: 1) sending the notification, that's covered by this blog and 2) identifying when to send a notification. That's not covered by this blog, but it is something that you need to figure out per your own requirement. I will say that doing a notification when content is added to a page is actually pretty hard, mostly because there are legitimate ways to add content that appear on a page but are not placed there. An asset publisher is a typical example; if you add an AP, you configure it for the content to display, sometimes you cast a wide net and get a list, but you can also be rather narrow and come up with a handful or even a single asset. Carousels built around AP are like this. But the important part is that content can be created, will appear on a page, but won't be directly placed there by an admin. Display pages on content can be another example. A final example is content versioning; you can create a new version of content, but Liferay will typically display the most recent version. So changing a content can change the page w/o direct intervention. This is not like an old html site where developers have to directly place content on pages and therefore, on page change, you can issue notifications. Liferay is designed from the ground up to be a dynamic system, and changes can be added/updated/removed without touching a page. Por favor identifíquese para votar. Contestar como... Cancelar
Rajan Bhatt Hace 6 años Hi David, It's really nice blog. do you have any list of out of the box portlet where liferay dxp provides notifications? Por favor identifíquese para votar. Contestar como... Cancelar
Brad Worsfold Hace 5 años Great article. There is one issue with it when using LR 7 fp 57. The handler is only used for website/push notifications. It's never used for email notifications to render the body. I sure wish this was not the case. Perhaps this was the case at time of writing. Anyways, this was a great sample that got me going with Notifications. Thanks! Por favor identifíquese para votar. Contestar como... Cancelar
Dave Kliczbor Hace 3 años - Editado Nice blog post, but there is something in the code that is bugging me... AdminLoginNotificationEventSender.notifySubscribers: The values put into the Maps subjectLocalizedValuesMap and bodyLocalizedValuesMap are never used. Por favor identifíquese para votar. Contestar como... Cancelar David H Nebinger Dave Kliczbor Hace 3 años - Editado Good catch, Dave, I must have missed that. The SubscriptionSender has two methods, setLocalizedSubjectMap() and setLocalizedBodyMap() methods that would be invoked to pass in the subject and body maps. Por favor identifíquese para votar. Contestar como... Cancelar Dave Kliczbor David H Nebinger Hace 3 años - Editado Thanks for adding that info, David! I'm currently in the woes of writing my own UserNotification type; and I want to share some pitfalls and tidbits here: At one point my notifications did turn up, but I couldn't mark them as read, as unread, nor could I delete them. They just show up without the ellipsis menu and all buttons in the top bar are disabled when I select such a notification. In this case, something went wrong with the UserNotificationDefinition: probably the default constructor hasn't been overridden. I even managed to send a notification that showed up as "Notification isn't valid anymore" right from the start (I did use the wrong portletId String, so there's no Handler class registered for that portletId)... but I cannot delete that one in the UI. It's just there and cannot be deleted. I can only say that one better doesn't make that test on a production server ;-) You can actually skip the whole Subscription stuff and send a single Notification (of TYPE_WEBSITE) to a single user using UserNotificationEventLocalService.sendUserNotificationEvents(), which accepts a JSON object as payload. You'll still need to implement the Handler and Definition classes, but this allows you to send arbitrary plain text notifications to single users. Por favor identifíquese para votar. Contestar como... Cancelar Dave Kliczbor Dave Kliczbor Hace 3 años - Editado Also, why does this comment system double my empty lines??? Por favor identifíquese para votar. Contestar como... Cancelar David H Nebinger Dave Kliczbor Hace 3 años - Editado You should never test anything in production ;-) Notifications are tricky kind of like the asset framework can be; all of your ducks have to line up in a row. If you miss a piece, it can break notification functionality and it can be hard to figure out why. You're getting double newlines, but mine were stripped entirely. It's a known issue, but trying to balance the editor, theme, antispam and other capabilities along with the cross-browser requirements, I'm just uncertain if it is an easy problem for them to solve or not. Por favor identifíquese para votar. Contestar como... Cancelar Dave Kliczbor David H Nebinger Hace 3 años - Editado You mention "all of your ducks have to line up in a row" ... yeah, that hits the heart of my gripes with liferay's documentation. I've never found any docs listing the minimal set of ducks needed to achieve a given goal (in other words: what is the implicit contract that Liferay is assuming that my code fulfills). Something like: "To show a custom notification, you need the following things in place: a) a Definition class, linked to an arbitrary portlet name (using the @component property javax.portlet.name), which provides a service for UserNotificationDefinition.class (using the @component service argument), extending UserNotificationDefinition, having a default constructor which calls super(String, long, int, String) and one or more of the add*DeliveryType methods to register properly. b) a Handler class, linked to the same portlet name as the Definition class, providing a service of UserNotificationHandler.class, extending BaseUserNotificationHandler, calling setPortletId in its default constructor, overriding setBody(), where you must not return null nor StringPool.BLANK, but get the payload from the given UserNotificationEvent and interpret it and return that (the payload is always a JSON, because the notification sending methods want a JSONObject; also, you are responsible to come up with a schema for this JSON and adhere to it whenever you send a notification). c) A sender method, which builds said payload as a JSONObject and ultimately calls userNotificationEventLocalService.sendUserNotificationEvents (whatever you pass as notificationEventJSONObject here comes out in the Handler class as a payload String; yes, the naming is inconsistent here) or derives from SubscriptionSender (see contract docs for Notification event subscription). -- Furthermore, the following options exist: 1) when sending, you can set the options "delivered" and "actionRequired", which have the following consequences: [I never found out the actual list of consequences] 2) in your handler class, you can override the getters of some flags to change them: getActionable, getApplicable, getOpenDialog, getSelector. [I never found out what exactly they are supposed to do]." Without such documentation, coding for Liferay just feels like mining tunnel after tunnel into hard rock, trying assumption after assumption on how the underlying contract might look like, but only at the end of each tunnel you know whether this tunnel has merit. And when you find your goal at the end of the tenth tunnel or so, you mark the right tunnel, but you're still not sure if you did oversee something. Regarding the editor: In this concrete case here, I think it could be solved if <p> elements get the same top/bottom margins in editor and in view and/or removing empty <p> after paragraph detection. But, ultimately, I think that problem stems from the detection of "what is a newline and what is a paragraph?", with some users insisting on hitting enter at the end of each line, even if they want to create a flowing paragraph, as if they're still working on a mechanical typewriter. Anyway, I've seen this problem pop up and down on Liferay (in Forum and Blogs components) as long as I've been working with it... i.e. since 6.1.0rc1. Currently here, it's the combination of all errors I've seen yet: single newlines are removed and double newlines produce an empty paragraph. It's as if with each ckeditor update, someone randomly remembers or forgets to apply that one patch that streamlines this behaviour. Por favor identifíquese para votar. Contestar como... Cancelar
David H Nebinger Dave Kliczbor Hace 3 años - Editado Good catch, Dave, I must have missed that. The SubscriptionSender has two methods, setLocalizedSubjectMap() and setLocalizedBodyMap() methods that would be invoked to pass in the subject and body maps. Por favor identifíquese para votar. Contestar como... Cancelar Dave Kliczbor David H Nebinger Hace 3 años - Editado Thanks for adding that info, David! I'm currently in the woes of writing my own UserNotification type; and I want to share some pitfalls and tidbits here: At one point my notifications did turn up, but I couldn't mark them as read, as unread, nor could I delete them. They just show up without the ellipsis menu and all buttons in the top bar are disabled when I select such a notification. In this case, something went wrong with the UserNotificationDefinition: probably the default constructor hasn't been overridden. I even managed to send a notification that showed up as "Notification isn't valid anymore" right from the start (I did use the wrong portletId String, so there's no Handler class registered for that portletId)... but I cannot delete that one in the UI. It's just there and cannot be deleted. I can only say that one better doesn't make that test on a production server ;-) You can actually skip the whole Subscription stuff and send a single Notification (of TYPE_WEBSITE) to a single user using UserNotificationEventLocalService.sendUserNotificationEvents(), which accepts a JSON object as payload. You'll still need to implement the Handler and Definition classes, but this allows you to send arbitrary plain text notifications to single users. Por favor identifíquese para votar. Contestar como... Cancelar Dave Kliczbor Dave Kliczbor Hace 3 años - Editado Also, why does this comment system double my empty lines??? Por favor identifíquese para votar. Contestar como... Cancelar David H Nebinger Dave Kliczbor Hace 3 años - Editado You should never test anything in production ;-) Notifications are tricky kind of like the asset framework can be; all of your ducks have to line up in a row. If you miss a piece, it can break notification functionality and it can be hard to figure out why. You're getting double newlines, but mine were stripped entirely. It's a known issue, but trying to balance the editor, theme, antispam and other capabilities along with the cross-browser requirements, I'm just uncertain if it is an easy problem for them to solve or not. Por favor identifíquese para votar. Contestar como... Cancelar Dave Kliczbor David H Nebinger Hace 3 años - Editado You mention "all of your ducks have to line up in a row" ... yeah, that hits the heart of my gripes with liferay's documentation. I've never found any docs listing the minimal set of ducks needed to achieve a given goal (in other words: what is the implicit contract that Liferay is assuming that my code fulfills). Something like: "To show a custom notification, you need the following things in place: a) a Definition class, linked to an arbitrary portlet name (using the @component property javax.portlet.name), which provides a service for UserNotificationDefinition.class (using the @component service argument), extending UserNotificationDefinition, having a default constructor which calls super(String, long, int, String) and one or more of the add*DeliveryType methods to register properly. b) a Handler class, linked to the same portlet name as the Definition class, providing a service of UserNotificationHandler.class, extending BaseUserNotificationHandler, calling setPortletId in its default constructor, overriding setBody(), where you must not return null nor StringPool.BLANK, but get the payload from the given UserNotificationEvent and interpret it and return that (the payload is always a JSON, because the notification sending methods want a JSONObject; also, you are responsible to come up with a schema for this JSON and adhere to it whenever you send a notification). c) A sender method, which builds said payload as a JSONObject and ultimately calls userNotificationEventLocalService.sendUserNotificationEvents (whatever you pass as notificationEventJSONObject here comes out in the Handler class as a payload String; yes, the naming is inconsistent here) or derives from SubscriptionSender (see contract docs for Notification event subscription). -- Furthermore, the following options exist: 1) when sending, you can set the options "delivered" and "actionRequired", which have the following consequences: [I never found out the actual list of consequences] 2) in your handler class, you can override the getters of some flags to change them: getActionable, getApplicable, getOpenDialog, getSelector. [I never found out what exactly they are supposed to do]." Without such documentation, coding for Liferay just feels like mining tunnel after tunnel into hard rock, trying assumption after assumption on how the underlying contract might look like, but only at the end of each tunnel you know whether this tunnel has merit. And when you find your goal at the end of the tenth tunnel or so, you mark the right tunnel, but you're still not sure if you did oversee something. Regarding the editor: In this concrete case here, I think it could be solved if <p> elements get the same top/bottom margins in editor and in view and/or removing empty <p> after paragraph detection. But, ultimately, I think that problem stems from the detection of "what is a newline and what is a paragraph?", with some users insisting on hitting enter at the end of each line, even if they want to create a flowing paragraph, as if they're still working on a mechanical typewriter. Anyway, I've seen this problem pop up and down on Liferay (in Forum and Blogs components) as long as I've been working with it... i.e. since 6.1.0rc1. Currently here, it's the combination of all errors I've seen yet: single newlines are removed and double newlines produce an empty paragraph. It's as if with each ckeditor update, someone randomly remembers or forgets to apply that one patch that streamlines this behaviour. Por favor identifíquese para votar. Contestar como... Cancelar
Dave Kliczbor David H Nebinger Hace 3 años - Editado Thanks for adding that info, David! I'm currently in the woes of writing my own UserNotification type; and I want to share some pitfalls and tidbits here: At one point my notifications did turn up, but I couldn't mark them as read, as unread, nor could I delete them. They just show up without the ellipsis menu and all buttons in the top bar are disabled when I select such a notification. In this case, something went wrong with the UserNotificationDefinition: probably the default constructor hasn't been overridden. I even managed to send a notification that showed up as "Notification isn't valid anymore" right from the start (I did use the wrong portletId String, so there's no Handler class registered for that portletId)... but I cannot delete that one in the UI. It's just there and cannot be deleted. I can only say that one better doesn't make that test on a production server ;-) You can actually skip the whole Subscription stuff and send a single Notification (of TYPE_WEBSITE) to a single user using UserNotificationEventLocalService.sendUserNotificationEvents(), which accepts a JSON object as payload. You'll still need to implement the Handler and Definition classes, but this allows you to send arbitrary plain text notifications to single users. Por favor identifíquese para votar. Contestar como... Cancelar Dave Kliczbor Dave Kliczbor Hace 3 años - Editado Also, why does this comment system double my empty lines??? Por favor identifíquese para votar. Contestar como... Cancelar David H Nebinger Dave Kliczbor Hace 3 años - Editado You should never test anything in production ;-) Notifications are tricky kind of like the asset framework can be; all of your ducks have to line up in a row. If you miss a piece, it can break notification functionality and it can be hard to figure out why. You're getting double newlines, but mine were stripped entirely. It's a known issue, but trying to balance the editor, theme, antispam and other capabilities along with the cross-browser requirements, I'm just uncertain if it is an easy problem for them to solve or not. Por favor identifíquese para votar. Contestar como... Cancelar Dave Kliczbor David H Nebinger Hace 3 años - Editado You mention "all of your ducks have to line up in a row" ... yeah, that hits the heart of my gripes with liferay's documentation. I've never found any docs listing the minimal set of ducks needed to achieve a given goal (in other words: what is the implicit contract that Liferay is assuming that my code fulfills). Something like: "To show a custom notification, you need the following things in place: a) a Definition class, linked to an arbitrary portlet name (using the @component property javax.portlet.name), which provides a service for UserNotificationDefinition.class (using the @component service argument), extending UserNotificationDefinition, having a default constructor which calls super(String, long, int, String) and one or more of the add*DeliveryType methods to register properly. b) a Handler class, linked to the same portlet name as the Definition class, providing a service of UserNotificationHandler.class, extending BaseUserNotificationHandler, calling setPortletId in its default constructor, overriding setBody(), where you must not return null nor StringPool.BLANK, but get the payload from the given UserNotificationEvent and interpret it and return that (the payload is always a JSON, because the notification sending methods want a JSONObject; also, you are responsible to come up with a schema for this JSON and adhere to it whenever you send a notification). c) A sender method, which builds said payload as a JSONObject and ultimately calls userNotificationEventLocalService.sendUserNotificationEvents (whatever you pass as notificationEventJSONObject here comes out in the Handler class as a payload String; yes, the naming is inconsistent here) or derives from SubscriptionSender (see contract docs for Notification event subscription). -- Furthermore, the following options exist: 1) when sending, you can set the options "delivered" and "actionRequired", which have the following consequences: [I never found out the actual list of consequences] 2) in your handler class, you can override the getters of some flags to change them: getActionable, getApplicable, getOpenDialog, getSelector. [I never found out what exactly they are supposed to do]." Without such documentation, coding for Liferay just feels like mining tunnel after tunnel into hard rock, trying assumption after assumption on how the underlying contract might look like, but only at the end of each tunnel you know whether this tunnel has merit. And when you find your goal at the end of the tenth tunnel or so, you mark the right tunnel, but you're still not sure if you did oversee something. Regarding the editor: In this concrete case here, I think it could be solved if <p> elements get the same top/bottom margins in editor and in view and/or removing empty <p> after paragraph detection. But, ultimately, I think that problem stems from the detection of "what is a newline and what is a paragraph?", with some users insisting on hitting enter at the end of each line, even if they want to create a flowing paragraph, as if they're still working on a mechanical typewriter. Anyway, I've seen this problem pop up and down on Liferay (in Forum and Blogs components) as long as I've been working with it... i.e. since 6.1.0rc1. Currently here, it's the combination of all errors I've seen yet: single newlines are removed and double newlines produce an empty paragraph. It's as if with each ckeditor update, someone randomly remembers or forgets to apply that one patch that streamlines this behaviour. Por favor identifíquese para votar. Contestar como... Cancelar
Dave Kliczbor Dave Kliczbor Hace 3 años - Editado Also, why does this comment system double my empty lines??? Por favor identifíquese para votar. Contestar como... Cancelar David H Nebinger Dave Kliczbor Hace 3 años - Editado You should never test anything in production ;-) Notifications are tricky kind of like the asset framework can be; all of your ducks have to line up in a row. If you miss a piece, it can break notification functionality and it can be hard to figure out why. You're getting double newlines, but mine were stripped entirely. It's a known issue, but trying to balance the editor, theme, antispam and other capabilities along with the cross-browser requirements, I'm just uncertain if it is an easy problem for them to solve or not. Por favor identifíquese para votar. Contestar como... Cancelar Dave Kliczbor David H Nebinger Hace 3 años - Editado You mention "all of your ducks have to line up in a row" ... yeah, that hits the heart of my gripes with liferay's documentation. I've never found any docs listing the minimal set of ducks needed to achieve a given goal (in other words: what is the implicit contract that Liferay is assuming that my code fulfills). Something like: "To show a custom notification, you need the following things in place: a) a Definition class, linked to an arbitrary portlet name (using the @component property javax.portlet.name), which provides a service for UserNotificationDefinition.class (using the @component service argument), extending UserNotificationDefinition, having a default constructor which calls super(String, long, int, String) and one or more of the add*DeliveryType methods to register properly. b) a Handler class, linked to the same portlet name as the Definition class, providing a service of UserNotificationHandler.class, extending BaseUserNotificationHandler, calling setPortletId in its default constructor, overriding setBody(), where you must not return null nor StringPool.BLANK, but get the payload from the given UserNotificationEvent and interpret it and return that (the payload is always a JSON, because the notification sending methods want a JSONObject; also, you are responsible to come up with a schema for this JSON and adhere to it whenever you send a notification). c) A sender method, which builds said payload as a JSONObject and ultimately calls userNotificationEventLocalService.sendUserNotificationEvents (whatever you pass as notificationEventJSONObject here comes out in the Handler class as a payload String; yes, the naming is inconsistent here) or derives from SubscriptionSender (see contract docs for Notification event subscription). -- Furthermore, the following options exist: 1) when sending, you can set the options "delivered" and "actionRequired", which have the following consequences: [I never found out the actual list of consequences] 2) in your handler class, you can override the getters of some flags to change them: getActionable, getApplicable, getOpenDialog, getSelector. [I never found out what exactly they are supposed to do]." Without such documentation, coding for Liferay just feels like mining tunnel after tunnel into hard rock, trying assumption after assumption on how the underlying contract might look like, but only at the end of each tunnel you know whether this tunnel has merit. And when you find your goal at the end of the tenth tunnel or so, you mark the right tunnel, but you're still not sure if you did oversee something. Regarding the editor: In this concrete case here, I think it could be solved if <p> elements get the same top/bottom margins in editor and in view and/or removing empty <p> after paragraph detection. But, ultimately, I think that problem stems from the detection of "what is a newline and what is a paragraph?", with some users insisting on hitting enter at the end of each line, even if they want to create a flowing paragraph, as if they're still working on a mechanical typewriter. Anyway, I've seen this problem pop up and down on Liferay (in Forum and Blogs components) as long as I've been working with it... i.e. since 6.1.0rc1. Currently here, it's the combination of all errors I've seen yet: single newlines are removed and double newlines produce an empty paragraph. It's as if with each ckeditor update, someone randomly remembers or forgets to apply that one patch that streamlines this behaviour. Por favor identifíquese para votar. Contestar como... Cancelar
David H Nebinger Dave Kliczbor Hace 3 años - Editado You should never test anything in production ;-) Notifications are tricky kind of like the asset framework can be; all of your ducks have to line up in a row. If you miss a piece, it can break notification functionality and it can be hard to figure out why. You're getting double newlines, but mine were stripped entirely. It's a known issue, but trying to balance the editor, theme, antispam and other capabilities along with the cross-browser requirements, I'm just uncertain if it is an easy problem for them to solve or not. Por favor identifíquese para votar. Contestar como... Cancelar Dave Kliczbor David H Nebinger Hace 3 años - Editado You mention "all of your ducks have to line up in a row" ... yeah, that hits the heart of my gripes with liferay's documentation. I've never found any docs listing the minimal set of ducks needed to achieve a given goal (in other words: what is the implicit contract that Liferay is assuming that my code fulfills). Something like: "To show a custom notification, you need the following things in place: a) a Definition class, linked to an arbitrary portlet name (using the @component property javax.portlet.name), which provides a service for UserNotificationDefinition.class (using the @component service argument), extending UserNotificationDefinition, having a default constructor which calls super(String, long, int, String) and one or more of the add*DeliveryType methods to register properly. b) a Handler class, linked to the same portlet name as the Definition class, providing a service of UserNotificationHandler.class, extending BaseUserNotificationHandler, calling setPortletId in its default constructor, overriding setBody(), where you must not return null nor StringPool.BLANK, but get the payload from the given UserNotificationEvent and interpret it and return that (the payload is always a JSON, because the notification sending methods want a JSONObject; also, you are responsible to come up with a schema for this JSON and adhere to it whenever you send a notification). c) A sender method, which builds said payload as a JSONObject and ultimately calls userNotificationEventLocalService.sendUserNotificationEvents (whatever you pass as notificationEventJSONObject here comes out in the Handler class as a payload String; yes, the naming is inconsistent here) or derives from SubscriptionSender (see contract docs for Notification event subscription). -- Furthermore, the following options exist: 1) when sending, you can set the options "delivered" and "actionRequired", which have the following consequences: [I never found out the actual list of consequences] 2) in your handler class, you can override the getters of some flags to change them: getActionable, getApplicable, getOpenDialog, getSelector. [I never found out what exactly they are supposed to do]." Without such documentation, coding for Liferay just feels like mining tunnel after tunnel into hard rock, trying assumption after assumption on how the underlying contract might look like, but only at the end of each tunnel you know whether this tunnel has merit. And when you find your goal at the end of the tenth tunnel or so, you mark the right tunnel, but you're still not sure if you did oversee something. Regarding the editor: In this concrete case here, I think it could be solved if <p> elements get the same top/bottom margins in editor and in view and/or removing empty <p> after paragraph detection. But, ultimately, I think that problem stems from the detection of "what is a newline and what is a paragraph?", with some users insisting on hitting enter at the end of each line, even if they want to create a flowing paragraph, as if they're still working on a mechanical typewriter. Anyway, I've seen this problem pop up and down on Liferay (in Forum and Blogs components) as long as I've been working with it... i.e. since 6.1.0rc1. Currently here, it's the combination of all errors I've seen yet: single newlines are removed and double newlines produce an empty paragraph. It's as if with each ckeditor update, someone randomly remembers or forgets to apply that one patch that streamlines this behaviour. Por favor identifíquese para votar. Contestar como... Cancelar
Dave Kliczbor David H Nebinger Hace 3 años - Editado You mention "all of your ducks have to line up in a row" ... yeah, that hits the heart of my gripes with liferay's documentation. I've never found any docs listing the minimal set of ducks needed to achieve a given goal (in other words: what is the implicit contract that Liferay is assuming that my code fulfills). Something like: "To show a custom notification, you need the following things in place: a) a Definition class, linked to an arbitrary portlet name (using the @component property javax.portlet.name), which provides a service for UserNotificationDefinition.class (using the @component service argument), extending UserNotificationDefinition, having a default constructor which calls super(String, long, int, String) and one or more of the add*DeliveryType methods to register properly. b) a Handler class, linked to the same portlet name as the Definition class, providing a service of UserNotificationHandler.class, extending BaseUserNotificationHandler, calling setPortletId in its default constructor, overriding setBody(), where you must not return null nor StringPool.BLANK, but get the payload from the given UserNotificationEvent and interpret it and return that (the payload is always a JSON, because the notification sending methods want a JSONObject; also, you are responsible to come up with a schema for this JSON and adhere to it whenever you send a notification). c) A sender method, which builds said payload as a JSONObject and ultimately calls userNotificationEventLocalService.sendUserNotificationEvents (whatever you pass as notificationEventJSONObject here comes out in the Handler class as a payload String; yes, the naming is inconsistent here) or derives from SubscriptionSender (see contract docs for Notification event subscription). -- Furthermore, the following options exist: 1) when sending, you can set the options "delivered" and "actionRequired", which have the following consequences: [I never found out the actual list of consequences] 2) in your handler class, you can override the getters of some flags to change them: getActionable, getApplicable, getOpenDialog, getSelector. [I never found out what exactly they are supposed to do]." Without such documentation, coding for Liferay just feels like mining tunnel after tunnel into hard rock, trying assumption after assumption on how the underlying contract might look like, but only at the end of each tunnel you know whether this tunnel has merit. And when you find your goal at the end of the tenth tunnel or so, you mark the right tunnel, but you're still not sure if you did oversee something. Regarding the editor: In this concrete case here, I think it could be solved if <p> elements get the same top/bottom margins in editor and in view and/or removing empty <p> after paragraph detection. But, ultimately, I think that problem stems from the detection of "what is a newline and what is a paragraph?", with some users insisting on hitting enter at the end of each line, even if they want to create a flowing paragraph, as if they're still working on a mechanical typewriter. Anyway, I've seen this problem pop up and down on Liferay (in Forum and Blogs components) as long as I've been working with it... i.e. since 6.1.0rc1. Currently here, it's the combination of all errors I've seen yet: single newlines are removed and double newlines produce an empty paragraph. It's as if with each ckeditor update, someone randomly remembers or forgets to apply that one patch that streamlines this behaviour. Por favor identifíquese para votar. Contestar como... Cancelar
Chirag Patel Hace 3 años - Editado Hi David, I'm using Liferay 7 CE server and have many custom portlets installed in it. I have one custom entity/table named partner which has LicenceUpto Date. On every login event and site page opening event we have to validate License expiration, if expired we have to show notification that 'Your License expired'. can you please give idea how to achieve that? Por favor identifíquese para votar. Contestar como... Cancelar David H Nebinger Chirag Patel Hace 3 años - Editado There's a couple of ways to skin this cat... Build this out as a portlet. One that does the check. It would render nothing if license is fine or add this banner (not a notification) if it is expired. Then drop it on every page and let it sit there. Another way would be to embed it into portal_normal in your theme to invoke a local method on the service, i.e. isLicenceExpired() (one you write yourself) and then use in the FM as an indicator to add the banner. Notifications, as presented here, are really more of "event notifications", i.e. you have a new workflow task or someone commented on your blog, those kinds of things. The thing you are describing to me isn't really an event notification as much as it is more of a system status. Por favor identifíquese para votar. Contestar como... Cancelar Chirag Patel David H Nebinger Hace 3 años - Editado Hi David, Thanks for the reply! Just want to add something, I want to show notification/alert as like below message : 'Danger Due to inactivity, your session has expired. Please save any data you may have entered before refreshing the page.' This notification/alert comes when user session has time out. One more thing, I'm using servlet.service.events.pre and login.events.pre events in which I have to validate License expiration and from that I have to send notification/alerts like session expiration. Por favor identifíquese para votar. Contestar como... Cancelar
David H Nebinger Chirag Patel Hace 3 años - Editado There's a couple of ways to skin this cat... Build this out as a portlet. One that does the check. It would render nothing if license is fine or add this banner (not a notification) if it is expired. Then drop it on every page and let it sit there. Another way would be to embed it into portal_normal in your theme to invoke a local method on the service, i.e. isLicenceExpired() (one you write yourself) and then use in the FM as an indicator to add the banner. Notifications, as presented here, are really more of "event notifications", i.e. you have a new workflow task or someone commented on your blog, those kinds of things. The thing you are describing to me isn't really an event notification as much as it is more of a system status. Por favor identifíquese para votar. Contestar como... Cancelar Chirag Patel David H Nebinger Hace 3 años - Editado Hi David, Thanks for the reply! Just want to add something, I want to show notification/alert as like below message : 'Danger Due to inactivity, your session has expired. Please save any data you may have entered before refreshing the page.' This notification/alert comes when user session has time out. One more thing, I'm using servlet.service.events.pre and login.events.pre events in which I have to validate License expiration and from that I have to send notification/alerts like session expiration. Por favor identifíquese para votar. Contestar como... Cancelar
Chirag Patel David H Nebinger Hace 3 años - Editado Hi David, Thanks for the reply! Just want to add something, I want to show notification/alert as like below message : 'Danger Due to inactivity, your session has expired. Please save any data you may have entered before refreshing the page.' This notification/alert comes when user session has time out. One more thing, I'm using servlet.service.events.pre and login.events.pre events in which I have to validate License expiration and from that I have to send notification/alerts like session expiration. Por favor identifíquese para votar. Contestar como... Cancelar
Yisel Saez Hace 2 años - Editado Hi, Hello, very good publication, thank you. It has served as a guide because I am implementing a module in which the user can create personalized notifications through a form that consists of two inputs for the title and body of the notification and finally a submit button. When you click on the submit button the notification is created, however I have modified the code, specifically the AdminLoginUserNotificationHandler class to take this information from the view but all the notifications are taking the same text, even the ones that were previously created. Why is this happening? Por favor identifíquese para votar. Contestar como... Cancelar