Author: chabotc
Date: Mon Oct 13 10:30:34 2008
New Revision: 704174

URL: http://svn.apache.org/viewvc?rev=704174&view=rev
Log:
Fixed up deleting app data via REST + few small code cleanups

Modified:
    incubator/shindig/trunk/php/src/social/converters/InputAtomConverter.php
    incubator/shindig/trunk/php/src/social/converters/OutputJsonConverter.php
    incubator/shindig/trunk/php/src/social/service/AppDataHandler.php
    incubator/shindig/trunk/php/src/social/service/RestRequestItem.php

Modified: 
incubator/shindig/trunk/php/src/social/converters/InputAtomConverter.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social/converters/InputAtomConverter.php?rev=704174&r1=704173&r2=704174&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social/converters/InputAtomConverter.php 
(original)
+++ incubator/shindig/trunk/php/src/social/converters/InputAtomConverter.php 
Mon Oct 13 10:30:34 2008
@@ -24,7 +24,7 @@
 
        public function convertPeople($requestParam)
        {
-               throw new Exception("Operation not supported");
+               throw new SocialSpiException("Operation not supported", 
ResponseError::$NOT_IMPLEMENTED);
        }
 
        public function convertActivities($requestParam)

Modified: 
incubator/shindig/trunk/php/src/social/converters/OutputJsonConverter.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social/converters/OutputJsonConverter.php?rev=704174&r1=704173&r2=704174&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social/converters/OutputJsonConverter.php 
(original)
+++ incubator/shindig/trunk/php/src/social/converters/OutputJsonConverter.php 
Mon Oct 13 10:30:34 2008
@@ -68,15 +68,12 @@
                $new_json = "";
                $indent_level = 0;
                $in_string = false;
-               
                $json_obj = json_decode($json);
-               
-               if (! $json_obj)
+               if (! $json_obj) {
                        return false;
-               
+               }
                $json = json_encode($json_obj);
                $len = strlen($json);
-               
                for ($c = 0; $c < $len; $c ++) {
                        $char = $json[$c];
                        switch ($char) {
@@ -124,7 +121,6 @@
                                        break;
                        }
                }
-               
                return $new_json;
        }
 }

Modified: incubator/shindig/trunk/php/src/social/service/AppDataHandler.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social/service/AppDataHandler.php?rev=704174&r1=704173&r2=704174&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social/service/AppDataHandler.php (original)
+++ incubator/shindig/trunk/php/src/social/service/AppDataHandler.php Mon Oct 
13 10:30:34 2008
@@ -88,6 +88,8 @@
                        throw new InvalidArgumentException("Multiple userIds 
not supported");
                }               
                $values = $requestItem->getParameter("data");
+               // this used to be $requestItem->getFields() instead of using 
the fields, but that makes no sense to me
+               // better to detect the fields depending on input right?
                $fields = array();
                foreach (array_keys($values) as $key) {
                        $fields[] = $key;
@@ -95,8 +97,7 @@
                                throw new SocialSpiException("One or more of 
the app data keys are invalid: " . $key, ResponseError::$BAD_REQUEST);
                        }
                }
-               // this used to be $requestItem->getFields() instead of using 
the fields, but that makes no sense to me
-               return $this->service->updatePersonData($userIds[0], 
$requestItem->getGroup(), $requestItem->getAppId(), $fields, $values, 
$requestItem->getToken());
+               $this->service->updatePersonData($userIds[0], 
$requestItem->getGroup(), $requestItem->getAppId(), $fields, $values, 
$requestItem->getToken());
        }
 
        /**

Modified: incubator/shindig/trunk/php/src/social/service/RestRequestItem.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social/service/RestRequestItem.php?rev=704174&r1=704173&r2=704174&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social/service/RestRequestItem.php 
(original)
+++ incubator/shindig/trunk/php/src/social/service/RestRequestItem.php Mon Oct 
13 10:30:34 2008
@@ -63,6 +63,8 @@
                $service = $this->getServiceFromPath($this->url);
                switch ($service) {
                        case DataServiceServlet::$PEOPLE_ROUTE:
+                               // in our current implementation this will 
throw a SocialSPIException since we don't support 
+                               // adding people/friendships in our API yet, 
but this might be added some day
                                $data = 
$this->inputConverter->convertPeople($this->postData);
                                break;
                        case DataServiceServlet::$ACTIVITY_ROUTE:


Reply via email to