I have a repetition problem at the time of listing, in my view it repeats R01 and R01, twice the same code and only after it correctly follows R02, RO3 and so on. The correct one would be R01, R02, R03 and so on. Thanks.
public void reorganizarNumerosItens() {
List<Listitem> itens = this.getItems();
if (itens != null) {
int i = 1;
for (Listitem itemAtual : itens) {
ListitemRequisitoFuncional itemReq = (ListitemRequisitoFuncional) itemAtual;
RequisitoFuncional requisitoFuncional = itemReq.getReqFuncional();
requisitoFuncional.setStrNumRequisito(this.getStrNumItemAtual(i));
i++;
itemReq.recarregaObjeto();
try {
this.bo.salvar(requisitoFuncional);
} catch (NegocioException e) {
e.printStackTrace();
}
}
}
}
public String getStrNumItemAtual(Integer numItem) {
if (numItem == 0) {
numItem +=1;
}
String strNumItem = numItem.toString();
strNumItem = strNumItem.length() < 2 ? "R0" + strNumItem : "R" + numItem;
return strNumItem;
}