Skip to content

Commit ef60eb2

Browse files
committed
Merge remote-tracking branch 'bulk/bulk-status-search' into status-searchapi
2 parents 8412217 + 9bd966f commit ef60eb2

10 files changed

+25
-65
lines changed

app/code/Magento/AsynchronousOperations/Api/BulkStatusInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
namespace Magento\AsynchronousOperations\Api;
1010

1111
/**
12-
* Interface BulkStatusInterface
12+
* Interface BulkStatusInterface.
13+
*
1314
* Bulk summary data with list of operations items short data.
1415
*
1516
* @api

app/code/Magento/AsynchronousOperations/Api/Data/DetailedBulkOperationsStatusInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ interface DetailedBulkOperationsStatusInterface extends BulkSummaryInterface
2323
/**
2424
* Retrieve operations list.
2525
*
26-
* @return \Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface[]
26+
* @return \Magento\AsynchronousOperations\Api\Data\OperationInterface[]
2727
*/
2828
public function getOperationsList();
2929

3030
/**
3131
* Set operations list.
3232
*
33-
* @param \Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface[] $operationStatusList
33+
* @param \Magento\AsynchronousOperations\Api\Data\OperationInterface[] $operationStatusList
3434
* @return $this
3535
*/
3636
public function setOperationsList($operationStatusList);

app/code/Magento/AsynchronousOperations/Api/Data/DetailedOperationStatusInterface.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

app/code/Magento/AsynchronousOperations/Api/Data/OperationSearchResultsInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
@@ -10,21 +9,22 @@
109
namespace Magento\AsynchronousOperations\Api\Data;
1110

