Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/trigger/PhabricatorProjectTriggerRule.php
| Show All 32 Lines | final public function getRecord() { | ||||
| return $this->record; | return $this->record; | ||||
| } | } | ||||
| final protected function getValue() { | final protected function getValue() { | ||||
| return $this->getRecord()->getValue(); | return $this->getRecord()->getValue(); | ||||
| } | } | ||||
| abstract public function getDescription(); | abstract public function getDescription(); | ||||
| abstract public function getSelectControlName(); | |||||
| abstract protected function assertValidRuleValue($value); | abstract protected function assertValidRuleValue($value); | ||||
| abstract protected function newDropTransactions($object, $value); | abstract protected function newDropTransactions($object, $value); | ||||
| abstract protected function newDropEffects($value); | abstract protected function newDropEffects($value); | ||||
| abstract protected function getDefaultValue(); | |||||
| abstract protected function getPHUIXControlType(); | |||||
| abstract protected function getPHUIXControlSpecification(); | |||||
| protected function isSelectableRule() { | |||||
| return true; | |||||
| } | |||||
| protected function isValidRule() { | |||||
| return true; | |||||
| } | |||||
| protected function newInvalidView() { | |||||
| return null; | |||||
| } | |||||
| final public function getDropTransactions($object, $value) { | final public function getDropTransactions($object, $value) { | ||||
| return $this->newDropTransactions($object, $value); | return $this->newDropTransactions($object, $value); | ||||
| } | } | ||||
| final public function setViewer(PhabricatorUser $viewer) { | final public function setViewer(PhabricatorUser $viewer) { | ||||
| $this->viewer = $viewer; | $this->viewer = $viewer; | ||||
| return $this; | return $this; | ||||
| Show All 38 Lines | abstract class PhabricatorProjectTriggerRule | ||||
| final public function getDropEffects() { | final public function getDropEffects() { | ||||
| return $this->newDropEffects($this->getValue()); | return $this->newDropEffects($this->getValue()); | ||||
| } | } | ||||
| final protected function newEffect() { | final protected function newEffect() { | ||||
| return new PhabricatorProjectDropEffect(); | return new PhabricatorProjectDropEffect(); | ||||
| } | } | ||||
| final public function toDictionary() { | |||||
| $record = $this->getRecord(); | |||||
| $is_valid = $this->isValidRule(); | |||||
| if (!$is_valid) { | |||||
| $invalid_view = hsprintf('%s', $this->newInvalidView()); | |||||
| } else { | |||||
| $invalid_view = null; | |||||
| } | |||||
| return array( | |||||
| 'type' => $record->getType(), | |||||
| 'value' => $record->getValue(), | |||||
| 'isValidRule' => $is_valid, | |||||
| 'invalidView' => $invalid_view, | |||||
| ); | |||||
| } | |||||
| final public function newTemplate() { | |||||
| return array( | |||||
| 'type' => $this->getTriggerType(), | |||||
| 'name' => $this->getSelectControlName(), | |||||
| 'selectable' => $this->isSelectableRule(), | |||||
| 'defaultValue' => $this->getDefaultValue(), | |||||
| 'control' => array( | |||||
| 'type' => $this->getPHUIXControlType(), | |||||
| 'specification' => $this->getPHUIXControlSpecification(), | |||||
| ), | |||||
| ); | |||||
| } | |||||
| } | } | ||||