0
This model is working, look at the figure!
You may notice that you are concatenating two String variables as you can see in the figure below;
My problem now is to be able to concatenate an Integer variable with a String variable, because the eclipse does not allow it, as you can see below;
I’d have to make one Cast, but I am having difficulty to do for lack of experience, I need help in this direction!
That is the code;
/*lista de NaoConformidade*/
@Autorizacao(values = { AutorizacaoSistema.M_ADM })
public List<TipoInconsistenciaEntity> getListNaoConformidade() {
AbstractCriteriaSearch<TipoInconsistenciaEntity> filtro =
new AbstractCriteriaSearch<TipoInconsistenciaEntity>(new TipoInconsistenciaEntity());
filtro.addOrder("codigo", ASC);
List<TipoInconsistenciaEntity> lista = tipoInconsistenciaService.listarEntidades(filtro);
List<TipoInconsistenciaEntity> listaRetorno = new ArrayList<TipoInconsistenciaEntity>();
for (TipoInconsistenciaEntity pj : lista) {
if(pj.getCodigo() > 5000) {
TipoInconsistenciaEntity p = new TipoInconsistenciaEntity();
p.setDescricao(pj.getDescricao());
p.setCodigo(pj.getCodigo() + " - ["+ pj.getDescricao() + "]");
listaRetorno.add(p);
}
}
return listaRetorno;
}
Good morning, man.. you can only receive an Integer field there, there is no way to cast because it is a description and contains non-numeric characters. Either you change your object and consequently your getters and setters or write the code (which makes more sense).
– Filipe L. Constante
there is no way to change the object because they are being used elsewhere in the project, if I change the object will be considerably disadvantageous.
– wladyband
I imagine so, but out of curiosity, why do you want to put the code (string) in an integer? Why not use the registration ID directly?
– Filipe L. Constante
I found the answer, and I put the solution, I had the help of a co-worker.
– wladyband
I still didn’t understand the meaning of it, but if you did it’s all that matters! :)
– Filipe L. Constante
If shown the registration ID along with the description is a customer requirement!
– wladyband