Skip to content

Commit

Permalink
[MODORDERS-1210] Update collection name
Browse files Browse the repository at this point in the history
  • Loading branch information
Saba-Zedginidze-EPAM committed Nov 27, 2024
1 parent 37452ec commit 06ff190
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions ramls/pieces.raml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ documentation:
types:
piece: !include acq-models/mod-orders-storage/schemas/piece.json
piece-collection: !include acq-models/mod-orders-storage/schemas/piece_collection.json
piece-batch-status: !include acq-models/mod-orders/schemas/pieceStatusBatchCollection.json
piece-batch-status-collection: !include acq-models/mod-orders/schemas/pieceStatusBatchCollection.json
errors: !include raml-util/schemas/errors.schema
UUID:
type: string
Expand Down Expand Up @@ -148,7 +148,7 @@ resourceTypes:
description: Batch status update for pieces
body:
application/json:
type: piece-batch-status
type: piece-batch-status-collection
example:
strict: false
value: !include acq-models/mod-orders/examples/pieceStatusBatchCollection.sample
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/org/folio/rest/impl/PiecesAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.folio.rest.annotations.Validate;
import org.folio.rest.core.models.RequestContext;
import org.folio.rest.jaxrs.model.Piece;
import org.folio.rest.jaxrs.model.PieceBatchStatus;
import org.folio.rest.jaxrs.model.PieceBatchStatusCollection;
import org.folio.rest.jaxrs.resource.OrdersPieces;
import org.folio.rest.jaxrs.resource.OrdersPiecesRequests;
import org.folio.service.CirculationRequestsRetriever;
Expand Down Expand Up @@ -63,9 +63,8 @@ public void postOrdersPieces(boolean createItem, Piece entity, Map<String, Strin
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
pieceCreateFlowManager.createPiece(entity, createItem, new RequestContext(vertxContext, okapiHeaders))
.onSuccess(piece -> {
if (logger.isInfoEnabled()) {
logger.debug("Successfully created piece: {}", JsonObject.mapFrom(piece)
.encodePrettily());
if (logger.isDebugEnabled()) {
logger.debug("Successfully created piece: {}", JsonObject.mapFrom(piece).encodePrettily());
}
asyncResultHandler.handle(succeededFuture(buildCreatedResponse(piece)));
})
Expand Down Expand Up @@ -112,9 +111,9 @@ public void getOrdersPiecesRequests(List<String> pieceIds, String status, Map<St
}

@Override
public void putOrdersPiecesBatchStatus(PieceBatchStatus entity, Map<String, String> okapiHeaders,
public void putOrdersPiecesBatchStatus(PieceBatchStatusCollection pieceBatchStatusCollection, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
pieceUpdateFlowManager.updatePiecesStatuses(entity.getPieceIds(), entity.getReceivingStatus(), new RequestContext(vertxContext, okapiHeaders))
pieceUpdateFlowManager.updatePiecesStatuses(pieceBatchStatusCollection.getPieceIds(), pieceBatchStatusCollection.getReceivingStatus(), new RequestContext(vertxContext, okapiHeaders))
.onSuccess(v -> asyncResultHandler.handle(succeededFuture(buildNoContentResponse())))
.onFailure(t -> handleErrorResponse(asyncResultHandler, t));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.folio.rest.jaxrs.model.CompositePurchaseOrder.WorkflowStatus;
import org.folio.rest.jaxrs.model.Location;
import org.folio.rest.jaxrs.model.Piece;
import org.folio.rest.jaxrs.model.PieceBatchStatus;
import org.folio.rest.jaxrs.model.PieceBatchStatusCollection;
import org.folio.service.ProtectionService;
import org.folio.service.orders.PurchaseOrderLineService;
import org.folio.service.pieces.PieceService;
Expand Down Expand Up @@ -89,7 +89,7 @@ public Future<Void> updatePiece(Piece pieceToUpdate, boolean createItem, boolean
.mapEmpty();
}

public Future<Void> updatePiecesStatuses(List<String> pieceIds, PieceBatchStatus.ReceivingStatus receivingStatus, RequestContext requestContext) {
public Future<Void> updatePiecesStatuses(List<String> pieceIds, PieceBatchStatusCollection.ReceivingStatus receivingStatus, RequestContext requestContext) {
var newStatus = Piece.ReceivingStatus.fromValue(receivingStatus.value());
return pieceStorageService.getPiecesByIds(pieceIds, requestContext)
.map(pieces -> pieces.stream().collect(Collectors.groupingBy(Piece::getPoLineId)))
Expand Down

0 comments on commit 06ff190

Please sign in to comment.