2013-11-07 02:00:09 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class NuanceItemEditor
|
|
|
|
extends PhabricatorApplicationTransactionEditor {
|
|
|
|
|
2014-08-12 21:28:41 +02:00
|
|
|
public function getEditorApplicationClass() {
|
|
|
|
return 'PhabricatorNuanceApplication';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getEditorObjectsDescription() {
|
|
|
|
return pht('Nuance Items');
|
|
|
|
}
|
|
|
|
|
2013-11-07 02:00:09 +01:00
|
|
|
public function getTransactionTypes() {
|
|
|
|
$types = parent::getTransactionTypes();
|
|
|
|
|
2014-01-06 20:19:32 +01:00
|
|
|
$types[] = NuanceItemTransaction::TYPE_OWNER;
|
|
|
|
$types[] = NuanceItemTransaction::TYPE_SOURCE;
|
|
|
|
$types[] = NuanceItemTransaction::TYPE_REQUESTOR;
|
2015-06-05 20:01:06 +02:00
|
|
|
$types[] = NuanceItemTransaction::TYPE_PROPERTY;
|
2015-08-24 18:21:56 +02:00
|
|
|
$types[] = NuanceItemTransaction::TYPE_QUEUE;
|
2014-01-06 20:19:32 +01:00
|
|
|
|
2013-11-07 02:00:09 +01:00
|
|
|
$types[] = PhabricatorTransactions::TYPE_EDGE;
|
|
|
|
$types[] = PhabricatorTransactions::TYPE_COMMENT;
|
|
|
|
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
|
|
|
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
|
|
|
|
|
|
|
|
return $types;
|
|
|
|
}
|
|
|
|
|
2014-01-06 20:19:32 +01:00
|
|
|
protected function getCustomTransactionOldValue(
|
|
|
|
PhabricatorLiskDAO $object,
|
|
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
|
|
|
|
|
|
switch ($xaction->getTransactionType()) {
|
|
|
|
case NuanceItemTransaction::TYPE_REQUESTOR:
|
|
|
|
return $object->getRequestorPHID();
|
|
|
|
case NuanceItemTransaction::TYPE_SOURCE:
|
|
|
|
return $object->getSourcePHID();
|
|
|
|
case NuanceItemTransaction::TYPE_OWNER:
|
|
|
|
return $object->getOwnerPHID();
|
2015-08-24 18:21:56 +02:00
|
|
|
case NuanceItemTransaction::TYPE_QUEUE:
|
|
|
|
return $object->getQueuePHID();
|
2015-06-05 20:01:06 +02:00
|
|
|
case NuanceItemTransaction::TYPE_PROPERTY:
|
|
|
|
$key = $xaction->getMetadataValue(
|
|
|
|
NuanceItemTransaction::PROPERTY_KEY);
|
|
|
|
return $object->getNuanceProperty($key);
|
2014-01-06 20:19:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return parent::getCustomTransactionOldValue($object, $xaction);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getCustomTransactionNewValue(
|
|
|
|
PhabricatorLiskDAO $object,
|
|
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
|
|
|
|
|
|
switch ($xaction->getTransactionType()) {
|
|
|
|
case NuanceItemTransaction::TYPE_REQUESTOR:
|
|
|
|
case NuanceItemTransaction::TYPE_SOURCE:
|
|
|
|
case NuanceItemTransaction::TYPE_OWNER:
|
2015-06-05 20:01:06 +02:00
|
|
|
case NuanceItemTransaction::TYPE_PROPERTY:
|
2015-08-24 18:21:56 +02:00
|
|
|
case NuanceItemTransaction::TYPE_QUEUE:
|
2014-01-06 20:19:32 +01:00
|
|
|
return $xaction->getNewValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::getCustomTransactionNewValue($object, $xaction);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function applyCustomInternalTransaction(
|
|
|
|
PhabricatorLiskDAO $object,
|
|
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
|
|
|
|
|
|
switch ($xaction->getTransactionType()) {
|
|
|
|
case NuanceItemTransaction::TYPE_REQUESTOR:
|
|
|
|
$object->setRequestorPHID($xaction->getNewValue());
|
|
|
|
break;
|
|
|
|
case NuanceItemTransaction::TYPE_SOURCE:
|
|
|
|
$object->setSourcePHID($xaction->getNewValue());
|
|
|
|
break;
|
|
|
|
case NuanceItemTransaction::TYPE_OWNER:
|
|
|
|
$object->setOwnerPHID($xaction->getNewValue());
|
|
|
|
break;
|
2015-08-24 18:21:56 +02:00
|
|
|
case NuanceItemTransaction::TYPE_QUEUE:
|
|
|
|
$object->setQueuePHID($xaction->getNewValue());
|
|
|
|
break;
|
2015-06-05 20:01:06 +02:00
|
|
|
case NuanceItemTransaction::TYPE_PROPERTY:
|
|
|
|
$key = $xaction->getMetadataValue(
|
|
|
|
NuanceItemTransaction::PROPERTY_KEY);
|
|
|
|
$object->setNuanceProperty($key, $xaction->getNewValue());
|
|
|
|
break;
|
2014-01-06 20:19:32 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function applyCustomExternalTransaction(
|
|
|
|
PhabricatorLiskDAO $object,
|
|
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
|
|
|
|
|
|
switch ($xaction->getTransactionType()) {
|
|
|
|
case NuanceItemTransaction::TYPE_REQUESTOR:
|
|
|
|
case NuanceItemTransaction::TYPE_SOURCE:
|
|
|
|
case NuanceItemTransaction::TYPE_OWNER:
|
2015-06-05 20:01:06 +02:00
|
|
|
case NuanceItemTransaction::TYPE_PROPERTY:
|
2015-08-24 18:21:56 +02:00
|
|
|
case NuanceItemTransaction::TYPE_QUEUE:
|
2014-01-06 20:19:32 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::applyCustomExternalTransaction($object, $xaction);
|
|
|
|
}
|
|
|
|
|
2013-11-07 02:00:09 +01:00
|
|
|
}
|