List of usage examples for com.liferay.portal.kernel.messaging DestinationNames ASYNC_SERVICE
String ASYNC_SERVICE
To view the source code for com.liferay.portal.kernel.messaging DestinationNames ASYNC_SERVICE.
Click Source Link
From source file:com.liferay.google.mail.groups.hook.listeners.GroupModelListener.java
License:Open Source License
@Override public void onAfterAddAssociation(Object classPK, String associationClassName, Object associationClassPK) { try {/*from w w w.java2 s.c om*/ final Group group = GroupLocalServiceUtil.getGroup((Long) classPK); final List<User> users = getUsers(classPK, associationClassName, associationClassPK); Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { MessageBusUtil.sendMessage(DestinationNames.ASYNC_SERVICE, new OnAssociationProcessCallable(group, users, "addGroupMembers")); return null; } }; TransactionCommitCallbackRegistryUtil.registerCallback(callable); } catch (Exception e) { _log.error(e, e); } }
From source file:com.liferay.google.mail.groups.hook.listeners.GroupModelListener.java
License:Open Source License
@Override public void onAfterRemoveAssociation(Object classPK, String associationClassName, Object associationClassPK) { try {// w w w .j av a2 s. c o m final Group group = GroupLocalServiceUtil.getGroup((Long) classPK); final List<User> users = getUsers(classPK, associationClassName, associationClassPK); Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { MessageBusUtil.sendMessage(DestinationNames.ASYNC_SERVICE, new OnAssociationProcessCallable(group, users, "deleteGroupMembers")); return null; } }; TransactionCommitCallbackRegistryUtil.registerCallback(callable); } catch (Exception e) { _log.error(e, e); } }
From source file:com.liferay.google.mail.groups.hook.listeners.RoleModelListener.java
License:Open Source License
@Override public void onAfterAddAssociation(Object classPK, String associationClassName, Object associationClassPK) { try {/*from w ww . ja v a2 s. co m*/ final List<User> users = getUsers(classPK, associationClassName, associationClassPK); Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { MessageBusUtil.sendMessage(DestinationNames.ASYNC_SERVICE, new OnAssociationProcessCallable(users, "MANAGER")); return null; } }; TransactionCommitCallbackRegistryUtil.registerCallback(callable); } catch (Exception e) { _log.error(e, e); } }
From source file:com.liferay.google.mail.groups.hook.listeners.RoleModelListener.java
License:Open Source License
@Override public void onAfterRemoveAssociation(Object classPK, String associationClassName, Object associationClassPK) { try {/*w ww. j av a 2s . c o m*/ final List<User> users = getUsers(classPK, associationClassName, associationClassPK); Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { MessageBusUtil.sendMessage(DestinationNames.ASYNC_SERVICE, new OnAssociationProcessCallable(users, "MEMBER")); return null; } }; TransactionCommitCallbackRegistryUtil.registerCallback(callable); } catch (Exception e) { _log.error(e, e); } }
From source file:com.liferay.google.mail.groups.hook.listeners.UserModelListener.java
License:Open Source License
@Override public void onAfterAddAssociation(Object classPK, String associationClassName, Object associationClassPK) { try {//from w w w . jav a 2 s. c o m final List<Group> groups = getGroups(associationClassName, associationClassPK); final User user = UserLocalServiceUtil.getUser((Long) classPK); Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { MessageBusUtil.sendMessage(DestinationNames.ASYNC_SERVICE, new OnAssociationProcessCallable(groups, user, "addGroupMembers")); return null; } }; TransactionCommitCallbackRegistryUtil.registerCallback(callable); } catch (Exception e) { _log.error(e, e); } }
From source file:com.liferay.google.mail.groups.hook.listeners.UserModelListener.java
License:Open Source License
@Override public void onAfterRemoveAssociation(Object classPK, String associationClassName, Object associationClassPK) { try {//from ww w .j a v a 2s .c o m final List<Group> groups = getGroups(associationClassName, associationClassPK); final User user = UserLocalServiceUtil.getUser((Long) classPK); Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { MessageBusUtil.sendMessage(DestinationNames.ASYNC_SERVICE, new OnAssociationProcessCallable(groups, user, "deleteGroupMembers")); return null; } }; TransactionCommitCallbackRegistryUtil.registerCallback(callable); } catch (Exception e) { _log.error(e, e); } }
From source file:com.liferay.google.mail.groups.hook.service.impl.GoogleMailGroupsGroupLocalServiceImpl.java
License:Open Source License
@Override public Group updateFriendlyURL(long groupId, String friendlyURL) throws PortalException { Group group = GroupLocalServiceUtil.getGroup(groupId); String oldFriendlyURL = group.getFriendlyURL(); String oldGroupEmailAddress = GoogleMailGroupsUtil.getGroupEmailAddress(group); group = super.updateFriendlyURL(groupId, friendlyURL); MessageBusUtil.sendMessage(DestinationNames.ASYNC_SERVICE, new UpdateGGroupProcessCallable(group, oldFriendlyURL, oldGroupEmailAddress)); return group; }
From source file:com.liferay.google.mail.groups.hook.service.impl.GoogleMailGroupsGroupLocalServiceImpl.java
License:Open Source License
@Override public Group updateGroup(long groupId, long parentGroupId, String name, String description, int type, boolean manualMembership, int membershipRestriction, String friendlyURL, boolean active, ServiceContext serviceContext) throws PortalException { Group group = GroupLocalServiceUtil.getGroup(groupId); String oldFriendlyURL = group.getFriendlyURL(); String oldGroupEmailAddress = GoogleMailGroupsUtil.getGroupEmailAddress(group); group = super.updateGroup(groupId, parentGroupId, name, description, type, manualMembership, membershipRestriction, friendlyURL, active, serviceContext); MessageBusUtil.sendMessage(DestinationNames.ASYNC_SERVICE, new UpdateGGroupProcessCallable(group, oldFriendlyURL, oldGroupEmailAddress)); return group; }
From source file:com.liferay.microblogs.service.impl.MicroblogsEntryLocalServiceImpl.java
License:Open Source License
protected void sendNotificationEvent(final MicroblogsEntry microblogsEntry, ServiceContext serviceContext) throws PortalException { final JSONObject notificationEventJSONObject = JSONFactoryUtil.createJSONObject(); notificationEventJSONObject.put("className", MicroblogsEntry.class.getName()); notificationEventJSONObject.put("classPK", microblogsEntry.getMicroblogsEntryId()); notificationEventJSONObject.put("entryTitle", microblogsEntry.getContent()); AssetRendererFactory assetRendererFactory = AssetRendererFactoryRegistryUtil .getAssetRendererFactoryByClassName(MicroblogsEntry.class.getName()); AssetRenderer assetRenderer = assetRendererFactory.getAssetRenderer(microblogsEntry.getMicroblogsEntryId()); String entryURL = StringPool.BLANK; try {/*from www . j ava 2 s . c om*/ entryURL = assetRenderer.getURLViewInContext(serviceContext.getLiferayPortletRequest(), serviceContext.getLiferayPortletResponse(), null); } catch (Exception e) { } notificationEventJSONObject.put("entryURL", entryURL); notificationEventJSONObject.put("userId", microblogsEntry.getUserId()); final List<Long> receiverUserIds = MicroblogsUtil.getSubscriberUserIds(microblogsEntry); Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { MessageBusUtil.sendMessage(DestinationNames.ASYNC_SERVICE, new NotificationProcessCallable( receiverUserIds, microblogsEntry, notificationEventJSONObject)); return null; } }; TransactionCommitCallbackRegistryUtil.registerCallback(callable); }
From source file:com.liferay.notifications.hook.service.impl.AnnouncementsEntryLocalServiceImpl.java
License:Open Source License
protected void sendNotificationEvent(AnnouncementsEntry announcementEntry) throws PortalException, SystemException { JSONObject notificationEventJSONObject = JSONFactoryUtil.createJSONObject(); notificationEventJSONObject.put("classPK", announcementEntry.getEntryId()); notificationEventJSONObject.put("userId", announcementEntry.getUserId()); MessageBusUtil.sendMessage(DestinationNames.ASYNC_SERVICE, new NotificationProcessCallable(announcementEntry, notificationEventJSONObject)); }