List of usage examples for com.liferay.portal.kernel.json JSONObject getLong
public long getLong(String key, long defaultValue);
From source file:com.liferay.pushnotifications.service.impl.PushNotificationsEntryLocalServiceImpl.java
License:Open Source License
@Override public void sendPushNotification(long toUserId, JSONObject jsonObject, int start, int end) throws PortalException { long fromUserId = addFromUserDetails(jsonObject); JSONObject payloadJSONObject = jsonObject.getJSONObject(PushNotificationsConstants.KEY_PAYLOAD); long parentPushNotificationsEntryId = jsonObject.getLong( PushNotificationsConstants.KEY_PARENT_PUSH_NOTIFICATIONS_ENTRY_ID, PushNotificationsConstants.VALUE_PARENT_PUSH_NOTIFICATIONS_ENTRY_ID_DEFAULT); addPushNotificationsEntry(fromUserId, parentPushNotificationsEntryId, payloadJSONObject); for (Map.Entry<String, PushNotificationsSender> entry : _pushNotificationsSenders.entrySet()) { List<String> tokens = new ArrayList<String>(); List<PushNotificationsDevice> pushNotificationsDevices = pushNotificationsDeviceLocalService .getPushNotificationsDevices(toUserId, entry.getKey(), start, end); for (PushNotificationsDevice pushNotificationsDevice : pushNotificationsDevices) { tokens.add(pushNotificationsDevice.getToken()); }/*from w w w.ja v a 2 s . c o m*/ if (tokens.isEmpty()) { continue; } PushNotificationsSender pushNotificationsSender = entry.getValue(); try { pushNotificationsSender.send(tokens, jsonObject); } catch (PortalException pe) { throw pe; } catch (Exception e) { throw new PortalException(e); } } }
From source file:com.liferay.sync.internal.servlet.SyncDownloadServlet.java
License:Open Source License
private InputStream _getZipFileInputStream(JSONObject zipObjectJSONObject, long userId, long groupId) throws Exception { String uuid = zipObjectJSONObject.getString("uuid"); if (zipObjectJSONObject.getBoolean("patch")) { long sourceVersionId = zipObjectJSONObject.getLong("sourceVersionId", 0); long targetVersionId = zipObjectJSONObject.getLong("targetVersionId", 0); return getPatchDownloadServletInputStream(userId, groupId, uuid, sourceVersionId, targetVersionId); }//w ww . j a va 2 s . co m return getFileDownloadServletInputStream(userId, groupId, uuid, zipObjectJSONObject.getString("version"), zipObjectJSONObject.getLong("versionId")); }