TesteIncluirDocumento.java
3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package Sei;
import org.apache.commons.io.FileUtils;
import org.springframework.util.Base64Utils;
import java.io.File;
import java.net.URL;
import java.text.Normalizer;
public class TesteIncluirDocumento {
public static String removerCaracteresEspeciais(String string) {
string = Normalizer.normalize(string, Normalizer.Form.NFD);
string = string.replaceAll("[^\\p{ASCII}]", "");
return string;
}
public static void main(String... a) throws Exception {
//String string = "0.498961861934341|100|0.7975876445654828";
/*String string = "12313|666";
String[] parts = string.split("\\|",-1);
String part1 = parts[0]; // 004
String part2 = parts[1]; // 034556
System.out.println(part2);*/
// ClamAVClient cl = new ClamAVClient("10.209.40.206", 3310);
// final byte[] reply;
// try {
// System.out.println("Tudo limpo.");
// reply = cl.scan(new FileInputStream("/home/dario/Documentos/virus.pdf"));
//
// } catch (Exception e) {
// throw new RuntimeException(e);
// }
// if (!ClamAVClient.isCleanReply(reply)) {
// System.out.println("Virus encontrado.");
// } else {
// System.out.println("Tudo limpo.");
// }
enviar();
}
public static void enviar() throws Exception {
System.out.println(removerCaracteresEspeciais("Cabeção !@#$%*()"));
// Path path = Paths.get("/home/leonardo/Downloads/");
// System.out.println(path.resolve("PaytoStudy_Student_Guide_HiBonjour_PT.pdf").toFile().getAbsolutePath());
//
URL urlEndpoint = new URL("http://siphom.fazenda.gov.br/sei/ws/SeiWS.php");
SeiBindingStub seiBindingStub = new SeiBindingStub(urlEndpoint, null);
Assunto assunto = new Assunto();
assunto.setCodigoEstruturado("900"); //Tipo de assunto
Assunto[] assuntos = {assunto};
Procedimento procedimento = new Procedimento();
procedimento.setAssuntos(assuntos);
procedimento.setEspecificacao("Especificacao do processo");
Interessado interessado = new Interessado();
interessado.setNome("Leonardo Dias de Oliveira");
interessado.setSigla("04642559701");
Interessado[] interessados = {interessado};
procedimento.setInteressados(interessados);
procedimento.setObservacao("Obs");
procedimento.setNivelAcesso("0"); // 0 = Publico, 1 = Restrito, 2 = Sigiloso
procedimento.setIdTipoProcedimento("100000836"); // Tipo de Processo => Adesão de atas
RetornoGeracaoProcedimento retornoGeracaoProcedimento = seiBindingStub.gerarProcedimento("PROT_ELETRONICO",
"ProtocolizacaoEletronica",
"110000054",
procedimento, null,
null,
null, "S", "N", null, null, null, null, null);
System.out.println("************ RetornoGeracaoProcedimento = " + retornoGeracaoProcedimento.getProcedimentoFormatado());
System.out.println("************ RetornoGeracaoProcedimento = " + retornoGeracaoProcedimento.getLinkAcesso());
Documento documento = new Documento();
documento.setIdProcedimento(retornoGeracaoProcedimento.getProcedimentoFormatado());
documento.setDescricao("Meu documento 5");
documento.setNomeArquivo("PaytoStudy_Student_Guide_HiBonjour_PT.pdf");
documento.setConteudo(Base64Utils.encodeToString(FileUtils.readFileToByteArray(new File("/home/matheus/teste.pdf"))));
documento.setTipo("R");
documento.setIdSerie("1");
documento.setData("02/04/2019");
RetornoInclusaoDocumento retornoInclusaoDocumento = seiBindingStub.incluirDocumento("PROT_ELETRONICO", "ProtocolizacaoEletronica", "110000054", documento);
System.out.println("Link = " + retornoInclusaoDocumento.getLinkAcesso());
}
}