<?php
namespace Airavata\Model\Sharing;

/**
 * Autogenerated by Thrift Compiler (0.10.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
use Thrift\Base\TBase;
use Thrift\Type\TType;
use Thrift\Type\TMessageType;
use Thrift\Exception\TException;
use Thrift\Exception\TProtocolException;
use Thrift\Protocol\TProtocol;
use Thrift\Protocol\TBinaryProtocolAccelerated;
use Thrift\Exception\TApplicationException;


/**
 * <p>This is an system internal enum used to define single user groups and multi users groups. Every user is also
 * considered as a group in it's own right for implementation ease</p>
 * 
 */
final class GroupCardinality {
  const SINGLE_USER = 0;
  const MULTI_USER = 1;
  static public $__names = array(
    0 => 'SINGLE_USER',
    1 => 'MULTI_USER',
  );
}

/**
 * <p>Group types can be either user level or domain level groups.</p>
 * 
 */
final class GroupType {
  const DOMAIN_LEVEL_GROUP = 0;
  const USER_LEVEL_GROUP = 1;
  static public $__names = array(
    0 => 'DOMAIN_LEVEL_GROUP',
    1 => 'USER_LEVEL_GROUP',
  );
}

/**
 * <p>System internal data type to match group child types</p>
 * 
 */
final class GroupChildType {
  const USER = 0;
  const GROUP = 1;
  static public $__names = array(
    0 => 'USER',
    1 => 'GROUP',
  );
}

/**
 * <p>This list of fields that can be used to search entities</p>
 * <li>NAME : Name of the entity</li>
 * <li>DESCRIPTION : Description of the entity</li>
 * <li>FULL_TEXT : Full text field of the entity</li>
 * <li>PARENT_ENTITY_ID : Parent entity id of the entity</li>
 * <li>OWNER_ID : Owner of the entity</li>
 * <li>CREATED_TIME : Created time of the entity</li>
 * <li>UPDATED_TIME : Updated time of the entity</li>
 * <li>SHARED_COUNT : Number of directly shared users and groups</li>
 * 
 */
final class EntitySearchField {
  const NAME = 0;
  const DESCRIPTION = 1;
  const FULL_TEXT = 2;
  const PARRENT_ENTITY_ID = 3;
  const OWNER_ID = 4;
  const PERMISSION_TYPE_ID = 5;
  const CREATED_TIME = 6;
  const UPDATED_TIME = 7;
  const ENTITY_TYPE_ID = 8;
  const SHARED_COUNT = 9;
  static public $__names = array(
    0 => 'NAME',
    1 => 'DESCRIPTION',
    2 => 'FULL_TEXT',
    3 => 'PARRENT_ENTITY_ID',
    4 => 'OWNER_ID',
    5 => 'PERMISSION_TYPE_ID',
    6 => 'CREATED_TIME',
    7 => 'UPDATED_TIME',
    8 => 'ENTITY_TYPE_ID',
    9 => 'SHARED_COUNT',
  );
}

/**
 * <p>Different search operators that can be used with the entity search fields</p>
 * <li>EQUAL : Simply matches for equality. Applicable for name, and parent entity id</li>
 * <li>LIKE : Check for the condition %$FIELD% condition. Applicable for name, and description</li>
 * <li>FULL_TEXT : Does a full text search. Only applicable for the FULL_TEXT field.</li>
 * <li>GTE : Greater than or equal. Only applicable for created time, updated time and shared count.</li>
 * <li>LTE : Less than or equal. Only applicable for created time, updated time and shared count.</li>
 * 
 */
final class SearchCondition {
  const EQUAL = 0;
  const LIKE = 1;
  const FULL_TEXT = 2;
  const GTE = 3;
  const LTE = 4;
  const NOT = 5;
  static public $__names = array(
    0 => 'EQUAL',
    1 => 'LIKE',
    2 => 'FULL_TEXT',
    3 => 'GTE',
    4 => 'LTE',
    5 => 'NOT',
  );
}

/**
 * <p>This is an internal enum type for managing sharings</p>
 * 
 */
final class SharingType {
  const DIRECT_NON_CASCADING = 0;
  const DIRECT_CASCADING = 1;
  const INDIRECT_CASCADING = 2;
  static public $__names = array(
    0 => 'DIRECT_NON_CASCADING',
    1 => 'DIRECT_CASCADING',
    2 => 'INDIRECT_CASCADING',
  );
}

/**
 * <p>Domain is the entity that enables multi-tenency in this componenet. Every tenant will be
 * operating separately it's own silo which is identified by the domain id. In the current implementation domain id
 * will be same as the domain name</p>
 * <li>domainId : Will be generated by the server based on the domain name</li>
 * <li><b>name</b> : A single word name that identifies the domain e.g seagrid, ultrascan</li>
 * <li>description : A short description for the domain</li>
 * <li>createdTime : Will be set by the system</li>
 * <li>updatedTime : Will be set by the system</li>
 * <li>initialUserGroupId : New users will automatically be added to this group</li>
 * 
 */
