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) throws BeansException 

Source Link

Document

Copy the property values of the given source bean into the target bean.

Usage

From source file:com.josescalia.tumblr.form.TumblrRssFavList.java

private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
    //logger.info("obj to save :" + selectedItem);
    //saveAction/*from w  w w.ja  v  a2  s.com*/
    if (formBean != null) {
        try {
            Rss temp = new Rss();
            BeanUtils.copyProperties(formBean, temp);
            service.save(temp);
            if (temp.getId() != null) {
                JOptionPane.showMessageDialog(this, "Save Succeed");
            } else {
                JOptionPane.showMessageDialog(this, "Save Failed");
            }
        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "Save Failed\n" + e.getMessage(), "Error",
                    JOptionPane.ERROR_MESSAGE);
        }
    }

    UIFormUtil.btnSetupConfig(UIFormUtil.CANCEL_MODE, pnlButton);
    UIFormUtil.isEnabledAndClearComp(false, true, panelForm);
    fetchData();
}

From source file:mx.edu.um.mateo.inventario.dao.impl.SalidaDaoHibernate.java

@SuppressWarnings("unchecked")
@Override//w w  w.j a v a2 s  .  com
@Transactional(readOnly = true)
public Map<String, Object> preCancelacion(Long id, Usuario usuario) throws NoEstaCerradaException {
    log.info("{} mando llamar precancelacion de salida {}", usuario, id);
    Salida salida = (Salida) currentSession().get(Salida.class, id);
    if (salida.getEstatus().getNombre().equals(Constantes.CERRADA)
            || salida.getEstatus().getNombre().equals(Constantes.FACTURADA)) {
        Set<Producto> productos = new HashSet<>();
        for (LoteSalida lote : salida.getLotes()) {
            productos.add(lote.getProducto());
        }

        log.debug("Buscando entradas que contengan los productos {} despues de la fecha {}", productos,
                salida.getFechaModificacion());
        Query query = currentSession()
                .createQuery("select e from Entrada e inner join e.lotes le inner join e.estatus es "
                        + "where(es.nombre = 'CERRADA' or es.nombre = 'PENDIENTE') "
                        + "and le.producto in (:productos) " + "and e.fechaModificacion > :fecha");
        query.setParameterList("productos", productos);
        query.setTimestamp("fecha", salida.getFechaModificacion());
        List<Entrada> entradas = (List<Entrada>) query.list();
        for (Entrada entrada : entradas) {
            log.debug("ENTRADA: {}", entrada);
            for (LoteEntrada lote : entrada.getLotes()) {
                productos.add(lote.getProducto());
            }
        }

        query = currentSession()
                .createQuery("select s from Salida s inner join s.lotes ls inner join s.estatus es "
                        + "where es.nombre = 'CERRADA' " + "and ls.producto in (:productos) "
                        + "and s.fechaModificacion > :fecha");
        query.setParameterList("productos", productos);
        query.setTimestamp("fecha", salida.getFechaModificacion());
        List<Salida> salidas = (List<Salida>) query.list();
        for (Salida otra : salidas) {
            log.debug("SALIDA: {}", otra);
            for (LoteSalida lote : otra.getLotes()) {
                productos.add(lote.getProducto());
            }
        }
        salidas.add(salida);

        Map<Long, Producto> productosCancelados = new HashMap<>();
        Map<Long, Producto> productosSinHistoria = new HashMap<>();
        for (Producto producto : productos) {
            log.debug("Buscando historial de {}", producto);
            query = currentSession()
                    .createQuery("select xp from XProducto xp " + "where xp.productoId = :productoId "
                            + "and (xp.actividad = 'CREAR' or actividad = 'ACTUALIZAR') "
                            + "and xp.fechaCreacion < :fecha "
                            + "and (xp.salidaId is null or xp.salidaId != :salidaId) "
                            + "order by xp.fechaCreacion desc");
            query.setLong("productoId", producto.getId());
            query.setTimestamp("fecha", salida.getFechaModificacion());
            query.setLong("salidaId", salida.getId());
            query.setMaxResults(1);
            List<XProducto> xproductos = (List<XProducto>) query.list();
            if (xproductos != null && xproductos.get(0) != null) {
                XProducto xproducto = xproductos.get(0);
                log.debug("Encontre historia del producto {}", xproducto);
                Producto p = new Producto();
                BeanUtils.copyProperties(xproducto, p);
                p.setTipoProducto(producto.getTipoProducto());
                p.setAlmacen(producto.getAlmacen());
                productosCancelados.put(producto.getId(), p);
            } else {
                log.debug("No encontre historia del producto {}", producto);
                Producto p = new Producto();
                BeanUtils.copyProperties(producto, p);
                p.setPrecioUnitario(BigDecimal.ZERO);
                p.setUltimoPrecio(BigDecimal.ZERO);
                p.setExistencia(BigDecimal.ZERO);
                productosSinHistoria.put(producto.getId(), p);
            }
        }

        Map<String, Object> resultado = new HashMap<>();
        resultado.put("salida", salida);
        resultado.put("productos", productos);
        if (entradas != null && entradas.size() > 0) {
            resultado.put("entradas", entradas);
        }
        if (salidas != null && salidas.size() > 0) {
            resultado.put("salidas", salidas);
        }
        if (productosCancelados.size() > 0) {
            resultado.put("productosCancelados", productosCancelados.values());
        }
        if (productosSinHistoria.size() > 0) {
            resultado.put("productosSinHistoria", productosSinHistoria.values());
        }
        return resultado;
    } else {
        throw new NoEstaCerradaException("La salida no se puede cancelar porque no esta cerrada o facturada",
                salida);
    }
}

