You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by ch...@apache.org on 2008/07/20 13:15:28 UTC
svn commit: r678268 - in /incubator/shindig/trunk:
features/opensocial-current/ php/src/social-api/dataservice/
php/src/social-api/samplecontainer/
Author: chabotc
Date: Sun Jul 20 04:15:27 2008
New Revision: 678268
URL: http://svn.apache.org/viewvc?rev=678268&view=rev
Log:
SHINDIG-461 - Add support for networkDistance
Modified:
incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js
incubator/shindig/trunk/php/src/social-api/dataservice/PeopleHandler.php
incubator/shindig/trunk/php/src/social-api/dataservice/PeopleService.php
incubator/shindig/trunk/php/src/social-api/dataservice/RestRequestItem.php
incubator/shindig/trunk/php/src/social-api/samplecontainer/BasicPeopleService.php
Modified: incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js?rev=678268&r1=678267&r2=678268&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js (original)
+++ incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js Sun Jul 20 04:15:27 2008
@@ -250,13 +250,15 @@
url += "&orderBy=" + (opt_params['sortOrder'] || 'topFriends');
// TODO: This filterBy isn't in the spec
url += "&filterBy=" + (opt_params['filter'] || 'all');
-
+ if (opt_params['networkDistance']) {
+ url += "&networkDistance=" + opt_params['networkDistance'];
+ }
var me = this;
return new RestfulRequestItem(url, "GET", null,
function(rawJson) {
var jsonPeople = rawJson['entry'];
var people = [];
- for (var i = 0; i < jsonPeople.length; i++) {
+ for (var i = 0; i < jsonPeople.length; i++) {
people.push(me.createPersonFromJson(jsonPeople[i]));
}
return new opensocial.Collection(people,
Modified: incubator/shindig/trunk/php/src/social-api/dataservice/PeopleHandler.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social-api/dataservice/PeopleHandler.php?rev=678268&r1=678267&r2=678268&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social-api/dataservice/PeopleHandler.php (original)
+++ incubator/shindig/trunk/php/src/social-api/dataservice/PeopleHandler.php Sun Jul 20 04:15:27 2008
@@ -48,7 +48,7 @@
//FIXME same logic as the java code here, but doesn't seem to do much with the optionalPersonId which seems odd
return $this->service->getPerson($requestItem->getUser(), $requestItem->getGroup(), $fields, $requestItem->getToken());
}
- return $this->service->getPeople($requestItem->getUser(), $requestItem->getGroup(), $requestItem->getOrderBy(), $requestItem->getFilterBy(), $requestItem->getStartIndex(), $requestItem->getCount(), $fields, $requestItem->getToken());
+ return $this->service->getPeople($requestItem->getUser(), $requestItem->getGroup(), $requestItem->getOrderBy(), $requestItem->getFilterBy(), $requestItem->getStartIndex(), $requestItem->getCount(), $fields, $requestItem->getNetworkDistance(), $requestItem->getToken());
}
public function handleDelete(RestRequestItem $requestItem)
Modified: incubator/shindig/trunk/php/src/social-api/dataservice/PeopleService.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social-api/dataservice/PeopleService.php?rev=678268&r1=678267&r2=678268&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social-api/dataservice/PeopleService.php (original)
+++ incubator/shindig/trunk/php/src/social-api/dataservice/PeopleService.php Sun Jul 20 04:15:27 2008
@@ -18,8 +18,8 @@
*/
abstract class PeopleService {
- static public $sortOrder = array('topFriends', 'name');
- static public $filterType = array('all', 'hasApp', 'topFriends');
+ public static $sortOrder = array('topFriends', 'name');
+ public static $filterType = array('all', 'hasApp', 'topFriends');
/**
* Returns a Person object for person with $id or false on not found
@@ -40,5 +40,5 @@
* @param max The max number of people to fetch.
* @return a list of people.
*/
- abstract public function getPeople($userId, $groupId, $sortOrder, $filter, $first, $max, $profileDetails, SecurityToken $token);
+ abstract public function getPeople($userId, $groupId, $sortOrder, $filter, $first, $max, $profileDetails, $networkDistance, SecurityToken $token);
}
Modified: incubator/shindig/trunk/php/src/social-api/dataservice/RestRequestItem.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social-api/dataservice/RestRequestItem.php?rev=678268&r1=678267&r2=678268&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social-api/dataservice/RestRequestItem.php (original)
+++ incubator/shindig/trunk/php/src/social-api/dataservice/RestRequestItem.php Sun Jul 20 04:15:27 2008
@@ -28,6 +28,7 @@
public static $START_INDEX = "startIndex";
public static $COUNT = "count";
public static $ORDER_BY = "orderBy";
+ public static $NETWORK_DISTANCE = "networkDistance";
public static $FILTER_BY = "filterBy";
public static $FIELDS = "fields";
@@ -140,7 +141,7 @@
public function getStartIndex()
{
- if (!empty($this->parameters[self::$START_INDEX])) {
+ if (! empty($this->parameters[self::$START_INDEX])) {
return $this->parameters[self::$START_INDEX];
} else {
return self::$DEFAULT_START_INDEX;
@@ -149,7 +150,7 @@
public function getCount()
{
- if (!empty($this->parameters[self::$COUNT])) {
+ if (! empty($this->parameters[self::$COUNT])) {
return $this->parameters[self::$COUNT];
} else {
return self::$DEFAULT_COUNT;
@@ -158,19 +159,28 @@
public function getOrderBy()
{
- if (!empty($this->parameters[self::$ORDER_BY])) {
+ if (! empty($this->parameters[self::$ORDER_BY])) {
return $this->parameters[self::$ORDER_BY];
} else {
return PeopleService::$sortOrder;
}
}
+ public function getNetworkDistance()
+ {
+ if (! empty($this->parameters[self::$NETWORK_DISTANCE])) {
+ return $this->parameters[self::$NETWORK_DISTANCE];
+ } else {
+ return false;
+ }
+ }
+
public function getFilterBy()
{
- if (!empty($this->parameters[self::$FILTER_BY])) {
+ if (! empty($this->parameters[self::$FILTER_BY])) {
return $this->parameters[self::$FILTER_BY];
} else {
- return PeopleService::$filterType;
+ return PeopleService::$filterType;
}
}
@@ -181,7 +191,7 @@
public function getFieldsWithDefaultValue(Array $defaultValue)
{
- if (!empty($this->parameters[self::$FIELDS])) {
+ if (! empty($this->parameters[self::$FIELDS])) {
$paramValue = $this->parameters[self::$FIELDS];
return explode(',', $paramValue);
} else {
Modified: incubator/shindig/trunk/php/src/social-api/samplecontainer/BasicPeopleService.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social-api/samplecontainer/BasicPeopleService.php?rev=678268&r1=678267&r2=678268&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social-api/samplecontainer/BasicPeopleService.php (original)
+++ incubator/shindig/trunk/php/src/social-api/samplecontainer/BasicPeopleService.php Sun Jul 20 04:15:27 2008
@@ -31,7 +31,7 @@
public function getPerson($userId, $groupId, $profileDetails, SecurityToken $token)
{
- $person = $this->getPeople($userId, $groupId, null, null, null, null, $profileDetails, $token);
+ $person = $this->getPeople($userId, $groupId, null, null, null, null, $profileDetails, $token, null);
// return of getPeople is a ResponseItem(RestfulCollection(ArrayOfPeople)), disassemble to return just one person
$person = $person->getResponse()->getEntry();
if (is_array($person) && count($person) == 1) {
@@ -40,7 +40,7 @@
return new ResponseItem(NOT_FOUND, "Person not found", null);
}
- public function getPeople($userId, $groupId, $sortOrder, $filter, $first, $max, $profileDetails, SecurityToken $token)
+ public function getPeople($userId, $groupId, $sortOrder, $filter, $first, $max, $profileDetails, $networkDistance, SecurityToken $token)
{
$ids = array();
$group = is_object($groupId) ? $groupId->getType() : '';
@@ -58,7 +58,7 @@
break;
}
$allPeople = XmlStateFileFetcher::get()->getAllPeople();
- if (!$token->isAnonymous() && $filter == "hasApp") {
+ if (! $token->isAnonymous() && $filter == "hasApp") {
$appId = $token->getAppId();
$peopleWithApp = XmlStateFileFetcher::get()->getPeopleWithApp($appId);
}
@@ -70,13 +70,13 @@
$person = null;
if (is_array($allPeople) && isset($allPeople[$id])) {
$person = $allPeople[$id];
- if (!$token->isAnonymous() && $id == $token->getViewerId()) {
+ if (! $token->isAnonymous() && $id == $token->getViewerId()) {
$person->setIsViewer(true);
}
- if (!$token->isAnonymous() && $id == $token->getOwnerId()) {
+ if (! $token->isAnonymous() && $id == $token->getOwnerId()) {
$person->setIsOwner(true);
}
- if (is_array($profileDetails) && count($profileDetails) && !in_array('all', $profileDetails)) {
+ if (is_array($profileDetails) && count($profileDetails) && ! in_array('all', $profileDetails)) {
$newPerson = array();
$newPerson['isOwner'] = $person->isOwner;
$newPerson['isViewer'] = $person->isViewer;