class PageService extends BasicService implements OwnerAPISupport<Page> {

	@GET
	@Path("/pages/{pageId}/references")
	@Produces(MediaType.APPLICATION_JSON)
	public PageReferences getReferences(@PathParam("pageId") long pageId) {
		Page existingPage = getExistingPage(pageId, false);
		if (!existingPage.isListPublicly() && !this.isAdmin() && !inAdminOwners(existingPage.getOwners())) {
			throwUnauthorized();
		}

		PageReferences refs = new PageReferences();

		List<Playlist> playlists = PlaylistDAO.getPlaylistsByPage(existingPage);
		for (Playlist playlist : playlists) {
			if (this.isAdmin() || inAdminOwners(playlist.getOwners())) {
				refs.addUserPlaylist(playlist);
			} else {
				refs.setForeignPlaylists(refs.getForeignPlaylists() + 1);
			}
		}

		return refs;
	}

}