for (Iterator iter
= myDBResultList.
iterator(); iter.
hasNext();) {
AlerteOppDB alerteOppDB = (AlerteOppDB) iter.next();
if(user.hasProfile(PRC.class)){
AlerteOppBean alerteOppBean = MetierDBFactory.getInstance().createAlerteOpportunite(user,
(!user.hasProfile(PRC.class) ? 0 : alerteOppDB.getNonAffectee().intValue()),
alerteOppDB.getATraiter().intValue(),
alerteOppDB.getEncours().intValue(),
alerteOppDB.getTransformee().intValue(),
alerteOppDB.getNonTransformee().intValue(),
alerteOppDB.getNomCommercial(),
alerteOppDB.getCodeRRDI(),
alerteOppDB.getCodeContrat(),
alerteOppDB.getIdPlaque(), false);
alerteOppBean.setLignePlaque(false);
alerteOppBean.setLigneContrat(false);
// Actualizacion de la PLACA
if(hashResult.containsKey(alerteOppBean.getIdPlaque())){
AlerteOppBean alerteOppBeanAux = (AlerteOppBean) hashResult.get(alerteOppBean.getIdPlaque());
alerteOppBeanAux.
setATraiter(Integer.
toString(Integer.
parseInt(alerteOppBeanAux.
getATraiter())+Integer.
parseInt(alerteOppBean.
getATraiter()))); alerteOppBeanAux.
setNonAffectees(Integer.
toString(Integer.
parseInt(alerteOppBeanAux.
getNonAffectees())+Integer.
parseInt(alerteOppBean.
getNonAffectees()))); alerteOppBeanAux.
setNonTransformee(Integer.
toString(Integer.
parseInt(alerteOppBeanAux.
getNonTransformee())+Integer.
parseInt(alerteOppBean.
getNonTransformee()))); alerteOppBeanAux.
setTransformee(Integer.
toString(Integer.
parseInt(alerteOppBeanAux.
getTransformee())+Integer.
parseInt(alerteOppBean.
getTransformee()))); alerteOppBeanAux.
setEncours(Integer.
toString(Integer.
parseInt(alerteOppBeanAux.
getEncours())+Integer.
parseInt(alerteOppBean.
getEncours()))); alerteOppBeanAux.setCodeRrdi(alerteOppBean.getCodeRrdi());
alerteOppBeanAux.setCodeContrat(alerteOppBean.getCodeContrat());
alerteOppBeanAux.setIdPlaque(alerteOppBean.getIdPlaque());
alerteOppBeanAux.setLibelle(alerteOppBeanAux.getIdPlaque());
alerteOppBeanAux.setLignePlaque(true);
alerteOppBeanAux.setLigneContrat(false);
} else { // Nueva PLACA
alerteOppBean.setLignePlaque(true);
alerteOppBean.setLigneContrat(false);
alerteOppBean.setLibelle(alerteOppBean.getIdPlaque());
}
// Actualizacion de CONTACTO
if(hashResult.containsKey(alerteOppBean.getIdPlaque()+" "+alerteOppBean.getCodeContrat())){
AlerteOppBean alerteOppBeanAux = (AlerteOppBean) hashResult.get(alerteOppBean.getIdPlaque()+" "+alerteOppBean.getCodeContrat());
if(alerteOppBeanAux.getIdPlaque().equalsIgnoreCase(alerteOppBean.getIdPlaque())){
alerteOppBeanAux.
setATraiter(Integer.
toString(Integer.
parseInt(alerteOppBeanAux.
getATraiter())+Integer.
parseInt(alerteOppBean.
getATraiter()))); alerteOppBeanAux.
setNonAffectees(Integer.
toString(Integer.
parseInt(alerteOppBeanAux.
getNonAffectees())+Integer.
parseInt(alerteOppBean.
getNonAffectees()))); alerteOppBeanAux.
setNonTransformee(Integer.
toString(Integer.
parseInt(alerteOppBeanAux.
getNonTransformee())+Integer.
parseInt(alerteOppBean.
getNonTransformee()))); alerteOppBeanAux.
setTransformee(Integer.
toString(Integer.
parseInt(alerteOppBeanAux.
getTransformee())+Integer.
parseInt(alerteOppBean.
getTransformee()))); alerteOppBeanAux.
setEncours(Integer.
toString(Integer.
parseInt(alerteOppBeanAux.
getEncours())+Integer.
parseInt(alerteOppBean.
getEncours()))); alerteOppBeanAux.setCodeRrdi(alerteOppBean.getCodeRrdi());
alerteOppBeanAux.setCodeContrat(alerteOppBean.getCodeContrat());
alerteOppBeanAux.setIdPlaque(alerteOppBean.getIdPlaque());
alerteOppBeanAux.setLibelle(LibelleServiceHelper.getInstance().retrieveLibelle(user, OpportuniteServiceConstants.ACCUEIL_LIBELLE_CONTRAT, user.getLocaleBGC()) + " " + alerteOppBean.getCodeContrat());
alerteOppBeanAux.setLigneContrat(true);
alerteOppBeanAux.setLignePlaque(false);
hashResult.put(alerteOppBean.getIdPlaque()+" "+alerteOppBean.getCodeContrat(), alerteOppBeanAux);
} else { // Nuevo CONTACTO
alerteOppBean.setLigneContrat(true);
alerteOppBean.setLignePlaque(false);
alerteOppBean.setLibelle(LibelleServiceHelper.getInstance().retrieveLibelle(user, OpportuniteServiceConstants.ACCUEIL_LIBELLE_CONTRAT, user.getLocaleBGC()) + " " + alerteOppBean.getCodeContrat());
hashResult.put(alerteOppBean.getIdPlaque()+" "+alerteOppBean.getCodeContrat(), alerteOppBean);
}
} else { // Nuevo CONTACTO
alerteOppBean.setLigneContrat(true);
alerteOppBean.setLignePlaque(false);
alerteOppBean.setLibelle(LibelleServiceHelper.getInstance().retrieveLibelle(user, OpportuniteServiceConstants.ACCUEIL_LIBELLE_CONTRAT, user.getLocaleBGC()) + " " + alerteOppBean.getCodeContrat());
hashResult.put(alerteOppBean.getIdPlaque()+" "+alerteOppBean.getCodeContrat(), alerteOppBean);
}
}
}
Iterator it
= hashResult.
entrySet().
iterator(); while (it.hasNext()) {
AlerteOppBean alerteOppBean = (AlerteOppBean) e.getValue();
myResultList.add(alerteOppBean);
}