Example usage for java.lang Long equals

List of usage examples for java.lang Long equals

Introduction

In this page you can find the example usage for java.lang Long equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Compares this object to the specified object.

Usage

From source file:jp.primecloud.auto.service.impl.ComponentServiceImpl.java

/**
 * {@inheritDoc}//from   w w  w  .  jav  a 2 s .  c  o m
 */
@Override
public Collection<Object> checkAttachDisk(Long farmNo, Long componentNo, String instanceName,
        String notSelectedItem, Collection<Object> moveList) {

    List<InstanceDto> instances = instanceService.getInstances(farmNo);
    for (InstanceDto instance : instances) {
        if (StringUtils.equals(instanceName, instance.getInstance().getInstanceName())) {
            //TODO CLOUD BRANCHING
            if (instance.getAwsVolumes() != null) {
                // AwsVolume?
                for (AwsVolume awsVolume : instance.getAwsVolumes()) {
                    if (componentNo.equals(awsVolume.getComponentNo())) {
                        if (StringUtils.isNotEmpty(awsVolume.getInstanceId())) {
                            // ????????
                            moveList.add(notSelectedItem);
                        }
                        break;
                    }
                }
            } else if (instance.getVmwareDisks() != null) {
                // VmwareDisk?
                for (VmwareDisk vmwareDisk : instance.getVmwareDisks()) {
                    if (componentNo.equals(vmwareDisk.getComponentNo())) {
                        if (BooleanUtils.isTrue(vmwareDisk.getAttached())) {
                            // ????????
                            moveList.add(notSelectedItem);
                        }
                        break;
                    }
                }
            } else if (instance.getCloudstackVolumes() != null) {
                // CloudstackVolume?
                for (CloudstackVolume cloudstackVolume : instance.getCloudstackVolumes()) {
                    if (componentNo.equals(cloudstackVolume.getComponentNo())) {
                        if (StringUtils.isNotEmpty(cloudstackVolume.getInstanceId())) {
                            // ????????
                            moveList.add(notSelectedItem);
                        }
                        break;
                    }
                }
            } else if (instance.getVcloudDisks() != null) {
                // VcloudDisk?
                for (VcloudDisk vcloudDisk : instance.getVcloudDisks()) {
                    if (componentNo.equals(vcloudDisk.getComponentNo())) {
                        if (BooleanUtils.isTrue(vcloudDisk.getAttached())) {
                            if (InstanceStatus
                                    .fromStatus(instance.getInstance().getStatus()) != InstanceStatus.STOPPED) {
                                // ????????
                                moveList.add(notSelectedItem);
                            }
                        }
                        break;
                    }
                }
            } else if (instance.getAzureDisks() != null) {
                // AzureDisk?
                for (AzureDisk azureDisk : instance.getAzureDisks()) {
                    if (componentNo.equals(azureDisk.getComponentNo())) {
                        if (StringUtils.isNotEmpty(azureDisk.getInstanceName())) {
                            if (InstanceStatus
                                    .fromStatus(instance.getInstance().getStatus()) != InstanceStatus.STOPPED) {
                                // ????????
                                moveList.add(notSelectedItem);
                            }
                        }
                        break;
                    }
                }
            } else if (instance.getNiftyVolumes() != null) {
                // NiftyVolume?
                for (NiftyVolume niftyVolume : instance.getNiftyVolumes()) {
                    if (componentNo.equals(niftyVolume.getComponentNo())) {
                        if (StringUtils.isNotEmpty(niftyVolume.getInstanceId())) {
                            // ????????
                            moveList.add(notSelectedItem);
                        }
                        break;
                    }
                }
            } else if (instance.getOpenstackVolumes() != null) {
                // OpenstackVolume?
                for (OpenstackVolume openstackVolume : instance.getOpenstackVolumes()) {
                    if (componentNo.equals(openstackVolume.getComponentNo())) {
                        if (StringUtils.isNotEmpty(openstackVolume.getInstanceId())) {
                            // ????????
                            moveList.add(notSelectedItem);
                        }
                        break;
                    }
                }
            }
        }
    }

    return moveList;
}

From source file:com.square.adherent.noyau.service.implementations.AdherentServiceImpl.java

