1
Guys I have a "big problem" and I can’t think of anything to solve it so I’d like your help. I have a desktop system that is the intermediary between the server and my web system. This desktop system makes two queries in the database every hour and writes this data to a file .xml
On the Web system I read these files and upload the data in tables.
As you can see there’s a commandButton
on each line, this button opens a Dialog
and loads other data from the second .xml
The problem is the following. Every time I click on enviar auditoria
or concluir auditoria
the Customer has to stop appearing on the first screen. However how will I do it if the xml
is updated every 1 hour, if I edit the client does not appear in 1 hour xml
will be updated and it will appear.
Anyone can help?
Code:
I get the data from xml
in the Get
of List
@ManagedBean(name = "dtBasicView")
@ViewScoped
public class SolicitacoesBean {
private List<Solicitacoes> list;
private List<Solicitacoes> listaFiltrada;
private Solicitacoes solicitacoes;
public List<Solicitacoes> getList() {
// pega a lista com os dados do .xml
try {
list = XmlParserSolicitacoes
.realizaLeituraXML("C:\\Solicitacoes.xml");
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}
My DataTable
:
<p:dataTable emptyMessage="Nenhum registro encontrado" var="lista"
value="#{dtBasicView.list}"
filteredValue="#{dtBasicView.listaFiltrada}" rows="10"
paginator="true" style="margin-top: 5px;"
rowKey="#{lista.codigoBeneficiario}">
<p:column headerText="Código" filterBy="#{lista.codigoBeneficiario}" style="width:20%" >
<h:outputText value="#{lista.codigoBeneficiario}" />
</p:column>
<p:column headerText="Nome" filterBy="#{lista.nomePessoa}" style="width:45%;"
sortBy="#{lista.nomePessoa}">
<h:outputText value="#{lista.nomePessoa}" />
</p:column>
<p:column headerText="Senha" style="width:10%">
<h:outputText value="#{lista.senha}" />
</p:column>
<p:column headerText="Data Solic." style="width:20%">
<h:outputText value="#{lista.dataSolicitacao}" />
</p:column>
<p:column headerText="Status" style="width:22%" sortBy="#{lista.status}" filterBy="#{lista.status}">
<h:outputText value="#{lista.status}" />
</p:column>
<p:column headerText="Opções" style="width:7%">
<p:commandButton icon="ui-icon-search"
action="#{dtBasicView.abrirDialogo}" process="@this">
<!-- Mandar informação para outra página -->
<f:setPropertyActionListener target="#{dtBasicView.solicitacoes}" value="#{lista}" />
</p:commandButton>
</p:column>
</p:dataTable>
But this is the problem the table data comes straight from xml, how can I stop displaying them? I can record in the bank and check what I don’t even understand is how not to show them.
– DiegoAugusto
Do not show them you control in routine. You have a database ? See my code.
– Diego Souza
Yes I saw, and I even understood. Let me try to give a summary. The first table is filled by data that is read from an xml file. This xml file is generated by another system every 1 hour. That is, the file will be updated (overwritten) every 1 hour.
– DiegoAugusto
Can you not show the submitted or completed data in the table without touching the xml? For example, a condition where I go through my List that sends the data to the table and checks and if any item is equal to some data from my database I do not show in the table?
– DiegoAugusto
Exact. No need to mess with XML. Just save the clients to a separate table in the database. And at the time of listing you make a
select
checking if the name that is coming from XML exists in the table. If it does not exist you show.– Diego Souza
I understood the logic and I will do it, I just do not know yet how I will make the condition, but I will try and Jaja put if I can
– DiegoAugusto
Post your code, mainly what you list the data in XML. The condition is the one I posted in my comment.
– Diego Souza
I’ll edit the question
– DiegoAugusto
Managed to make the communication ?
– Diego Souza
I’m still trying, I’m restructuring the code and creating the entities
– DiegoAugusto
I was able to save the data in the database, now as would be the Query in Hibernate?
– DiegoAugusto