Example usage for org.springframework.beans BeanUtils copyProperties

List of usage examples for org.springframework.beans BeanUtils copyProperties

Introduction

In this page you can find the example usage for org.springframework.beans BeanUtils copyProperties.

Prototype

public static void copyProperties(Object source, Object target, String... ignoreProperties)
        throws BeansException 

Source Link

Document

Copy the property values of the given source bean into the given target bean, ignoring the given "ignoreProperties".

Usage

From source file:org.nekorp.workflow.desktop.servicio.bridge.PagoCobranzaBridge.java

@Override
public void unload(PagoCobranzaVB origen, PagoCobranza destino) {
    BeanUtils.copyProperties(origen, destino, "monto");
    destino.getMonto().setValue(origen.getMonto().toString());
}

From source file:org.nekorp.workflow.desktop.servicio.bridge.AutoBridge.java

@Override
public void unload(AutoVB origen, Auto destino) {
    BeanUtils.copyProperties(origen, destino, new String[] { "equipamiento" });
    equipamientoBridge.unload(origen.getEquipamiento(), destino.getEquipamiento());
}

From source file:org.nekorp.workflow.desktop.servicio.bridge.DamageDetailBridge.java

@Override
public void unload(DamageDetailsVB origen, DamageDetail destino) {
    BeanUtils.copyProperties(origen, destino, new String[] { "id" });
    if (StringUtils.isEmpty(origen.getId())) {
        destino.setId(null);//  www .  ja  va  2  s  . com
    } else {
        destino.setId(Long.valueOf(origen.getId()));
    }
}

From source file:org.nekorp.workflow.desktop.servicio.bridge.DatosCobranzaBridge.java

@Override
public void load(DatosCobranza origen, DatosCobranzaVB destino) {
    BeanUtils.copyProperties(origen, destino, "pagos");
    List<PagoCobranzaVB> pagos = new LinkedList<>();
    for (PagoCobranza x : origen.getPagos()) {
        PagoCobranzaVB pagoVB = pagoFactory.creaPago();
        pagoCobranzaBridge.load(x, pagoVB);
        pagos.add(pagoVB);//from ww w . j  a  v  a2s .c om
    }
    destino.setPagos(pagos);
}

From source file:com.gallatinsystems.survey.dao.SurveyUtils.java

public static Survey copySurvey(Survey source, SurveyDto dto) {

    final SurveyDAO sDao = new SurveyDAO();
    final Survey tmp = new Survey();

    BeanUtils.copyProperties(source, tmp, Constants.EXCLUDED_PROPERTIES);
    // set name and surveyGroupId to values we got from the dashboard
    tmp.setCode(dto.getCode());/*from  w w  w . j  a  va  2  s .  co m*/
    tmp.setName(dto.getName());
    tmp.setSurveyGroupId(dto.getSurveyGroupId());

    tmp.setStatus(Survey.Status.COPYING);
    tmp.setPath(getPath(tmp));
    tmp.setVersion(Double.valueOf("1.0"));

    log.log(Level.INFO, "Copying `Survey` " + source.getKey().getId());
    final Survey newSurvey = sDao.save(tmp);

    log.log(Level.INFO, "New `Survey` ID: " + newSurvey.getKey().getId());

    SurveyUtils.copyTranslation(source.getKey().getId(), newSurvey.getKey().getId(), newSurvey.getKey().getId(),
            null, ParentType.SURVEY_NAME, ParentType.SURVEY_DESC);

    log.log(Level.INFO, "Running rest of copy functionality as a task...");

    final Queue queue = QueueFactory.getDefaultQueue();

    final TaskOptions options = TaskOptions.Builder.withUrl("/app_worker/dataprocessor")
            .param(DataProcessorRequest.ACTION_PARAM, DataProcessorRequest.COPY_SURVEY)
            .param(DataProcessorRequest.SURVEY_ID_PARAM, String.valueOf(newSurvey.getKey().getId()))
            .param(DataProcessorRequest.SOURCE_PARAM, String.valueOf(source.getKey().getId()));

    queue.add(options);

    return newSurvey;
}

From source file:org.nekorp.workflow.desktop.servicio.bridge.EquipamientoBridge.java

@Override
public void unload(EquipamientoVB origen, Equipamiento destino) {
    BeanUtils.copyProperties(origen, destino, new String[] { "transmision", "elevadores" });
    destino.setTransmision(origen.getTransmision().toString());
    destino.setElevadores(origen.getElevadores().toString());
}

From source file:org.nekorp.workflow.desktop.servicio.bridge.RegistroCostoBridge.java

@Override
public void unload(RegistroCostoVB origen, RegistroCosto destino) {
    BeanUtils.copyProperties(origen, destino, new String[] { "id", "tipo", "precioUnitario", "precioCliente" });
    if (StringUtils.isEmpty(origen.getId())) {
        destino.setId(null);/*from w ww.j  av a 2  s . c o  m*/
    } else {
        destino.setId(Long.valueOf(origen.getId()));
    }
    destino.setTipo(origen.getTipo());
    destino.getPrecioUnitario().setValue(origen.getPrecioUnitario().toString());
    destino.getPrecioCliente().setValue(origen.getPrecioCliente().toString());
}

From source file:org.syncope.core.rest.data.NotificationDataBinder.java

public void updateNotification(final Notification notification, final NotificationTO notificationTO) {

    BeanUtils.copyProperties(notificationTO, notification, IGNORE_PROPERTIES);

    notification.setAbout(notificationTO.getAbout());
    notification.setRecipients(notificationTO.getRecipients());
}

From source file:org.syncope.core.rest.data.VirtualSchemaDataBinder.java

private <T extends AbstractSchema> AbstractVirSchema populate(AbstractVirSchema virtualSchema,
        final VirtualSchemaTO virtualSchemaTO, final Class<T> reference,
        final SyncopeClientCompositeErrorException scce) throws SyncopeClientCompositeErrorException {

    BeanUtils.copyProperties(virtualSchemaTO, virtualSchema, ignoreVirtualSchemaProperties);

    return virtualSchema;
}

From source file:org.nekorp.workflow.desktop.servicio.bridge.ClienteBridge.java

@Override
public void unload(ClienteVB origen, Cliente destino) {
    BeanUtils.copyProperties(origen, destino,
            new String[] { "id", "domicilio", "telefonoUno", "telefonoDos", "telefonoTres" });
    if (StringUtils.isEmpty(origen.getId())) {
        destino.setId(null);//from   w  w w  .  j a v  a 2  s  .  c om
    } else {
        destino.setId(Long.valueOf(origen.getId()));
    }
    domicilioBridge.unload(origen.getDomicilio(), destino.getDomicilio());
    telefonoBridge.unload(origen.getTelefonoUno(), destino.getTelefonoContacto().get(0));
    telefonoBridge.unload(origen.getTelefonoDos(), destino.getTelefonoContacto().get(1));
    telefonoBridge.unload(origen.getTelefonoTres(), destino.getTelefonoContacto().get(2));
}