@Override
public com.square.adherent.noyau.dto.adherent.PersonneDto getPersonneByNumClient(String numClient) {
    // Recherche de la personne
    final PersonneCriteresRechercheDto criterias = new PersonneCriteresRechercheDto();
    criterias.setNumeroClient(numClient);
    final RemotePagingCriteriasDto<PersonneCriteresRechercheDto> criteres = new RemotePagingCriteriasDto<PersonneCriteresRechercheDto>(
            criterias, 0, 1);/*  w ww . ja va  2  s.  c  om*/
    final RemotePagingResultsDto<PersonneSimpleDto> result = personnePhysiqueService
            .rechercherPersonneFullTextParCriteres(criteres);

    if (result != null && result.getListResults() != null) {
        final PersonneSimpleDto personneSquare = result.getListResults().get(0);
        // Rcupration des informations supplmentaires ncessaires
        final Long idNatureEmailPersonnel = squareMappingService.getIdNatureEmailPersonnel();
        final Long idTelephoneFixe = squareMappingService.getIdNatureTelephoneFixe();
        final com.square.adherent.noyau.dto.adherent.PersonneDto personneEcm = mapperDozerBean
                .map(personneSquare, com.square.adherent.noyau.dto.adherent.PersonneDto.class);
        // Rcupration des coordonnes
        final CoordonneesDto coordonnees = personneService
                .rechercherCoordonneesParIdPersonne(personneSquare.getId());
        if (coordonnees != null) {
            if (coordonnees.getEmails() != null && coordonnees.getEmails().size() > 0) {
                // Email
                for (EmailDto email : coordonnees.getEmails()) {
                    if (email.getNatureEmail() != null
                            && idNatureEmailPersonnel.equals(email.getNatureEmail().getIdentifiant())) {
                        personneEcm.setAdresseEmail(email.getAdresse());
                        break;
                    }
                }

                // Tlphone
                for (TelephoneDto telephone : coordonnees.getTelephones()) {
                    if (telephone.getNature() != null
                            && idTelephoneFixe.equals(telephone.getNature().getIdentifiant())) {
                        personneEcm.setNumeroTelephoneFixe(telephone.getNumero());
                        break;
                    }
                }

                // Adresse
                for (AdresseDto adresse : coordonnees.getAdresses()) {
                    if (adresse.getNature() != null
                            && idTelephoneFixe.equals(adresse.getNature().getIdentifiant())) {
                        final com.square.adherent.noyau.dto.adherent.AdresseDto adressePrincipale = mapperDozerBean
                                .map(adresse, com.square.adherent.noyau.dto.adherent.AdresseDto.class);
                        personneEcm.setAdressePrincipale(adressePrincipale);
                        break;
                    }
                }
            }
        }
        return personneEcm;
    }
    return null;
}

From source file:gate.annotation.AnnotationSetImpl.java

/** Returns the nodes corresponding to the Longs. The Nodes are created if
 * they don't exist./*  w  w w  .  j  av  a  2 s  .c  o  m*/
 **/
private final Node[] getNodes(Long start, Long end) throws InvalidOffsetException {
    // are the offsets valid?
    if (!doc.isValidOffsetRange(start, end)) {
        throw new InvalidOffsetException("Offsets [" + start + ":" + end
                + "] not valid for this document of size " + doc.getContent().size());
    }
    // the set has to be indexed by position in order to add, as we need
    // to find out if nodes need creating or if they exist already
    if (nodesByOffset == null) {
        indexByStartOffset();
    }
    // find existing nodes if appropriate nodes don't already exist,
    // create them
    Node startNode = nodesByOffset.get(start);
    if (startNode == null)
        startNode = new NodeImpl(doc.getNextNodeId(), start);

    Node endNode = null;
    if (start.equals(end)) {
        endNode = startNode;
        return new Node[] { startNode, endNode };
    }

    endNode = nodesByOffset.get(end);
    if (endNode == null)
        endNode = new NodeImpl(doc.getNextNodeId(), end);

    return new Node[] { startNode, endNode };
}

From source file:com.ylife.shoppingcart.service.impl.ShoppingCartServiceImpl.java

