Exemplo n.º 1
0
 public function build()
 {
     if ($this->objectID == NULL) {
         $this->objectID = UOID::createUOID();
     }
     if (!UOID::isValid($this->objectID)) {
         throw new IllegalModelStateException('Invalid objectID');
     }
     if (!GID::isValid($this->owner)) {
         throw new IllegalModelStateException('Invalid owner');
     }
     if (!GID::isValid($this->author)) {
         throw new IllegalModelStateException('Invalid author');
     }
     if ($this->activity == '' || $this->activity == NULL) {
         throw new IllegalModelStateException('Invalid activity');
     }
     if (!XSDDateTime::validateXSDDateTime($this->datetime)) {
         throw new IllegalModelStateException('Invalid datetime');
     }
     $streamItem = new StreamItemObject($this);
     if ($streamItem->getSignature() == NULL) {
         $streamItem->signObject();
     }
     if (!$streamItem->verifyObjectSignature()) {
         throw new IllegalModelStateException('Invalid signature');
     }
     return $streamItem;
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 public function build()
 {
     if ($this->objectID == NULL) {
         $this->objectID = UOID::createUOID();
     }
     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 (!GID::isValid($this->tag)) {
         throw new IllegalModelStateException('Invalid tag');
     }
     if (!XSDDateTime::validateXSDDateTime($this->datePublished)) {
         throw new IllegalModelStateException('Invalid date');
     }
     $tag = new TagObject($this);
     if ($tag->getSignature() == NULL) {
         $tag->signObject();
     }
     if (!$tag->verifyObjectSignature()) {
         throw new IllegalModelStateException('Invalid signature');
     }
     return $tag;
 }
Exemplo n.º 4
0
 public function build()
 {
     if ($this->objectID == NULL) {
         $this->objectID = UOID::createUOID();
     }
     if ($this->featureList == NULL) {
         $this->featureList = array();
     }
     if ($this->datetime == NULL) {
         $this->datetime = XSDDateTime::getXSDDateTime();
     }
     if ($this->expires == NULL) {
         $this->expires = $this->datetime;
     }
     if (!UOID::isValid($this->objectID)) {
         throw new IllegalModelStateException('Invalid objectID');
     }
     $featureList = new FeatureListObject($this);
     if ($this->signature == NULL) {
         $featureList->signObject();
     }
     if (!$featureList->verifyObjectSignature()) {
         throw new IllegalModelStateException('Invalid signature');
     }
     return $featureList;
 }
 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;
 }
Exemplo n.º 6
0
 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 (!GID::isValid($this->owner)) {
         throw new IllegalModelStateException('Invalid owner');
     }
     if (!GID::isValid($this->link)) {
         throw new IllegalModelStateException('Invalid link');
     }
     if (!XSDDateTime::validateXSDDateTime($this->datetime)) {
         throw new IllegalModelStateException('Invalid datetime');
     }
     $link = new LinkObject($this);
     if ($link->getSignature() == NULL) {
         $link->signObject();
     }
     if (!$link->verifyObjectSignature()) {
         throw new IllegalModelStateException('Invalid signature');
     }
     return $link;
 }
Exemplo n.º 7
0
 public function build()
 {
     if ($this->objectID == NULL) {
         $this->objectID = UOID::createUOID();
     }
     if (!UOID::isValid($this->objectID)) {
         throw new IllegalModelStateException('Invalid objectID');
     }
     $featureObject = new FeatureObject($this);
     return $featureObject;
 }
Exemplo n.º 8
0
 public function build()
 {
     if ($this->objectID == NULL) {
         $this->objectID = UOID::createUOID();
     }
     if (!UOID::isValid($this->objectID)) {
         throw new IllegalModelStateException('Invalid objectID');
     }
     if (!GID::isValid($this->owner)) {
         throw new IllegalModelStateException('Invalid owner');
     }
     return new LinkRosterObject($this);
 }
