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->targetID)) { throw new IllegalModelStateException('Invalid targetID'); } if (!GID::isValid($this->author)) { throw new IllegalModelStateException('Invalid author'); } if ($this->targetGID != "" && !GID::isValid($this->targetGID)) { throw new IllegalModelStateException('Invalid targetGID: ' . $this->targetGID); } if ($this->status == '' || $this->status == NULL) { throw new IllegalModelStateException('Invalid status: ' . $this->status); } if (!XSDDateTime::validateXSDDateTime($this->datetime)) { throw new IllegalModelStateException('Invalid datetime'); } $conversationStatus = new ConversationStatusObject($this); if ($conversationStatus->getSignature() == NULL) { $conversationStatus->signObject(); } if (!$conversationStatus->verifyObjectSignature()) { throw new IllegalModelStateException('Invalid signature'); } return $conversationStatus; }