/**
 * ??//ww w  . ja v a  2  s .c o  m
 *
 * @param businessId
 * @param shopdata
 * @return
 */
@Override
public Map<String, Object> getEveryThirdPriceMap(Long businessId, List<ShoppingCart> shopdata,
        Long distinctId) {
    Map<String, Object> paramMap = new HashMap<>();
    // 1?? 0?
    paramMap.put(STOCK, "1");
    List<ShoppingCart> shoplist = new ArrayList<>();
    if (CollectionUtils.isNotEmpty(shopdata)) {

        for (int i = 0; i < shopdata.size(); i++) {
            if (businessId.equals(shopdata.get(i).getThirdId())) {
                shoplist.add(shopdata.get(i));
            }
        }
    }
    // ?
    BigDecimal sumPrice = BigDecimal.valueOf(0);
    // ?
    BigDecimal sumOldPrice = BigDecimal.valueOf(0);
    // ?
    BigDecimal prePrice = BigDecimal.valueOf(0);
    // ??
    BigDecimal flag = BigDecimal.ZERO;
    // boss?
    BigDecimal bossSumPrice = BigDecimal.ZERO;
    ProductWare productWare;
    Map<String, Object> para = new HashMap<>();
    if (CollectionUtils.isNotEmpty(shoplist)) {
        Long goodssum = 0L;
        BigDecimal goodsprice = BigDecimal.ZERO;
        BigDecimal totalprice = BigDecimal.ZERO;

        for (int v = 0; v < shoplist.size(); v++) {

            if (shoplist.get(v).getFitId() == null) {

                // ?
                goodsprice = shoplist.get(v).getGoodsDetailBean().getProductVo().getGoodsInfoPreferPrice();
                //?
                if ("0".equals(shoplist.get(v).getGoodsDetailBean().getProductVo().getGoodsInfoAdded())) {
                    paramMap.put(STOCK, "0");
                }
                // ?
                String discountFlag = "";
                DecimalFormat myformat = null;
                // 
                if ("1".equals(discountFlag)) {
                    myformat = new DecimalFormat("0.0");
                } else if ("2".equals(discountFlag)) {
                    myformat = new DecimalFormat("0");
                } else {
                    myformat = new DecimalFormat("0.00");
                }
                goodsprice = BigDecimal.valueOf(Double.valueOf(myformat.format(goodsprice)));
                // ??()
                shoplist.get(v).getGoodsDetailBean().getProductVo().setGoodsInfoPreferPrice(goodsprice);
                // ?
                goodssum = shoplist.get(v).getGoodsNum();
                // boss?
                if (shoplist.get(v).getThirdId() == 0) {
                    if (shoplist.get(v).getSubjectId() != null && shoplist.get(v).getSubjectId() > 0) {
                        bossSumPrice = bossSumPrice.add(BigDecimal
                                .valueOf(
                                        Double.valueOf(myformat.format(shoplist.get(v).getSubjectGoodsPrice())))
                                .multiply(BigDecimal.valueOf(goodssum)));
                    } else {
                        bossSumPrice = bossSumPrice.add(goodsprice.multiply(BigDecimal.valueOf(goodssum)));
                    }
                }
                // ?
                if (shoplist.get(v).getSubjectId() != null && shoplist.get(v).getSubjectId() > 0) {
                    sumOldPrice = sumOldPrice.add(BigDecimal
                            .valueOf(Double.valueOf(myformat.format(shoplist.get(v).getSubjectGoodsPrice())))
                            .multiply(BigDecimal.valueOf(goodssum)));
                    flag = flag.add(BigDecimal
                            .valueOf(Double.valueOf(myformat.format(shoplist.get(v).getSubjectGoodsPrice())))
                            .multiply(BigDecimal.valueOf(goodssum)));
                } else {
                    sumOldPrice = sumOldPrice.add(goodsprice.multiply(BigDecimal.valueOf(goodssum)));
                    flag = flag.add(goodsprice.multiply(BigDecimal.valueOf(goodssum)));
                }
            }

        }
        List<ShoppingCart> cartList = null;
        // ?id?
        cartList = new ArrayList<>();
        for (ShoppingCart sc : shoplist) {
            if (sc.getFitId() == null) {
                cartList.add(sc);

            }
        }
    }
    paramMap.put("sumOldPrice", sumOldPrice);
    paramMap.put(BOSSSUMPRICE, bossSumPrice);
    paramMap.put(SUMPRICE, flag);
    return paramMap;
}