From source file:mx.edu.um.mateo.inventario.dao.impl.EntradaDaoHibernate.java

@SuppressWarnings("unchecked")
@Override//from   w  ww. j  av  a2  s .  c  o  m
@Transactional(readOnly = true)
public Map<String, Object> preCancelacion(Long id, Usuario usuario) throws NoEstaCerradaException {
    log.info("{} mando llamar precancelacion de entrada {}", usuario, id);
    Entrada entrada = (Entrada) currentSession().get(Entrada.class, id);
    if (entrada.getEstatus().getNombre().equals(Constantes.CERRADA)
            || entrada.getEstatus().getNombre().equals(Constantes.FACTURADA)) {
        Set<Producto> productos = new HashSet<>();
        for (LoteEntrada lote : entrada.getLotes()) {
            productos.add(lote.getProducto());
        }

        log.debug("Buscando entradas que contengan los productos {} despues de la fecha {}", productos,
                entrada.getFechaModificacion());
        Query query = currentSession()
                .createQuery("select e from Entrada e inner join e.lotes le inner join e.estatus es "
                        + "where(es.nombre = 'CERRADA' or es.nombre = 'PENDIENTE') "
                        + "and le.producto in (:productos) " + "and e.fechaModificacion > :fecha");
        query.setParameterList("productos", productos);
        query.setTimestamp("fecha", entrada.getFechaModificacion());
        List<Entrada> entradas = (List<Entrada>) query.list();
        for (Entrada e : entradas) {
            log.debug("ENTRADA: {}", e);
            for (LoteEntrada lote : e.getLotes()) {
                productos.add(lote.getProducto());
            }
        }
        entradas.add(entrada);

        query = currentSession()
                .createQuery("select s from Salida s inner join s.lotes ls inner join s.estatus es "
                        + "where es.nombre = 'CERRADA' " + "and ls.producto in (:productos) "
                        + "and s.fechaModificacion > :fecha");
        query.setParameterList("productos", productos);
        query.setTimestamp("fecha", entrada.getFechaModificacion());
        List<Salida> salidas = (List<Salida>) query.list();
        for (Salida salida : salidas) {
            log.debug("SALIDA: {}", salida);
            for (LoteSalida lote : salida.getLotes()) {
                productos.add(lote.getProducto());
            }
        }

        Map<Long, Producto> productosCancelados = new HashMap<>();
        Map<Long, Producto> productosSinHistoria = new HashMap<>();
        for (Producto producto : productos) {
            log.debug("Buscando historial de {}", producto);
            query = currentSession()
                    .createQuery("select xp from XProducto xp " + "where xp.productoId = :productoId "
                            + "and (xp.actividad = 'CREAR' or actividad = 'ACTUALIZAR') "
                            + "and xp.fechaCreacion < :fecha "
                            + "and (xp.entradaId is null or xp.entradaId != :entradaId) "
                            + "order by xp.fechaCreacion desc");
            query.setLong("productoId", producto.getId());
            query.setTimestamp("fecha", entrada.getFechaModificacion());
            query.setLong("entradaId", entrada.getId());
            query.setMaxResults(1);
            List<XProducto> xproductos = (List<XProducto>) query.list();
            if (xproductos != null && xproductos.get(0) != null) {
                XProducto xproducto = xproductos.get(0);
                log.debug("Encontre historia del producto {}", xproducto);
                Producto p = new Producto();
                BeanUtils.copyProperties(xproducto, p);
                p.setTipoProducto(producto.getTipoProducto());
                p.setAlmacen(producto.getAlmacen());
                productosCancelados.put(producto.getId(), p);
            } else {
                log.debug("No encontre historia del producto {}", producto);
                Producto p = new Producto();
                BeanUtils.copyProperties(producto, p);
                p.setPrecioUnitario(BigDecimal.ZERO);
                p.setUltimoPrecio(BigDecimal.ZERO);
                p.setExistencia(BigDecimal.ZERO);
                productosSinHistoria.put(producto.getId(), p);
            }
        }

        Map<String, Object> resultado = new HashMap<>();
        resultado.put("entrada", entrada);
        resultado.put("productos", productos);
        if (entradas != null && entradas.size() > 0) {
            resultado.put("entradas", entradas);
        }
        if (salidas != null && salidas.size() > 0) {
            resultado.put("salidas", salidas);
        }
        if (productosCancelados.size() > 0) {
            resultado.put("productosCancelados", productosCancelados.values());
        }
        if (productosSinHistoria.size() > 0) {
            resultado.put("productosSinHistoria", productosSinHistoria.values());
        }
        return resultado;
    } else {
        throw new NoEstaCerradaException("La entrada no se puede cancelar porque no esta cerrada o facturada",
                entrada);
    }
}

