use of org.apache.shindig.protocol.RestfulCollection in project liferay-ide by liferay.
the class LiferayActivityService method doGetActivities.
public RestfulCollection<Activity> doGetActivities(Set<UserId> userIds, GroupId groupId, String appId, Set<String> fields, CollectionOptions collectionOptions, SecurityToken securityToken) throws Exception {
ThemeDisplay themeDisplay = getThemeDisplay(securityToken);
List<Activity> activities = new ArrayList<Activity>();
for (UserId userId : userIds) {
long userIdLong = GetterUtil.getLong(userId.getUserId(securityToken));
List<Activity> personActivities = getActivities(themeDisplay, userIdLong);
activities.addAll(personActivities);
}
return new RestfulCollection<Activity>(activities, collectionOptions.getFirst(), activities.size(), collectionOptions.getMax());
}
use of org.apache.shindig.protocol.RestfulCollection in project liferay-ide by liferay.
the class LiferayActivityService method doGetActivities.
public RestfulCollection<Activity> doGetActivities(UserId userId, GroupId groupId, String appId, Set<String> fields, CollectionOptions collectionOptions, Set<String> activityIds, SecurityToken securityToken) throws Exception {
ThemeDisplay themeDisplay = getThemeDisplay(securityToken);
long userIdLong = GetterUtil.getLong(userId.getUserId(securityToken));
List<Activity> activities = getActivities(themeDisplay, userIdLong);
return new RestfulCollection<Activity>(activities, collectionOptions.getFirst(), activities.size(), collectionOptions.getMax());
}
use of org.apache.shindig.protocol.RestfulCollection in project liferay-ide by liferay.
the class LiferayAlbumService method doGetAlbums.
protected RestfulCollection<Album> doGetAlbums(UserId userId, String appId, Set<String> fields, CollectionOptions collectionOptions, Set<String> albumIds, SecurityToken securityToken) throws Exception {
List<Album> albums = new ArrayList<Album>();
for (String albumId : albumIds) {
Folder folder = DLAppServiceUtil.getFolder(GetterUtil.getLong(albumId));
Album album = toAlbum(folder, fields, securityToken);
albums.add(album);
}
return new RestfulCollection<Album>(albums, collectionOptions.getFirst(), albums.size(), collectionOptions.getMax());
}
use of org.apache.shindig.protocol.RestfulCollection in project liferay-ide by liferay.
the class LiferayAlbumService method doGetAlbums.
protected RestfulCollection<Album> doGetAlbums(Set<UserId> userIds, GroupId groupId, String appId, Set<String> fields, CollectionOptions collectionOptions, SecurityToken securityToken) throws Exception {
List<Album> albums = new ArrayList<Album>();
for (UserId userId : userIds) {
String userIdString = userId.getUserId(securityToken);
long userIdLong = GetterUtil.getLong(userIdString);
User user = UserLocalServiceUtil.getUserById(userIdLong);
if (!ShindigUtil.isValidUser(user)) {
continue;
}
List<Folder> folders = new ArrayList<Folder>();
GroupId.Type groupIdType = groupId.getType();
if (groupIdType.equals(GroupId.Type.all) || groupIdType.equals(GroupId.Type.friends) || groupIdType.equals(GroupId.Type.groupId)) {
List<User> socialUsers = UserLocalServiceUtil.getSocialUsers(user.getUserId(), SocialRelationConstants.TYPE_BI_FRIEND, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
for (User socialUser : socialUsers) {
Group group = socialUser.getGroup();
List<Folder> friendFolders = DLAppServiceUtil.getFolders(group.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID);
folders.addAll(friendFolders);
}
} else if (groupIdType.equals(GroupId.Type.self)) {
Group group = user.getGroup();
folders = DLAppServiceUtil.getFolders(group.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID);
}
for (Folder folder : folders) {
Album album = toAlbum(folder, fields, securityToken);
albums.add(album);
}
}
return new RestfulCollection<Album>(albums, collectionOptions.getFirst(), albums.size(), collectionOptions.getMax());
}
use of org.apache.shindig.protocol.RestfulCollection in project liferay-ide by liferay.
the class LiferayPersonService method doGetPeople.
protected RestfulCollection<Person> doGetPeople(Set<UserId> userIds, GroupId groupId, CollectionOptions collectionOptions, Set<String> fields, SecurityToken securityToken) throws Exception {
List<Person> people = new ArrayList<Person>();
for (UserId userId : userIds) {
Person person = null;
String userIdString = userId.getUserId(securityToken);
GroupId.Type groupIdType = groupId.getType();
if (groupIdType.equals(GroupId.Type.all) || groupIdType.equals(GroupId.Type.friends) || groupIdType.equals(GroupId.Type.groupId)) {
long userIdLong = GetterUtil.getLong(userIdString);
User user = UserLocalServiceUtil.getUserById(userIdLong);
List<User> friends = UserLocalServiceUtil.getSocialUsers(user.getUserId(), SocialRelationConstants.TYPE_BI_FRIEND, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
for (User friend : friends) {
person = getUserPerson(friend, fields, securityToken);
people.add(person);
}
} else if (groupIdType.equals(GroupId.Type.self)) {
person = doGetPerson(userId, fields, securityToken);
people.add(person);
}
}
return new RestfulCollection<Person>(people, collectionOptions.getFirst(), people.size(), collectionOptions.getMax());
}
Aggregations