From source file:com.selfsoft.baseinformation.dao.impl.TbPartInfoDaoImpl.java

public Double getOutTmStoreHouseAsFinal(Long storeHouseId, String year, String mounth, Long outType) {

    StringBuilder sql = new StringBuilder();

    String stockoutWhereStr = " and (";

    String maintainWhereStr = " and (";

    for (int i = 1; i <= Integer.valueOf(mounth); i++) {

        String mounthStr = i < 10 ? "0" + i : i + "";
        String yearhMonth = year + "" + mounthStr;

        if (i == 1) {
            stockoutWhereStr += " so.stock_out_code like '%" + yearhMonth + "%'";

            maintainWhereStr += " m.maintain_code like '%" + yearhMonth + "%'";
        } else {//from   ww w . j a v a  2  s  . c om

            stockoutWhereStr += " or so.stock_out_code like '%" + yearhMonth + "%'";

            maintainWhereStr += " or m.maintain_code like '%" + yearhMonth + "%'";
        }
    }
    stockoutWhereStr += ")";
    maintainWhereStr += ")";
    sql.append("select sum(aa.so_quantity) from (");
    if (outType != null && outType.equals(StockTypeElements.MAINTAIN.getElementValue())) {
        sql.append(
                "select sum(m.part_quantity*pi.cost_price) so_quantity from tb_maintain_part_content m  ,tb_part_info pi ");
        sql.append("where pi.id = m.part_id and  m.is_confirm not in(8000) and m.is_free = 1");
        sql.append(" and pi.store_house_id = " + storeHouseId + " " + maintainWhereStr);
    } else {

        sql.append(
                "select sum(sod.quantity*pi.cost_price) so_quantity from tm_stock_out so , tm_stockout_detail sod ,tb_part_info pi ");
        sql.append(
                "where pi.id = sod.partinfo_Id and so.id = sod.stockout_id  and so.is_confirm not in(8000) and (sod.is_free = 1 or sod.is_free is null)");
        sql.append(" and pi.store_house_id = " + storeHouseId + " " + stockoutWhereStr);
        sql.append(" and so.out_Type=" + outType);
    }
    //      sql.append(" union all ");
    sql.append(") aa");
    List<Object[]> list = this.findByOriginSql(sql.toString(), null);

    Object obj = list.get(0);
    if (null == obj)
        return 0D;

    Double result = obj != null ? Double.valueOf(obj.toString()) : 0D;
    return result;
}

From source file:com.square.tarificateur.noyau.service.implementations.TarificateurEditiqueServiceImpl.java

/**
 * Complte les informations de rglement.
 * @param documentsDto le DTO contenant les documents
 * @param devis le devis  partir duquel on rcupre les informations de rglement
 * @param editionDocumentDto infos pour l'edition
 *//*  ww  w. j a v a  2  s .  c o m*/
