GeneticAnnotationServiceImpl.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.model.GeneticAnnotation;
import org.gringlobal.persistence.GeneticAnnotationRepository;
import org.gringlobal.service.GeneticAnnotationService;
import org.gringlobal.service.filter.GeneticAnnotationFilter;
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
@Transactional(readOnly = true)
@Validated
public class GeneticAnnotationServiceImpl
extends FilteredCRUDService2Impl<GeneticAnnotation, GeneticAnnotationFilter, GeneticAnnotationRepository>
implements GeneticAnnotationService {
@Override
@Transactional
@PreAuthorize("hasAuthority('GROUP_ADMINS') or @ggceSec.actionAllowed('GeneticAnnotation', 'WRITE')")
public GeneticAnnotation create(final GeneticAnnotation source) {
return createFast(source);
}
@Override
@Transactional
@PreAuthorize("hasAuthority('GROUP_ADMINS') or @ggceSec.actionAllowed('GeneticAnnotation', 'WRITE')")
public GeneticAnnotation createFast(final GeneticAnnotation source) {
GeneticAnnotation annotation = new GeneticAnnotation();
annotation.apply(source);
return repository.save(annotation);
}
@Override
@Transactional
@PreAuthorize("hasAuthority('GROUP_ADMINS') or @ggceSec.actionAllowed('GeneticAnnotation', 'WRITE')")
public GeneticAnnotation update(final GeneticAnnotation updated) {
return super.update(updated);
}
@Override
@Transactional
@PreAuthorize("hasAuthority('GROUP_ADMINS') or @ggceSec.actionAllowed('GeneticAnnotation', 'WRITE')")
public GeneticAnnotation update(final GeneticAnnotation updated, final GeneticAnnotation target) {
return updateFast(updated, target);
}
@Override
@Transactional
@PreAuthorize("hasAuthority('GROUP_ADMINS') or @ggceSec.actionAllowed('GeneticAnnotation', 'WRITE')")
public GeneticAnnotation updateFast(final GeneticAnnotation updated, final GeneticAnnotation target) {
target.apply(updated);
return repository.save(target);
}
@Override
@Transactional
@PreAuthorize("hasAuthority('GROUP_ADMINS') or @ggceSec.actionAllowed('GeneticAnnotation', 'WRITE')")
public GeneticAnnotation remove(final GeneticAnnotation entity) {
return super.remove(entity);
}
}