/**
  * Handle update event
  * 
  * called by ilTaskScheduler
  * 
  * @param ilECSSetting $a_server
  * @param int $a_econtent_id
  * @param array $a_mids
  * @return boolean
  */
 public function handleUpdate(ilECSSetting $a_server, $a_econtent_id, array $a_mids)
 {
     global $ilLog;
     // get content details
     include_once './Services/WebServices/ECS/classes/class.ilECSEContentDetails.php';
     $details = ilECSEContentDetails::getInstance($a_server->getServerId(), $a_econtent_id, $this->getECSObjectType());
     if (!$details instanceof ilECSEContentDetails) {
         $this->handleDelete($a_server, $a_econtent_id);
         $ilLog->write(__METHOD__ . ': Handling delete of deprecated remote object. DONE');
         return;
     }
     $ilLog->write(__METHOD__ . ': Receivers are ' . print_r($details->getReceivers(), true));
     $ilLog->write(__METHOD__ . ': Senders are ' . print_r($details->getSenders(), true));
     // check owner (sender mid)
     include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
     if (!ilECSParticipantSettings::getInstanceByServerId($a_server->getServerId())->isImportAllowed($details->getSenders())) {
         $ilLog->write('Ignoring disabled participant. MID: ' . $details->getOwner());
         return true;
     }
     // new mids
     include_once 'Services/WebServices/ECS/classes/class.ilECSImport.php';
     include_once 'Services/WebServices/ECS/classes/class.ilECSConnector.php';
     foreach (array_intersect($a_mids, $details->getReceivers()) as $mid) {
         try {
             $connector = new ilECSConnector($a_server);
             $res = $connector->getResource($this->getECSObjectType(), $a_econtent_id);
             if ($res->getHTTPCode() == ilECSConnector::HTTP_CODE_NOT_FOUND) {
                 continue;
             }
             $json = $res->getResult();
             $GLOBALS['ilLog']->write(__METHOD__ . ': Received json: ' . print_r($json, true));
             if (!is_object($json)) {
                 // try as array (workaround for invalid content)
                 $json = $json[0];
                 if (!is_object($json)) {
                     throw new ilECSConnectorException('invalid json');
                 }
             }
         } catch (ilECSConnectorException $exc) {
             $ilLog->write(__METHOD__ . ': Error parsing result. ' . $exc->getMessage());
             $ilLog->logStack();
             return false;
         }
         // Update existing
         // Check receiver mid
         if ($obj_id = ilECSImport::_isImported($a_server->getServerId(), $a_econtent_id, $mid)) {
             $ilLog->write(__METHOD__ . ': Handling update for existing object');
             $remote = ilObjectFactory::getInstanceByObjId($obj_id, false);
             if (!$remote instanceof ilRemoteObjectBase) {
                 $ilLog->write(__METHOD__ . ': Cannot instantiate remote object. Got object type ' . $remote->getType());
                 continue;
             }
             $remote->updateFromECSContent($a_server, $json, $details->getMySender());
         } else {
             $GLOBALS['ilLog']->write(__METHOD__ . ': my sender ' . $details->getMySender() . 'vs mid' . $mid);
             $ilLog->write(__METHOD__ . ': Handling create for non existing object');
             $this->createFromECSEContent($a_server, $json, $details->getMySender());
             // update import status
             $ilLog->write(__METHOD__ . ': Updating import status');
             include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
             $import = new ilECSImport($a_server->getServerId(), $this->getId());
             $import->setEContentId($a_econtent_id);
             // Store receiver mid
             $import->setMID($mid);
             $import->save();
             $ilLog->write(__METHOD__ . ': Sending notification');
             $this->sendNewContentNotification($a_server->getServerId());
         }
     }
     $ilLog->write(__METHOD__ . ': done');
     return true;
 }
 /**
  * get enabled participants
  *
  * @access public
  * 
  */
 public function getEnabledParticipants()
 {
     include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
     $ps = ilECSParticipantSettings::getInstanceByServerId($this->getServer()->getServerId());
     $en = $ps->getEnabledParticipants();
     foreach ($this->getCommunities() as $community) {
         foreach ($community->getParticipants() as $participant) {
             if (in_array($participant->getMid(), $en)) {
                 $e_part[] = $participant;
             }
         }
     }
     return $e_part ? $e_part : array();
 }