| 1 |
<?php |
<?php |
| 2 |
// $Id$ |
// $Id: ShindigIntegratorAppDataService.php,v 1.1.4.2 2009/08/14 10:09:17 impetus Exp $ |
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 5 |
* OpenSocial AppData Service |
* OpenSocial AppData Service |
| 26 |
*/ |
*/ |
| 27 |
public function deletePersonData($userId, GroupId $groupId, $appId, $fields, SecurityToken $token) |
public function deletePersonData($userId, GroupId $groupId, $appId, $fields, SecurityToken $token) |
| 28 |
{ |
{ |
| 29 |
|
if ($fields == null || $fields[0] == '*') { |
| 30 |
|
$key = "*"; |
| 31 |
|
if (! ShindigIntegratorDbFetcher::get()->deleteAppData($userId, $key, $token->getAppId())) { |
| 32 |
|
throw new SocialSpiException("Internal server error", ResponseError::$INTERNAL_ERROR); |
| 33 |
|
} |
| 34 |
|
return null; |
| 35 |
|
} |
| 36 |
foreach ($fields as $key) { |
foreach ($fields as $key) { |
| 37 |
if (! ShindigIntegratorAppDataService::isValidKey($key)) { |
if (! ShindigIntegratorAppDataService::isValidKey($key)) { |
| 38 |
throw new SocialSpiException("The person app data key had invalid characters", ResponseError::$BAD_REQUEST); |
throw new SocialSpiException("The person app data key had invalid characters", ResponseError::$BAD_REQUEST); |
| 69 |
*/ |
*/ |
| 70 |
public function getPersonData($userId, GroupId $groupId, $appId, $fields, SecurityToken $token) |
public function getPersonData($userId, GroupId $groupId, $appId, $fields, SecurityToken $token) |
| 71 |
{ |
{ |
| 72 |
|
if (! isset($fields[0])) { |
| 73 |
|
$fields[0] = '@all'; |
| 74 |
|
} |
| 75 |
$ids = ShindigIntegratorDbFetcher::get()->getIdSet($userId, $groupId, $token); |
$ids = ShindigIntegratorDbFetcher::get()->getIdSet($userId, $groupId, $token); |
| 76 |
$data = ShindigIntegratorDbFetcher::get()->getAppData($ids, $fields, $appId); |
$data = ShindigIntegratorDbFetcher::get()->getAppData($ids, $fields, $appId); |
|
if (!count($data)) { |
|
|
throw new SocialSpiException("Data Not Found".print_r($appId, true), ResponseError::$NOT_FOUND); |
|
|
} |
|
| 77 |
return new DataCollection($data); |
return new DataCollection($data); |
| 78 |
} |
} |
| 79 |
|
|