Example usage for org.apache.commons.beanutils PropertyUtils copyProperties

List of usage examples for org.apache.commons.beanutils PropertyUtils copyProperties

Introduction

In this page you can find the example usage for org.apache.commons.beanutils PropertyUtils copyProperties.

Prototype

public static void copyProperties(Object dest, Object orig)
        throws IllegalAccessException, InvocationTargetException, NoSuchMethodException 

Source Link

Document

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.

Usage

From source file:com.utest.webservice.builders.Builder.java

public To toObject(final Class<To> objectClass, final Ti info) throws Exception {
    To result;/* w  ww  .  ja  va  2s  . c o m*/
    final Constructor<To> constr = objectClass.getConstructor(new Class[] {});
    if (constr == null) {
        throw new IllegalArgumentException("No default constructor found for " + infoClass.getName());
    }
    result = constr.newInstance(new Object[] {});
    PropertyUtils.copyProperties(result, info);
    return result;
}

From source file:com.floreantpos.bo.ui.explorer.QuickMaintenanceExplorer.java

private static void quickMaintainOrderType(OrderType orderType) {
    try {//from w  ww. j a v  a 2  s  . co m
        if (orderType.getId() != null) {
            if (btnCopy.isSelected()) {
                OrderType newOrderType = new OrderType();
                PropertyUtils.copyProperties(newOrderType, orderType);
                newOrderType.setId(null);
                orderType = newOrderType;
            } else if (btnDelete.isSelected()) {
                if (POSMessageDialog.showYesNoQuestionDialog(POSUtil.getFocusedWindow(),
                        POSConstants.CONFIRM_DELETE, POSConstants.DELETE) != JOptionPane.YES_OPTION) {
                    return;
                }

                OrderTypeDAO orderTypeDAO = new OrderTypeDAO();
                orderTypeDAO.delete(orderType.getId());
                SwitchboardView.getInstance().rendererOrderPanel();
                return;
            }
        }
        OrderTypeForm editor = new OrderTypeForm(orderType);
        BeanEditorDialog dialog = new BeanEditorDialog(Application.getPosWindow(), editor);
        dialog.open();
        if (dialog.isCanceled())
            return;
        Application.getInstance().refreshOrderTypes();
        SwitchboardView.getInstance().rendererOrderPanel();
        return;
    } catch (Exception e) {
        return;
    }
}

From source file:jp.co.opentone.bsol.linkbinder.service.correspon.impl.CorresponSaveServiceImpl.java

/**
 * ?????./* w ww  .  j  ava  2s.c o m*/
 *
 * @param correspon
 *            ?
 * @return correspon
 *            ?
 */
private Correspon copyCorresponProperties(Correspon correspon) {
    Correspon clone = new Correspon();
    try {
        PropertyUtils.copyProperties(clone, correspon);
    } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
        throw new ApplicationFatalRuntimeException(e);
    }
    return clone;
}

From source file:au.org.theark.lims.web.component.biospecimen.batchaliquot.form.BatchAliquotBiospecimenForm.java

/**
 * //  w w w . j a  v a  2 s  . c  om
 * @return the listEditor of Biospecimens to aliquot
 */
