public function createPOSTSearchQuery(SearchQueryObject $searchQueryObject) { $this->request = new OutgoingRequest(); $this->request->setServer($this->getDomainFromProfileLocation($this->targetSocialRecord->getProfileLocation())); $this->request->setPath($this->getPathFromProfileLocation($this->targetSocialRecord->getProfileLocation()) . $this->targetSocialRecord->getGlobalID() . '/' . self::RESOURCE_NAME_SEARCH); $this->request->setRequestMethod('POST'); $this->request->setRequestBody($searchQueryObject->getJSONString()); return $this; }
public function build() { if ($this->objectID == NULL) { $this->objectID = UOID::createUOID(); } if ($this->hopCount == NULL) { $this->hopCount = 0; } if ($this->datetime == NULL) { $this->datetime = XSDDateTime::getXSDDateTime(); } if (!UOID::isValid($this->objectID)) { throw new IllegalModelStateException('Invalid objectID'); } if (!GID::isValid($this->initiatingGID)) { throw new IllegalModelStateException('Invalid initiatingGID'); } if (!is_numeric($this->hopCount) || $this->hopCount > 3) { throw new IllegalModelStateException('Invalid value for hopCount'); } if (!XSDDateTime::validateXSDDateTime($this->datetime)) { throw new IllegalModelStateException('Invalid datetime'); } if ($this->query === NULL || !$this->query instanceof ESQuery) { throw new IllegalModelStateException('Invalid value for query'); } $searchQuery = new SearchQueryObject($this); if ($searchQuery->getSignature() == NULL) { $searchQuery->signObject(); } if (!$searchQuery->verifyObjectSignature()) { throw new IllegalModelStateException('Invalid signature'); } return $searchQuery; }