From source file:mx.edu.um.mateo.inventario.dao.impl.SalidaDaoHibernate.java

private void auditaProducto(Producto producto, Usuario usuario, String actividad, Long salidaId,
        Long cancelacionId, Date fecha) {
    XProducto xproducto = new XProducto();
    BeanUtils.copyProperties(producto, xproducto);
    xproducto.setId(null);/* w w w .ja v a  2s . c o m*/
    xproducto.setProductoId(producto.getId());
    xproducto.setSalidaId(salidaId);
    xproducto.setCancelacionId(cancelacionId);
    xproducto.setTipoProductoId(producto.getTipoProducto().getId());
    xproducto.setAlmacenId(producto.getAlmacen().getId());
    xproducto.setFechaCreacion(fecha);
    xproducto.setActividad(actividad);
    xproducto.setCreador((usuario != null) ? usuario.getUsername() : "sistema");
    currentSession().save(xproducto);
}

From source file:mx.edu.um.mateo.inventario.dao.impl.SalidaDaoHibernate.java

private void auditaEntrada(Entrada entrada, Usuario usuario, String actividad, Date fecha, boolean conLotes) {
    XEntrada xentrada = new XEntrada();
    BeanUtils.copyProperties(entrada, xentrada);
    xentrada.setId(null);/*  ww  w .  j  av a 2 s  .  c o  m*/
    xentrada.setEntradaId(entrada.getId());
    xentrada.setProveedorId(entrada.getProveedor().getId());
    xentrada.setEstatusId(entrada.getEstatus().getId());
    xentrada.setFechaCreacion(fecha);
    xentrada.setActividad(actividad);
    xentrada.setCreador((usuario != null) ? usuario.getUsername() : "sistema");
    currentSession().save(xentrada);
    if (conLotes) {
        for (LoteEntrada lote : entrada.getLotes()) {
            XLoteEntrada xlote = new XLoteEntrada();
            BeanUtils.copyProperties(lote, xlote, new String[] { "id", "version" });
            xlote.setLoteEntradaId(lote.getId());
            xlote.setEntradaId(entrada.getId());
            xlote.setProductoId(lote.getProducto().getId());
            xlote.setActividad(actividad);
            xlote.setCreador((usuario != null) ? usuario.getUsername() : "sistema");
            xlote.setFechaCreacion(fecha);
            currentSession().save(xlote);
        }
    }
}