1211
/**
13-
* Interface defines Operation Search Results data object
12+
* Bulk operation search result interface.
1413
*
14+
* An bulk is a group of queue messages. An bulk operation item is a queue message.
1515
* @api
1616
*/
1717
interface OperationSearchResultsInterface extends \Magento\Framework\Api\SearchResultsInterface
1818
{
1919
/**
20-
* Get operations list.
20+
* Get list of operations.
2121
*
2222
* @return \Magento\AsynchronousOperations\Api\Data\OperationInterface[]
2323
*/
2424
public function getItems();
2525

2626
/**
27-
* Set operations list.
27+
* Set list of operations.
2828
*
2929
* @param \Magento\AsynchronousOperations\Api\Data\OperationInterface[] $items
3030
* @return $this

app/code/Magento/AsynchronousOperations/Api/OperationRepositoryInterface.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99
namespace Magento\AsynchronousOperations\Api;
1010

1111
/**
12+
* Bulk operation item repository interface.
13+
*
14+
* An bulk is a group of queue messages. An bulk operation item is a queue message.
1215
* @api
1316
*/
1417
interface OperationRepositoryInterface
1518
{
1619
/**
17-
* Find operation entities by criteria
20+
* Lists the bulk operation items that match specified search criteria.
1821
*
1922
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
2023
* @return \Magento\AsynchronousOperations\Api\Data\OperationSearchResultsInterface

app/code/Magento/AsynchronousOperations/Model/Operation.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
*/
66
namespace Magento\AsynchronousOperations\Model;
77

8-
use Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface;
8+
use Magento\AsynchronousOperations\Api\Data\OperationInterface;
99
use Magento\Framework\DataObject;
10-
use Magento\Framework\Api\ExtensibleDataInterface;
1110

1211
/**
1312
* Class Operation
1413
*/
15-
class Operation extends DataObject implements DetailedOperationStatusInterface
14+
class Operation extends DataObject implements OperationInterface
1615
{
1716
/**
1817
* @inheritDoc

app/code/Magento/AsynchronousOperations/Model/OperationManagement.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Magento\AsynchronousOperations\Model;
88

9-
use Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterfaceFactory;
9+
use Magento\AsynchronousOperations\Api\Data\OperationInterfaceFactory;
1010
use Magento\Framework\EntityManager\EntityManager;
1111

1212
/**
@@ -20,7 +20,7 @@ class OperationManagement implements \Magento\Framework\Bulk\OperationManagement
2020
private $entityManager;
2121

2222
/**
23-
* @var DetailedOperationStatusInterfaceFactory
23+
* @var OperationInterfaceFactory
2424
*/
2525
private $operationFactory;
2626

@@ -33,12 +33,12 @@ class OperationManagement implements \Magento\Framework\Bulk\OperationManagement
3333
* OperationManagement constructor.
3434
*
3535
* @param EntityManager $entityManager
36-
* @param DetailedOperationStatusInterfaceFactory $operationFactory
36+
* @param OperationInterfaceFactory $operationFactory
3737
* @param \Psr\Log\LoggerInterface $logger
3838
*/
3939
public function __construct(
4040
EntityManager $entityManager,
41-
DetailedOperationStatusInterfaceFactory $operationFactory,
41+
OperationInterfaceFactory $operationFactory,
4242
\Psr\Log\LoggerInterface $logger
4343
) {
4444
$this->entityManager = $entityManager;
@@ -65,7 +65,6 @@ public function changeOperationStatus(
6565
$operationEntity->setResultMessage($message);
6666
$operationEntity->setSerializedData($data);
6767
$operationEntity->setResultSerializedData($resultData);
68-
$operationEntity->setResultSerializedData($resultData);
6968
$this->entityManager->save($operationEntity);
7069
} catch (\Exception $exception) {
7170
$this->logger->critical($exception->getMessage());

app/code/Magento/AsynchronousOperations/Model/OperationRepository.php

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
namespace Magento\AsynchronousOperations\Model;
1010

11-
use Magento\Framework\App\ObjectManager;
12-
use Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterfaceFactory;
1311
use Magento\Framework\EntityManager\EntityManager;
1412
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
1513
use Magento\AsynchronousOperations\Api\Data\OperationSearchResultsInterfaceFactory as SearchResultFactory;
@@ -20,7 +18,7 @@
2018
use Magento\Framework\Exception\NoSuchEntityException;
2119

2220
/**
23-
* Operation Management Service
21+
* Repository class for @see \Magento\AsynchronousOperations\Api\OperationRepositoryInterface
2422
*/
2523
class OperationRepository implements \Magento\AsynchronousOperations\Api\OperationRepositoryInterface
2624
{
@@ -61,6 +59,7 @@ class OperationRepository implements \Magento\AsynchronousOperations\Api\Operati
6159

6260
/**
6361
* OperationRepository constructor.
62+
*
6463
* @param EntityManager $entityManager
6564
* @param CollectionFactory $collectionFactory
6665
* @param SearchResultFactory $searchResultFactory
@@ -83,6 +82,7 @@ public function __construct(
8382
$this->searchResultFactory = $searchResultFactory;
8483
$this->joinProcessor = $joinProcessor;
8584
$this->operationExtensionFactory = $operationExtension;
85+
$this->collectionProcessor = $collectionProcessor;
8686
$this->logger = $logger;
8787
$this->collectionProcessor = $collectionProcessor;
8888
}
@@ -101,18 +101,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
101101
$this->collectionProcessor->process($searchCriteria, $collection);
102102
$searchResult->setSearchCriteria($searchCriteria);
103103
$searchResult->setTotalCount($collection->getSize());
104-
105-
$items = [];
106-
foreach ($collection->getItems() as $item) {
107-
$extensionAttributes = $item->getExtensionAttributes();
108-
if ($extensionAttributes == null) {
109-
$extensionAttributes = $this->operationExtensionFactory->create();
110-
}
111-
$extensionAttributes->setStartTime($item->getExtensionAttributeStartTimeStartTime());
112-
$item->setExtensionAttributes($extensionAttributes);
113-
$items[] = $item;
114-
}
115-
$searchResult->setItems($items);
104+
$searchResult->setItems($collection->getItems());
116105

117106
return $searchResult;
118107
}

app/code/Magento/AsynchronousOperations/Test/Unit/Model/OperationManagementTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ protected function setUp()
4040
$this->entityManagerMock = $this->createMock(\Magento\Framework\EntityManager\EntityManager::class);
4141
$this->metadataPoolMock = $this->createMock(\Magento\Framework\EntityManager\MetadataPool::class);
4242
$this->operationFactoryMock = $this->createPartialMock(
43-
\Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterfaceFactory::class,
43+
\Magento\AsynchronousOperations\Api\Data\OperationInterfaceFactory::class,
4444
['create']
4545
);
4646
$this->operationMock =
47-
$this->createMock(\Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface::class);
47+
$this->createMock(\Magento\AsynchronousOperations\Api\Data\OperationInterface::class);
4848
$this->loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
4949
$this->model = new \Magento\AsynchronousOperations\Model\OperationManagement(
5050
$this->entityManagerMock,

app/code/Magento/AsynchronousOperations/etc/di.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
99
<preference for="Magento\AsynchronousOperations\Api\Data\BulkSummaryInterface" type="Magento\AsynchronousOperations\Model\BulkSummary" />
1010
<preference for="Magento\AsynchronousOperations\Api\Data\OperationInterface" type="Magento\AsynchronousOperations\Model\Operation" />
11-
<preference for="Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface" type="Magento\AsynchronousOperations\Model\Operation" />
1211
<preference for="Magento\AsynchronousOperations\Api\Data\OperationListInterface" type="Magento\AsynchronousOperations\Model\OperationList" />
1312
<preference for="Magento\Framework\Bulk\BulkManagementInterface" type="Magento\AsynchronousOperations\Model\BulkManagement" />
1413
<preference for="Magento\AsynchronousOperations\Api\BulkStatusInterface" type="Magento\AsynchronousOperations\Model\BulkOperationsStatus" />
@@ -22,7 +21,7 @@
2221
<type name="Magento\Framework\EntityManager\MetadataPool">
2322
<arguments>
2423
<argument name="metadata" xsi:type="array">
25-
<item name="Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface" xsi:type="array">
24+
<item name="Magento\AsynchronousOperations\Api\Data\OperationInterface" xsi:type="array">
2625
<item name="entityTableName" xsi:type="string">magento_operation</item>
2726
<item name="identifierField" xsi:type="string">id</item>
2827
</item>

0 commit comments

Comments
 (0)