public AbstractListEditor<Biospecimen> buildListEditor() {
    listEditor = new AbstractListEditor<Biospecimen>("aliquots",
            new PropertyModel(getModelObject(), "aliquots")) {

        private static final long serialVersionUID = 1L;

        @SuppressWarnings("serial")
        @Override
        protected void onPopulateItem(final ListItem<Biospecimen> item) {
            item.setOutputMarkupId(true);

            Biospecimen parentBiospecimen = BatchAliquotBiospecimenForm.this.getModelObject()
                    .getParentBiospecimen();
            try {
                PropertyUtils.copyProperties(item.getModelObject(), parentBiospecimen);
            } catch (IllegalAccessException e1) {
                log.error(e1.getMessage());
            } catch (InvocationTargetException e1) {
                log.error(e1.getMessage());
            } catch (NoSuchMethodException e1) {
                log.error(e1.getMessage());
            }

            if (copyBiospecimen) {
                item.getModelObject().setParent(parentBiospecimen);
                item.getModelObject().setParentUid(parentBiospecimen.getBiospecimenUid());
                item.getModelObject().setQuantity(biospecimenToCopy.getQuantity());
                item.getModelObject().setTreatmentType(biospecimenToCopy.getTreatmentType());
                item.getModelObject().setConcentration(biospecimenToCopy.getConcentration());
            } else {
                item.getModelObject().setParent(parentBiospecimen);
                item.getModelObject().setParentUid(parentBiospecimen.getBiospecimenUid());
                item.getModelObject().setQuantity(null);
                item.getModelObject().setConcentration(null);
            }

            biospecimenUidTxtFld = new TextField<String>("biospecimenUid",
                    new PropertyModel(item.getModelObject(), "biospecimenUid"));
            if (parentBiospecimen.getStudy().getAutoGenerateBiospecimenUid()) {
                biospecimenUidTxtFld.setEnabled(false);
                biospecimenUidTxtFld.setModelObject(Constants.AUTO_GENERATED);
            } else {
                biospecimenUidTxtFld.setEnabled(true);
                biospecimenUidTxtFld.setModelObject(null);
            }

            quantityTxtFld = new TextField<Double>("quantity",
                    new PropertyModel(item.getModelObject(), "quantity")) {
                private static final long serialVersionUID = 1L;

                @Override
                public <C> IConverter<C> getConverter(Class<C> type) {
                    DoubleConverter doubleConverter = new DoubleConverter();
                    NumberFormat numberFormat = NumberFormat.getInstance();
                    numberFormat.setMinimumFractionDigits(1);
                    doubleConverter.setNumberFormat(getLocale(), numberFormat);
                    return (IConverter<C>) doubleConverter;
                }
            };

            initTreatmentTypeDdc(item);
            concentrationTxtFld = new TextField<Number>("concentration",
                    new PropertyModel(item.getModelObject(), "concentration"));

            item.add(biospecimenUidTxtFld.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                    if (!item.getModelObject().getStudy().getAutoGenerateBiospecimenUid()) {
                        // Check BiospecimenUID is unique
                        String biospecimenUid = (getComponent().getDefaultModelObject().toString() != null
                                ? getComponent().getDefaultModelObject().toString()
                                : new String());
                        Biospecimen biospecimen = iLimsService.getBiospecimenByUid(biospecimenUid,
                                item.getModelObject().getStudy());
                        if (biospecimen != null && biospecimen.getId() != null) {
                            error("Biospecimen UID must be unique. Please try again.");
                            target.focusComponent(getComponent());
                        }
                    }
                    target.add(feedbackPanel);
                    biospecimenToCopy.setBiospecimenUid(getComponent().getDefaultModelObject().toString());
                }
            }));

            item.add(quantityTxtFld.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                    if (!totalQuantityLessThanParentQuantity()) {
                        target.focusComponent(getComponent());
                    }
                    target.add(feedbackPanel);
                    biospecimenToCopy.setQuantity((Double) getComponent().getDefaultModelObject());
                    item.getModelObject().setQuantity((Double) getComponent().getDefaultModelObject());
                }

                @Override
                protected void onError(AjaxRequestTarget target, RuntimeException e) {
                    target.add(feedbackPanel);
                }
            }));
            item.add(treatmentTypeDdc.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                    biospecimenToCopy.setTreatmentType((TreatmentType) getComponent().getDefaultModelObject());
                    item.getModelObject()
                            .setTreatmentType((TreatmentType) getComponent().getDefaultModelObject());
                }
            }));
            item.add(concentrationTxtFld.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                    biospecimenToCopy.setConcentration((Double) getComponent().getDefaultModelObject());
                    item.getModelObject().setConcentration((Double) getComponent().getDefaultModelObject());
                }
            }));

            // Copy button allows entire row details to be copied
            item.add(new AjaxEditorButton(Constants.COPY) {
                private static final long serialVersionUID = 1L;

                @Override
                protected void onError(AjaxRequestTarget target, Form<?> form) {
                    target.add(feedbackPanel);
                }

                @Override
                protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                    Biospecimen biospecimen = new Biospecimen();
                    copyBiospecimen = true;
                    try {
                        PropertyUtils.copyProperties(biospecimen, getItem().getModelObject());
                        PropertyUtils.copyProperties(biospecimenToCopy, getItem().getModelObject());
                        listEditor.addItem(biospecimen);
                        target.add(form);
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    } catch (InvocationTargetException e) {
                        e.printStackTrace();
                    } catch (NoSuchMethodException e) {
                        e.printStackTrace();
                    }
                }
            }.setDefaultFormProcessing(false));

            item.add(new AjaxEditorButton(Constants.DELETE) {
                private static final long serialVersionUID = 1L;

                @Override
                protected void onError(AjaxRequestTarget target, Form<?> form) {
                    target.add(feedbackPanel);
                }

                @Override
                protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                    listEditor.removeItem(item);
                    target.add(form);
                }
            }.setDefaultFormProcessing(false).setVisible(item.getIndex() > 0));

            item.add(new AttributeModifier(Constants.CLASS, new AbstractReadOnlyModel() {

                private static final long serialVersionUID = 1L;

                @Override
                public String getObject() {
                    return (item.getIndex() % 2 == 1) ? Constants.EVEN : Constants.ODD;
                }
            }));
        }

    };
    return listEditor;
}