From source file:mx.edu.um.mateo.inventario.dao.impl.SalidaDaoHibernate.java

private void audita(Salida salida, Usuario usuario, String actividad, Date fecha, boolean conLotes) {
    XSalida xsalida = new XSalida();
    BeanUtils.copyProperties(salida, xsalida);
    xsalida.setId(null);//  www.  j a  v  a 2s  .  c  o  m
    xsalida.setSalidaId(salida.getId());
    xsalida.setAlmacenId(salida.getAlmacen().getId());
    xsalida.setClienteId(salida.getCliente().getId());
    xsalida.setEstatusId(salida.getEstatus().getId());
    xsalida.setFechaCreacion(fecha);
    xsalida.setActividad(actividad);
    xsalida.setCreador((usuario != null) ? usuario.getUsername() : "sistema");
    currentSession().save(xsalida);
    if (conLotes) {
        for (LoteSalida lote : salida.getLotes()) {
            XLoteSalida xlote = new XLoteSalida();
            BeanUtils.copyProperties(lote, xlote, new String[] { "id", "version" });
            xlote.setLoteSalidaId(lote.getId());
            xlote.setSalidaId(salida.getId());
            xlote.setProductoId(lote.getProducto().getId());
            xlote.setActividad(actividad);
            xlote.setCreador((usuario != null) ? usuario.getUsername() : "sistema");
            xlote.setFechaCreacion(fecha);
            currentSession().save(xlote);
        }
    }
}

From source file:com.allinfinance.bo.impl.mchnt.TblMchntServiceImpl.java

