Archive one or more objects

@param array $objectIDs List of object identifiers as integers

@return self Returns itself

@throws Exception on error
515869
public function archive(array $objectIDs) {
        $requests = [];

        foreach ($objectIDs as $objectID) {
            $requests[] = [
                'method' => 'cmdb.object.archive',
                'params' => [
                    'object' => $objectID
                ]
            ];
        }

        $this->api->batchRequest($requests);

        return $this;
    }
435461
public void writeObjectId(ObjectId objectId) throws IOException {
		_writeArrayFieldNameIfNeeded();
		_verifyValueWrite("write datetime");
		_buffer.putByte(_typeMarker, BsonConstants.TYPE_OBJECTID);
		// ObjectIds have their byte order flipped
		int time = ByteOrderUtil.flip(objectId.getTime());
		int machine = ByteOrderUtil.flip(objectId.getMachine());
		int inc = ByteOrderUtil.flip(objectId.getInc());
		_buffer.putInt(time);
		_buffer.putInt(machine);
		_buffer.putInt(inc);
		flushBuffer();
	}
1264663
public function batchRead(array $objectIDs) {
        $requests = [];

        foreach ($objectIDs as $objectID) {
            if (!is_int($objectID) || $objectID <= 0) {
                throw new BadMethodCallException('Invalid object identifiers');
            }

            $requests[] = [
                'method' => 'checkmk.tags.read',
                'params' => [
                    'objID' => $objectID
                ]
            ];
        }

        return $this->api->batchRequest($requests);
    }
1347303
protected function copyNode(ObjectId $oid) {
    $logger = $this->getLogger();
    if ($logger->isDebugEnabled()) {
      $logger->debug("Copying node ".$oid);
    }
    $persistenceFacade = $this->getPersistenceFacade();

    // load the original node
    $node = $persistenceFacade->load($oid);
    if ($node == null) {
      throw new PersistenceException("Can't load node '".$oid."'");
    }

    // check if we already have a copy of the node
    $nodeCopy = $this->getCopy($node->getOID());
    if ($nodeCopy == null) {
      // if not, create it
      $nodeCopy = $persistenceFacade->create($node->getType());
      $node->copyValues($nodeCopy, false);
    }

    // save copy
    $this->registerCopy($node, $nodeCopy);

    if ($logger->isInfoEnabled()) {
      $logger->info("Copied: ".$node->getOID()." to ".$nodeCopy->getOID());
    }
    if ($logger->isDebugEnabled()) {
      $logger->debug($nodeCopy->__toString());
    }

    // create the connections to already copied relatives
    // this must be done after saving the node in order to have a correct oid
    $mapper = $node->getMapper();
    $relations = $mapper->getRelations();
    foreach ($relations as $relation) {
      if ($relation->getOtherNavigability()) {
        $otherRole = $relation->getOtherRole();
        $relativeValue = $node->getValue($otherRole);
        $relatives = $relation->isMultiValued() ? $relativeValue :
                ($relativeValue != null ? [$relativeValue] : []);
        foreach ($relatives as $relative) {
          $copiedRelative = $this->getCopy($relative->getOID());
          if ($copiedRelative != null) {
            $nodeCopy->addNode($copiedRelative, $otherRole);
            if ($logger->isDebugEnabled()) {
              $logger->debug("Added ".$copiedRelative->getOID()." to ".$nodeCopy->getOID());
              $logger->debug($copiedRelative->__toString());
            }
          }
        }
      }
    }
    return $nodeCopy;
  }
364285
public function deleteFileById($id)
    {
        if ($id instanceof \MongoId) {
            $result = $this->getMongoCollection()->delete($id);
        } else {
            try {
                $result = $this->getMongoCollection()->delete(new \MongoId($id));
            } catch (\MongoException $e) {
                $result = $this->getMongoCollection()->delete($id);
            }
        }
        if ($result['ok'] !== (double) 1) {
            throw new Exception('Error deleting file: ' . $result['err'] . ': ' . $result['errmsg']);
        }
        
        return $this;
    }
1068198
protected function exportNodes($oids) {
    if (sizeof($oids) > 0) {
      $persistenceFacade = $this->getPersistenceFacade();
      $permissionManager = $this->getPermissionManager();

      // get document definition
      $docFile = $this->getDownloadFile();
      $type = $oids[0]->getType();

      $mapper = $persistenceFacade->getMapper($type);
      $attributes = $mapper->getAttributes();

      $translateValues = StringUtil::getBoolean($this->getRequestValue('translateValues'));

      // process nodes
      $fileHandle = fopen($docFile, "a");
      foreach ($oids as $oid) {
        if ($permissionManager->authorize($oid, '', PersistenceAction::READ)) {
          $node = $persistenceFacade->load($oid);
          $values = [];
          foreach ($attributes as $attribute) {
            $inputType = $attribute->getInputType();
            $value = $node->getValue($attribute->getName());
            // translate values if requested
            if ($translateValues) {
              $value = ValueListProvider::translateValue($value, $inputType);
            }
            $values[] = $value;
          }
          fputcsv($fileHandle, $values);
        }
      }
      fclose($fileHandle);
    }
  }