From source file:com.fengduo.bee.commons.core.lang.BeanUtils.java

/**
 * copy init?//w  ww. ja v  a2  s.  co  m
 * 
 * @param target
 * @param raw
 * @param defaultValues
 */
@SuppressWarnings({ "rawtypes" })
public static <T extends Object> void copyProperties(T target, Object raw, ValueEditable... defaultValues) {

    try {
        Map values = raw == null ? new HashMap() : PropertyUtils.describe(raw);
        if (Argument.isNotEmptyArray(defaultValues)) {
            for (ValueEditable edit : defaultValues) {
                edit.edit(raw, values);
            }
        }

        PropertyUtils.copyProperties(target, values);
        // ?
        optInitMethod(target);
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
    }
}

From source file:com.floreantpos.bo.ui.explorer.QuickMaintenanceExplorer.java

private static void quickMaintainShopTable(ShopTable shopTable) {
    try {//from  w w  w . j  ava 2 s  . co m
        if (shopTable.getId() != null) {
            if (btnCopy.isSelected()) {
                ShopTable newShopTable = new ShopTable();
                PropertyUtils.copyProperties(newShopTable, shopTable);
                newShopTable.setId(shopTable.getId() + 1);
                newShopTable.setDescription(String.valueOf(shopTable.getId() + 1));
                shopTable = newShopTable;
            } else if (btnDelete.isSelected()) {
                if (POSMessageDialog.showYesNoQuestionDialog(POSUtil.getFocusedWindow(),
                        POSConstants.CONFIRM_DELETE, POSConstants.DELETE) != JOptionPane.YES_OPTION) {
                    return;
                }

                ShopTableDAO shopTableDAO = new ShopTableDAO();
                shopTableDAO.delete(shopTable.getId());
                TableMapView.getInstance().updateView();
                return;
            }
        }
        ShopTableForm editor = new ShopTableForm();
        editor.setBean(shopTable);
        BeanEditorDialog dialog = new BeanEditorDialog(Application.getPosWindow(), editor);
        dialog.open(600, 500);
        if (dialog.isCanceled())
            return;
        TableMapView.getInstance().updateView();
        return;
    } catch (Exception e) {
        return;
    }
}

From source file:br.gov.jfrj.siga.cp.bl.CpBL.java

/**
 * Altera a senha da identidade.//ww w  . j a  v a 2s.  com
 * 
 * @param matricula
 * @param cpf
 * @param idCadastrante
 * @param senhaGerada
 *            - Usado para retornar a senha gerada.  um array para que o
 *            valor seja passado como referncia e o mtodo que o chama
 *            tenha a oportunidade de conhecer a senha)
 * @return
 * @throws AplicacaoException
 */
