3 abstract class PhabricatorProjectTriggerRule
12 final public function getTriggerType() {
13 return $this->getPhobjectClassConstant('TRIGGERTYPE', 64);
16 final public static function getAllTriggerRules() {
17 return id(new PhutilClassMapQuery())
18 ->setAncestorClass(__CLASS__
)
19 ->setUniqueMethod('getTriggerType')
23 final public function setRecord(PhabricatorProjectTriggerRuleRecord
$record) {
24 $value = $record->getValue();
26 $this->assertValidRuleRecordFormat($value);
28 $this->record
= $record;
32 final public function getRecord() {
36 final protected function getValue() {
37 return $this->getRecord()->getValue();
40 protected function getValueForEditorField() {
41 return $this->getValue();
44 abstract public function getSelectControlName();
45 abstract public function getRuleViewLabel();
46 abstract public function getRuleViewDescription($value);
47 abstract public function getRuleViewIcon($value);
48 abstract protected function assertValidRuleRecordFormat($value);
50 final public function getRuleRecordValueValidationException() {
52 $this->assertValidRuleRecordValue($this->getRecord()->getValue());
53 } catch (Exception
$ex) {
60 protected function assertValidRuleRecordValue($value) {
64 abstract protected function newDropTransactions($object, $value);
65 abstract protected function newDropEffects($value);
66 abstract protected function getDefaultValue();
67 abstract protected function getPHUIXControlType();
68 abstract protected function getPHUIXControlSpecification();
70 protected function isSelectableRule() {
74 protected function isValidRule() {
78 protected function newInvalidView() {
82 public function getSoundEffects() {
86 final public function getDropTransactions($object, $value) {
87 return $this->newDropTransactions($object, $value);
90 final public function setViewer(PhabricatorUser
$viewer) {
91 $this->viewer
= $viewer;
95 final public function getViewer() {
99 final public function setColumn(PhabricatorProjectColumn
$column) {
100 $this->column
= $column;
104 final public function getColumn() {
105 return $this->column
;
108 final public function setTrigger(PhabricatorProjectTrigger
$trigger) {
109 $this->trigger
= $trigger;
113 final public function getTrigger() {
114 return $this->trigger
;
117 final public function setObject(
118 PhabricatorApplicationTransactionInterface
$object) {
119 $this->object = $object;
123 final public function getObject() {
124 return $this->object;
127 final protected function newTransaction() {
128 return $this->getObject()->getApplicationTransactionTemplate();
131 final public function getDropEffects() {
132 return $this->newDropEffects($this->getValue());
135 final protected function newEffect() {
136 return id(new PhabricatorProjectDropEffect())
137 ->setIsTriggerEffect(true);
140 final public function toDictionary() {
141 $record = $this->getRecord();
143 $is_valid = $this->isValidRule();
145 $invalid_view = hsprintf('%s', $this->newInvalidView());
147 $invalid_view = null;
151 'type' => $record->getType(),
152 'value' => $this->getValueForEditorField(),
153 'isValidRule' => $is_valid,
154 'invalidView' => $invalid_view,
158 final public function newTemplate() {
160 'type' => $this->getTriggerType(),
161 'name' => $this->getSelectControlName(),
162 'selectable' => $this->isSelectableRule(),
163 'defaultValue' => $this->getDefaultValue(),
165 'type' => $this->getPHUIXControlType(),
166 'specification' => $this->getPHUIXControlSpecification(),