forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request magento#2769 from magento-engcom/status-searchapi
Status Search API
- Loading branch information
Showing
18 changed files
with
414 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
app/code/Magento/AsynchronousOperations/Api/Data/DetailedOperationStatusInterface.php
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
app/code/Magento/AsynchronousOperations/Api/Data/OperationSearchResultsInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\AsynchronousOperations\Api\Data; | ||
|
||
/** | ||
* Bulk operation search result interface. | ||
* | ||
* An bulk is a group of queue messages. An bulk operation item is a queue message. | ||
* @api | ||
*/ | ||
interface OperationSearchResultsInterface extends \Magento\Framework\Api\SearchResultsInterface | ||
{ | ||
/** | ||
* Get list of operations. | ||
* | ||
* @return \Magento\AsynchronousOperations\Api\Data\OperationInterface[] | ||
*/ | ||
public function getItems(); | ||
|
||
/** | ||
* Set list of operations. | ||
* | ||
* @param \Magento\AsynchronousOperations\Api\Data\OperationInterface[] $items | ||
* @return $this | ||
*/ | ||
public function setItems(array $items); | ||
} |
26 changes: 26 additions & 0 deletions
26
app/code/Magento/AsynchronousOperations/Api/OperationRepositoryInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\AsynchronousOperations\Api; | ||
|
||
/** | ||
* Bulk operation item repository interface. | ||
* | ||
* An bulk is a group of queue messages. An bulk operation item is a queue message. | ||
* @api | ||
*/ | ||
interface OperationRepositoryInterface | ||
{ | ||
/** | ||
* Lists the bulk operation items that match specified search criteria. | ||
* | ||
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria | ||
* @return \Magento\AsynchronousOperations\Api\Data\OperationSearchResultsInterface | ||
*/ | ||
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
app/code/Magento/AsynchronousOperations/Model/OperationRepository.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\AsynchronousOperations\Model; | ||
|
||
use Magento\Framework\EntityManager\EntityManager; | ||
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; | ||
use Magento\AsynchronousOperations\Api\Data\OperationSearchResultsInterfaceFactory as SearchResultFactory; | ||
use Magento\AsynchronousOperations\Api\Data\OperationExtensionInterfaceFactory; | ||
use Magento\AsynchronousOperations\Model\ResourceModel\Operation\CollectionFactory; | ||
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface; | ||
use Magento\Framework\Exception\InputException; | ||
use Magento\Framework\Exception\NoSuchEntityException; | ||
|
||
/** | ||
* Repository class for @see \Magento\AsynchronousOperations\Api\OperationRepositoryInterface | ||
*/ | ||
class OperationRepository implements \Magento\AsynchronousOperations\Api\OperationRepositoryInterface | ||
{ | ||
/** | ||
* @var EntityManager | ||
*/ | ||
private $entityManager; | ||
|
||
/** | ||
* @var CollectionFactory | ||
*/ | ||
private $collectionFactory; | ||
|
||
/** | ||
* @var SearchResultFactory | ||
*/ | ||
private $searchResultFactory; | ||
|
||
/** | ||
* @var JoinProcessorInterface | ||
*/ | ||
private $joinProcessor; | ||
|
||
/** | ||
* @var \Magento\AsynchronousOperations\Api\Data\OperationExtensionInterfaceFactory | ||
*/ | ||
private $operationExtensionFactory; | ||
|
||
/** | ||
* @var CollectionProcessorInterface | ||
*/ | ||
private $collectionProcessor; | ||
|
||
/** | ||
* @var \Psr\Log\LoggerInterface | ||
*/ | ||
private $logger; | ||
|
||
/** | ||
* OperationRepository constructor. | ||
* | ||
* @param EntityManager $entityManager | ||
* @param CollectionFactory $collectionFactory | ||
* @param SearchResultFactory $searchResultFactory | ||
* @param JoinProcessorInterface $joinProcessor | ||
* @param OperationExtensionInterfaceFactory $operationExtension | ||
* @param CollectionProcessorInterface $collectionProcessor | ||
* @param \Psr\Log\LoggerInterface $logger | ||
*/ | ||
public function __construct( | ||
EntityManager $entityManager, | ||
CollectionFactory $collectionFactory, | ||
SearchResultFactory $searchResultFactory, | ||
JoinProcessorInterface $joinProcessor, | ||
OperationExtensionInterfaceFactory $operationExtension, | ||
CollectionProcessorInterface $collectionProcessor, | ||
\Psr\Log\LoggerInterface $logger | ||
) { | ||
$this->entityManager = $entityManager; | ||
$this->collectionFactory = $collectionFactory; | ||
$this->searchResultFactory = $searchResultFactory; | ||
$this->joinProcessor = $joinProcessor; | ||
$this->operationExtensionFactory = $operationExtension; | ||
$this->collectionProcessor = $collectionProcessor; | ||
$this->logger = $logger; | ||
$this->collectionProcessor = $collectionProcessor; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria) | ||
{ | ||
/** @var \Magento\AsynchronousOperations\Api\Data\OperationSearchResultsInterface $searchResult */ | ||
$searchResult = $this->searchResultFactory->create(); | ||
|
||
/** @var \Magento\AsynchronousOperations\Model\ResourceModel\Operation\Collection $collection */ | ||
$collection = $this->collectionFactory->create(); | ||
$this->joinProcessor->process($collection, \Magento\AsynchronousOperations\Api\Data\OperationInterface::class); | ||
$this->collectionProcessor->process($searchCriteria, $collection); | ||
$searchResult->setSearchCriteria($searchCriteria); | ||
$searchResult->setTotalCount($collection->getSize()); | ||
$searchResult->setItems($collection->getItems()); | ||
|
||
return $searchResult; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
app/code/Magento/AsynchronousOperations/etc/extension_attributes.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd"> | ||
<extension_attributes for="Magento\AsynchronousOperations\Api\Data\OperationInterface"> | ||
<attribute code="start_time" type="string"> | ||
<resources> | ||
<resource ref="Magento_Logging::system_magento_logging_bulk_operations"/> | ||
</resources> | ||
<join reference_table="magento_bulk" join_on_field="bulk_uuid" reference_field="uuid"> | ||
<field column="start_time">start_time</field> | ||
</join> | ||
</attribute> | ||
</extension_attributes> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.