fr.ird.observe.binder.referential.ReferentialEntityDtoBinderSupport Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common-db Show documentation
Show all versions of common-db Show documentation
ObServe Toolkit Common Db module
The newest version!
package fr.ird.observe.binder.referential;
/*-
* #%L
* ObServe Toolkit :: Common Db
* %%
* Copyright (C) 2008 - 2017 IRD, Ultreia.io
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* .
* #L%
*/
import fr.ird.observe.binder.EntityDtoBinderSupport;
import fr.ird.observe.dto.referential.I18nReferentialDto;
import fr.ird.observe.dto.referential.ReferentialDto;
import fr.ird.observe.entities.referentiel.I18nReferentialEntity;
import fr.ird.observe.entities.referentiel.ObserveReferentialEntity;
/**
* Created on 24/11/15.
*
* @author Tony Chemit - [email protected]
*/
public abstract class ReferentialEntityDtoBinderSupport extends EntityDtoBinderSupport {
protected ReferentialEntityDtoBinderSupport(Class entityType, Class dtoType) {
super(dtoType, entityType);
}
// -------------------------------------------------------------------------------------------------------------- //
// -- ENTITY → REFERENTIAL REFERENCE ---------------------------------------------------------------------------- //
// -------------------------------------------------------------------------------------------------------------- //
// -------------------------------------------------------------------------------------------------------------- //
// -- REFERENTIAL → REFERENTIAL REFERENCE ----------------------------------------------------------------------- //
// -------------------------------------------------------------------------------------------------------------- //
// -------------------------------------------------------------------------------------------------------------- //
// -- REFERENTIAL REFERENCE → ENTITY ---------------------------------------------------------------------------- //
// -------------------------------------------------------------------------------------------------------------- //
// -------------------------------------------------------------------------------------------------------------- //
// -- ENTITY → REFERENTIAL--------------------------------------------------------------------------------------- //
// -------------------------------------------------------------------------------------------------------------- //
protected void copyDtoI18nFieldsToEntity(I18nReferentialDto dto, I18nReferentialEntity entity) {
entity.setLabel1(dto.getLabel1());
entity.setLabel2(dto.getLabel2());
entity.setLabel3(dto.getLabel3());
entity.setLabel4(dto.getLabel4());
entity.setLabel5(dto.getLabel5());
entity.setLabel6(dto.getLabel6());
entity.setLabel7(dto.getLabel7());
entity.setLabel8(dto.getLabel8());
}
protected void copyDtoReferentialFieldsToEntity(ReferentialDto dto, ObserveReferentialEntity entity) {
entity.setTopiaId(dto.getId());
entity.setStatus(dto.getStatus());
entity.setNeedComment(dto.isNeedComment());
entity.setLastUpdateDate(dto.getLastUpdateDate());
entity.setTopiaVersion(dto.getVersion());
entity.setTopiaCreateDate(dto.getCreateDate());
entity.setCode(dto.getCode());
entity.setUri(dto.getUri());
}
protected void copyEntityReferentialFieldsToDto(ObserveReferentialEntity entity, ReferentialDto dto) {
dto.setId(entity.getTopiaId());
dto.setStatus(entity.getStatus());
dto.setNeedComment(entity.isNeedComment());
dto.setLastUpdateDate(entity.getLastUpdateDate());
dto.setVersion(entity.getTopiaVersion());
dto.setCreateDate(entity.getTopiaCreateDate());
dto.setCode(entity.getCode());
dto.setUri(entity.getUri());
}
protected void copyEntityI18nFieldsToDto(I18nReferentialEntity entity, I18nReferentialDto dto) {
dto.setLabel1(entity.getLabel1());
dto.setLabel2(entity.getLabel2());
dto.setLabel3(entity.getLabel3());
dto.setLabel4(entity.getLabel4());
dto.setLabel5(entity.getLabel5());
dto.setLabel6(entity.getLabel6());
dto.setLabel7(entity.getLabel7());
dto.setLabel8(entity.getLabel8());
}
}