![JAR search and dependency download from the Maven repository](/logo.png)
sk.seges.acris.server.model.dto.configuration.CountryDTOConverter Maven / Gradle / Ivy
The newest version!
package sk.seges.acris.server.model.dto.configuration;
import java.io.Serializable;
import javax.annotation.Generated;
import javax.persistence.EntityManager;
import sk.seges.acris.shared.model.dto.CountryDTO;
import sk.seges.corpis.pap.converter.hibernate.TransactionalConverter;
import sk.seges.corpis.server.domain.jpa.JpaCountry;
import sk.seges.corpis.server.domain.server.model.data.CountryData;
import sk.seges.sesam.pap.model.annotation.TransferObjectMapping;
import sk.seges.sesam.shared.model.converter.ConverterProviderContext;
@SuppressWarnings("serial")
@TransferObjectMapping(dtoClass = CountryDTO.class,
domainClassName = "sk.seges.corpis.server.domain.jpa.JpaCountry",
configurationClassName = "sk.seges.acris.server.model.dto.configuration.CountryDTOConfiguration",
generateConverter = false, generateDto = false,
converterClassName = "sk.seges.acris.server.model.dto.configuration.CountryDTOConverter")
@Generated(value = "sk.seges.corpis.pap.model.hibernate.HibernateTransferObjectDataConverterProcessor")
public class CountryDTOConverter extends TransactionalConverter {
protected final EntityManager entityManager;
protected final ConverterProviderContext converterProviderContext;
public CountryDTOConverter(EntityManager entityManager, ConverterProviderContext converterProviderContext) {
super();
this.entityManager = entityManager;
this.converterProviderContext = converterProviderContext;
}
public boolean equals(Object _domainArg, Object _dtoArg) {
if (_domainArg == null) {
return (_dtoArg == null);
}
if (_dtoArg == null) {
return false;
}
if (!(_domainArg instanceof CountryData)) {
return false;
}
CountryData _domain = (CountryData)_domainArg;
if (!(_dtoArg instanceof CountryDTO)) {
return false;
}
CountryDTO _dto = (CountryDTO)_dtoArg;
Long dtoId = _domain.getId();
if (dtoId == null) {
return false;
}
return dtoId.equals(_dto.getId());
}
public CountryDTO createDtoInstance(Serializable id) {
CountryDTO _result = new CountryDTO();
_result.setId((Long)id);
return _result;
}
public CountryDTO toDto(CountryData _domain) {
if (_domain == null) {
return null;
}
CountryDTO _result = getDtoInstance(_domain, _domain.getId());
if (_result != null) {
return _result;
}
_result = createDtoInstance(_domain.getId());
return convertToDto(_result, _domain);
}
public CountryDTO convertToDto(CountryDTO _result, CountryData _domain) {
if (_domain == null) {
return null;
}
CountryDTO dtoFromCache = getDtoFromCache(_domain, _domain.getId());
if (dtoFromCache != null) {
return dtoFromCache;
}
putDtoIntoCache(_domain, _result,_result.getId());
_result.setCountry(_domain.getCountry());
_result.setLabel(_domain.getLabel());
return _result;
}
public CountryData createDomainInstance(Serializable id) {
if (id != null) {
JpaCountry _result = (JpaCountry)entityManager.find(JpaCountry.class, id);
if (_result != null) {
return _result;
}
}
JpaCountry _result = new JpaCountry();
_result.setId((Long)id);
return _result;
}
public CountryData fromDto(CountryDTO _dto) {
if (_dto == null) {
return null;
}
CountryData _result = getDomainInstance(_dto, _dto.getId());
if (_result != null) {
return _result;
}
Long _id = _dto.getId();
_result = createDomainInstance(_id);
return convertFromDto(_result, _dto);
}
public CountryData convertFromDto(CountryData _result, CountryDTO _dto) {
if (_dto == null) {
return null;
}
CountryData domainFromCache = getDomainFromCache(_dto, _dto.getId());
if (domainFromCache != null) {
return domainFromCache;
}
putDomainIntoCache(_dto, _result,_result.getId());
_result.setCountry(_dto.getCountry());
_result.setLabel(_dto.getLabel());
return _result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy