OrderRequestItemActionApiServiceImpl.java
/*
* Copyright 2024 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gringlobal.api.v2.facade.impl;
import java.util.List;
import org.gringlobal.api.model.OrderRequestItemActionDTO;
import org.gringlobal.api.model.OrderRequestItemActionRequestDTO;
import org.gringlobal.api.v2.facade.OrderRequestItemActionApiService;
import org.gringlobal.model.OrderRequest;
import org.gringlobal.model.OrderRequestItemAction;
import org.gringlobal.service.OrderRequestItemActionService;
import org.gringlobal.service.OrderRequestService;
import org.gringlobal.service.filter.OrderRequestItemActionFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Component;
@Component
public class OrderRequestItemActionApiServiceImpl extends APIBaseActionSupportFacade<OrderRequestItemActionService, OrderRequestItemActionDTO, OrderRequestItemAction, OrderRequestItemActionFilter, OrderRequestItemActionRequestDTO, OrderRequestItemActionService.OrderRequestItemActionRequest, OrderRequestItemActionService.OrderRequestItemActionScheduleFilter> implements OrderRequestItemActionApiService {
@Autowired
private OrderRequestService orderRequestService;
@Override
protected OrderRequestItemAction convert(OrderRequestItemActionDTO source) {
return mapper.map(source);
}
@Override
protected OrderRequestItemActionDTO convert(OrderRequestItemAction source) {
return mapper.map(source);
}
@Override
protected OrderRequestItemActionService.OrderRequestItemActionRequest convertRequest(OrderRequestItemActionRequestDTO source) {
return mapper.map(source);
}
@Override
protected OrderRequestItemActionRequestDTO convertRequest(OrderRequestItemActionService.OrderRequestItemActionRequest source) {
return mapper.map(source);
}
@Override
public Page<OrderRequestItemActionDTO> listByOrderRequest(Long orderRequestId, Pageable pageable) {
final OrderRequest orderRequest = orderRequestService.get(orderRequestId);
return mapper.map(service.listByOrderRequest(orderRequest, pageable), mapper::map);
}
@Override
public List<OrderRequestItemActionDTO> startActions(Long orderRequestId, String actionCode) {
final OrderRequest orderRequest = orderRequestService.get(orderRequestId);
return mapper.map(service.startActions(orderRequest, actionCode), mapper::map);
}
}