Exemplo n.º 9
0
 public function build()
 {
     if ($this->objectID == NULL) {
         $this->objectID = UOID::createUOID();
     }
     if (!UOID::isValid($this->objectID)) {
         throw new IllegalModelStateException('Invalid objectID');
     }
     if (!GID::isValid($this->globalID)) {
         throw new IllegalModelStateException('Invalid globalID');
     }
     if ($this->displayName == '' || $this->displayName == NULL) {
         throw new IllegalModelStateException('Invalid displayName');
     }
     return new ProfileObject($this);
 }
 public function build()
 {
     if ($this->objectID == NULL) {
         $this->objectID = UOID::createUOID();
     }
     if (!UOID::isValid($this->objectID)) {
         throw new IllegalModelStateException('Invalid objectID');
     }
     if (!GID::isValid($this->owner)) {
         throw new IllegalModelStateException('Invalid owner');
     }
     if ($this->displayName == NULL) {
         throw new IllegalModelStateException('Invalid displayName');
     }
     if (!is_array($this->members)) {
         throw new IllegalModelStateException('Invalid members');
     }
     return new AccessControlGroupObject($this);
 }
Exemplo n.º 11
0
 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 (!GID::isValid($this->initiatingGID)) {
         throw new IllegalModelStateException('Invalid initiatingGID');
     }
     if (!GID::isValid($this->targetedGID)) {
         throw new IllegalModelStateException('Invalid targetedGID');
     }
     if (!XSDDateTime::validateXSDDateTime($this->datetime)) {
         throw new IllegalModelStateException('Invalid datetime');
     }
     return new LinkRequestObject($this);
 }
 public function build()
 {
     if ($this->objectID == NULL) {
         $this->objectID = UOID::createUOID();
     }
     if (!UOID::isValid($this->objectID)) {
         throw new IllegalModelStateException('Invalid objectID');
     }
     if (!UOID::isValid($this->targetID)) {
         throw new IllegalModelStateException('Invalid targetID');
     }
     if (!GID::isValid($this->platformGID)) {
         throw new IllegalModelStateException('Invalid platformGID');
     }
     if (!XSDDateTime::validateXSDDateTime($this->datetime)) {
         throw new IllegalModelStateException('Invalid datetime');
     }
     if (!is_array($this->results)) {
         throw new IllegalModelStateException('Invalid results value');
     }
     return new SearchResultCollectionObject($this);
 }
Exemplo n.º 13
0
 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 ($this->accept === true && $this->link == NULL) {
         throw new IllegalModelStateException('Invalid link');
     }
     if (!XSDDateTime::validateXSDDateTime($this->datetime)) {
         throw new IllegalModelStateException('Invalid datetime: ' . $this->datetime);
     }
     return new LinkResponseObject($this);
 }
Exemplo n.º 14
0
 public function build()
 {
     if ($this->objectID == NULL) {
         $this->objectID = UOID::createUOID();
     }
     if ($this->datePublished == NULL) {
         $this->datePublished = 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->comment == '' || $this->comment == NULL) {
         throw new IllegalModelStateException('Invalid comment');
     }
     if (!XSDDateTime::validateXSDDateTime($this->datePublished)) {
         throw new IllegalModelStateException('Invalid datePublished');
     }
     if ($this->dateUpdated != NULL && !XSDDateTime::validateXSDDateTime($this->dateUpdated)) {
         throw new IllegalModelStateException('Invalid dateUpdated');
     }
     $comment = new CommentObject($this);
     if ($this->signature == NULL) {
         $comment->signObject();
     }
     if (!$comment->verifyObjectSignature()) {
         throw new IllegalModelStateException('Invalid signature');
     }
     return $comment;
 }