public String refuse(String mchntId, String refuseInfo)
        throws IllegalAccessException, InvocationTargetException {

    TblMchtBaseInfTmp tmp = tblMchtBaseInfTmpDAO.get(mchntId);
    TblMchtSettleInfTmp tmpSettle = tblMchtSettleInfTmpDAO.get(mchntId);

    String crtDateTmp = tmp.getRecCrtTs();
    if (null == tmp || null == tmpSettle) {
        return "??";
    }/*from  ww w . ja v  a 2 s.  c  om*/
    Operator opr = (Operator) ServletActionContext.getRequest().getSession()
            .getAttribute(Constants.OPERATOR_INFO);

    // ??
    TblMchntRefuse refuse = new TblMchntRefuse();
    TblMchntRefusePK tblMchntRefusePK = new TblMchntRefusePK(mchntId, CommonFunction.getCurrentDateTime());
    refuse.setId(tblMchntRefusePK);
    refuse.setRefuseInfo(refuseInfo);
    refuse.setBrhId(tmp.getBankNo());
    refuse.setOprId(opr.getOprId());

    //?
    List<TblTermInfTmp> list = tblTermInfTmpDAO.getByMchnt(mchntId);
    if (list != null && list.size() != 0) {
        for (TblTermInfTmp tblTermInfTmp : list) {
            if (tblTermInfTmp == null) {
                continue;
            }
            //814???YYYYMMDD YYYYMMDDHHMMSS
            //tblTermInf.setRecUpdTs(CommonFunction.getCurrentDate());
            Operator opra = (Operator) ServletActionContext.getRequest().getSession()
                    .getAttribute(Constants.OPERATOR_INFO);
            tblTermInfTmp.setRecUpdOpr(opra.getOprId());
            tblTermInfTmp.setTermSta("8");
            tblTermInfTmp.setRecUpdTs(CommonFunction.getCurrentDateTime());
            tblTermInfTmpDAO.update(tblTermInfTmp);

        }
    }
    // ??
    refuse.setRefuseType(StatusUtil.getNextStatus("RM." + tmp.getMchtStatus()));

    // ???
    if (TblMchntInfoConstants.MCHNT_ST_NEW_UNCK.equals(tmp.getMchtStatus())
            || TblMchntInfoConstants.MCHNT_ST_NEW_FIRST_UNCK.equals(tmp.getMchtStatus())
            || TblMchntInfoConstants.MCHNT_ST_MODI_UNCK_SECOND.equals(tmp.getMchtStatus())) {
        //         tblMchtBaseInfTmpDAO.delete(tmp);
        //         tblMchtSettleInfTmpDAO.delete(tmpSettle);
        //         tblMchntRefuseDAO.save(refuse);
        //         ICommQueryDAO commQueryDAO = (ICommQueryDAO) ContextUtil.getBean("CommQueryDAO");
        //         commQueryDAO.excute("delete from tbl_term_inf_tmp where mcht_cd='" + mchntId + "'");
        tmp.setMchtStatus("C");
        tmp.setRecUpdTs(CommonFunction.getCurrentDateTime());
        tmp.setUpdOprId(opr.getOprId());
        tmpSettle.setRecUpdTs(CommonFunction.getCurrentDateTime());
        tblMchtBaseInfTmpDAO.update(tmp);
        tblMchtSettleInfTmpDAO.update(tmpSettle);
        tblMchntRefuseDAO.save(refuse);
    } else if (TblMchntInfoConstants.MCHNT_ST_BULK_IPT_UNCK.equals(tmp.getMchtStatus())) {
        tblMchtBaseInfTmpDAO.delete(tmp);
        tblMchtSettleInfTmpDAO.delete(tmpSettle);
        tblMchntRefuseDAO.save(refuse);
    } else {
        // ??
        TblMchtBaseInf inf = tblMchtBaseInfDAO.get(tmp.getMchtNo());
        TblMchtSettleInf infSettle = tblMchtSettleInfDAO.get(tmpSettle.getMchtNo());
        if (null == inf || null == infSettle) {
            return "???";
        } else {
            // 
            inf.setRecUpdTs(CommonFunction.getCurrentDateTime());
            inf.setUpdOprId(opr.getOprId());
            // ??
            BeanUtils.copyProperties(inf, tmp);
            BeanUtils.copyProperties(infSettle, tmpSettle);
            tmp.setRecCrtTs(crtDateTmp);
            // ?
            tblMchtBaseInfTmpDAO.update(tmp);
            tblMchtBaseInfDAO.update(inf);
            tblMchtSettleInfTmpDAO.update(tmpSettle);
            tblMchtSettleInfDAO.update(infSettle);
            tblMchntRefuseDAO.save(refuse);
            updHisSta(tmp);
        }
    }
    return Constants.SUCCESS_CODE;
}

From source file:com.oneops.transistor.service.ManifestRfcBulkProcessor.java