class Domain {
  static $_TSPEC;

  /**
   * @var string
   */
  public $domainId = "DO_NOT_SET_AT_CLIENTS_ID";
  /**
   * @var string
   */
  public $name = null;
  /**
   * @var string
   */
  public $description = null;
  /**
   * @var int
   */
  public $createdTime = null;
  /**
   * @var int
   */
  public $updatedTime = null;
  /**
   * @var string
   */
  public $initialUserGroupId = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'domainId',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'name',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'description',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'createdTime',
          'type' => TType::I64,
          ),
        5 => array(
          'var' => 'updatedTime',
          'type' => TType::I64,
          ),
        6 => array(
          'var' => 'initialUserGroupId',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['domainId'])) {
        $this->domainId = $vals['domainId'];
      }
      if (isset($vals['name'])) {
        $this->name = $vals['name'];
      }
      if (isset($vals['description'])) {
        $this->description = $vals['description'];
      }
      if (isset($vals['createdTime'])) {
        $this->createdTime = $vals['createdTime'];
      }
      if (isset($vals['updatedTime'])) {
        $this->updatedTime = $vals['updatedTime'];
      }
      if (isset($vals['initialUserGroupId'])) {
        $this->initialUserGroupId = $vals['initialUserGroupId'];
      }
    }
  }

  public function getName() {
    return 'Domain';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->domainId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->name);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->description);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->createdTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->initialUserGroupId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('Domain');
    if ($this->domainId !== null) {
      $xfer += $output->writeFieldBegin('domainId', TType::STRING, 1);
      $xfer += $output->writeString($this->domainId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->name !== null) {
      $xfer += $output->writeFieldBegin('name', TType::STRING, 2);
      $xfer += $output->writeString($this->name);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->description !== null) {
      $xfer += $output->writeFieldBegin('description', TType::STRING, 3);
      $xfer += $output->writeString($this->description);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createdTime !== null) {
      $xfer += $output->writeFieldBegin('createdTime', TType::I64, 4);
      $xfer += $output->writeI64($this->createdTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedTime !== null) {
      $xfer += $output->writeFieldBegin('updatedTime', TType::I64, 5);
      $xfer += $output->writeI64($this->updatedTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->initialUserGroupId !== null) {
      $xfer += $output->writeFieldBegin('initialUserGroupId', TType::STRING, 6);
      $xfer += $output->writeString($this->initialUserGroupId);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

/**
 * <p>User is the model used to register a user in the system. Minimal user information will be required to provide
 * regarding the user.</p>
 * <li><b>userId</b> : User id provided by the client</li>
 * <li><b>domainId</b> : Domain id for that user</li>
 * <li><b>userName</b> : User name for the user</li>
 * <li><b>firstName</b> : First name of the user</li>
 * <li><b>lastName</b> : Last name of the user</li>
 * <li><b>email</b> : Email address of the user</li>
 * <li>icon : A binary field for storing the user icon</li>
 * <li>createdTime : If client provides this value then the system will use it if not the current time will be set</li>
 * <li>updatedTime : If client provides this value then the system will use it if not the current time will be set</li>
 * 
 */
class User {
  static $_TSPEC;

  /**
   * @var string
   */
  public $userId = null;
  /**
   * @var string
   */
  public $domainId = null;
  /**
   * @var string
   */
  public $userName = null;
  /**
   * @var string
   */
  public $firstName = null;
  /**
   * @var string
   */
  public $lastName = null;
  /**
   * @var string
   */
  public $email = null;
  /**
   * @var string
   */
  public $icon = null;
  /**
   * @var int
   */
  public $createdTime = null;
  /**
   * @var int
   */
  public $updatedTime = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'userId',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'domainId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'userName',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'firstName',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'lastName',
          'type' => TType::STRING,
          ),
        6 => array(
          'var' => 'email',
          'type' => TType::STRING,
          ),
        7 => array(
          'var' => 'icon',
          'type' => TType::STRING,
          ),
        8 => array(
          'var' => 'createdTime',
          'type' => TType::I64,
          ),
        9 => array(
          'var' => 'updatedTime',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['userId'])) {
        $this->userId = $vals['userId'];
      }
      if (isset($vals['domainId'])) {
        $this->domainId = $vals['domainId'];
      }
      if (isset($vals['userName'])) {
        $this->userName = $vals['userName'];
      }
      if (isset($vals['firstName'])) {
        $this->firstName = $vals['firstName'];
      }
      if (isset($vals['lastName'])) {
        $this->lastName = $vals['lastName'];
      }
      if (isset($vals['email'])) {
        $this->email = $vals['email'];
      }
      if (isset($vals['icon'])) {
        $this->icon = $vals['icon'];
      }
      if (isset($vals['createdTime'])) {
        $this->createdTime = $vals['createdTime'];
      }
      if (isset($vals['updatedTime'])) {
        $this->updatedTime = $vals['updatedTime'];
      }
    }
  }

  public function getName() {
    return 'User';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->userId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->domainId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->userName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->firstName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->lastName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->email);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->icon);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->createdTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 9:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('User');
    if ($this->userId !== null) {
      $xfer += $output->writeFieldBegin('userId', TType::STRING, 1);
      $xfer += $output->writeString($this->userId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->domainId !== null) {
      $xfer += $output->writeFieldBegin('domainId', TType::STRING, 2);
      $xfer += $output->writeString($this->domainId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->userName !== null) {
      $xfer += $output->writeFieldBegin('userName', TType::STRING, 3);
      $xfer += $output->writeString($this->userName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->firstName !== null) {
      $xfer += $output->writeFieldBegin('firstName', TType::STRING, 4);
      $xfer += $output->writeString($this->firstName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->lastName !== null) {
      $xfer += $output->writeFieldBegin('lastName', TType::STRING, 5);
      $xfer += $output->writeString($this->lastName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->email !== null) {
      $xfer += $output->writeFieldBegin('email', TType::STRING, 6);
      $xfer += $output->writeString($this->email);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->icon !== null) {
      $xfer += $output->writeFieldBegin('icon', TType::STRING, 7);
      $xfer += $output->writeString($this->icon);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createdTime !== null) {
      $xfer += $output->writeFieldBegin('createdTime', TType::I64, 8);
      $xfer += $output->writeI64($this->createdTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedTime !== null) {
      $xfer += $output->writeFieldBegin('updatedTime', TType::I64, 9);
      $xfer += $output->writeI64($this->updatedTime);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GroupAdmin {
  static $_TSPEC;

  /**
   * @var string
   */
  public $groupId = null;
  /**
   * @var string
   */
  public $domainId = null;
  /**
   * @var string
   */
  public $adminId = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'groupId',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'domainId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'adminId',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['groupId'])) {
        $this->groupId = $vals['groupId'];
      }
      if (isset($vals['domainId'])) {
        $this->domainId = $vals['domainId'];
      }
      if (isset($vals['adminId'])) {
        $this->adminId = $vals['adminId'];
      }
    }
  }

  public function getName() {
    return 'GroupAdmin';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->groupId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->domainId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->adminId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('GroupAdmin');
    if ($this->groupId !== null) {
      $xfer += $output->writeFieldBegin('groupId', TType::STRING, 1);
      $xfer += $output->writeString($this->groupId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->domainId !== null) {
      $xfer += $output->writeFieldBegin('domainId', TType::STRING, 2);
      $xfer += $output->writeString($this->domainId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->adminId !== null) {
      $xfer += $output->writeFieldBegin('adminId', TType::STRING, 3);
      $xfer += $output->writeString($this->adminId);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

/**
 * <p>User group is a collection of users.</p>
 *  <li><b>groupId</b> : Group id provided by the client</li>
 *  <li><b>domainId</b> : Domain id for this user group</li>
 *  <li><b>name</b> : Name for the user group. should be one word</li>
 *  <li>description : Short description for the group.</li>
 *  <li><b>ownerId</b> : Owner id of this group.</li>
 *  <li><b>groupType</b> : Group type (DOMAIN_LEVEL_GROUP, USER_LEVEL_GROUP)</li>
 *  <li><b>groupCardinality</b> : Group cardinality (SINGLE_USER, MULTI_USER)</li>
 *  <li>createdTime : Will be set by the system</li>
 *  <li>updatedTime : Will be set by the system</li>
 *  <li>groupAdmins : Admins for the group</li>
 *  
 */
class UserGroup {
  static $_TSPEC;

  /**
   * @var string
   */
  public $groupId = null;
  /**
   * @var string
   */
  public $domainId = null;
  /**
   * @var string
   */
  public $name = null;
  /**
   * @var string
   */
  public $description = null;
  /**
   * @var string
   */
  public $ownerId = null;
  /**
   * @var int
   */
  public $groupType = null;
  /**
   * @var int
   */
  public $groupCardinality = null;
  /**
   * @var int
   */
  public $createdTime = null;
  /**
   * @var int
   */
  public $updatedTime = null;
  /**
   * @var \Airavata\Model\Sharing\GroupAdmin[]
   */
  public $groupAdmins = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'groupId',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'domainId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'name',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'description',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'ownerId',
          'type' => TType::STRING,
          ),
        6 => array(
          'var' => 'groupType',
          'type' => TType::I32,
          ),
        7 => array(
          'var' => 'groupCardinality',
          'type' => TType::I32,
          ),
        8 => array(
          'var' => 'createdTime',
          'type' => TType::I64,
          ),
        9 => array(
          'var' => 'updatedTime',
          'type' => TType::I64,
          ),
        10 => array(
          'var' => 'groupAdmins',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\Airavata\Model\Sharing\GroupAdmin',
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['groupId'])) {
        $this->groupId = $vals['groupId'];
      }
      if (isset($vals['domainId'])) {
        $this->domainId = $vals['domainId'];
      }
      if (isset($vals['name'])) {
        $this->name = $vals['name'];
      }
      if (isset($vals['description'])) {
        $this->description = $vals['description'];
      }
      if (isset($vals['ownerId'])) {
        $this->ownerId = $vals['ownerId'];
      }
      if (isset($vals['groupType'])) {
        $this->groupType = $vals['groupType'];
      }
      if (isset($vals['groupCardinality'])) {
        $this->groupCardinality = $vals['groupCardinality'];
      }
      if (isset($vals['createdTime'])) {
        $this->createdTime = $vals['createdTime'];
      }
      if (isset($vals['updatedTime'])) {
        $this->updatedTime = $vals['updatedTime'];
      }
      if (isset($vals['groupAdmins'])) {
        $this->groupAdmins = $vals['groupAdmins'];
      }
    }
  }

  public function getName() {
    return 'UserGroup';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->groupId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->domainId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->name);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->description);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->ownerId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->groupType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->groupCardinality);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->createdTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 9:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 10:
          if ($ftype == TType::LST) {
            $this->groupAdmins = array();
            $_size0 = 0;
            $_etype3 = 0;
            $xfer += $input->readListBegin($_etype3, $_size0);
            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
            {
              $elem5 = null;
              $elem5 = new \Airavata\Model\Sharing\GroupAdmin();
              $xfer += $elem5->read($input);
              $this->groupAdmins []= $elem5;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('UserGroup');
    if ($this->groupId !== null) {
      $xfer += $output->writeFieldBegin('groupId', TType::STRING, 1);
      $xfer += $output->writeString($this->groupId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->domainId !== null) {
      $xfer += $output->writeFieldBegin('domainId', TType::STRING, 2);
      $xfer += $output->writeString($this->domainId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->name !== null) {
      $xfer += $output->writeFieldBegin('name', TType::STRING, 3);
      $xfer += $output->writeString($this->name);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->description !== null) {
      $xfer += $output->writeFieldBegin('description', TType::STRING, 4);
      $xfer += $output->writeString($this->description);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ownerId !== null) {
      $xfer += $output->writeFieldBegin('ownerId', TType::STRING, 5);
      $xfer += $output->writeString($this->ownerId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->groupType !== null) {
      $xfer += $output->writeFieldBegin('groupType', TType::I32, 6);
      $xfer += $output->writeI32($this->groupType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->groupCardinality !== null) {
      $xfer += $output->writeFieldBegin('groupCardinality', TType::I32, 7);
      $xfer += $output->writeI32($this->groupCardinality);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createdTime !== null) {
      $xfer += $output->writeFieldBegin('createdTime', TType::I64, 8);
      $xfer += $output->writeI64($this->createdTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedTime !== null) {
      $xfer += $output->writeFieldBegin('updatedTime', TType::I64, 9);
      $xfer += $output->writeI64($this->updatedTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->groupAdmins !== null) {
      if (!is_array($this->groupAdmins)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('groupAdmins', TType::LST, 10);
      {
        $output->writeListBegin(TType::STRUCT, count($this->groupAdmins));
        {
          foreach ($this->groupAdmins as $iter6)
          {
            $xfer += $iter6->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

/**
 * <p>System internal data type to map group memberships</p>
 * 
 */
class GroupMembership {
  static $_TSPEC;

  /**
   * @var string
   */
  public $parentId = null;
  /**
   * @var string
   */
  public $childId = null;
  /**
   * @var string
   */
  public $domainId = null;
  /**
   * @var int
   */
  public $childType = null;
  /**
   * @var int
   */
  public $createdTime = null;
  /**
   * @var int
   */
  public $updatedTime = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'parentId',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'childId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'domainId',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'childType',
          'type' => TType::I32,
          ),
        5 => array(
          'var' => 'createdTime',
          'type' => TType::I64,
          ),
        6 => array(
          'var' => 'updatedTime',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['parentId'])) {
        $this->parentId = $vals['parentId'];
      }
      if (isset($vals['childId'])) {
        $this->childId = $vals['childId'];
      }
      if (isset($vals['domainId'])) {
        $this->domainId = $vals['domainId'];
      }
      if (isset($vals['childType'])) {
        $this->childType = $vals['childType'];
      }
      if (isset($vals['createdTime'])) {
        $this->createdTime = $vals['createdTime'];
      }
      if (isset($vals['updatedTime'])) {
        $this->updatedTime = $vals['updatedTime'];
      }
    }
  }

  public function getName() {
    return 'GroupMembership';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->parentId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->childId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->domainId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->childType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->createdTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('GroupMembership');
    if ($this->parentId !== null) {
      $xfer += $output->writeFieldBegin('parentId', TType::STRING, 1);
      $xfer += $output->writeString($this->parentId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->childId !== null) {
      $xfer += $output->writeFieldBegin('childId', TType::STRING, 2);
      $xfer += $output->writeString($this->childId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->domainId !== null) {
      $xfer += $output->writeFieldBegin('domainId', TType::STRING, 3);
      $xfer += $output->writeString($this->domainId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->childType !== null) {
      $xfer += $output->writeFieldBegin('childType', TType::I32, 4);
      $xfer += $output->writeI32($this->childType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createdTime !== null) {
      $xfer += $output->writeFieldBegin('createdTime', TType::I64, 5);
      $xfer += $output->writeI64($this->createdTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedTime !== null) {
      $xfer += $output->writeFieldBegin('updatedTime', TType::I64, 6);
      $xfer += $output->writeI64($this->updatedTime);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

/**
 * <p>client defined entity types</p>
 * <li><b>entityTypeId</b> : Entity type id provided by the client</li>
 * <li><b>domainId</b> : Domain id of the domain.</li>
 * <li><b>name</b> : Name for the entity type. Should be a single word.</li>
 * <li>description : Short description for the entity type.</li>
 * <li>createdTime : Will be set by the system</li>
 * <li>updatedTime : Will be set by the system</li>
 * 
 */
class EntityType {
  static $_TSPEC;

  /**
   * @var string
   */
  public $entityTypeId = null;
  /**
   * @var string
   */
  public $domainId = null;
  /**
   * @var string
   */
  public $name = null;
  /**
   * @var string
   */
  public $description = null;
  /**
   * @var int
   */
  public $createdTime = null;
  /**
   * @var int
   */
  public $updatedTime = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'entityTypeId',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'domainId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'name',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'description',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'createdTime',
          'type' => TType::I64,
          ),
        6 => array(
          'var' => 'updatedTime',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['entityTypeId'])) {
        $this->entityTypeId = $vals['entityTypeId'];
      }
      if (isset($vals['domainId'])) {
        $this->domainId = $vals['domainId'];
      }
      if (isset($vals['name'])) {
        $this->name = $vals['name'];
      }
      if (isset($vals['description'])) {
        $this->description = $vals['description'];
      }
      if (isset($vals['createdTime'])) {
        $this->createdTime = $vals['createdTime'];
      }
      if (isset($vals['updatedTime'])) {
        $this->updatedTime = $vals['updatedTime'];
      }
    }
  }

  public function getName() {
    return 'EntityType';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->entityTypeId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->domainId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->name);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->description);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->createdTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('EntityType');
    if ($this->entityTypeId !== null) {
      $xfer += $output->writeFieldBegin('entityTypeId', TType::STRING, 1);
      $xfer += $output->writeString($this->entityTypeId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->domainId !== null) {
      $xfer += $output->writeFieldBegin('domainId', TType::STRING, 2);
      $xfer += $output->writeString($this->domainId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->name !== null) {
      $xfer += $output->writeFieldBegin('name', TType::STRING, 3);
      $xfer += $output->writeString($this->name);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->description !== null) {
      $xfer += $output->writeFieldBegin('description', TType::STRING, 4);
      $xfer += $output->writeString($this->description);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createdTime !== null) {
      $xfer += $output->writeFieldBegin('createdTime', TType::I64, 5);
      $xfer += $output->writeI64($this->createdTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedTime !== null) {
      $xfer += $output->writeFieldBegin('updatedTime', TType::I64, 6);
      $xfer += $output->writeI64($this->updatedTime);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

/**
 * <p>Container object for search criteria</p>
 * <li><b>searchField</b> : Entity search field</li>
 * <li><b>value</b> : Search value</li>
 * <li><b>searchCondition</b> : EQUAL, LIKE etc..</li>
 * 
 */
class SearchCriteria {
  static $_TSPEC;

  /**
   * @var int
   */
  public $searchField = null;
  /**
   * @var string
   */
  public $value = null;
  /**
   * @var int
   */
  public $searchCondition = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'searchField',
          'type' => TType::I32,
          ),
        2 => array(
          'var' => 'value',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'searchCondition',
          'type' => TType::I32,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['searchField'])) {
        $this->searchField = $vals['searchField'];
      }
      if (isset($vals['value'])) {
        $this->value = $vals['value'];
      }
      if (isset($vals['searchCondition'])) {
        $this->searchCondition = $vals['searchCondition'];
      }
    }
  }

  public function getName() {
    return 'SearchCriteria';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->searchField);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->value);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->searchCondition);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('SearchCriteria');
    if ($this->searchField !== null) {
      $xfer += $output->writeFieldBegin('searchField', TType::I32, 1);
      $xfer += $output->writeI32($this->searchField);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->value !== null) {
      $xfer += $output->writeFieldBegin('value', TType::STRING, 2);
      $xfer += $output->writeString($this->value);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->searchCondition !== null) {
      $xfer += $output->writeFieldBegin('searchCondition', TType::I32, 3);
      $xfer += $output->writeI32($this->searchCondition);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

/**
 * <p>Entity object which is used to register an entity in the system.</p>
 * <li><b>entityId</b> : Entity id provided by the client</li>
 * <li><b>domainId</b> : Domain id</li>
 * <li><b>entityTypeId</b> : Entity type id</li>
 * <li><b>ownerId</b> : Owner id</li>
 * <li>parentEntityId : Parent entity id</li>
 * <li><b>name</b> : Name</li>
 * <li>description : Short description for the entity</li>
 * <li>binaryData : Any information stored in binary format</li>
 * <li>fullText : A string which will be considered for full text search</li>
 * <li><b>originalEntityCreationTime</b> : When registering old records what is the original entity creation time. If not
 * set will be default to current time</li>
 * <li>createdTime : Will be set by the system</li>
 * <li>updatedTime : Will be set by the system</li>
 * 
 */
class Entity {
  static $_TSPEC;

  /**
   * @var string
   */
  public $entityId = null;
  /**
   * @var string
   */
  public $domainId = null;
  /**
   * @var string
   */
  public $entityTypeId = null;
  /**
   * @var string
   */
  public $ownerId = null;
  /**
   * @var string
   */
  public $parentEntityId = null;
  /**
   * @var string
   */
  public $name = null;
  /**
   * @var string
   */
  public $description = null;
  /**
   * @var string
   */
  public $binaryData = null;
  /**
   * @var string
   */
  public $fullText = null;
  /**
   * @var int
   */
  public $sharedCount = 0;
  /**
   * @var int
   */
  public $originalEntityCreationTime = null;
  /**
   * @var int
   */
  public $createdTime = null;
  /**
   * @var int
   */
  public $updatedTime = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'entityId',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'domainId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'entityTypeId',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'ownerId',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'parentEntityId',
          'type' => TType::STRING,
          ),
        6 => array(
          'var' => 'name',
          'type' => TType::STRING,
          ),
        7 => array(
          'var' => 'description',
          'type' => TType::STRING,
          ),
        8 => array(
          'var' => 'binaryData',
          'type' => TType::STRING,
          ),
        9 => array(
          'var' => 'fullText',
          'type' => TType::STRING,
          ),
        10 => array(
          'var' => 'sharedCount',
          'type' => TType::I64,
          ),
        11 => array(
          'var' => 'originalEntityCreationTime',
          'type' => TType::I64,
          ),
        12 => array(
          'var' => 'createdTime',
          'type' => TType::I64,
          ),
        13 => array(
          'var' => 'updatedTime',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['entityId'])) {
        $this->entityId = $vals['entityId'];
      }
      if (isset($vals['domainId'])) {
        $this->domainId = $vals['domainId'];
      }
      if (isset($vals['entityTypeId'])) {
        $this->entityTypeId = $vals['entityTypeId'];
      }
      if (isset($vals['ownerId'])) {
        $this->ownerId = $vals['ownerId'];
      }
      if (isset($vals['parentEntityId'])) {
        $this->parentEntityId = $vals['parentEntityId'];
      }
      if (isset($vals['name'])) {
        $this->name = $vals['name'];
      }
      if (isset($vals['description'])) {
        $this->description = $vals['description'];
      }
      if (isset($vals['binaryData'])) {
        $this->binaryData = $vals['binaryData'];
      }
      if (isset($vals['fullText'])) {
        $this->fullText = $vals['fullText'];
      }
      if (isset($vals['sharedCount'])) {
        $this->sharedCount = $vals['sharedCount'];
      }
      if (isset($vals['originalEntityCreationTime'])) {
        $this->originalEntityCreationTime = $vals['originalEntityCreationTime'];
      }
      if (isset($vals['createdTime'])) {
        $this->createdTime = $vals['createdTime'];
      }
      if (isset($vals['updatedTime'])) {
        $this->updatedTime = $vals['updatedTime'];
      }
    }
  }

  public function getName() {
    return 'Entity';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->entityId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->domainId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->entityTypeId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->ownerId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->parentEntityId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->name);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->description);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->binaryData);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 9:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->fullText);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 10:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->sharedCount);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 11:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->originalEntityCreationTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 12:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->createdTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 13:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('Entity');
    if ($this->entityId !== null) {
      $xfer += $output->writeFieldBegin('entityId', TType::STRING, 1);
      $xfer += $output->writeString($this->entityId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->domainId !== null) {
      $xfer += $output->writeFieldBegin('domainId', TType::STRING, 2);
      $xfer += $output->writeString($this->domainId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->entityTypeId !== null) {
      $xfer += $output->writeFieldBegin('entityTypeId', TType::STRING, 3);
      $xfer += $output->writeString($this->entityTypeId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ownerId !== null) {
      $xfer += $output->writeFieldBegin('ownerId', TType::STRING, 4);
      $xfer += $output->writeString($this->ownerId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parentEntityId !== null) {
      $xfer += $output->writeFieldBegin('parentEntityId', TType::STRING, 5);
      $xfer += $output->writeString($this->parentEntityId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->name !== null) {
      $xfer += $output->writeFieldBegin('name', TType::STRING, 6);
      $xfer += $output->writeString($this->name);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->description !== null) {
      $xfer += $output->writeFieldBegin('description', TType::STRING, 7);
      $xfer += $output->writeString($this->description);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->binaryData !== null) {
      $xfer += $output->writeFieldBegin('binaryData', TType::STRING, 8);
      $xfer += $output->writeString($this->binaryData);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->fullText !== null) {
      $xfer += $output->writeFieldBegin('fullText', TType::STRING, 9);
      $xfer += $output->writeString($this->fullText);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->sharedCount !== null) {
      $xfer += $output->writeFieldBegin('sharedCount', TType::I64, 10);
      $xfer += $output->writeI64($this->sharedCount);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->originalEntityCreationTime !== null) {
      $xfer += $output->writeFieldBegin('originalEntityCreationTime', TType::I64, 11);
      $xfer += $output->writeI64($this->originalEntityCreationTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createdTime !== null) {
      $xfer += $output->writeFieldBegin('createdTime', TType::I64, 12);
      $xfer += $output->writeI64($this->createdTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedTime !== null) {
      $xfer += $output->writeFieldBegin('updatedTime', TType::I64, 13);
      $xfer += $output->writeI64($this->updatedTime);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

/**
 * <p>Object for creating client defined permission type</p>
 * <li><b>permissionTypeId</b> : Permission type id provided by the client</li>
 * <li><b>domainId</b> : Domain id</li>
 * <li><b>name</b> : Single word name for the permission</li>
 * <li>description : Short description for the permission type</li>
 * <li>createdTime : Will be set by the system</li>
 * <li>updatedTime : Will be set by the system</li>
 * 
 */
class PermissionType {
  static $_TSPEC;

  /**
   * @var string
   */
  public $permissionTypeId = null;
  /**
   * @var string
   */
  public $domainId = null;
  /**
   * @var string
   */
  public $name = null;
  /**
   * @var string
   */
  public $description = null;
  /**
   * @var int
   */
  public $createdTime = null;
  /**
   * @var int
   */
  public $updatedTime = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'permissionTypeId',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'domainId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'name',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'description',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'createdTime',
          'type' => TType::I64,
          ),
        6 => array(
          'var' => 'updatedTime',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['permissionTypeId'])) {
        $this->permissionTypeId = $vals['permissionTypeId'];
      }
      if (isset($vals['domainId'])) {
        $this->domainId = $vals['domainId'];
      }
      if (isset($vals['name'])) {
        $this->name = $vals['name'];
      }
      if (isset($vals['description'])) {
        $this->description = $vals['description'];
      }
      if (isset($vals['createdTime'])) {
        $this->createdTime = $vals['createdTime'];
      }
      if (isset($vals['updatedTime'])) {
        $this->updatedTime = $vals['updatedTime'];
      }
    }
  }

  public function getName() {
    return 'PermissionType';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->permissionTypeId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->domainId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->name);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->description);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->createdTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('PermissionType');
    if ($this->permissionTypeId !== null) {
      $xfer += $output->writeFieldBegin('permissionTypeId', TType::STRING, 1);
      $xfer += $output->writeString($this->permissionTypeId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->domainId !== null) {
      $xfer += $output->writeFieldBegin('domainId', TType::STRING, 2);
      $xfer += $output->writeString($this->domainId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->name !== null) {
      $xfer += $output->writeFieldBegin('name', TType::STRING, 3);
      $xfer += $output->writeString($this->name);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->description !== null) {
      $xfer += $output->writeFieldBegin('description', TType::STRING, 4);
      $xfer += $output->writeString($this->description);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createdTime !== null) {
      $xfer += $output->writeFieldBegin('createdTime', TType::I64, 5);
      $xfer += $output->writeI64($this->createdTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedTime !== null) {
      $xfer += $output->writeFieldBegin('updatedTime', TType::I64, 6);
      $xfer += $output->writeI64($this->updatedTime);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

/**
 * <p>This is an internal enum type for managing sharings</p>
 * 
 */
class Sharing {
  static $_TSPEC;

  /**
   * @var string
   */
  public $permissionTypeId = null;
  /**
   * @var string
   */
  public $entityId = null;
  /**
   * @var string
   */
  public $groupId = null;
  /**
   * @var int
   */
  public $sharingType = null;
  /**
   * @var string
   */
  public $domainId = null;
  /**
   * @var string
   */
  public $inheritedParentId = null;
  /**
   * @var int
   */
  public $createdTime = null;
  /**
   * @var int
   */
  public $updatedTime = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'permissionTypeId',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'entityId',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'groupId',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'sharingType',
          'type' => TType::I32,
          ),
        5 => array(
          'var' => 'domainId',
          'type' => TType::STRING,
          ),
        6 => array(
          'var' => 'inheritedParentId',
          'type' => TType::STRING,
          ),
        7 => array(
          'var' => 'createdTime',
          'type' => TType::I64,
          ),
        8 => array(
          'var' => 'updatedTime',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['permissionTypeId'])) {
        $this->permissionTypeId = $vals['permissionTypeId'];
      }
      if (isset($vals['entityId'])) {
        $this->entityId = $vals['entityId'];
      }
      if (isset($vals['groupId'])) {
        $this->groupId = $vals['groupId'];
      }
      if (isset($vals['sharingType'])) {
        $this->sharingType = $vals['sharingType'];
      }
      if (isset($vals['domainId'])) {
        $this->domainId = $vals['domainId'];
      }
      if (isset($vals['inheritedParentId'])) {
        $this->inheritedParentId = $vals['inheritedParentId'];
      }
      if (isset($vals['createdTime'])) {
        $this->createdTime = $vals['createdTime'];
      }
      if (isset($vals['updatedTime'])) {
        $this->updatedTime = $vals['updatedTime'];
      }
    }
  }

  public function getName() {
    return 'Sharing';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->permissionTypeId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->entityId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->groupId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->sharingType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->domainId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->inheritedParentId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->createdTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->updatedTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('Sharing');
    if ($this->permissionTypeId !== null) {
      $xfer += $output->writeFieldBegin('permissionTypeId', TType::STRING, 1);
      $xfer += $output->writeString($this->permissionTypeId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->entityId !== null) {
      $xfer += $output->writeFieldBegin('entityId', TType::STRING, 2);
      $xfer += $output->writeString($this->entityId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->groupId !== null) {
      $xfer += $output->writeFieldBegin('groupId', TType::STRING, 3);
      $xfer += $output->writeString($this->groupId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->sharingType !== null) {
      $xfer += $output->writeFieldBegin('sharingType', TType::I32, 4);
      $xfer += $output->writeI32($this->sharingType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->domainId !== null) {
      $xfer += $output->writeFieldBegin('domainId', TType::STRING, 5);
      $xfer += $output->writeString($this->domainId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->inheritedParentId !== null) {
      $xfer += $output->writeFieldBegin('inheritedParentId', TType::STRING, 6);
      $xfer += $output->writeString($this->inheritedParentId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createdTime !== null) {
      $xfer += $output->writeFieldBegin('createdTime', TType::I64, 7);
      $xfer += $output->writeI64($this->createdTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->updatedTime !== null) {
      $xfer += $output->writeFieldBegin('updatedTime', TType::I64, 8);
      $xfer += $output->writeI64($this->updatedTime);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

/**
 * <p>Exception model used in the sharing registry service</p>
 * 
 */
class SharingRegistryException extends TException {
  static $_TSPEC;

  /**
   * @var string
   */
  public $message = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'message',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['message'])) {
        $this->message = $vals['message'];
      }
    }
  }

  public function getName() {
    return 'SharingRegistryException';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->message);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('SharingRegistryException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

/**
 * This exception is thrown when you try to save a duplicate entity that already exists
 *   in the database.
 * 
 *   message: contains the associated error message
 * 
 */
class DuplicateEntryException extends TException {
  static $_TSPEC;

  /**
   * @var string
   */
  public $message = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'message',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['message'])) {
        $this->message = $vals['message'];
      }
    }
  }

  public function getName() {
    return 'DuplicateEntryException';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->message);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('DuplicateEntryException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

final class Constant extends \Thrift\Type\TConstant {
  static protected $DO_NOT_SET_AT_CLIENTS_ID;

  static protected function init_DO_NOT_SET_AT_CLIENTS_ID() {
    return "DO_NOT_SET_AT_CLIENTS_ID";
  }
}