private void completerInfosReglement(DocumentsBulletinsAdhesionDto documentsDto, Devis devis,
        EditionDocumentDto editionDocumentDto) {
    if (devis != null) {
        final Adhesion adhesion = devis.getOpportunite().getAdhesion();
        // Rcupration de la priodicit
        String periodicite = null;
        if (adhesion.getPeriodicitePaiement() != null && adhesion.getPeriodicitePaiement().getId() != null) {
            final Long idPeriodicite = adhesion.getPeriodicitePaiement().getId();
            if (idPeriodicite.equals(tarificateurSquareMappingService.getIdPeriodicitePaiementMensuelle())) {
                periodicite = InfosReglementDto.PERIODICITE_MENSUELLE;
            } else if (idPeriodicite
                    .equals(tarificateurSquareMappingService.getIdPeriodicitePaiementTrimestrielle())) {
                periodicite = InfosReglementDto.PERIODICITE_TRIMESTRIELLE;
            } else if (idPeriodicite
                    .equals(tarificateurSquareMappingService.getIdPeriodicitePaiementSemestrielle())) {
                periodicite = InfosReglementDto.PERIODICITE_SEMESTRIELLE;
            } else if (idPeriodicite
                    .equals(tarificateurSquareMappingService.getIdPeriodicitePaiementAnnuelle())) {
                periodicite = InfosReglementDto.PERIODICITE_ANNUELLE;
            }
        }
        // Rcupration du moyen de paiement (Prlvement ou chque)
        String moyenPaiement = null;
        if (adhesion.getMoyenPaiement() != null && adhesion.getMoyenPaiement().getId() != null) {
            final Long idMoyenPaiement = adhesion.getMoyenPaiement().getId();
            if (idMoyenPaiement.equals(tarificateurSquareMappingService.getIdMoyenPaiementPrelevement())) {
                moyenPaiement = InfosReglementDto.MODE_REGLEMENT_PRELEVEMENT_AUTOMATIQUE;
            } else if (idMoyenPaiement.equals(tarificateurSquareMappingService.getIdMoyenPaiementCheque())) {
                moyenPaiement = InfosReglementDto.MODE_REGLEMENT_CHEQUE;
            }
        }
        // Rcupration du moyen de paiement avec le jour si prlvement
        if (moyenPaiement != null
                && moyenPaiement.equals(InfosReglementDto.MODE_REGLEMENT_PRELEVEMENT_AUTOMATIQUE)) {
            // Rcupration du jour de paiement
            if (adhesion.getJourPaiement() != null && adhesion.getJourPaiement().getId() != null) {
                final Long idJourPaiement = adhesion.getJourPaiement().getId();
                if (idJourPaiement.equals(tarificateurSquareMappingService.getIdJourPaiement5DuMois())) {
                    moyenPaiement = InfosReglementDto.MODE_REGLEMENT_PRELEVEMENT_AUTOMATIQUE_5_DU_MOIS;
                } else if (idJourPaiement
                        .equals(tarificateurSquareMappingService.getIdJourPaiement10DuMois())) {
                    moyenPaiement = InfosReglementDto.MODE_REGLEMENT_PRELEVEMENT_AUTOMATIQUE_10_DU_MOIS;
                } else if (idJourPaiement
                        .equals(tarificateurSquareMappingService.getIdJourPaiement15DuMois())) {
                    moyenPaiement = InfosReglementDto.MODE_REGLEMENT_PRELEVEMENT_AUTOMATIQUE_15_DU_MOIS;
                }
            }
        }

        InfosRibDto infosRibDto = null;
        // si on a pass des infos de RIB et qu'on en a pas sur l'adhsion
        if (editionDocumentDto.getInfosRib() != null && adhesion.getInfosRib() == null) {
            infosRibDto = mapperDozerBean.map(editionDocumentDto.getInfosRib(), InfosRibDto.class);
        } else if (adhesion.getInfosRib() != null) {
            infosRibDto = mapperDozerBean.map(adhesion.getInfosRib(), InfosRibDto.class);
        }
        // si on a pass des infos de paiement et qu'on en a pas sur l'adhsion
        if (editionDocumentDto.getJourPaiement() != null
                && editionDocumentDto.getJourPaiement().getIdentifiant() != null && moyenPaiement == null) {
            final Long idJourPaiement = editionDocumentDto.getJourPaiement().getIdentifiant();
            if (idJourPaiement.equals(tarificateurSquareMappingService.getIdJourPaiement5DuMois())) {
                moyenPaiement = InfosReglementDto.MODE_REGLEMENT_PRELEVEMENT_AUTOMATIQUE_5_DU_MOIS;
            } else if (idJourPaiement.equals(tarificateurSquareMappingService.getIdJourPaiement10DuMois())) {
                moyenPaiement = InfosReglementDto.MODE_REGLEMENT_PRELEVEMENT_AUTOMATIQUE_10_DU_MOIS;
            } else if (idJourPaiement.equals(tarificateurSquareMappingService.getIdJourPaiement15DuMois())) {
                moyenPaiement = InfosReglementDto.MODE_REGLEMENT_PRELEVEMENT_AUTOMATIQUE_15_DU_MOIS;
            }
        }
        for (BulletinAdhesionDto bulletinAdhesionDto : documentsDto.getListeBulletinsAdhesion()) {
            if (periodicite != null || moyenPaiement != null) {
                bulletinAdhesionDto.setInfosReglement(new InfosReglementDto(periodicite, moyenPaiement));
            }
            bulletinAdhesionDto.setInfosRib(infosRibDto);
        }
    }
}