1359444
public static function updateObjectsSection( array $objectIDs, $sectionID )
    {
        $searchEngine = eZSearch::getEngine();
        if ( $searchEngine instanceof ezpSearchEngine && method_exists( $searchEngine, 'updateObjectsSection' ) )
        {
            return $searchEngine->updateObjectsSection( $objectIDs, $sectionID );
        }
        return false;
    }
1173686
private function load($id)
    {
        $fields = $this->getDbConnection()->fetchAssoc('SELECT * FROM `'.$this->objectDefinition->table.'` WHERE id = ?', array($id));
        if (!$fields) throw new \Exception('Object '.$this->objectDefinition->table.':'.$id.' is not found'); 
        $this->setFields($fields);
        $this->_id = $id;
        return $this;
    }
843819
public function readOne($objectType) {
        $result = $this->api->request(
            'cmdb.object_types',
            [
                'filter' => [
                    'id' => $objectType
                ],
                'countobjects' => true
            ]
        );

        return end($result);
    }
675870
protected function initialize()
    {
        if (is_array($this->objectIdentifiers)) {
            foreach ($this->objectIdentifiers as $identifier) {
                try {
                    parent::attach($this->persistenceManager->getObjectByIdentifier($identifier));
                } catch (Exception\InvalidObjectDataException $exception) {
                    // when security query rewriting holds back an object here, we skip it...
                }
            }
            $this->objectIdentifiers = null;
        }
    }
800406
protected function getObjectIdsForNodeIds(array $nodeIds)
    {
        $objectIds = array();

        foreach ($nodeIds as $nodeId) {
            $object = eZContentObject::fetchByNodeID($nodeId);
            if ($object instanceof eZContentObject) {
                $objectIds[] = $object->attribute('id');
            }
        }

        return $objectIds;
    }
1161766
private function initStores($storeIds)
    {
        if (!is_array($storeIds)) {
            $storeIds = explode(',', $storeIds);
        }

        $availableStores = $this->storeManager->getStores(true);

        foreach ($availableStores as $availableStore) {
            if (in_array($availableStore->getId(), $storeIds)) {
                $this->storeIds[$availableStore->getId()] = $availableStore;
            }
        }

        return $this;
    }
692240
public function batchCreate($objectID, array $messages) {
        $requests = [];

        foreach ($messages as $message) {
            $requests[] = [
                'method' => 'cmdb.logbook.create',
                'params' => [
                    'object_id' => $objectID,
                    'message' => $message
                ]
            ];
        }

        $this->api->batchRequest($requests);

        return $this;
    }
931858
public static function object($objectType)
    {
        //====================================================================//
        // First Access to Local Objects
        if (!isset(self::core()->objects)) {
            //====================================================================//
            // Initialize Local Objects Class Array
            self::core()->objects = array();
        }

        //====================================================================//
        // Check in Cache
        if (array_key_exists($objectType, self::core()->objects)) {
            return self::core()->objects[$objectType];
        }

        //====================================================================//
        // Verify if Object Class is Valid
        if (!self::validate()->isValidObject($objectType)) {
            throw new Exception('You requested access to an Invalid Object Type : '.$objectType);
        }

        //====================================================================//
        // Check if Object Manager is Overriden
        if (self::local() instanceof ObjectsProviderInterface) {
            //====================================================================//
            // Initialize Local Object Manager
            self::core()->objects[$objectType] = self::local()->object($objectType);
        } else {
            //====================================================================//
            // Initialize Standard Class
            $className = SPLASH_CLASS_PREFIX.'\\Objects\\'.$objectType;
            self::core()->objects[$objectType] = new $className();
        }

        //====================================================================//
        //  Load Translation File
        self::translator()->load('objects');

        return self::core()->objects[$objectType];
    }
294395
public static function fromObjectId( $objectId, $checkAccess = true )
    {
        $object = eZContentObject::fetch( $objectId );
        if ( $object instanceof eZContentObject )
            return self::fromObject( $object, $checkAccess );
        else
            throw new ezpContentNotFoundException( "Unable to find an eZContentObject with ID $objectId" );
    }
435528
public function setPrototypeId($objectOrId)
    {
        if ($objectOrId instanceof Prototype) {
            $objectOrId = $objectOrId->getId();
        }

        $this->setValue('prototypeId', (string) $objectOrId);
    }
428300
public function setIds($ids): self
    {
        if (\is_array($ids)) {
            $this->_params['values'] = $ids;
        } else {
            $this->_params['values'] = [$ids];
        }

        return $this;
    }