Tenho o seguinte código abaixo a qual monta uma StringBuffer e tinha praticamente todos os campos como obrigatórios então conseguia adicioná-los corretamente. Porem agora somente o primeiro e obrigatório e tenho que finalizar a StringBuffer com um " . " ao final do jeito que esta hoje se não preencho todos ele vem com " ; " .
Preciso de modificar a logica para que independer dos campos preenchidos ele no final coloque o " . " e não a virgula.
StringBuffer strObservation = new StringBuffer();
strObservation.append(
String.valueOf(
anp.getFluidTypeById().get(
sym.getParameters().get("fluido")
.getValue()) + ": "));
if(!strDens.equals("")){
strObservation.append("P=" + strDens + "; ");
}
if(!strVisc.equals("")){
strObservation.append("V=" + strVisc + "; ");
}
if(!strFilt.equals("")){
strObservation.append("F=" + strFilt + "; ");
}
if(!strOlea.equals("")){
strObservation.append("O/A=" + strOlea + "; ");
}
if(!strOil.equals("")){
strObservation.append("O=" + strOil + "%; ");
}
if(!strPh.equals("")){
strObservation.append("pH=" + strPh + "; ");
}
if(!strSal.equals("")){
strObservation.append("SAL=" + strSal + "ppm.");
}
observation.setTextContent(strObservation.toString());
observations.appendChild(observation);
root.appendChild(depth);
root.appendChild(code);
root.appendChild(observations);
doc.appendChild(root);