NameGroupServiceImpl.java
/*
* Copyright 2026 Global Crop Diversity Trust
* Licensed under the Apache License, Version 2.0
* See LICENSE file in project root folder or http://www.apache.org/licenses/LICENSE-2.0
*/
package org.gringlobal.service.impl;
import org.gringlobal.custom.elasticsearch.SearchException;
import org.gringlobal.model.NameGroup;
import org.gringlobal.persistence.NameGroupRepository;
import org.gringlobal.service.NameGroupService;
import org.gringlobal.service.filter.NameGroupFilter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @author Maxym Borodenko
*/
@Service
@Transactional(readOnly = true)
@Slf4j
public class NameGroupServiceImpl extends FilteredCRUDService2Impl<NameGroup, NameGroupFilter, NameGroupRepository> implements NameGroupService {
@Override
@Transactional
public NameGroup create(NameGroup source) {
return _lazyLoad(createFast(source));
}
@Override
@Transactional
public NameGroup createFast(NameGroup source) {
log.debug("Create NameGroup. Input data {}", source);
NameGroup nameGroup = new NameGroup();
nameGroup.apply(source);
return repository.save(nameGroup);
}
@Override
@Transactional
public NameGroup update(NameGroup input, NameGroup target) {
return _lazyLoad(updateFast(input, target));
}
@Override
@Transactional
public NameGroup updateFast(NameGroup input, NameGroup target) {
log.debug("Update NameGroup. Input data {}", input);
target.apply(input);
return repository.save(target);
}
@Override
public Page<NameGroup> list(NameGroupFilter filter, Pageable page) throws SearchException {
return super.list(NameGroup.class, filter, page);
}
}