From source file:com.square.adherent.noyau.service.implementations.AdherentServiceImpl.java

@Override
public List<com.square.adherent.noyau.dto.adherent.PersonneDto> getListeAssurePrincipalParPagination(
        int debutPagination, int taillePagination) {
    // Cration de l'objet de retour
    final List<com.square.adherent.noyau.dto.adherent.PersonneDto> listeAssures = new ArrayList<com.square.adherent.noyau.dto.adherent.PersonneDto>();

    // Recherche des personnes
    final PersonneCriteresRechercheDto criterias = new PersonneCriteresRechercheDto();
    final List<Long> listeNatures = new ArrayList<Long>();
    listeNatures.add(squareMappingService.getIdNaturePersonneAdherent());
    criterias.setListeNatures(listeNatures);
    final List<Long> listeReseaux = new ArrayList<Long>();
    listeReseaux.add(squareMappingService.getIdReseauIndividuel());
    criterias.setListeReseaux(listeReseaux);
    final RemotePagingCriteriasDto<PersonneCriteresRechercheDto> criteres = new RemotePagingCriteriasDto<PersonneCriteresRechercheDto>(
            criterias, debutPagination, taillePagination);
    final RemotePagingResultsDto<PersonneSimpleDto> result = personnePhysiqueService
            .rechercherPersonneFullTextParCriteres(criteres);

    // Rcupration des informations supplmentaires ncessaires
    final Long idNatureEmailPersonnel = squareMappingService.getIdNatureEmailPersonnel();
    final Long idTelephoneFixe = squareMappingService.getIdNatureTelephoneFixe();
    if (result != null && result.getListResults() != null) {
        for (PersonneSimpleDto personne : result.getListResults()) {
            final com.square.adherent.noyau.dto.adherent.PersonneDto assure = mapperDozerBean.map(personne,
                    com.square.adherent.noyau.dto.adherent.PersonneDto.class);
            // Rcupration des coordonnes
            final CoordonneesDto coordonnees = personneService
                    .rechercherCoordonneesParIdPersonne(assure.getId());
            if (coordonnees != null) {
                if (coordonnees.getEmails() != null && coordonnees.getEmails().size() > 0) {
                    // Email
                    for (EmailDto email : coordonnees.getEmails()) {
                        if (email.getNatureEmail() != null
                                && idNatureEmailPersonnel.equals(email.getNatureEmail().getIdentifiant())) {
                            assure.setAdresseEmail(email.getAdresse());
                            break;
                        }//from  w  w  w .  j  a  v a  2 s.com
                    }

                    // Tlphone
                    for (TelephoneDto telephone : coordonnees.getTelephones()) {
                        if (telephone.getNature() != null
                                && idTelephoneFixe.equals(telephone.getNature().getIdentifiant())) {
                            assure.setNumeroTelephoneFixe(telephone.getNumero());
                            break;
                        }
                    }

                    // Adresse
                    for (AdresseDto adresse : coordonnees.getAdresses()) {
                        if (adresse.getNature() != null
                                && idTelephoneFixe.equals(adresse.getNature().getIdentifiant())) {
                            final com.square.adherent.noyau.dto.adherent.AdresseDto adressePrincipale = mapperDozerBean
                                    .map(adresse, com.square.adherent.noyau.dto.adherent.AdresseDto.class);
                            assure.setAdressePrincipale(adressePrincipale);
                            break;
                        }
                    }
                }
            }
            listeAssures.add(assure);
        }
    }
    return listeAssures;
}

From source file:com.square.adherent.noyau.service.implementations.AdherentServiceImpl.java