public CpIdentidade alterarSenhaDeIdentidade(String matricula, String cpf, CpIdentidade idCadastrante,
        String[] senhaGerada) throws AplicacaoException {
    final long longmatricula = Long.parseLong(matricula.substring(2));
    final DpPessoa pessoa = dao().consultarPorCpfMatricula(Long.parseLong(cpf), longmatricula);

    if (pessoa != null && pessoa.getSigla().equals(matricula) && pessoa.getEmailPessoaAtual() != null) {

        // final Usuario usuario =
        // dao().consultaUsuarioCadastrante(matricula);

        CpIdentidade id = dao().consultaIdentidadeCadastrante(matricula, true);
        if (id != null) {
            final String novaSenha = GeraMessageDigest.geraSenha();
            if (senhaGerada != null) {
                senhaGerada[0] = novaSenha;
            }
            try {
                Date dt = dao().consultarDataEHoraDoServidor();
                CpIdentidade idNova = new CpIdentidade();
                PropertyUtils.copyProperties(idNova, id);
                idNova.setIdIdentidade(null);
                idNova.setDtCancelamentoIdentidade(null);
                idNova.setDtCriacaoIdentidade(dt);

                final String hashNova = GeraMessageDigest.executaHash(novaSenha.getBytes(), "MD5");
                idNova.setDscSenhaIdentidade(hashNova);

                BASE64Encoder encoderBase64 = new BASE64Encoder();
                String chave = encoderBase64.encode(id.getDpPessoa().getIdInicial().toString().getBytes());
                String senhaCripto = encoderBase64.encode(Criptografia.criptografar(novaSenha, chave));
                idNova.setDscSenhaIdentidadeCripto(null);
                idNova.setDscSenhaIdentidadeCriptoSinc(null);

                dao().iniciarTransacao();
                dao().gravarComHistorico(idNova, id, dt, idCadastrante);
                dao().commitTransacao();
                Correio.enviar(pessoa.getEmailPessoaAtual(), "Alterao de senha ",
                        "\n" + idNova.getDpPessoa().getNomePessoa() + "\nMatricula: "
                                + idNova.getDpPessoa().getSigla() + "\n" + "\nSua senha foi alterada para: "
                                + novaSenha + "\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("Este usurio no est cadastrado no sistema");
        }

    } else {
        if (pessoa == null) {
            throw new AplicacaoException("No foi encontrado usurio com matrcula e cpf informados.");
        } else if (pessoa.getEmailPessoaAtual() == null) {
            throw new AplicacaoException("Este usurio no possui e-mail cadastrado");
        } else {
            throw new AplicacaoException("Dados Incorretos!");
        }
    }
}

From source file:com.glaf.base.modules.workspace.service.mybatis.MessageServiceImpl.java

@Transactional
public boolean saveSendMessage(Message message, String[] recverIds) {
    boolean rst = true;

    // /*from w w w . j  ava  2s  .  c o m*/
    StringBuffer recverList = new StringBuffer("");

    // ???
    for (int i = 0; i < recverIds.length; i++) {
        if (recverIds[i] == null || recverIds[i].trim().length() == 0) {
            continue;
        }

        Message newMessage = new Message();
        try {
            PropertyUtils.copyProperties(newMessage, message);
        } catch (Exception ex) {
            org.springframework.beans.BeanUtils.copyProperties(newMessage, message);
        }

        SysUser recver = sysUserService.findByAccount(recverIds[i]);
        if (recver != null) {
            newMessage.setRecver(recver);
            newMessage.setRecverId(recver.getId());
            recverList.append(recver.getName()).append(",");
        }

        if (!saveOrUpdate(newMessage)) {
            rst = false;
        }
    }

    // ???,??
    if (rst) {
        sendToSelf(message, recverList.toString());
    }

    return rst;
}

From source file:br.gov.jfrj.siga.vraptor.GrupoController.java

/**
 * Grava o grupo e as configuraes// ww w.java  2s  . co  m
 * @param idConfiguracao TODO
 * 
 * @throws AplicacaoException
 * @throws IllegalAccessException
 * @throws InstantiationException
 * @throws InvocationTargetException
 */
public Long aGravar(Long idCpGrupo, String siglaGrupo, String dscGrupo, CpGrupoDeEmailSelecao grupoPaiSel,
        Integer codigoTipoConfiguracaoNova, String conteudoConfiguracaoNova, List<String> idConfiguracao,
        List<String> codigoTipoConfiguracao, List<String> conteudoConfiguracao) throws Exception {

    if (siglaGrupo == null) {
        throw new AplicacaoException("A sigla do grupo deve ser definida!");
    }

    idConfiguracao = Optional.fromNullable(idConfiguracao).or(new ArrayList<String>());

    codigoTipoConfiguracao = Optional.fromNullable(codigoTipoConfiguracao).or(new ArrayList<String>());

    conteudoConfiguracao = Optional.fromNullable(conteudoConfiguracao).or(new ArrayList<String>());

    try {
        CpGrupo grp = null;
        CpGrupo grpNovo = null;
        Date dt = dao().consultarDataEHoraDoServidor();
        CpTipoGrupo tpGrp = obterCpTipoGrupoPorId(getIdTipoGrupo());
        if (tpGrp == null) {
            throw new AplicacaoException("Tipo de grupo nulo para Id do grupo: " + idCpGrupo);
        }

        // Substituir isso por uma fbrica
        //
        if (tpGrp.getIdTpGrupo() == CpTipoGrupo.TIPO_GRUPO_GRUPO_DE_DISTRIBUICAO)
            grpNovo = new CpGrupoDeEmail();
        if (tpGrp.getIdTpGrupo() == CpTipoGrupo.TIPO_GRUPO_PERFIL_DE_ACESSO)
            grpNovo = new CpPerfil();
        if (tpGrp.getIdTpGrupo() == CpTipoGrupo.TIPO_GRUPO_PERFIL_JEE)
            grpNovo = new CpPerfilJEE();

        if (idCpGrupo == null) {
            grpNovo.setCpTipoGrupo(tpGrp);
            grpNovo.setOrgaoUsuario(getLotaTitular().getOrgaoUsuario());
        } else {
            grp = (CpGrupo) Objeto.getImplementation(daoGrupo(idCpGrupo));
            PropertyUtils.copyProperties(grpNovo, grp);
            grpNovo.setIdGrupo(null);
        }
        grpNovo.setCpGrupoPai(grupoPaiSel != null ? grupoPaiSel.getObjeto() : null);
        grpNovo.setDscGrupo(dscGrupo);
        grpNovo.setSiglaGrupo(siglaGrupo);

        dao().iniciarTransacao();
        grp = (CpGrupo) dao().gravarComHistorico(grpNovo, grp, dt, getIdentidadeCadastrante());
        idCpGrupo = grp.getIdGrupo();

        // Fabrica
        ConfiguracaoGrupoFabrica fabrica = new ConfiguracaoGrupoFabrica();
        // grava uma nova configurao

        TipoConfiguracaoGrupoEnum tpCfgGrpEnum = TipoConfiguracaoGrupoEnum.obterPara(tpGrp,
                codigoTipoConfiguracaoNova);
        if (tpCfgGrpEnum != null) {
            ConfiguracaoGrupo cfgGrp = fabrica.getInstance(tpCfgGrpEnum);
            if (isConfiguracaoAvancada(cfgGrp) && !podeEditarConfiguracoesAvancadas()) {
                throw new AplicacaoException("Voc no tem permisso para configurar "
                        + tpCfgGrpEnum.getDescricao()
                        + ". Por favor, entre em contato com o suporte tcnico para realizar tal configurao.");
            }

            if (conteudoConfiguracaoNova != null) {
                cfgGrp.setConteudoConfiguracao(conteudoConfiguracaoNova);
            }

            if (conteudoConfiguracaoNova == null || cfgGrp.getConteudoConfiguracao() == null
                    || cfgGrp.getConteudoConfiguracao().equals("")) {
                throw new AplicacaoException("Erro ao gravar nova configurao para o grupo: contedo do(a) "
                        + tpCfgGrpEnum.getDescricao() + " inexistente! ");
            }
            CpConfiguracao cfg = new CpConfiguracao();
            cfg.setCpTipoConfiguracao(tipoConfiguracao);
            cfg.setHisDtIni(dt);
            cfgGrp.setCpConfiguracao(cfg);
            cfgGrp.setCpGrupo(grp);
            cfgGrp.atualizarCpConfiguracao();
            dao().gravarComHistorico(cfg, getIdentidadeCadastrante());
        }

        // processa as configuraes existentes
        configuracoesGrupo = Cp.getInstance().getConf().obterCfgGrupo(grp);
        for (int i = 0; i < idConfiguracao.size(); i++) {
            Long idCfg = Long.parseLong(idConfiguracao.get(i));
            for (ConfiguracaoGrupo cfgGrpGravada : configuracoesGrupo) {
                Long idCfgGravada = cfgGrpGravada.getCpConfiguracao().getIdConfiguracao();
                if (idCfgGravada.equals(idCfg)) {
                    Integer tpCfg = Integer.parseInt(codigoTipoConfiguracao.get(i));
                    // Remoo de uma configurao gravada antes
                    if (tpCfg.equals(-1)) {
                        // excluso remove apenas logicamente, deixa o
                        // registro antigo como log
                        if (isConfiguracaoAvancada(cfgGrpGravada) && !podeEditarConfiguracoesAvancadas()) {
                            throw new AplicacaoException("Voc no tem permisso para remover "
                                    + cfgGrpGravada.getTipo().getDescricao()
                                    + ". Por favor, entre em contato com o suporte tcnico para realizar tal configurao.");
                        }

                        cfgGrpGravada.getCpConfiguracao().setHisDtFim(dt);
                        dao().gravarComHistorico(cfgGrpGravada.getCpConfiguracao(), getIdentidadeCadastrante());
                    } else {
                        String cfgConteudo = conteudoConfiguracao.get(i);
                        // Nato: o ideal seria se pudssemos utilizar o
                        // mtodo "semelhante" para comparar configuraes.
                        // No entanto, como as configuraes anteriores so
                        // lidas do "cache-da-aplicao", e no do
                        // Hibernate, fica impossvel fazer a comparao
                        // automaticamente. Por isso,  necessrio esse "if"
                        // que s grava alteraes se no for do mesmo tipo
                        // ou no tiver mesmo contedo que a gravada
                        if (!tpCfg.equals(cfgGrpGravada.getTipo().getCodigo())
                                || !cfgConteudo.equals(cfgGrpGravada.getConteudoConfiguracao())) {
                            TipoConfiguracaoGrupoEnum tpCfgGrpNova = TipoConfiguracaoGrupoEnum.obterPara(tpGrp,
                                    tpCfg);
                            ConfiguracaoGrupo cfgGrpNova = fabrica.getInstance(tpCfgGrpNova);
                            if (isConfiguracaoAvancada(cfgGrpNova) && !podeEditarConfiguracoesAvancadas()) {
                                throw new AplicacaoException("Voc no tem permisso para configurar "
                                        + tpCfgGrpNova.getDescricao()
                                        + ". Por favor, entre em contato com o suporte tcnico para realizar tal configurao.");
                            }
                            if (cfgConteudo == null || cfgConteudo.equals("")) {
                                throw new AplicacaoException(
                                        "Erro ao gravar alterao da configurao para o grupo: contedo do(a)"
                                                + tpCfgGrpEnum.getDescricao() + " inexistente!");
                            }
                            cfgGrpNova.setConteudoConfiguracao(cfgConteudo);
                            CpConfiguracao cfgNova = new CpConfiguracao();
                            cfgNova.setCpTipoConfiguracao(tipoConfiguracao);
                            cfgGrpNova.setCpConfiguracao(cfgNova);
                            cfgGrpNova.setCpGrupo(grp);
                            cfgGrpNova.atualizarCpConfiguracao();
                            dao().gravarComHistorico(cfgNova, cfgGrpGravada.getCpConfiguracao(), dt,
                                    getIdentidadeCadastrante());
                        }
                    }
                }
            }
        }

        dao().commitTransacao();
        Cp.getInstance().getConf().limparCache(
                dao().consultar(CpTipoConfiguracao.TIPO_CONFIG_PERTENCER, CpTipoConfiguracao.class, false));
        return idCpGrupo;
    } catch (Exception e) {
        throw new AplicacaoException("Id do grupo: " + idCpGrupo + " erro ao gravar grupo e configuraes.", 0,
                e);
    }
}

From source file:com.bdx.rainbow.service.basic.impl.EnterpriseService.java

@Override
public Map<String, Object> getEnterpriseDetailById(Integer enterpriseId) throws Exception {
    TBasicEnterpriseInfo info = tBasicEnterpriseInfoMapper.selectByPrimaryKey(enterpriseId);
    if (info != null) {
        Map<String, Object> result = new HashMap<String, Object>();
        DubboEnterpriseInfo dInfo = new DubboEnterpriseInfo();
        PropertyUtils.copyProperties(dInfo, info);
        result.put("info", dInfo);
        List<TBasicLicense> licenses = getEnterpriseLicenses(enterpriseId);
        if (licenses != null && licenses.size() != 0) {
            List<DubboLicense> dLicenses = new ArrayList<DubboLicense>();
            DubboLicense dLicense = null;
            for (TBasicLicense license : licenses) {
                dLicense = new DubboLicense();
                PropertyUtils.copyProperties(dLicense, license);
                dLicenses.add(dLicense);
            }/* ww w . j ava2 s . c om*/
            result.put("licenses", dLicenses);
        }
        return result;
    }
    return null;
}