3 final class PhabricatorRepositorySyncEvent
4 extends PhabricatorRepositoryDAO
5 implements PhabricatorPolicyInterface
{
7 protected $repositoryPHID;
10 protected $fromDevicePHID;
11 protected $deviceVersion;
12 protected $fromDeviceVersion;
13 protected $resultType;
14 protected $resultCode;
16 protected $properties = array();
18 private $repository = self
::ATTACHABLE
;
20 const RESULT_SYNC
= 'sync';
21 const RESULT_ERROR
= 'error';
22 const RESULT_TIMEOUT
= 'timeout';
23 const RESULT_EXCEPTION
= 'exception';
25 public static function initializeNewEvent() {
29 protected function getConfiguration() {
31 self
::CONFIG_AUX_PHID
=> true,
32 self
::CONFIG_TIMESTAMPS
=> false,
33 self
::CONFIG_SERIALIZATION
=> array(
34 'properties' => self
::SERIALIZATION_JSON
,
36 self
::CONFIG_COLUMN_SCHEMA
=> array(
37 'deviceVersion' => 'uint32?',
38 'fromDeviceVersion' => 'uint32?',
39 'resultType' => 'text32',
40 'resultCode' => 'uint32',
41 'syncWait' => 'uint64',
43 self
::CONFIG_KEY_SCHEMA
=> array(
44 'key_repository' => array(
45 'columns' => array('repositoryPHID'),
48 'columns' => array('epoch'),
51 ) + parent
::getConfiguration();
54 public function getPHIDType() {
55 return PhabricatorRepositorySyncEventPHIDType
::TYPECONST
;
58 public function attachRepository(PhabricatorRepository
$repository) {
59 $this->repository
= $repository;
63 public function getRepository() {
64 return $this->assertAttached($this->repository
);
67 public function setProperty($key, $value) {
68 $this->properties
[$key] = $value;
72 public function getProperty($key, $default = null) {
73 return idx($this->properties
, $key, $default);
76 /* -( PhabricatorPolicyInterface )----------------------------------------- */
79 public function getCapabilities() {
81 PhabricatorPolicyCapability
::CAN_VIEW
,
85 public function getPolicy($capability) {
86 return $this->getRepository()->getPolicy($capability);
89 public function hasAutomaticCapability($capability, PhabricatorUser
$viewer) {
90 return $this->getRepository()->hasAutomaticCapability($capability, $viewer);
93 public function describeAutomaticCapability($capability) {
95 "A repository's sync events are visible to users who can see the ".