CodeValueApiServiceImpl.java
/*
* Copyright 2025 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.CodeValueDTO;
import org.gringlobal.api.model.CodeValueLangDTO;
import org.gringlobal.api.model.TranslatedCodeValueDTO;
import org.gringlobal.api.v2.facade.CodeValueApiService;
import org.gringlobal.api.v2.facade.impl.APIFilteredTranslatedServiceFacadeImpl;
import org.gringlobal.model.CodeValue;
import org.gringlobal.model.CodeValueLang;
import org.gringlobal.service.CodeValueService;
import org.gringlobal.service.CodeValueTranslationService;
import org.gringlobal.service.filter.CodeValueFilter;
import org.gringlobal.service.impl.CodeValueServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class CodeValueApiServiceImpl extends APIFilteredTranslatedServiceFacadeImpl<CodeValueService, CodeValueDTO,
TranslatedCodeValueDTO, CodeValueLangDTO, CodeValue, CodeValueLang,
CodeValueTranslationService.TranslatedCodeValue, CodeValueFilter> implements CodeValueApiService {
@Override
protected CodeValueTranslationService.TranslatedCodeValue convertTranslation(TranslatedCodeValueDTO source) {
return mapper.map(source);
}
@Override
protected TranslatedCodeValueDTO convertTranslation(CodeValueTranslationService.TranslatedCodeValue source) {
return mapper.map(source);
}
@Override
protected CodeValueLang convertLang(CodeValueLangDTO source) {
return mapper.map(source);
}
@Override
protected CodeValueLangDTO convertLang(CodeValueLang source) {
return mapper.map(source);
}
@Override
protected CodeValue convert(CodeValueDTO source) {
return mapper.map(source);
}
@Override
protected CodeValueDTO convert(CodeValue source) {
return mapper.map(source);
}
@Override
@Transactional
public CodeValueDTO replaceAndRemove(CodeValueDTO entity, CodeValueDTO replacement) {
return mapper.map(service.replaceAndRemove(mapper.map(entity), mapper.map(replacement)));
}
@Override
public List<CodeValueServiceImpl.CodeValueStats> getStatistics(String groupName) {
return service.getStatistics(groupName);
}
}