OrderRequestActionApiServiceImpl.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 org.gringlobal.api.model.OrderRequestActionDTO;
import org.gringlobal.api.model.OrderRequestActionRequestDTO;
import org.gringlobal.api.v2.facade.OrderRequestActionApiService;
import org.gringlobal.model.OrderRequestAction;
import org.gringlobal.service.OrderRequestActionService;
import org.gringlobal.service.OrderRequestService;
import org.gringlobal.service.filter.OrderRequestActionFilter;
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 OrderRequestActionApiServiceImpl extends APIBaseActionSupportFacade<OrderRequestActionService, OrderRequestActionDTO, OrderRequestAction, OrderRequestActionFilter, OrderRequestActionRequestDTO, OrderRequestActionService.OrderRequestActionRequest, OrderRequestActionService.OrderRequestActionScheduleFilter> implements OrderRequestActionApiService {
@Autowired
private OrderRequestService orderRequestService;
@Override
protected OrderRequestAction convert(OrderRequestActionDTO source) {
return mapper.map(source);
}
@Override
protected OrderRequestActionDTO convert(OrderRequestAction source) {
return mapper.map(source);
}
@Override
protected OrderRequestActionService.OrderRequestActionRequest convertRequest(OrderRequestActionRequestDTO source) {
return mapper.map(source);
}
@Override
protected OrderRequestActionRequestDTO convertRequest(OrderRequestActionService.OrderRequestActionRequest source) {
return mapper.map(source);
}
@Override
public Page<OrderRequestActionDTO> listByOrderRequest(long orderRequestId, Pageable pageable) {
return mapper.map(service.listByOrderRequest(orderRequestService.get(orderRequestId), pageable), mapper::map);
}
}