private void processMonitor(CmsCIRelation tmplRelation, CmsCIRelation designRelation, CmsRfcCI manifestPlat,
        DesignPullContext context, ManifestRfcContainer platformRfcs, CmsRfcCI monitorFromRfc,
        Map<String, CmsRfcRelation> existingMonitorsMap, List<String> rfcNames) {

    CmsCI templateCi = tmplRelation != null ? tmplRelation.getToCi() : null;
    CmsCI designCi = designRelation != null ? designRelation.getToCi() : null;

    String monitorName = null;//from w  ww.j  a  va  2s .  c  om
    if (designRelation == null) {
        CmsCI templateCiClone = new CmsCI();
        BeanUtils.copyProperties(templateCi, templateCiClone);
        templateCi = templateCiClone;
        monitorName = getMonitorName(manifestPlat, monitorFromRfc.getCiName(),
                tmplRelation.getToCi().getCiName());
        //change the template monitor CI name to target name if there is no design CI 
        //as we need to find a match in existing manifest CIs below using this name
        templateCi.setCiName(monitorName);
    } else {
        monitorName = designRelation.getToCi().getCiName();
    }

    CmsRfcCI monitorRfc = mergeCi(templateCi, designCi, context);
    existingMonitorsMap.remove(monitorName);

    CmsCI existingCI = context.existingManifestCIs.get(monitorRfc.getCiId());
    CmsRfcCI newMonitorRfc = needUpdateRfc(monitorRfc, existingCI);
    boolean monitorCiNeedsUpdate = (newMonitorRfc != null);
    if (newMonitorRfc == null) {
        newMonitorRfc = rfcUtil.mergeRfcAndCi(newMonitorRfc, existingCI, CmsConstants.ATTR_VALUE_TYPE_DF);
    }

    CmsRfcRelation rfcWatchRelation = newMergedManfestRfcRelation(tmplRelation, designRelation, context);
    rfcWatchRelation.setFromCiId(monitorFromRfc.getCiId());
    rfcWatchRelation.setToCiId(newMonitorRfc.getCiId());
    setCiRelationId(rfcWatchRelation);
    CmsRfcRelation newRfcRelation = rfcWatchRelation;
    CmsCIRelation existingWatchedByRel = null;
    boolean watchedByRelationNeedsUpdate = true;
    if (existingCI != null) {
        Map<String, CmsCIRelation> watchRels = context.existingManifestPlatRels
                .get(rfcWatchRelation.getRelationName());
        if (watchRels != null) {
            existingWatchedByRel = watchRels
                    .get(rfcWatchRelation.getFromCiId() + ":" + rfcWatchRelation.getToCiId());
            newRfcRelation = needUpdateRfcRel(rfcWatchRelation, existingWatchedByRel);
            watchedByRelationNeedsUpdate = (newRfcRelation != null);
        }
    }

    if (monitorCiNeedsUpdate || watchedByRelationNeedsUpdate) {
        if (existingWatchedByRel == null || existingCI == null) {
            //new monitor, so create a new triplet
            platformRfcs.getRfcRelTripletList()
                    .add(newManifestRfcRelTriplet(rfcWatchRelation, monitorFromRfc, newMonitorRfc));
        } else {
            if (monitorCiNeedsUpdate) {
                platformRfcs.getRfcList().add(newMonitorRfc);
            }
            if (watchedByRelationNeedsUpdate) {
                platformRfcs.getRfcRelationList().add(newRfcRelation);
            }
        }
        //create dummy update on the component if there is an update on the monitor and there is no rfc already for the component
        if (monitorCiNeedsUpdate && (monitorFromRfc.getRfcId() == 0)) {
            if (!rfcNames.contains(monitorFromRfc.getCiName())) {
                cmRfcMrgProcessor.createDummyUpdateRfc(monitorFromRfc.getCiId(), null, 0, context.userId);
            }
        }
    }
}

From source file:com.wcna.calms.jpos.services.quote.JPOSQuickQuoteLoadService.java

