PathogenGeographyMapServiceImpl.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 javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.gringlobal.model.community.PathogenGeographyMap;
import org.gringlobal.persistence.community.PathogenGeographyMapRepository;
import org.gringlobal.service.PathogenGeographyMapService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
@Service
@Validated
public class PathogenGeographyMapServiceImpl extends CRUDService2Impl<PathogenGeographyMap, PathogenGeographyMapRepository> implements PathogenGeographyMapService {
@Override
@Transactional
@PreAuthorize("hasAuthority('GROUP_ADMINS') or @ggceSec.actionAllowed('Pathogen', 'WRITE')")
public PathogenGeographyMap create(PathogenGeographyMap source) {
PathogenGeographyMap saved = new PathogenGeographyMap();
saved.apply(source);
return repository.save(saved);
}
@Override
@Transactional
@PreAuthorize("hasAuthority('GROUP_ADMINS') or @ggceSec.actionAllowed('Pathogen', 'WRITE')")
public PathogenGeographyMap createFast(PathogenGeographyMap source) {
return super.createFast(source);
}
@Override
@Transactional
@PreAuthorize("hasAuthority('GROUP_ADMINS') or @ggceSec.actionAllowed('Pathogen', 'WRITE')")
public PathogenGeographyMap update(PathogenGeographyMap input, PathogenGeographyMap target) {
target.apply(input);
return _lazyLoad(repository.save(target));
}
@Override
@Transactional
@PreAuthorize("hasAuthority('GROUP_ADMINS') or @ggceSec.actionAllowed('Pathogen', 'WRITE')")
public PathogenGeographyMap updateFast(@NotNull @Valid PathogenGeographyMap updated, PathogenGeographyMap target) {
target.apply(updated);
return repository.save(target);
}
@Override
@Transactional
@PreAuthorize("hasAuthority('GROUP_ADMINS') or @ggceSec.actionAllowed('Pathogen', 'WRITE')")
public PathogenGeographyMap remove(PathogenGeographyMap entity) {
return super.remove(entity);
}
}