lundi 21 janvier 2019

if else stament block

im so sorry if i open another question for the same problem,but my first,received a lot of downvote.I try to exlpain much better in what i have some problems and what i need to solve it.

Initially i have this method:

private boolean METHOD1(BaseElaboration line) {
        if (line.getMercato().equals("MERCATO LIBERO")) {
            if (line.getStrategia().toLowerCase().startsWith("STRATEGIA FO".toLowerCase())
                    || line.getStrategia().toLowerCase().contains("CREDITI CEDUTI".toLowerCase())) {
                return true;
            }

            if (line.getAttivita().equalsIgnoreCase("Proposta di Recupero Stragiudiziale FO")
                    || line.getAttivita().equalsIgnoreCase("Proposta di Cessione")) {
                return true;
            }

            if (line.getLegalenome().equalsIgnoreCase("Euroservice junk STR FO")
                    || line.getLegalenome().equalsIgnoreCase("Euroservice_FO")) {
                return true;
            }
        } else if (line.getMercato().equals("MAGGIOR TUTELA")) {
            if (line.getaNomeCluster().equalsIgnoreCase("Full Outsourcing")) {
                return true;
            }

            if (line.getAttivitaCrabb().toLowerCase().contains("*FO".toLowerCase())) {
                return true;
            }

            if (line.getCollector().toLowerCase().contains("Cessione".toLowerCase())
                    || line.getCollector().equalsIgnoreCase("Euroservice_Fo")) {
                return true;
            }
        }

        return false;
    }

The tool,takes input files and save in an output file lines who start with Cessione,EuroServervice FO ecc.The method save only 1 record ( 1 line) when he should saves groups of records for the same ID.I do a modify for save all groups of the same IDs:

}
         else if (line.getMercato().equals("MAGGIOR TUTELA")) {

                    if(line.getCollector().toLowerCase().contains("Cessione".toLowerCase())
                    || (line.getCollector().equalsIgnoreCase("Euroservice_Fo"))
                    || (line.getAttivitaCrabb().toLowerCase().contains("*FO".toLowerCase())
                    ||  (line.getaNomeCluster().equalsIgnoreCase("Full Outsourcing")))) {


                onlyID = true;
            }

             else if(Collections.frequency(storedIds,line.getCuv()) >= 1 ){
                 onlyID= true;

        }

        return onlyID;
    }
        return false;
    }

with this :

else if(Collections.frequency(storedIds,line.getCuv()) >= 1 ){
                 onlyID= true;

i saved multi lines for the same ID.THe 2 block of id with this modify works,correclty,but the first no,i dont know what i wrong... I need a little help.SHould change the first if ( mercto libero) ,like 2 if big ( maggior tutela.

 private boolean checkPerimetroJunk(BaseElaborazione riga) {

        if (line.getMercato().toLowerCase().contains("*Libero".toLowerCase())) {
            if (line.getStrategia().toLowerCase().startsWith("STRATEGIA FO".toLowerCase())
                    || (line.getStrategia().toLowerCase().contains("CREDITI CEDUTI".toLowerCase())
                    || (line.getAttivita().equalsIgnoreCase("Proposta di Recupero Stragiudiziale FO")
                    ||  (line.getAttivita().toLowerCase().contains("Cessione".toLowerCase())
                    || (line.getLegalenome().equalsIgnoreCase("Euroservice junk STR FO")
                    || (line.getLegalenome().equalsIgnoreCase("Euroservice_FO"))))))) {

                    onlyID=true;
                }

                     else if(Collections.frequency(storedIds,line.getCuv()) >= 1 ){
                 onlyID= true;
                   }

        return onlyID;
    }
         else if (line.getMercato().equals("MAGGIOR TUTELA")) {

                    if(line.getCollector().toLowerCase().contains("Cessione".toLowerCase())
                    || (line.getCollector().equalsIgnoreCase("Euroservice_Fo"))
                    || (line.getAttivitaCrabb().toLowerCase().contains("*FO".toLowerCase())
                    ||  (line.getaNomeCluster().equalsIgnoreCase("Full Outsourcing")))) {


                onlyID= true;
            }

             else if(Collections.frequency(storedIds,line.getCuv()) >= 1 ){
                 onlyID= true;

        }

        return onlyID;
    }
        return false;
    }

Aucun commentaire:

Enregistrer un commentaire