AmphibianApiServiceImpl.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.genesys.server.api.v2.facade.impl;
import org.genesys.filerepository.InvalidRepositoryPathException;
import org.genesys.server.api.v2.facade.AmphibianApiService;
import org.genesys.server.api.v2.mapper.MapstructMapper;
import org.genesys.server.api.v2.model.impl.PreviewAccessionRefDTO;
import org.genesys.server.api.v2.model.impl.RepositoryFileDTO;
import org.genesys.server.service.AmphibianService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import java.util.List;
import java.util.UUID;
@Service
@Validated
@Transactional(readOnly = true)
public class AmphibianApiServiceImpl implements AmphibianApiService {
@Autowired
private AmphibianService amphibianService;
@Autowired
private MapstructMapper mapper;
@Override
public List<RepositoryFileDTO> myFiles() throws InvalidRepositoryPathException {
return mapper.map(amphibianService.myFiles(), mapper::map);
}
@Override
@Transactional
public long addAccessionRefs(UUID uuid, int sheet, List<PreviewAccessionRefDTO> accessionRefs) {
return amphibianService.addAccessionRefs(uuid, sheet, mapper.map(accessionRefs, mapper::map));
}
}