PathogenSymptomMapServiceImpl.java
/*
* Copyright 2022 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.service.impl;
import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.gringlobal.api.MultiOp;
import org.gringlobal.model.community.PathogenSymptomMap;
import org.gringlobal.persistence.community.PathogenSymptomMapRepository;
import org.gringlobal.service.PathogenSymptomMapService;
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 PathogenSymptomMapServiceImpl extends CRUDService2Impl<PathogenSymptomMap, PathogenSymptomMapRepository> implements PathogenSymptomMapService {
@Override
@Transactional
@PreAuthorize("hasAuthority('GROUP_ADMINS') or @ggceSec.actionAllowed('Pathogen', 'WRITE')")
public PathogenSymptomMap create(PathogenSymptomMap source) {
PathogenSymptomMap saved = new PathogenSymptomMap();
saved.apply(source);
return repository.save(saved);
}
@Override
@PreAuthorize("hasAuthority('GROUP_ADMINS') or @ggceSec.actionAllowed('Pathogen', 'WRITE')")
public PathogenSymptomMap createFast(PathogenSymptomMap source) {
return super.createFast(source);
}
@Override
@Transactional
@PreAuthorize("hasAuthority('GROUP_ADMINS') or @ggceSec.actionAllowed('Pathogen', 'WRITE')")
public PathogenSymptomMap update(PathogenSymptomMap input, PathogenSymptomMap target) {
target.apply(input);
return _lazyLoad(repository.save(target));
}
@Override
@Transactional
@PreAuthorize("hasAuthority('GROUP_ADMINS') or @ggceSec.actionAllowed('Pathogen', 'WRITE')")
public PathogenSymptomMap updateFast(@NotNull @Valid PathogenSymptomMap updated, PathogenSymptomMap target) {
target.apply(updated);
return repository.save(target);
}
@Override
@Transactional
@PreAuthorize("hasAuthority('GROUP_ADMINS') or @ggceSec.actionAllowed('Pathogen', 'WRITE')")
public PathogenSymptomMap remove(PathogenSymptomMap entity) {
return super.remove(entity);
}
}