@Override
public List<com.square.adherent.noyau.dto.adherent.PersonneDto> getListeBeneficaireParPagination(
        int debutPagination, int taillePagination) {
    // Cration de l'objet de retour
    final List<com.square.adherent.noyau.dto.adherent.PersonneDto> listeBeneficiaires = new ArrayList<com.square.adherent.noyau.dto.adherent.PersonneDto>();

    // Recherche des personnes
    final PersonneCriteresRechercheDto criterias = new PersonneCriteresRechercheDto();
    final List<Long> listeNatures = new ArrayList<Long>();
    listeNatures.add(squareMappingService.getIdNaturePersonneBeneficiaireAdherent());
    criterias.setListeNatures(listeNatures);
    final List<Long> listeReseaux = new ArrayList<Long>();
    listeReseaux.add(squareMappingService.getIdReseauIndividuel());
    criterias.setListeReseaux(listeReseaux);
    final RemotePagingCriteriasDto<PersonneCriteresRechercheDto> criteres = new RemotePagingCriteriasDto<PersonneCriteresRechercheDto>(
            criterias, debutPagination, taillePagination);
    final RemotePagingResultsDto<PersonneSimpleDto> result = personnePhysiqueService
            .rechercherPersonneFullTextParCriteres(criteres);

    // Rcupration des informations supplmentaires ncessaires
    final Long idNatureEmailPersonnel = squareMappingService.getIdNatureEmailPersonnel();
    final Long idTelephoneFixe = squareMappingService.getIdNatureTelephoneFixe();
    if (result != null && result.getListResults() != null) {
        for (PersonneSimpleDto personne : result.getListResults()) {
            final com.square.adherent.noyau.dto.adherent.PersonneDto beneficiaire = mapperDozerBean
                    .map(personne, com.square.adherent.noyau.dto.adherent.PersonneDto.class);
            // Rcupration des coordonnes
            final CoordonneesDto coordonnees = personneService
                    .rechercherCoordonneesParIdPersonne(personne.getId());
            if (coordonnees != null) {
                if (coordonnees.getEmails() != null && coordonnees.getEmails().size() > 0) {
                    // Email
                    for (EmailDto email : coordonnees.getEmails()) {
                        if (email.getNatureEmail() != null
                                && idNatureEmailPersonnel.equals(email.getNatureEmail().getIdentifiant())) {
                            beneficiaire.setAdresseEmail(email.getAdresse());
                            break;
                        }//  www .  ja  v a  2s. co m
                    }

                    // Tlphone
                    for (TelephoneDto telephone : coordonnees.getTelephones()) {
                        if (telephone.getNature() != null
                                && idTelephoneFixe.equals(telephone.getNature().getIdentifiant())) {
                            beneficiaire.setNumeroTelephoneFixe(telephone.getNumero());
                            break;
                        }
                    }

                    // Adresse
                    for (AdresseDto adresse : coordonnees.getAdresses()) {
                        if (adresse.getNature() != null
                                && idTelephoneFixe.equals(adresse.getNature().getIdentifiant())) {
                            final com.square.adherent.noyau.dto.adherent.AdresseDto adressePrincipale = mapperDozerBean
                                    .map(adresse, com.square.adherent.noyau.dto.adherent.AdresseDto.class);
                            beneficiaire.setAdressePrincipale(adressePrincipale);
                            break;
                        }
                    }
                }
            }
            listeBeneficiaires.add(beneficiaire);
        }
    }
    return listeBeneficiaires;
}

From source file:com.square.core.service.implementations.ActionServiceImplementation.java

/**
 * Mthode prive rcursive qui recherche les actions lies.
 * @param idActionSource l'identifiant de l'action source
 * @param niveau le niveau//from  w w  w  . j ava  2s.co  m
 * @param filtrerDateEffet bollen pour indiquer si on filtre ou non sur la date d'effet
 */
