use of model.bean.Requisito in project specify by rhebecaabreu.
the class RequisitoDAO method readOrderBy.
public List<Requisito> readOrderBy() {
// para JTable
PreparedStatement stmt = null;
ResultSet rs = null;
List<Requisito> req = new ArrayList<>();
try {
stmt = con.prepareStatement("SELECT * FROM requisito ORDER BY tipoRequisito ");
rs = stmt.executeQuery();
while (rs.next()) {
Requisito requisito = new Requisito();
requisito.setId(rs.getString("id"));
requisito.setCodigo(rs.getInt("codigo"));
requisito.setSujeito(rs.getString("sujeito"));
requisito.setAcaoRestricao(rs.getString("acaoRestricao"));
requisito.setValorRazao(rs.getString("valorRazao"));
requisito.setProjcodigo(rs.getInt("pcodigo"));
requisito.setEstimativa(rs.getInt("estimativa"));
requisito.setHoraCriacao(rs.getString("diaHoraCriacao"));
requisito.setUltimaMod(rs.getString("ultimaAtualizacao"));
requisito.setTipoReq(Enum.valueOf(TipoReq.class, rs.getString("tipoRequisito")));
requisito.setGrauPrioridade(Enum.valueOf(GrauP.class, rs.getString("grauPrioridade")));
requisito.setGrauDificuldade(Enum.valueOf(GrauD.class, rs.getString("grauDificuldade")));
req.add(requisito);
}
} catch (SQLException ex) {
Logger.getLogger(ProjetoDAO.class.getName()).log(Level.SEVERE, null, ex);
} finally {
ConnectionFactory.closeConnection(con, stmt, rs);
}
return req;
}
use of model.bean.Requisito in project specify by rhebecaabreu.
the class RequisitoDAO method readPEdit.
public List<Requisito> readPEdit() {
PreparedStatement stmt = null;
ResultSet rs = null;
List<Requisito> req = new ArrayList<>();
try {
stmt = con.prepareStatement("SELECT * FROM requisito");
rs = stmt.executeQuery();
while (rs.next()) {
Requisito requisito = new Requisito();
requisito.setId(rs.getString("id"));
requisito.setCodigo(rs.getInt("codigo"));
requisito.setSujeito(rs.getString("sujeito"));
requisito.setAcaoRestricao(rs.getString("acaoRestricao"));
requisito.setValorRazao(rs.getString("valorRazao"));
requisito.setProjcodigo(rs.getInt("pcodigo"));
requisito.setEstimativa(rs.getInt("estimativa"));
requisito.setHoraCriacao(rs.getString("diaHoraCriacao"));
requisito.setUltimaMod(rs.getString("ultimaAtualizacao"));
requisito.setTipoReq(Enum.valueOf(TipoReq.class, rs.getString("tipoRequisito")));
requisito.setGrauPrioridade(Enum.valueOf(GrauP.class, rs.getString("grauPrioridade")));
requisito.setGrauDificuldade(Enum.valueOf(GrauD.class, rs.getString("grauDificuldade")));
req.add(requisito);
}
} catch (SQLException ex) {
Logger.getLogger(ProjetoDAO.class.getName()).log(Level.SEVERE, null, ex);
} finally {
ConnectionFactory.closeConnection(con, stmt, rs);
}
return req;
}
use of model.bean.Requisito in project specify by rhebecaabreu.
the class DocumentoReq method criaPDF.
/**
* @param args
* @throws FileNotFoundException
* @throws DocumentException
* @throws IOException
* @throws MalformedURLException
*/
public void criaPDF(JTable table_1, java.util.List<Integer> codigosReq) throws FileNotFoundException, DocumentException {
// Listing 1. Instantiation of document object
Document document = new Document();
try {
document.setPageSize(PageSize.A4);
document.setMargins(50, 50, 50, 50);
nomepdf = MeusProjetos.getNome_pdf() + ".pdf";
// Listing 2. Creation of PdfWriter object
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(nomepdf));
ModelPDFRodape mf = new ModelPDFRodape();
mf.setTopo("Specify");
writer.setPageEvent(mf);
document.open();
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Date date = new Date();
String data = dateFormat.format(date);
// Listing 3. Creation of chapter object
Paragraph title1 = new Paragraph("JTFieldOnlyNumbers de Requisitos", FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLD));
title1.setAlignment(Element.ALIGN_CENTER);
Chapter chapter1 = new Chapter(title1, 1);
chapter1.setNumberDepth(0);
RequisitoDAO rdao = new RequisitoDAO();
// Listing 4. Creation of section object
ProjetoDAO pread = new ProjetoDAO();
for (Requisito r : rdao.readOrderBy()) {
for (Projeto p : pread.read()) {
for (int i = 0; i < codigosReq.size(); i++) {
if (r.getProjcodigo() == p.getCodigo() && r.getCodigo() == codigosReq.get(0)) {
Paragraph title_project2 = new Paragraph("Projeto: " + p.getNome(), FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLD));
title_project2.setAlignment(Element.ALIGN_CENTER);
chapter1.add(title_project2);
break;
}
}
}
}
Paragraph data_hora = new Paragraph("Gerado em " + data, FontFactory.getFont(FontFactory.HELVETICA, 14, Font.NORMAL));
data_hora.setAlignment(Element.ALIGN_CENTER);
chapter1.add(data_hora);
Paragraph listRequirement = new Paragraph("Lista de Requisitos", FontFactory.getFont(FontFactory.HELVETICA, 14, Font.NORMAL));
Section section1 = chapter1.addSection(listRequirement);
RequisitoDAO rrdao = new RequisitoDAO();
Font f = FontFactory.getFont(FontFactory.HELVETICA, 13, Font.NORMAL);
Font ff = FontFactory.getFont(FontFactory.HELVETICA, 13, Font.BOLD);
for (Requisito r : rrdao.readOrderBy()) {
if (table_1.getSelectedRow() != -1) {
for (int j = 0; j < (codigosReq.size()); j++) {
if (r.getCodigo() == codigosReq.get(j)) {
if (r.getTipoReq().toString().equals("FUNCIONAL")) {
Paragraph o = new Paragraph();
o.setFont(ff);
o.add("Tipo de Requisito: ");
o.setFont(f);
o.add("Funcional" + " ");
o.setFont(ff);
o.add(" Código: ");
o.setFont(f);
o.add(String.valueOf(r.getCodigo()));
section1.add(o);
}
if (r.getTipoReq().toString().equals("NAOFUNCIONAL")) {
Paragraph o = new Paragraph();
o.setFont(ff);
o.add("Tipo de Requisito: ");
o.setFont(f);
o.add("Não-funcional" + " ");
o.setFont(ff);
o.add(" Código: ");
o.setFont(f);
o.add(String.valueOf(r.getCodigo()));
section1.add(o);
}
if (r.getTipoReq().toString().equals("USUARIO")) {
Paragraph o = new Paragraph();
o.setFont(ff);
o.add("Tipo de Requisito: ");
o.setFont(f);
o.add(" Usuário" + " ");
o.setFont(ff);
o.add(" Código: ");
o.setFont(f);
o.add(String.valueOf(r.getCodigo()));
section1.add(o);
}
if (r.getTipoReq().toString().equals("NEGOCIO")) {
Paragraph o = new Paragraph();
o.setFont(ff);
o.add("Tipo de Requisito: ");
o.setFont(f);
o.add(" Negócio" + " ");
o.setFont(ff);
o.add(" Código: ");
o.setFont(f);
o.add(String.valueOf(r.getCodigo()));
section1.add(o);
}
Paragraph p = new Paragraph();
Paragraph q = new Paragraph();
Paragraph rr = new Paragraph();
Paragraph s = new Paragraph();
Paragraph t = new Paragraph();
p.setFont(ff);
p.add("Identificador: ");
p.setFont(f);
p.add(r.getId());
q.setFont(ff);
q.add("O(a) " + r.getSujeito() + " deve ser capaz de " + r.getAcaoRestricao() + " para " + r.getValorRazao());
rr.setFont(ff);
rr.add("Grau Prioridade: ");
rr.setFont(f);
rr.add(r.getGrauPrioridade().toString());
s.setFont(ff);
s.add("Grau Dificuldade: ");
s.setFont(f);
s.add(r.getGrauDificuldade().toString());
t = new Paragraph(" ");
section1.add(p);
section1.add(q);
section1.add(rr);
section1.add(s);
section1.add(t);
}
}
}
}
// Listing 5. Addition of a chapter to the main document
document.add(chapter1);
document.add(Chunk.NEXTPAGE);
} catch (DocumentException ex) {
System.out.println("Error:" + ex);
} catch (FileNotFoundException ex) {
System.out.println("Error:" + ex);
} finally {
document.close();
}
try {
Desktop.getDesktop().open(new File(nomepdf));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Aggregations