private IJPOSApplicationAssetDataVO loadAssetSubProcess(IJPOSApplicationAssetDataVO assetDataVo, String appId,
        Map<String, Object> loadMap) {

    List<IRentACarBean> rentACarList = null;
    IJPOSQuickQuoteAssetInputForm assetForm = null;
    int modelVariantId = 0;
    if (!StringUtil.isEmpty(appId)) {
        Locale locale = getUserContainer().getLocale();
        assetDataVo = quickQuoteService.loadAsset(Long.valueOf(appId), locale, false);
        rentACarList = quickQuoteService.getRentACarList(Long.valueOf(appId));

        assetForm = new JPOSQuickQuoteAssetVO();
        if (assetDataVo != null) {
            JPOSQuickQuoteAssetVO screenVo = new JPOSQuickQuoteAssetVO();
            screenVo.setNewUsed(assetDataVo.getNewOrUsed());
            screenVo.setRegistrationCode(assetDataVo.getRegPlateId());
            screenVo.setFreeFormatFlag(assetDataVo.getFreeFormatFlag());
            screenVo.setMakeId(assetDataVo.getMakeId());
            screenVo.setModelId(assetDataVo.getModelId());
            screenVo.setModelVariantId(assetDataVo.getModelVariantId());

            if (!"on".equals(screenVo.getFreeFormatFlag())) {
                if (!StringUtil.isEmpty(screenVo.getModelVariantId())) {
                    modelVariantId = formatService.parseInteger(screenVo.getModelVariantId(), locale, false, 0);
                }/*w w  w  .  j a v  a  2 s  . c o  m*/
            } else {
                if (!IClientConstants.EXECUTE.equals(projectProperties
                        .getProperty(IClientConstants.ONCHANGE_FFE_CHKBOX_IMPL_DISABLE_MAKE_TOGGLE))) {
                    screenVo.setMakeId(assetDataVo.getMakeDesc());
                }
                screenVo.setModelId(assetDataVo.getModelDesc());
                screenVo.setModelVariantId(assetDataVo.getModelVariantDesc());
            }

            screenVo.setTaxIncludingFlag(assetDataVo.getIsTaxable());
            screenVo.setRegistrationNumber(assetDataVo.getRegistrationNumber());
            Date d = assetDataVo.getRegistrationDate();
            if (d != null) {
                screenVo.setRegistrationDate(formatService.formatDate(d, locale));
            }

            screenVo.setAssetType(assetDataVo.getAssetType());

            Double meter = assetDataVo.getMeterValue();
            if (meter == null) {
                meter = new Double(0);
            }
            screenVo.setKilometrage(formatService.formatInteger(meter.intValue(), locale));
            screenVo.setVin(assetDataVo.getVin());

            screenVo.setManufactureDate(formatService.formatDate(assetDataVo.getManufactureDate(), locale));
            screenVo.setMortgageRegDate(formatService.formatDate(assetDataVo.getMortgageRegDate(), locale));

            screenVo.setAssetUsageCode(assetDataVo.getAssetUsageCode());
            screenVo.setApprovedUsedAssetCode(assetDataVo.getApprovedUsedAssetCode());
            screenVo.setEnviroImpactRatingCode(assetDataVo.getEnviroImpactRatingCode());
            screenVo.setEnviroImpactRatingAmount(
                    formatService.formatDouble(assetDataVo.getEnviroImpactRatingAmount(), locale));
            screenVo.setTaxHorsePowerRating(
                    formatService.formatDouble(assetDataVo.getTaxHorsePowerRating(), locale));

            screenVo.setSalePrice(formatService.formatDouble(assetDataVo.getSalePrice(), locale));
            screenVo.setTaxCode(assetDataVo.getTaxCode());
            screenVo.setTaxAmt(formatService.formatDouble(assetDataVo.getTaxAmt(), locale));
            screenVo.setGrossCost(formatService.formatDouble(assetDataVo.getGrossCost(), locale));

            screenVo.setExtraAmt(formatService.formatDouble(assetDataVo.getExtraAmount(), locale));
            screenVo.setExtraTaxCode(assetDataVo.getExtraTaxCode());
            screenVo.setExtraTaxAmt(formatService.formatDouble(assetDataVo.getExtraTaxAmount(), locale));
            screenVo.setExtraTotalCost(assetDataVo.getExtraTotalCost());

            screenVo.setTaxableDFOptionsGross(assetDataVo.getTaxableDFOptionsGross());
            screenVo.setTaxableDFOptionsNet(assetDataVo.getTaxableDFOptionsNet());
            String defaultZero = formatService.formatDouble(0d, locale);
            // this is to avoid validation issues if this is a rent-a-car deal
            if (StringUtils.isBlank(screenVo.getTaxableDFOptionsNet())) {
                screenVo.setTaxableDFOptionsNet(defaultZero);
            }
            if (StringUtils.isBlank(screenVo.getTaxableDFOptionsGross())) {
                screenVo.setTaxableDFOptionsGross(defaultZero);
            }

            screenVo.setTaxableDFOptionsVatAmt(assetDataVo.getTaxableDFOptionsVatAmt());
            screenVo.setTaxableDFOptionsVatRate(assetDataVo.getTaxableDFOptionsVatRate());

            screenVo.setNonTaxableDFOptionsGross(assetDataVo.getNonTaxableDFOptionsGross());
            screenVo.setNonTaxableDFOptionsNet(assetDataVo.getNonTaxableDFOptionsNet());
            if (StringUtils.isBlank(screenVo.getNonTaxableDFOptionsNet())) {
                screenVo.setNonTaxableDFOptionsNet(defaultZero);
            }
            if (StringUtils.isBlank(screenVo.getNonTaxableDFOptionsGross())) {
                screenVo.setNonTaxableDFOptionsGross(defaultZero);
            }

            screenVo.setNonTaxableDFOptionsVatAmt(assetDataVo.getNonTaxableDFOptionsVatAmt());
            screenVo.setNonTaxableDFOptionsVatRate(assetDataVo.getNonTaxableDFOptionsVatRate());

            screenVo.setRoadFundLicenseGross(assetDataVo.getRoadFundLicenseGross());
            screenVo.setRoadFundLicenseNet(assetDataVo.getRoadFundLicenseNet());
            screenVo.setRoadFundLicenseVatAmt(assetDataVo.getRoadFundLicenseVatAmt());
            screenVo.setRoadFundLicenseVatRate(assetDataVo.getRoadFundLicenseVatRate());

            screenVo.setFirstRegistrationGross(assetDataVo.getFirstRegistrationGross());
            screenVo.setFirstRegistrationNet(assetDataVo.getFirstRegistrationNet());
            screenVo.setFirstRegistrationVatAmt(assetDataVo.getFirstRegistrationVatAmt());
            screenVo.setFirstRegistrationVatRate(assetDataVo.getFirstRegistrationVatRate());

            screenVo.setTotalNet(assetDataVo.getTotalNet());
            screenVo.setTotalGross(formatService.formatDouble(assetDataVo.getTotalCost(), locale));
            screenVo.setTotalVatAmt(formatService.formatDouble(assetDataVo.getTotalVat(), locale));

            screenVo.setDiscountNet(assetDataVo.getDiscountNet());
            screenVo.setDiscountVatRate(assetDataVo.getDiscountVatRate());
            screenVo.setDiscountVatAmt(assetDataVo.getDiscountVatAmt());
            screenVo.setDiscountGross(assetDataVo.getDiscountGross());

            if (IConstants.FLAG_YES.equals(assetDataVo.getDiscountAmtIsPct())) {
                screenVo.setDiscountAmtIsPct(IConstants.FLAG_YES);
            } else {
                screenVo.setDiscountAmtIsPct("");
            }

            if (assetDataVo.getDiscountAmt() != null) {
                screenVo.setDiscountAmt(assetDataVo.getDiscountAmt());
            } else {
                screenVo.setDiscountAmt("");
            }

            if (assetDataVo.getDiscountPct() != null) {
                screenVo.setDiscountPct(assetDataVo.getDiscountPct());
            } else {
                screenVo.setDiscountPct("");
            }

            screenVo.setTaxPointDate(formatService.formatDate(assetDataVo.getTaxPointDate(), locale));
            screenVo.setTaxRateValue(formatService.formatDouble(assetDataVo.getTaxRateValue(), locale));

            // tfs demo
            screenVo.setLctSummary(formatService.formatDouble(assetDataVo.getLctSummary(), locale));
            screenVo.setGstSummary(formatService.formatDouble(assetDataVo.getGstSummary(), locale));
            screenVo.setLct(assetDataVo.getLct());
            if (StringUtils.isBlank(screenVo.getLct())) {
                screenVo.setLct(IJPOSQuickQuoteConstants.LCT_NONE);
            }
            // end tfs demo

            loadMap.put("assetDetails", screenVo);
            loadMap.put("vehicleOutline", quickQuoteService.getVehicleDescription(Long.valueOf(appId)));

            loadMap.put("rentACarList", rentACarList);

            List<IVehicleFFOBean> ffoList = assetDataVo.getFfoList();
            if (ffoList == null) {
                ffoList = new ArrayList<IVehicleFFOBean>();
            }
            loadMap.put("ffoList", ffoList);
            screenVo.setTotalRvUpliftPercentage(assetDataVo.getTotalRvUpliftPercentage());

            BeanUtils.copyProperties(screenVo, assetForm);
        }

        IAssetPartExchangeVO assetPartExchangeVO = (assetDataVo.getAssetPartExchange() == null)
                ? quickQuoteService.getDefaultPartExchange()
                : assetDataVo.getAssetPartExchange();
        this.quickQuoteService.setAssetDetailsToContainer(0, assetForm, assetDataVo.getFfoList(), rentACarList,
                assetPartExchangeVO);

    }
    return assetDataVo;
}

From source file:com.oneops.cms.dj.service.CmsRfcProcessor.java

private CmsRelease cloneRelease(CmsRelease openRelease) {
    CmsRelease newRelease = new CmsRelease();
    BeanUtils.copyProperties(openRelease, newRelease);
    newRelease.setReleaseId(0);
    return newRelease;
}