private void rechercherActionsLiees(Stack<ActionSyntheseDto> pileEnCours, Long idActionSource, int niveau,
        Long idOpportunite, Boolean filtrerDateEffet) {
    final Long idTypeActionRelance = squareMappingService.getIdTypeActionRelance();
    final List<Action> actionsLiees = actionDao.rechercherActionsLiees(idActionSource, idOpportunite,
            filtrerDateEffet);
    for (Action actionLiee : actionsLiees) {
        // Ajout de l'action source dans la pile
        final ActionSyntheseDto actionSyntheseDto = mapperDozerBean.map(actionLiee, ActionSyntheseDto.class);
        // On incrmente le niveau des actions de type Relance
        int niveauSuivant = 0;
        if (actionLiee.getType() != null && idTypeActionRelance.equals(actionLiee.getType().getId())) {
            niveauSuivant = niveau + 1;
        }
        actionSyntheseDto.setNiveau(niveauSuivant);
        actionSyntheseDto.setAttribueA(genererLibelleAttribueA(actionLiee.getActionAttribution()));
        // Rcupration si la date d'action est ditable
        if (actionEditable(actionLiee)) {
            actionSyntheseDto.setDateActionEditable(true);
        }
        pileEnCours.push(actionSyntheseDto);
        rechercherActionsLiees(pileEnCours, actionLiee.getId(), niveauSuivant, idOpportunite, filtrerDateEffet);
    }
}

From source file:data.services.ParseBaseService.java

private void updateModels() throws SQLException, ClassNotFoundException {
    List<Model> modelsForSaveList = new ArrayList();
    List<Model> modelsForUpdateList = new ArrayList();
    List<Model> modelList = modelDao.getAllAsc();
    List<Long> actualQutoIdList = new ArrayList();
    HashMap<Long, Model> ourOldIdModelMap = new HashMap();
    for (Model m : modelList) {
        ourOldIdModelMap.put(m.getQutoId(), m);
    }/*www. j  ava2 s. co m*/
    ResultSet resSet = getFromQutoBase(getSelectAll(QUTO_MODEL_TABLE));
    while (resSet.next()) {
        Long qutoId = resSet.getLong("id");
        actualQutoIdList.add(qutoId);

        Long markQutoId = resSet.getLong("car_brand_id");
        String pop = StringAdapter.getString(resSet.getString("is_popular")).trim();
        String title = StringAdapter.getString(resSet.getString("title")).trim();
        String titleRus = StringAdapter.getString(resSet.getString("title_rus")).trim();
        String url = StringAdapter.getString(resSet.getString("url")).trim();
        String desc = StringAdapter.getString(resSet.getString("description")).trim();
        Long mediaId = resSet.getLong("media_id");
        Mark mark = new Mark();
        mark.setQutoId(markQutoId);
        List<Mark> supMarkList = markDao.find(mark);
        if (!supMarkList.isEmpty() && qutoId != 0) {
            mark = supMarkList.get(0);

            if (!ourOldIdModelMap.keySet().contains(qutoId)) {
                Model model = new Model();
                model.setQutoId(qutoId);
                model.setMark(mark);
                model.setPop(pop);
                model.setTitle(title);
                model.setTitleRus(titleRus);
                model.setDescription(desc);
                model.setMediaId(mediaId);
                model.setUrl(url);
                if (validate(model, "TroubleQutoId=" + model.getQutoId() + "; ")) {
                    modelsForSaveList.add(model);
                }
            } else {
                Model model = ourOldIdModelMap.get(qutoId);
                if (!pop.equals(model.getPop()) || !title.equals(model.getTitle())
                        || !titleRus.equals(model.getTitleRus()) || !url.equals(model.getUrl())
                        || !mediaId.equals(model.getMediaId()) || !desc.equals(model.getDescription())) {
                    model.setQutoId(qutoId);
                    model.setMark(mark);
                    model.setPop(pop);
                    model.setTitle(title);
                    model.setTitleRus(titleRus);
                    model.setDescription(desc);
                    model.setMediaId(mediaId);
                    model.setUrl(url);
                    if (validate(model, "TroubleQutoId=" + model.getQutoId() + "; ")) {
                        modelsForUpdateList.add(model);
                    }
                }
            }
        }
    }
    int s = 0;
    int u = 0;
    int d = 0;
    for (Model m : modelsForSaveList) {
        modelDao.save(m);
        s++;
    }
    for (Model m : modelsForUpdateList) {
        modelDao.update(m);
        u++;
    }
    for (Long qutoId : ourOldIdModelMap.keySet()) {
        if (!actualQutoIdList.contains(qutoId)) {
            d++;
            modelDao.delete(ourOldIdModelMap.get(qutoId));
        }
    }
    addError(": " + s + " ? ?, " + u + " , " + d
            + " .");
}