public function createPOSTConversationMessageStatus(ConversationMessageStatusObject $messageStatusObject) { $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_CONVERSATION . '/' . $messageStatusObject->getConversationID() . '/' . self::RESOURCE_NAME_MESSAGE . '/' . $messageStatusObject->getTargetID() . '/' . self::RESOURCE_NAME_STATUS); $this->request->setRequestMethod('POST'); $this->request->setRequestBody($messageStatusObject->getJSONString()); return $this; }
public function build() { if ($this->objectID == NULL) { $this->objectID = UOID::createUOID(); } if ($this->datetime == NULL) { $this->datetime = XSDDateTime::getXSDDateTime(); } if (!UOID::isValid($this->objectID)) { throw new IllegalModelStateException('Invalid objectID'); } if (!UOID::isValid($this->conversationID)) { throw new IllegalModelStateException('Invalid conversationID'); } if (!UOID::isValid($this->targetID)) { throw new IllegalModelStateException('Invalid targetID'); } if (!GID::isValid($this->author)) { throw new IllegalModelStateException('Invalid author'); } if ($this->status == '' || $this->status == NULL) { throw new IllegalModelStateException('Invalid status: ' . $this->status); } if ($this->status != ConversationMessageStatusObject::STATUS_READ && $this->status != ConversationMessageStatusObject::STATUS_RECEIVED && $this->status != ConversationMessageStatusObject::STATUS_DELETED) { throw new IllegalModelStateException('Invalid status: ' . $this->status); } if (!XSDDateTime::validateXSDDateTime($this->datetime)) { throw new IllegalModelStateException('Invalid datetime: ' . $this->datetime); } $conversationMessageStatus = new ConversationMessageStatusObject($this); if ($conversationMessageStatus->getSignature() == NULL) { $conversationMessageStatus->signObject(); } if (!$conversationMessageStatus->verifyObjectSignature()) { throw new IllegalModelStateException('Invalid signature'); } return $conversationMessageStatus; }