Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / nuance / storage / NuanceItemCommand.php
blob21d3792ff25cd6c1f598f635a8eae5f70c4c0709
1 <?php
3 final class NuanceItemCommand
4 extends NuanceDAO
5 implements PhabricatorPolicyInterface {
7 const STATUS_ISSUED = 'issued';
8 const STATUS_EXECUTING = 'executing';
9 const STATUS_DONE = 'done';
10 const STATUS_FAILED = 'failed';
12 protected $itemPHID;
13 protected $authorPHID;
14 protected $queuePHID;
15 protected $command;
16 protected $status;
17 protected $parameters = array();
19 public static function initializeNewCommand() {
20 return id(new self())
21 ->setStatus(self::STATUS_ISSUED);
24 protected function getConfiguration() {
25 return array(
26 self::CONFIG_SERIALIZATION => array(
27 'parameters' => self::SERIALIZATION_JSON,
29 self::CONFIG_COLUMN_SCHEMA => array(
30 'command' => 'text64',
31 'status' => 'text64',
32 'queuePHID' => 'phid?',
34 self::CONFIG_KEY_SCHEMA => array(
35 'key_pending' => array(
36 'columns' => array('itemPHID', 'status'),
39 ) + parent::getConfiguration();
42 public static function getStatusMap() {
43 return array(
44 self::STATUS_ISSUED => array(
45 'name' => pht('Issued'),
46 'icon' => 'fa-clock-o',
47 'color' => 'bluegrey',
49 self::STATUS_EXECUTING => array(
50 'name' => pht('Executing'),
51 'icon' => 'fa-play',
52 'color' => 'green',
54 self::STATUS_DONE => array(
55 'name' => pht('Done'),
56 'icon' => 'fa-check',
57 'color' => 'blue',
59 self::STATUS_FAILED => array(
60 'name' => pht('Failed'),
61 'icon' => 'fa-times',
62 'color' => 'red',
67 private function getStatusSpec() {
68 $map = self::getStatusMap();
69 return idx($map, $this->getStatus(), array());
72 public function getStatusIcon() {
73 $spec = $this->getStatusSpec();
74 return idx($spec, 'icon', 'fa-question');
77 public function getStatusColor() {
78 $spec = $this->getStatusSpec();
79 return idx($spec, 'color', 'indigo');
82 public function getStatusName() {
83 $spec = $this->getStatusSpec();
84 return idx($spec, 'name', $this->getStatus());
88 /* -( PhabricatorPolicyInterface )----------------------------------------- */
91 public function getCapabilities() {
92 return array(
93 PhabricatorPolicyCapability::CAN_VIEW,
97 public function getPolicy($capability) {
98 return PhabricatorPolicies::getMostOpenPolicy();
101 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
102 return false;