Exemplo n.º 15
0
 public function build()
 {
     if ($this->objectID == NULL) {
         $this->objectID = UOID::createUOID();
     }
     if ($this->members == NULL) {
         $this->members = array();
     }
     if ($this->datetime == NULL) {
         $this->datetime = XSDDateTime::getXSDDateTime();
     }
     if (!UOID::isValid($this->objectID)) {
         throw new IllegalModelStateException('Invalid objectID');
     }
     if (!GID::isValid($this->owner)) {
         throw new IllegalModelStateException('Invalid owner');
     }
     if (!XSDDateTime::validateXSDDateTime($this->datetime)) {
         throw new IllegalModelStateException('Invalid datetime');
     }
     if (!is_array($this->members)) {
         throw new IllegalModelStateException('Invalid members');
     }
     $conversation = new ConversationObject($this);
     if ($this->signature == NULL) {
         $conversation->signObject();
     }
     if (!$conversation->verifyObjectSignature()) {
         throw new IllegalModelStateException('Invalid signature');
     }
     return $conversation;
 }
 public function build()
 {
     if ($this->objectID == NULL) {
         $this->objectID = UOID::createUOID();
     }
     if ($this->index == NULL || !is_numeric($this->index) || $this->index < 0) {
         $this->index = 0;
     }
     if (!UOID::isValid($this->objectID)) {
         throw new IllegalModelStateException('Invalid objectID');
     }
     if (!GID::isValid($this->owner)) {
         throw new IllegalModelStateException('Invalid owner');
     }
     if ($this->entityType == NULL) {
         throw new IllegalModelStateException('Invalid entityType');
     }
     if ($this->entityID == NULL) {
         throw new IllegalModelStateException('Invalid entityID');
     }
     if ($this->directive != AccessControlRuleObject::DIRECTIVE_DENY && $this->directive != AccessControlRuleObject::DIRECTIVE_ALLOW) {
         throw new IllegalModelStateException('Invalid directive');
     }
     if ($this->entityType != AccessControlRuleObject::ENTITY_TYPE_ALL && $this->entityType != AccessControlRuleObject::ENTITY_TYPE_FRIENDS && $this->entityType != AccessControlRuleObject::ENTITY_TYPE_GROUP && $this->entityType != AccessControlRuleObject::ENTITY_TYPE_INDIVIDUAL) {
         throw new IllegalModelStateException('Invalid entityType');
     }
     if (($this->entityType == AccessControlRuleObject::ENTITY_TYPE_ALL || $this->entityType == AccessControlRuleObject::ENTITY_TYPE_FRIENDS) && $this->entityID != AccessControlRuleObject::WILDCARD) {
         throw new IllegalModelStateException('Invalid combination of entityType and entityID');
     }
     if ($this->entityType == AccessControlRuleObject::ENTITY_TYPE_GROUP && !UOID::isValid($this->entityID)) {
         throw new IllegalModelStateException('entityType GROUP requires a valid UOID as entityID');
     }
     if ($this->entityType == AccessControlRuleObject::ENTITY_TYPE_INDIVIDUAL && !GID::isValid($this->entityID)) {
         throw new IllegalModelStateException('entityType INDIVIDUAL requires a valid GlobalID as entityID');
     }
     if ($this->targetType != AccessControlRuleObject::TARGET_TYPE_INTERFACE && $this->targetType != AccessControlRuleObject::TARGET_TYPE_CONTENT) {
         throw new IllegalModelStateException('Invalid targetType');
     }
     if ($this->target == NULL) {
         throw new IllegalModelStateException('Invalid target');
     }
     if ($this->accessType != AccessControlRuleObject::ACCESS_TYPE_READ && $this->accessType != AccessControlRuleObject::ACCESS_TYPE_WRITE && $this->accessType != AccessControlRuleObject::WILDCARD) {
         throw new IllegalModelStateException('Invalid accessType');
     }
     return new AccessControlRuleObject($this);
 }
Exemplo n.º 17
0
 public function testSearch()
 {
     $searchQuery = (new SearchQueryObjectBuilder())->initiatingGID(Sonic::getContextGlobalID())->query((new ESQueryBuilder())->type('profile')->match('displayName', 'alice')->build())->datetime()->build();
     $this->assertTrue($searchQuery->validate());
     $this->assertEquals($searchQuery, SearchQueryObjectBuilder::buildFromJSON($searchQuery->getJSONString()));
     $profile = (new ProfileObjectBuilder())->globalID(Sonic::getContextGlobalID())->displayName($this->aliceSocialRecord->getDisplayName())->param('x', 'y')->build();
     $searchResult = (new SearchResultObjectBuilder())->targetID($searchQuery->getObjectID())->resultOwnerGID($profile->getGlobalID())->resultObjectID($profile->getObjectID())->resultIndex($searchQuery->getQuery()->getIndex())->resultType($searchQuery->getQuery()->getType())->displayName($profile->getDisplayName())->datetime()->build();
     $this->assertTrue($searchResult->validate());
     $this->assertEquals($searchResult, SearchResultObjectBuilder::buildFromJSON($searchResult->getJSONString()));
     $searchResultCollection = (new SearchResultCollectionObjectBuilder())->objectID(UOID::createUOID($this->platformSocialRecord->getGlobalID()))->targetID($searchQuery->getObjectID())->platformGID($this->platformSocialRecord->getGlobalID())->datetime()->result($searchResult)->build();
     $this->assertTrue($searchResultCollection->validate());
     $this->assertEquals($searchResultCollection, SearchResultCollectionObjectBuilder::buildFromJSON($searchResultCollection->getJSONString()));
 }