List of usage examples for org.apache.commons.beanutils PropertyUtils copyProperties
public static void copyProperties(Object dest, Object orig) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
Copy property values from the "origin" bean to the "destination" bean for all cases where the property names are the same (even though the actual getter and setter methods might have been customized via BeanInfo
classes).
For more details see PropertyUtilsBean
.
From source file:com.jada.order.document.InvoiceEngine.java
static public InvoiceHeader clone(InvoiceHeader header) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { InvoiceHeader invoiceHeader = new InvoiceHeader(); invoiceHeader.setInvoiceHeaderId(header.getInvoiceHeaderId()); invoiceHeader.setInvoiceNum(header.getInvoiceNum()); invoiceHeader.setShippingTotal(header.getShippingTotal()); invoiceHeader.setInvoiceTotal(header.getInvoiceTotal()); invoiceHeader.setInvoiceStatus(header.getInvoiceStatus()); invoiceHeader.setInvoiceDate(header.getInvoiceDate()); invoiceHeader.setRecUpdateBy(header.getRecUpdateBy()); invoiceHeader.setRecUpdateDatetime(header.getRecUpdateDatetime()); invoiceHeader.setRecCreateBy(header.getRecCreateBy()); invoiceHeader.setRecCreateDatetime(header.getRecCreateDatetime()); invoiceHeader.setOrderHeader(header.getOrderHeader()); if (header.getPaymentTran() != null) { PaymentTran pt = header.getPaymentTran(); PaymentTran paymentTran = new PaymentTran(); PropertyUtils.copyProperties(paymentTran, pt); invoiceHeader.setPaymentTran(paymentTran); }/*w ww .j av a 2s . com*/ if (header.getVoidPaymentTran() != null) { PaymentTran pt = header.getVoidPaymentTran(); PaymentTran paymentTran = new PaymentTran(); PropertyUtils.copyProperties(paymentTran, pt); invoiceHeader.setVoidPaymentTran(paymentTran); } Iterator<?> iterator = header.getInvoiceDetails().iterator(); while (iterator.hasNext()) { InvoiceDetail detail = (InvoiceDetail) iterator.next(); InvoiceDetail invoiceDetail = new InvoiceDetail(); invoiceDetail.setInvoiceHeader(invoiceHeader); invoiceHeader.getInvoiceDetails().add(invoiceDetail); invoiceDetail.setInvoiceDetailId(detail.getInvoiceDetailId()); invoiceDetail.setSeqNum(detail.getSeqNum()); invoiceDetail.setItemInvoiceQty(detail.getItemInvoiceQty()); invoiceDetail.setItemInvoiceAmount(detail.getItemInvoiceAmount()); invoiceDetail.setRecUpdateBy(header.getRecUpdateBy()); invoiceDetail.setRecUpdateDatetime(header.getRecUpdateDatetime()); invoiceDetail.setRecCreateBy(header.getRecCreateBy()); invoiceDetail.setRecCreateDatetime(header.getRecCreateDatetime()); invoiceDetail.setOrderItemDetail(detail.getOrderItemDetail()); Iterator<?> taxIterator = detail.getInvoiceDetailTaxes().iterator(); while (taxIterator.hasNext()) { InvoiceDetailTax detailTax = (InvoiceDetailTax) taxIterator.next(); InvoiceDetailTax invoiceDetailTax = new InvoiceDetailTax(); invoiceDetailTax.setInvoiceDetailTaxId(detailTax.getInvoiceDetailTaxId()); invoiceDetailTax.setTaxName(detailTax.getTaxName()); invoiceDetailTax.setTaxAmount(detailTax.getTaxAmount()); invoiceDetailTax.setRecUpdateBy(detailTax.getRecUpdateBy()); invoiceDetailTax.setRecUpdateDatetime(detailTax.getRecUpdateDatetime()); invoiceDetailTax.setRecCreateBy(detailTax.getRecCreateBy()); invoiceDetailTax.setRecCreateDatetime(detailTax.getRecCreateDatetime()); invoiceDetailTax.setTax(detailTax.getTax()); invoiceDetailTax.setInvoiceDetail(invoiceDetail); invoiceDetail.getInvoiceDetailTaxes().add(invoiceDetailTax); invoiceDetailTax.setInvoiceHeader(invoiceHeader); invoiceHeader.getInvoiceTaxes().add(invoiceDetailTax); } } Iterator<?> taxIterator = header.getInvoiceTaxes().iterator(); while (taxIterator.hasNext()) { InvoiceDetailTax detailTax = (InvoiceDetailTax) taxIterator.next(); if (detailTax.getInvoiceDetail() != null) { continue; } InvoiceDetailTax invoiceDetailTax = new InvoiceDetailTax(); invoiceDetailTax.setInvoiceDetailTaxId(detailTax.getInvoiceDetailTaxId()); invoiceDetailTax.setTaxName(detailTax.getTaxName()); invoiceDetailTax.setTaxAmount(detailTax.getTaxAmount()); invoiceDetailTax.setRecUpdateBy(detailTax.getRecUpdateBy()); invoiceDetailTax.setRecUpdateDatetime(detailTax.getRecUpdateDatetime()); invoiceDetailTax.setRecCreateBy(detailTax.getRecCreateBy()); invoiceDetailTax.setRecCreateDatetime(detailTax.getRecCreateDatetime()); invoiceDetailTax.setTax(detailTax.getTax()); invoiceDetailTax.setInvoiceHeader(invoiceHeader); invoiceHeader.getInvoiceTaxes().add(invoiceDetailTax); } return invoiceHeader; }
From source file:com.jada.admin.site.SiteLoader.java
public void loadShippingType() throws Exception { EntityManager em = JpaConnection.getInstance().getCurrentEntityManager(); String sql = "from ShippingType where siteId = :siteId order by shippingTypeId"; Query query = em.createQuery(sql); query.setParameter("siteId", Constants.SITE_SYSTEM); Iterator<?> iterator = query.getResultList().iterator(); while (iterator.hasNext()) { ShippingType master = (ShippingType) iterator.next(); ShippingType shippingType = new ShippingType(); PropertyUtils.copyProperties(shippingType, master); shippingType.setSite(site);// w w w. j a va 2s .c o m shippingType.setRecUpdateBy(userId); shippingType.setRecUpdateDatetime(new Date(System.currentTimeMillis())); shippingType.setRecCreateBy(userId); shippingType.setRecCreateDatetime(new Date(System.currentTimeMillis())); shippingType.setShippingMethodRegionTypes(null); shippingTypes.add(shippingType); em.persist(shippingType); } }
From source file:com.jada.admin.site.SiteLoader.java
public void loadShippingRegion() throws Exception { EntityManager em = JpaConnection.getInstance().getCurrentEntityManager(); String sql = "from ShippingRegion where siteId = :siteId order by shippingRegionId"; Query query = em.createQuery(sql); query.setParameter("siteId", Constants.SITE_SYSTEM); Iterator<?> iterator = query.getResultList().iterator(); while (iterator.hasNext()) { ShippingRegion master = (ShippingRegion) iterator.next(); ShippingRegion shippingRegion = new ShippingRegion(); Set<Country> countries = shippingRegion.getCountries(); Set<State> states = shippingRegion.getStates(); PropertyUtils.copyProperties(shippingRegion, master); shippingRegion.setSite(site);// w w w .j a va 2s .c o m shippingRegion.setShippingRegionId(null); shippingRegion.setRecUpdateBy(userId); shippingRegion.setRecUpdateDatetime(new Date(System.currentTimeMillis())); shippingRegion.setRecCreateBy(userId); shippingRegion.setRecCreateDatetime(new Date(System.currentTimeMillis())); shippingRegion.setCountries(countries); shippingRegion.setStates(states); shippingRegion.setZipCodes(null); shippingRegion.setShippingMethodRegions(null); shippingRegion.setShippingMethodRegionTypes(null); Iterator<?> it = null; if (master.getCountries() != null) { it = master.getCountries().iterator(); while (it.hasNext()) { Country mc = (Country) it.next(); Country country = CountryDAO.loadByCountryName(site.getSiteId(), mc.getCountryName()); shippingRegion.getCountries().add(country); } } if (master.getStates() != null) { it = master.getStates().iterator(); while (it.hasNext()) { State mc = (State) it.next(); State state = StateDAO.loadByStateName(site.getSiteId(), mc.getStateName()); shippingRegion.getStates().add(state); } } shippingRegions.add(shippingRegion); em.persist(shippingRegion); } }
From source file:br.gov.jfrj.siga.cp.bl.CpBL.java
public CpIdentidade definirSenhaDeIdentidade(String senhaNova, String senhaConfirma, String nomeUsuario, String auxiliar1, String auxiliar2, CpIdentidade idCadastrante) throws NoSuchAlgorithmException, AplicacaoException { final CpIdentidade id = dao().consultaIdentidadeCadastrante(nomeUsuario, true); // se o usurio no existir if (id == null) throw new AplicacaoException("O usurio no est cadastrado."); if (senhaNova.equals(senhaConfirma)) { try {/* w w w. jav a 2s . c o m*/ Date dt = dao().consultarDataEHoraDoServidor(); CpIdentidade idNova = new CpIdentidade(); PropertyUtils.copyProperties(idNova, id); idNova.setIdIdentidade(null); idNova.setDtCriacaoIdentidade(dt); final String hashNova = GeraMessageDigest.executaHash(senhaNova.getBytes(), "MD5"); idNova.setDscSenhaIdentidade(hashNova); BASE64Encoder encoderBase64 = new BASE64Encoder(); String chave = encoderBase64.encode(id.getDpPessoa().getIdInicial().toString().getBytes()); String senhaCripto = encoderBase64.encode(Criptografia.criptografar(senhaNova, chave)); idNova.setDscSenhaIdentidadeCripto(null); idNova.setDscSenhaIdentidadeCriptoSinc(null); dao().iniciarTransacao(); dao().gravarComHistorico(idNova, id, dt, idCadastrante); dao().commitTransacao(); Correio.enviar(id.getDpPessoa().getEmailPessoaAtual(), "Alterao de senha ", "\n" + idNova.getDpPessoa().getNomePessoa() + "\nMatricula: " + idNova.getDpPessoa().getSigla() + "\n" + "\nSua senha foi alterada para: " + senhaNova + ".\n\n As seguintes pessoas participaram da alterao da senha: " + auxiliar1 + " e " + auxiliar2 + ".\n\n Ateno: esta uma " + "mensagem automtica. Por favor, no responda. "); return idNova; } catch (final Exception e) { dao().rollbackTransacao(); throw new AplicacaoException("Ocorreu um erro durante a gravao", 0, e); } } else { throw new AplicacaoException("Senha nova diferente de confirmao"); } }
From source file:ec.gob.ceaaces.controller.FuncionarioController.java
public void guardar() { if (funcionarioSeleccionado == null) { return;/*w w w.jav a2 s. c om*/ } if (validarDatosPersonales() == false) { return; } funcionarioSeleccionado.setOrigenCarga(ORIGEN_CARGA); funcionarioSeleccionado.setIesDTO(this.iesSeleccionada); funcionarioSeleccionado.setFaseIesDTO(faseIesDTO); PersonaDTO perdoc = null; try { perdoc = new PersonaDTO(); PropertyUtils.copyProperties(perdoc, funcionarioSeleccionado); } catch (IllegalAccessException e1) { e1.printStackTrace(); } catch (InvocationTargetException e1) { e1.printStackTrace(); } catch (NoSuchMethodException e1) { e1.printStackTrace(); } personaFuncionario = perdoc; personaFuncionario.setIesDTO(this.iesSeleccionada); PaisDTO nac = new PaisDTO(); nac.setId(idPais); this.personaFuncionario.setPaisOrigen(nac); this.personaFuncionario.setDiscapacidad(DiscapacidadEnum.parse(this.discapacidad)); this.personaFuncionario.setSexo(GeneroEnum.parse(this.genero)); this.funcionarioSeleccionado.setTipoFuncionario(TipoFuncionarioEnum.parse(this.tipoFunc)); SedeIesDTO sid = new SedeIesDTO(); sid.setId(this.idSedeSeleccionada); this.funcionarioSeleccionado.setSedeIesDTO(sid); personaFuncionario.setIesDTO(this.iesSeleccionada); FuncionarioDTO resultado = null; try { // if (pestania.equals("Datos Personales")) { if (funcionarioSeleccionado.getId() == null) { personaFuncionario.setActivo(true); personaFuncionario.setFaseIesDTO(faseIesDTO); funcionarioSeleccionado.setActivo(true); if (contrataciones.isEmpty()) { JsfUtil.msgAdvert("Ingrese los datos de contratacin."); indiceTab = 1; verTabContratacion = false; } else { funcionarioSeleccionado.setContratacionDTO(contrataciones); resultado = registroServicio.registrarFuncionario(personaFuncionario, funcionarioSeleccionado, usuarioSistema); RequestContext.getCurrentInstance().execute("dlgwContrato.hide()"); JsfUtil.msgInfo("Registro almacenado correctamente"); } } else { resultado = registroServicio.registrarFuncionario(personaFuncionario, funcionarioSeleccionado, usuarioSistema); JsfUtil.msgInfo("Registro almacenado correctamente"); } // resultado = guardarPestania(); } catch (Exception e) { JsfUtil.msgError("No se puede almacenar el registro."); } if (funcionarioSeleccionado.getId() != null) { activarTab(); } }
From source file:br.gov.jfrj.siga.cp.bl.CpBL.java
public CpModelo alterarCpModelo(CpModelo mod, String conteudo, CpIdentidade identidadeCadastrante) throws AplicacaoException { try {/*w ww. j a va2 s. c o m*/ Date dt = dao().consultarDataEHoraDoServidor(); CpModelo modNew = new CpModelo(); try { PropertyUtils.copyProperties(modNew, mod); } catch (Exception e) { throw new AplicacaoException("Erro ao copiar as propriedades do modelo anterior."); } modNew.setIdMod(null); modNew.setConteudoBlobString(conteudo); dao().iniciarTransacao(); CpModelo modSaved = (CpModelo) dao().gravarComHistorico(modNew, mod, dt, identidadeCadastrante); dao().commitTransacao(); return modSaved; } catch (Exception e) { dao().rollbackTransacao(); throw new AplicacaoException("No foi possvel alterar o modelo.", 9, e); } }
From source file:jp.co.opentone.bsol.linkbinder.view.AbstractPage.java
/** * ?????????????./* www. jav a 2 s . c o m*/ * @param condition ? * @return ?? */ public AbstractCondition cloneToAllRowCondition(AbstractCondition condition) { AbstractCondition clone = null; try { clone = condition.getClass().getConstructor().newInstance(); PropertyUtils.copyProperties(clone, condition); //? clone.setPageNo(1); clone.setPageRowNum(Integer.MAX_VALUE); } catch (NoSuchMethodException e) { throw new ReflectionRuntimeException(e); } catch (IllegalArgumentException e) { throw new ReflectionRuntimeException(e); } catch (SecurityException e) { throw new ReflectionRuntimeException(e); } catch (InstantiationException e) { throw new ReflectionRuntimeException(e); } catch (IllegalAccessException e) { throw new ReflectionRuntimeException(e); } catch (InvocationTargetException e) { throw new ReflectionRuntimeException(e); } return clone; }
From source file:com.jada.admin.site.SiteLoader.java
public void loadShippingMethod() throws Exception { EntityManager em = JpaConnection.getInstance().getCurrentEntityManager(); String sql = "from ShippingMethod where siteId = :siteId order by shippingMethodId"; Query query = em.createQuery(sql); query.setParameter("siteId", Constants.SITE_SYSTEM); Iterator<?> iterator = query.getResultList().iterator(); while (iterator.hasNext()) { ShippingMethod master = (ShippingMethod) iterator.next(); ShippingMethod shippingMethod = new ShippingMethod(); shippingMethod.setSite(site);// w w w.j av a 2 s .com shippingMethod.setSeqNum(master.getSeqNum()); shippingMethod.setPublished(master.getPublished()); shippingMethod.setRecUpdateBy(userId); shippingMethod.setRecUpdateDatetime(new Date(System.currentTimeMillis())); shippingMethod.setRecCreateBy(userId); shippingMethod.setRecCreateDatetime(new Date(System.currentTimeMillis())); for (ShippingMethodLanguage language : master.getShippingMethodLanguages()) { ShippingMethodLanguage shippingMethodLanguage = new ShippingMethodLanguage(); shippingMethodLanguage.setShippingMethodName(language.getShippingMethodName()); shippingMethodLanguage.setRecUpdateBy(userId); shippingMethodLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis())); shippingMethodLanguage.setRecCreateBy(userId); shippingMethodLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis())); em.persist(shippingMethodLanguage); if (language.getShippingMethodLangId() .equals(master.getShippingMethodLanguage().getShippingMethodLangId())) { shippingMethod.setShippingMethodLanguage(shippingMethodLanguage); } shippingMethod.getShippingMethodLanguages().add(shippingMethodLanguage); } if (master.getShippingMethodRegions() != null) { Iterator<?> it = master.getShippingMethodRegions().iterator(); while (it.hasNext()) { ShippingMethodRegion m_shippingMethodRegion = (ShippingMethodRegion) it.next(); ShippingMethodRegion shippingMethodRegion = new ShippingMethodRegion(); shippingMethodRegion.setPublished(m_shippingMethodRegion.getPublished()); shippingMethodRegion.setRecUpdateBy(userId); shippingMethodRegion.setRecUpdateDatetime(new Date(System.currentTimeMillis())); shippingMethodRegion.setRecCreateBy(userId); shippingMethodRegion.setRecCreateDatetime(new Date(System.currentTimeMillis())); shippingMethodRegion.setShippingMethod(shippingMethod); ShippingRegion shippingRegion = getShippingRegion( m_shippingMethodRegion.getShippingRegion().getShippingRegionName()); shippingMethodRegion.setShippingRegion(shippingRegion); if (m_shippingMethodRegion.getShippingMethodRegionTypes() != null) { Iterator<?> it1 = m_shippingMethodRegion.getShippingMethodRegionTypes().iterator(); while (it1.hasNext()) { ShippingMethodRegionType m_shippingMethodRegionType = (ShippingMethodRegionType) it1 .next(); ShippingMethodRegionType shippingMethodRegionType = new ShippingMethodRegionType(); shippingMethodRegionType.setPublished(m_shippingMethodRegionType.getPublished()); shippingMethodRegionType.setRecUpdateBy(userId); shippingMethodRegionType.setRecUpdateDatetime(new Date(System.currentTimeMillis())); shippingMethodRegionType.setRecCreateBy(userId); shippingMethodRegionType.setRecCreateDatetime(new Date(System.currentTimeMillis())); shippingMethodRegionType.setShippingRegion(shippingRegion); shippingMethodRegionType.setShippingMethod(shippingMethod); shippingMethodRegionType.setShippingType(getShippingType( m_shippingMethodRegionType.getShippingType().getShippingTypeName())); ShippingRate m_shippingRate = m_shippingMethodRegionType.getShippingRate(); ShippingRate shippingRate = new ShippingRate(); PropertyUtils.copyProperties(shippingRate, m_shippingRate); shippingRate.setPublished(m_shippingRate.getPublished()); shippingRate.setRecUpdateBy(userId); shippingRate.setRecUpdateDatetime(new Date(System.currentTimeMillis())); shippingRate.setRecCreateBy(userId); shippingRate.setRecCreateDatetime(new Date(System.currentTimeMillis())); shippingMethodRegionType.setShippingRate(shippingRate); em.persist(shippingRate); em.persist(shippingMethodRegionType); shippingMethodRegion.getShippingMethodRegionTypes().add(shippingMethodRegionType); } } shippingMethod.getShippingMethodRegions().add(shippingMethodRegion); } } em.persist(shippingMethod); } }
From source file:com.jada.order.document.CreditEngine.java
public void saveOrder() throws Exception { EntityManager em = JpaConnection.getInstance().getCurrentEntityManager(); if (masterHeader == null || !masterHeader.getRecUpdateDatetime().equals(creditHeader.getRecUpdateDatetime())) { if (creditHeader.getCreditNum() == null) { creditHeader.setCreditNum(// w w w .j av a 2 s .c om generateNumber(orderHeader.getSiteDomain().getSite(), Constants.SEQUENCE_CREDIT)); } if (masterHeader == null) { masterHeader = new CreditHeader(); } masterHeader.setCreditNum(creditHeader.getCreditNum()); masterHeader.setShippingTotal(creditHeader.getShippingTotal()); masterHeader.setCreditTotal(creditHeader.getCreditTotal()); masterHeader.setCreditStatus(creditHeader.getCreditStatus()); masterHeader.setCreditDate(creditHeader.getCreditDate()); masterHeader.setUpdateInventory(creditHeader.getUpdateInventory()); masterHeader.setRecUpdateBy(creditHeader.getRecUpdateBy()); masterHeader.setRecUpdateDatetime(creditHeader.getRecUpdateDatetime()); masterHeader.setRecCreateBy(creditHeader.getRecCreateBy()); masterHeader.setRecCreateDatetime(creditHeader.getRecCreateDatetime()); masterHeader.setOrderHeader(orderHeader); masterHeader.setInvoiceHeader(invoiceHeader); orderHeader.getCreditHeaders().add(masterHeader); // Copy data from creditHeader to masterHeader if (masterHeader.getCreditHeaderId() == null) { em.persist(masterHeader); } creditHeader.setCreditHeaderId(masterHeader.getCreditHeaderId()); if (masterHeader != null) { Iterator<?> taxIterator = masterHeader.getCreditTaxes().iterator(); while (taxIterator.hasNext()) { CreditDetailTax creditDetailTax = (CreditDetailTax) taxIterator.next(); if (creditDetailTax.getCreditDetail() != null) { continue; } em.remove(creditDetailTax); taxIterator.remove(); } } Iterator<?> taxIterator = creditHeader.getCreditTaxes().iterator(); while (taxIterator.hasNext()) { CreditDetailTax creditDetailTax = (CreditDetailTax) taxIterator.next(); if (creditDetailTax.getCreditDetail() != null) { continue; } CreditDetailTax masterTax = new CreditDetailTax(); masterTax.setCreditDetailTaxId(creditDetailTax.getCreditDetailTaxId()); masterTax.setTaxName(creditDetailTax.getTaxName()); masterTax.setTaxAmount(creditDetailTax.getTaxAmount()); masterTax.setRecUpdateBy(creditDetailTax.getRecUpdateBy()); masterTax.setRecUpdateDatetime(creditDetailTax.getRecUpdateDatetime()); masterTax.setRecCreateBy(creditDetailTax.getRecCreateBy()); masterTax.setRecCreateDatetime(creditDetailTax.getRecCreateDatetime()); masterTax.setCreditDetail(null); masterTax.setCreditHeader(masterHeader); masterTax.setTax(creditDetailTax.getTax()); masterTax.setCreditDetailTaxId(null); em.persist(masterTax); } } Iterator<?> iterator = masterHeader.getCreditDetails().iterator(); while (iterator.hasNext()) { CreditDetail masterDetail = (CreditDetail) iterator.next(); Iterator<?> taxIterator = masterDetail.getCreditDetailTaxes().iterator(); while (taxIterator.hasNext()) { CreditDetailTax masterDetailTax = (CreditDetailTax) taxIterator.next(); em.remove(masterDetailTax); taxIterator.remove(); } em.remove(masterDetail); iterator.remove(); } iterator = creditHeader.getCreditDetails().iterator(); while (iterator.hasNext()) { CreditDetail creditDetail = (CreditDetail) iterator.next(); CreditDetail masterDetail = new CreditDetail(); masterDetail.setCreditHeader(masterHeader); masterDetail.setSeqNum(creditDetail.getSeqNum()); masterDetail.setItemCreditQty(creditDetail.getItemCreditQty()); masterDetail.setItemCreditAmount(creditDetail.getItemCreditAmount()); masterDetail.setRecUpdateBy(creditDetail.getRecUpdateBy()); masterDetail.setRecUpdateDatetime(creditDetail.getRecUpdateDatetime()); masterDetail.setRecCreateBy(creditDetail.getRecCreateBy()); masterDetail.setRecCreateDatetime(creditDetail.getRecCreateDatetime()); masterDetail.setOrderItemDetail(creditDetail.getOrderItemDetail()); em.persist(masterDetail); masterHeader.getCreditDetails().add(masterDetail); Iterator<?> taxIterator = creditDetail.getCreditDetailTaxes().iterator(); while (taxIterator.hasNext()) { CreditDetailTax creditDetailTax = (CreditDetailTax) taxIterator.next(); CreditDetailTax masterTax = new CreditDetailTax(); masterTax.setTaxName(creditDetailTax.getTaxName()); masterTax.setTaxAmount(creditDetailTax.getTaxAmount()); masterTax.setRecUpdateBy(creditDetailTax.getRecUpdateBy()); masterTax.setRecUpdateDatetime(creditDetailTax.getRecUpdateDatetime()); masterTax.setRecCreateBy(creditDetailTax.getRecCreateBy()); masterTax.setRecCreateDatetime(creditDetailTax.getRecCreateDatetime()); masterTax.setCreditDetail(masterDetail); masterDetail.getCreditDetailTaxes().add(masterTax); masterTax.setCreditHeader(masterHeader); masterTax.setTax(creditDetailTax.getTax()); em.persist(masterTax); } } PaymentTran paymentTran = creditHeader.getPaymentTran(); PaymentTran masterPaymentTran = null; if (masterHeader != null) { masterPaymentTran = masterHeader.getPaymentTran(); } if (isSavePaymentTran(paymentTran, masterPaymentTran)) { if (masterPaymentTran == null) { masterPaymentTran = new PaymentTran(); } PropertyUtils.copyProperties(masterPaymentTran, paymentTran); masterHeader.setPaymentTran(masterPaymentTran); if (masterPaymentTran.getPaymentTranId() == null) { em.persist(masterPaymentTran); } } PaymentTran voidPaymentTran = creditHeader.getVoidPaymentTran(); masterPaymentTran = null; if (masterHeader != null) { masterPaymentTran = masterHeader.getVoidPaymentTran(); } if (isSavePaymentTran(voidPaymentTran, masterPaymentTran)) { if (masterPaymentTran == null) { masterPaymentTran = new PaymentTran(); } PropertyUtils.copyProperties(masterPaymentTran, voidPaymentTran); masterHeader.setVoidPaymentTran(masterPaymentTran); if (masterPaymentTran.getPaymentTranId() == null) { em.persist(masterPaymentTran); } } }
From source file:jp.co.opentone.bsol.linkbinder.view.AbstractPage.java
/** * ???????./*w ww .j av a2 s .c o m*/ * ???????????. * @param object * @return ?? */ public Object cloneToObject(Object object) { Object clone = null; try { clone = object.getClass().getConstructor().newInstance(); PropertyUtils.copyProperties(clone, object); } catch (NoSuchMethodException e) { throw new ReflectionRuntimeException(e); } catch (IllegalArgumentException e) { throw new ReflectionRuntimeException(e); } catch (SecurityException e) { throw new ReflectionRuntimeException(e); } catch (InstantiationException e) { throw new ReflectionRuntimeException(e); } catch (IllegalAccessException e) { throw new ReflectionRuntimeException(e); } catch (InvocationTargetException e) { throw new ReflectionRuntimeException(e); } return clone; }