SourceDescriptorCodeServiceImpl.java

package org.gringlobal.service.impl;

import org.gringlobal.model.SourceDescriptorCode;
import org.gringlobal.model.SourceDescriptorCodeLang;
import org.gringlobal.persistence.SourceDescriptorCodeLangRepository;
import org.gringlobal.persistence.SourceDescriptorCodeRepository;
import org.gringlobal.service.SourceDescriptorCodeService;
import org.gringlobal.service.SourceDescriptorCodeTranslationService;
import org.gringlobal.service.filter.SourceDescriptorCodeFilter;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;

/**
 * The Class SourceDescriptorCodeServiceImpl.
 */
@Service
@Transactional(readOnly = true)
@Validated
public class SourceDescriptorCodeServiceImpl extends FilteredTranslatedCRUDServiceImpl<SourceDescriptorCode, SourceDescriptorCodeLang, SourceDescriptorCodeTranslationService.TranslatedSourceDescriptorCode, SourceDescriptorCodeFilter, SourceDescriptorCodeRepository>
	implements SourceDescriptorCodeService {

	@Override
	@Transactional
	// TODO Add SecurityAction.SourceDescriptor
	public SourceDescriptorCode create(SourceDescriptorCode source) {
		var target = new SourceDescriptorCode();
		target.apply(source);
		return repository.save(target);
	}

	@Override
	@Transactional
	// TODO Add SecurityAction.SourceDescriptor
	public SourceDescriptorCode update(SourceDescriptorCode updated, SourceDescriptorCode target) {
		target.apply(updated);
		return repository.save(target);
	}

	@Override
	@Transactional
	// TODO Add SecurityAction.SourceDescriptor
	public SourceDescriptorCode updateFast(SourceDescriptorCode updated, SourceDescriptorCode target) {
		target.apply(updated);
		return repository.save(target);
	}

	@Component
	protected static class SourceDescriptorCodeTranslationSupport extends BaseTranslationSupport<SourceDescriptorCode, SourceDescriptorCodeLang, SourceDescriptorCodeTranslationService.TranslatedSourceDescriptorCode, SourceDescriptorCodeFilter, SourceDescriptorCodeLangRepository> implements SourceDescriptorCodeTranslationService {

		/**
		 * Instantiates a new source descriptor code translation support.
		 */
		public SourceDescriptorCodeTranslationSupport() {
			super();
		}

		@Override
		protected TranslatedSourceDescriptorCode toTranslated(SourceDescriptorCode e, String title, String description) {
			return TranslatedSourceDescriptorCode.from(e, title, description);
		}

	}

}