Index: src/__phutil_library_map__.php =================================================================== --- src/__phutil_library_map__.php +++ src/__phutil_library_map__.php @@ -668,6 +668,8 @@ 'DrydockManagementWaitForLeaseWorkflow' => 'applications/drydock/management/DrydockManagementWaitForLeaseWorkflow.php', 'DrydockManagementWorkflow' => 'applications/drydock/management/DrydockManagementWorkflow.php', 'DrydockPHIDTypeBlueprint' => 'applications/drydock/phid/DrydockPHIDTypeBlueprint.php', + 'DrydockPHIDTypeLease' => 'applications/drydock/phid/DrydockPHIDTypeLease.php', + 'DrydockPHIDTypeResource' => 'applications/drydock/phid/DrydockPHIDTypeResource.php', 'DrydockPreallocatedHostBlueprintImplementation' => 'applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php', 'DrydockResource' => 'applications/drydock/storage/DrydockResource.php', 'DrydockResourceCloseController' => 'applications/drydock/controller/DrydockResourceCloseController.php', @@ -3074,6 +3076,8 @@ 'DrydockManagementWaitForLeaseWorkflow' => 'DrydockManagementWorkflow', 'DrydockManagementWorkflow' => 'PhutilArgumentWorkflow', 'DrydockPHIDTypeBlueprint' => 'PhabricatorPHIDType', + 'DrydockPHIDTypeLease' => 'PhabricatorPHIDType', + 'DrydockPHIDTypeResource' => 'PhabricatorPHIDType', 'DrydockPreallocatedHostBlueprintImplementation' => 'DrydockBlueprintImplementation', 'DrydockResource' => array( Index: src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php =================================================================== --- src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php +++ src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php @@ -29,6 +29,12 @@ array $handles, array $objects) { + foreach ($handles as $phid => $handle) { + $blueprint = $objects[$phid]; + $id = $blueprint->getID(); + + $handle->setURI("/drydock/blueprint/{$id}/"); + } } } Index: src/applications/drydock/phid/DrydockPHIDTypeLease.php =================================================================== --- src/applications/drydock/phid/DrydockPHIDTypeLease.php +++ src/applications/drydock/phid/DrydockPHIDTypeLease.php @@ -1,26 +1,26 @@ withPHIDs($phids); } @@ -29,6 +29,12 @@ array $handles, array $objects) { + foreach ($handles as $phid => $handle) { + $lease = $objects[$phid]; + $id = $lease->getID(); + + $handle->setURI("/drydock/lease/{$id}/"); + } } } Index: src/applications/drydock/phid/DrydockPHIDTypeResource.php =================================================================== --- src/applications/drydock/phid/DrydockPHIDTypeResource.php +++ src/applications/drydock/phid/DrydockPHIDTypeResource.php @@ -1,26 +1,26 @@ withPHIDs($phids); } @@ -29,6 +29,12 @@ array $handles, array $objects) { + foreach ($handles as $phid => $handle) { + $resource = $objects[$phid]; + $id = $resource->getID(); + + $handle->setURI("/drydock/resource/{$id}/"); + } } } Index: src/applications/drydock/query/DrydockBlueprintQuery.php =================================================================== --- src/applications/drydock/query/DrydockBlueprintQuery.php +++ src/applications/drydock/query/DrydockBlueprintQuery.php @@ -34,7 +34,7 @@ DrydockBlueprintImplementation::getAllBlueprintImplementations(); foreach ($blueprints as $blueprint) { - if (array_key_exists($implementations, $blueprint->getClassName())) { + if (array_key_exists($blueprint->getClassName(), $implementations)) { $blueprint->attachImplementation( $implementations[$blueprint->getClassName()]); } Index: src/applications/drydock/query/DrydockLeaseQuery.php =================================================================== --- src/applications/drydock/query/DrydockLeaseQuery.php +++ src/applications/drydock/query/DrydockLeaseQuery.php @@ -4,6 +4,7 @@ extends PhabricatorCursorPagedPolicyAwareQuery { private $ids; + private $phids; private $resourceIDs; private $statuses; @@ -12,6 +13,11 @@ return $this; } + public function withPHIDs(array $phids) { + $this->phids = $phids; + return $this; + } + public function withResourceIDs(array $ids) { $this->resourceIDs = $ids; return $this; @@ -73,6 +79,13 @@ $this->ids); } + if ($this->phids) { + $where[] = qsprintf( + $conn_r, + 'phid IN (%Ls)', + $this->phids); + } + if ($this->statuses) { $where[] = qsprintf( $conn_r, Index: src/applications/drydock/query/DrydockResourceQuery.php =================================================================== --- src/applications/drydock/query/DrydockResourceQuery.php +++ src/applications/drydock/query/DrydockResourceQuery.php @@ -4,6 +4,7 @@ extends PhabricatorCursorPagedPolicyAwareQuery { private $ids; + private $phids; private $statuses; private $types; private $blueprintPHIDs; @@ -13,6 +14,11 @@ return $this; } + public function withPHIDs(array $phids) { + $this->phids = $phids; + return $this; + } + public function withTypes(array $types) { $this->types = $types; return $this; @@ -55,6 +61,13 @@ $this->ids); } + if ($this->phids) { + $where[] = qsprintf( + $conn_r, + 'phid IN (%Ls)', + $this->phids); + } + if ($this->types) { $where[] = qsprintf( $conn_r, Index: src/applications/drydock/storage/DrydockBlueprint.php =================================================================== --- src/applications/drydock/storage/DrydockBlueprint.php +++ src/applications/drydock/storage/DrydockBlueprint.php @@ -9,6 +9,8 @@ protected $editPolicy; protected $details; + private $implementation = self::ATTACHABLE; + public function getConfiguration() { return array( self::CONFIG_AUX_PHID => true, @@ -34,6 +36,12 @@ return id(new $class())->attachInstance($this); } + public function attachImplementation(DrydockBlueprintImplementation $impl) { + $this->implementation = $impl; + return $this; + } + + /* -( PhabricatorPolicyInterface )----------------------------------------- */ Index: src/applications/drydock/storage/DrydockLease.php =================================================================== --- src/applications/drydock/storage/DrydockLease.php +++ src/applications/drydock/storage/DrydockLease.php @@ -56,8 +56,7 @@ } public function generatePHID() { - return PhabricatorPHID::generateNewPHID( - PhabricatorPHIDConstants::PHID_TYPE_DRYL); + return PhabricatorPHID::generateNewPHID(DrydockPHIDTypeLease::TYPECONST); } public function getInterface($type) { Index: src/applications/drydock/storage/DrydockResource.php =================================================================== --- src/applications/drydock/storage/DrydockResource.php +++ src/applications/drydock/storage/DrydockResource.php @@ -27,8 +27,7 @@ } public function generatePHID() { - return PhabricatorPHID::generateNewPHID( - PhabricatorPHIDConstants::PHID_TYPE_DRYR); + return PhabricatorPHID::generateNewPHID(DrydockPHIDTypeResource::TYPECONST); } public function getAttribute($key, $default = null) { Index: src/applications/phid/PhabricatorPHIDConstants.php =================================================================== --- src/applications/phid/PhabricatorPHIDConstants.php +++ src/applications/phid/PhabricatorPHIDConstants.php @@ -7,8 +7,6 @@ const PHID_TYPE_MAGIC = '!!!!'; const PHID_TYPE_STRY = 'STRY'; const PHID_TYPE_ACMT = 'ACMT'; - const PHID_TYPE_DRYR = 'DRYR'; - const PHID_TYPE_DRYL = 'DRYL'; const PHID_TYPE_OASC = 'OASC'; const PHID_TYPE_OASA = 'OASA'; const PHID_TYPE_TOBJ = 'TOBJ';