Commit 43a491588fcc0bee0d67d52a9e93806034b5cc9a
1 parent
2e002fe2
Exists in
master
Cria datasource por arquivo -ds.xml
Datasource para a ser criado pelo arquivo templates-ds.xml, documentação atualizada.
Showing
10 changed files
with
680 additions
and
74 deletions
Show diff stats
... | ... | @@ -0,0 +1,132 @@ |
1 | +#---------------------------------------# | |
2 | +# Project Ignores # | |
3 | +#---------------------------------------# | |
4 | + | |
5 | +# Maven | |
6 | +target/ | |
7 | +pom.xml.tag | |
8 | +pom.xml.releaseBackup | |
9 | +pom.xml.versionsBackup | |
10 | +pom.xml.next | |
11 | +release.properties | |
12 | +dependency-reduced-pom.xml | |
13 | +buildNumber.properties | |
14 | +.mvn/timing.properties | |
15 | + | |
16 | +!/.mvn/wrapper/maven-wrapper.jar | |
17 | + | |
18 | +# Ant | |
19 | +build/ | |
20 | +dist/ | |
21 | +bin/ | |
22 | + | |
23 | +# Compiled class file | |
24 | +*.class | |
25 | + | |
26 | +# Mobile Tools for Java (J2ME) | |
27 | +.mtj.tmp/ | |
28 | + | |
29 | +# Package Files | |
30 | +*.jar | |
31 | +*.war | |
32 | +*.ear | |
33 | +*.zip | |
34 | +*.tar.gz | |
35 | +*.rar | |
36 | + | |
37 | +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | |
38 | +hs_err_pid* | |
39 | + | |
40 | +# misc | |
41 | +*.log | |
42 | +log/ | |
43 | +logs/ | |
44 | + | |
45 | + | |
46 | +#---------------------------------------# | |
47 | +# IDEs & Editors Ignores # | |
48 | +#---------------------------------------# | |
49 | + | |
50 | +# Sublime Text | |
51 | +/*.sublime* | |
52 | +.sublime-gulp.cache | |
53 | + | |
54 | +# VS Code | |
55 | +/.vscode | |
56 | + | |
57 | +# JetBrains IDEs | |
58 | +.idea/ | |
59 | +*.iml | |
60 | + | |
61 | +# Eclipse | |
62 | +.project | |
63 | +.classpath | |
64 | +.settings | |
65 | +.tern-project | |
66 | + | |
67 | +# Netbeans | |
68 | +nbactions*.xml | |
69 | +nb-configuration*.xml | |
70 | + | |
71 | +# BlueJ | |
72 | +*.ctxt | |
73 | + | |
74 | + | |
75 | +#---------------------------------------# | |
76 | +# General Ignores # | |
77 | +#---------------------------------------# | |
78 | + | |
79 | +*~ | |
80 | +*.orig | |
81 | +.vagrant | |
82 | + | |
83 | + | |
84 | +#---------------------------------------# | |
85 | +# Linux Ignores # | |
86 | +#---------------------------------------# | |
87 | + | |
88 | +# KDE directory preferences | |
89 | +.directory | |
90 | + | |
91 | + | |
92 | +#---------------------------------------# | |
93 | +# OSX Ignores # | |
94 | +#---------------------------------------# | |
95 | + | |
96 | +.DS_Store | |
97 | +.AppleDouble | |
98 | +.LSOverride | |
99 | +.localized | |
100 | + | |
101 | +# Icon must end with two \r | |
102 | +Icon | |
103 | + | |
104 | + | |
105 | +# Thumbnails | |
106 | +._* | |
107 | + | |
108 | +# Files that might appear on external disk | |
109 | +.Spotlight-V100 | |
110 | +.Trashes | |
111 | + | |
112 | +# Directories potentially created on remote AFP share | |
113 | +.AppleDB | |
114 | +.AppleDesktop | |
115 | +Network Trash Folder | |
116 | +Temporary Items | |
117 | +.apdisk | |
118 | + | |
119 | + | |
120 | +#---------------------------------------# | |
121 | +# Windows Ignores # | |
122 | +#---------------------------------------# | |
123 | + | |
124 | +# Windows image file caches | |
125 | +Thumbs.db | |
126 | +ehthumbs.db | |
127 | + | |
128 | +# Folder config file | |
129 | +Desktop.ini | |
130 | + | |
131 | +# Recycle Bin used on file shares | |
132 | +$RECYCLE.BIN/ | |
0 | 133 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,23 @@ |
1 | +# Faça um breve resumo das alterações | |
2 | +# Devemos escrever nosso comentário de forma a completar a frase abaixo, utilizando o verbo no presente. | |
3 | +# Esse commit: <Seu resumo> | |
4 | +# | |
5 | +# Exemplos: | |
6 | +# Corrige erro de sessão | |
7 | +# Adiciona funcionalidade de cadastro de livros | |
8 | +# |<---- Use no máximo 50 caracteres ---->| | |
9 | + | |
10 | + | |
11 | +# | |
12 | +# Descreva o que foi realizado no commit. | |
13 | +# | |
14 | +# Procure responder as três perguntas: "O que?", "Como?" e "Porquê?" | |
15 | +# |<--- Tente limitar as linhas para terem no maximo 72 caracteres --->| | |
16 | + | |
17 | + | |
18 | +# | |
19 | +# Número do ticket da ferramenta de controle utilizada. | |
20 | +# Exemplo: | |
21 | +# OTRS - 2017030220001019 | |
22 | +# OS - 050/2016 | |
23 | + | ... | ... |
pom.xml
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | <modelVersion>4.0.0</modelVersion> |
4 | 4 | <groupId>br.gov.ans</groupId> |
5 | 5 | <artifactId>templates-broker</artifactId> |
6 | - <version>1.0</version> | |
6 | + <version>1.1</version> | |
7 | 7 | <packaging>war</packaging> |
8 | 8 | <name>templates-broker</name> |
9 | 9 | <description>Sistema de gerenciamento de templates.</description> | ... | ... |
src/main/java/br/gov/ans/templates/dao/TemplatesDAO.java
... | ... | @@ -48,6 +48,29 @@ public class TemplatesDAO { |
48 | 48 | return query.getResultList(); |
49 | 49 | } |
50 | 50 | |
51 | + @SuppressWarnings("unchecked") | |
52 | + public List<Template> getTemplatesExcluidos(String filtro, Integer pagina, Integer qtdRegistros){ | |
53 | + HashMap<String, Object> parametros = new HashMap<String, Object>(); | |
54 | + StringBuilder sql = new StringBuilder("SELECT t FROM Template t "); | |
55 | + | |
56 | + if(StringUtils.isNotBlank(filtro)){ | |
57 | + sql.append("WHERE upper(t.nome) LIKE upper(:filtro) "); | |
58 | + parametros.put("filtro", "%"+filtro+"%"); | |
59 | + } | |
60 | + | |
61 | + sql.append(AndOrWhere(sql) + " t.dataExclusao is not null "); | |
62 | + | |
63 | + sql.append("order by nome asc "); | |
64 | + | |
65 | + Query query = em.createQuery(sql.toString()); | |
66 | + | |
67 | + setParametrosQuery(query, parametros); | |
68 | + | |
69 | + setPaginacaoQuery(query, pagina, qtdRegistros); | |
70 | + | |
71 | + return query.getResultList(); | |
72 | + } | |
73 | + | |
51 | 74 | public Long countTemplates(String filtro){ |
52 | 75 | HashMap<String, Object> parametros = new HashMap<String, Object>(); |
53 | 76 | StringBuilder sql = new StringBuilder("SELECT count(t) FROM Template t "); |
... | ... | @@ -66,6 +89,24 @@ public class TemplatesDAO { |
66 | 89 | return (Long) query.getSingleResult(); |
67 | 90 | } |
68 | 91 | |
92 | + public Long countTemplatesExcluidos(String filtro){ | |
93 | + HashMap<String, Object> parametros = new HashMap<String, Object>(); | |
94 | + StringBuilder sql = new StringBuilder("SELECT count(t) FROM Template t "); | |
95 | + | |
96 | + if(StringUtils.isNotBlank(filtro)){ | |
97 | + sql.append("WHERE upper(t.nome) LIKE upper(:filtro) "); | |
98 | + parametros.put("filtro", "%"+filtro+"%"); | |
99 | + } | |
100 | + | |
101 | + sql.append(AndOrWhere(sql) + " t.dataExclusao is not null "); | |
102 | + | |
103 | + Query query = em.createQuery(sql.toString()); | |
104 | + | |
105 | + setParametrosQuery(query, parametros); | |
106 | + | |
107 | + return (Long) query.getSingleResult(); | |
108 | + } | |
109 | + | |
69 | 110 | public Template getTemplate(String nome){ |
70 | 111 | HashMap<String, Object> params = new HashMap<String, Object>(); |
71 | 112 | params.put("nome", nome); | ... | ... |
src/main/java/br/gov/ans/templates/rest/TemplateResource.java
... | ... | @@ -225,7 +225,7 @@ public class TemplateResource { |
225 | 225 | * @apiParam (Request Body) {String} restrito Flag identificando se a atualização deste template é restrita. |
226 | 226 | * |
227 | 227 | * @apiExample Exemplo de requisição: |
228 | - * endpoint: [PUT] http://<host>/templates-broker/service/templates/confirmacao-cadastro | |
228 | + * endpoint: [POST] http://<host>/templates-broker/service/templates/confirmacao-cadastro | |
229 | 229 | * |
230 | 230 | * body: |
231 | 231 | * { |
... | ... | @@ -648,6 +648,69 @@ public class TemplateResource { |
648 | 648 | return Response.ok().build(); |
649 | 649 | } |
650 | 650 | |
651 | + /** | |
652 | + * @api {get} /templates Listar templates excluídos | |
653 | + * @apiName listTemplatesExcluidos | |
654 | + * @apiGroup Template | |
655 | + * @apiVersion 1.0.0 | |
656 | + * @apiPermission RO_ADMIN_TEMPLATE, RO_USUARIO_TEMPLATE | |
657 | + * | |
658 | + * @apiDescription Consulta os templates que foram excluídos. | |
659 | + * | |
660 | + * @apiParam (Query Parameters) {String} [filtro] Valor utilizado para filtrar os templates. | |
661 | + * @apiParam (Query Parameters) {String} [itens = 20] Quantidade de templates que serão exibidos | |
662 | + * @apiParam (Query Parameters) {String} [pag = 1] Número da página | |
663 | + * | |
664 | + * @apiExample Exemplo de requisição: | |
665 | + * curl -i http://<host>/templates-broker/service/templates | |
666 | + * | |
667 | + * @apiSuccess (Sucesso - 200) {List} resultado Lista com os templates encontrados. | |
668 | + * @apiSuccess (Sucesso - 200) {Template} resultado.template Objeto representando o template. | |
669 | + * @apiSuccess (Sucesso - 200) {String} resultado.template.corpo Corpo do template, conteúdo que as aplicações usarão para preencher e exibir os dados. | |
670 | + * @apiSuccess (Sucesso - 200) {String} resultado.template.dataCadastro Data de cadastro do template. | |
671 | + * @apiSuccess (Sucesso - 200) {String} resultado.template.dataCadastro Data de exclusao do template. | |
672 | + * @apiSuccess (Sucesso - 200) {String} resultado.template.descricao Descrição do template. | |
673 | + * @apiSuccess (Sucesso - 200) {String} resultado.template.exemplo Exemplo de request para preenchimento do template. | |
674 | + * @apiSuccess (Sucesso - 200) {String} resultado.template.nome Identificador do template | |
675 | + * @apiSuccess (Sucesso - 200) {String} resultado.template.responsavel Analista responsável pelo template. | |
676 | + * @apiSuccess (Sucesso - 200) {Boolean} resultado.template.restrito Flag identificando se a atualização deste template é restrita. | |
677 | + * | |
678 | + * @apiSuccessExample {json} Success-Response: | |
679 | + * HTTP/1.1 200 OK | |
680 | + * { | |
681 | + * "corpo": "Prezado {{fulano}}, seu cadastro foi realizado com sucesso.", | |
682 | + * "dataCadastro": "2017-03-14T16:57:47.405-03:00", | |
683 | + * "descricao": "Template de confirmação de cadastro.", | |
684 | + * "exemplo": "{"fulano":"André Guimarães"}", | |
685 | + * "nome": "confirmacao-cadastro", | |
686 | + * "responsavel": "andre.guimaraes", | |
687 | + * "restrito": false, | |
688 | + * "dataExclusao":"2017-08-14T16:57:47.405-03:00" | |
689 | + * } | |
690 | + * | |
691 | + * @apiErrorExample {json} Error-Response: | |
692 | + * HTTP/1.1 500 Internal Server Error | |
693 | + * { | |
694 | + * "error":"Mensagem de erro." | |
695 | + * "code":"código do erro" | |
696 | + * } | |
697 | + */ | |
698 | + @GET | |
699 | + @Path("excluidos") | |
700 | + @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) | |
701 | + public Response listTemplatesExcluidos(@QueryParam("filtro") String filtro, @QueryParam("pag") String pagina, @QueryParam("itens") String tamanhoPagina) throws BusinessException, ResourceNotFoundException{ | |
702 | + List<Template> templates = daoTemplate.getTemplatesExcluidos(filtro, pagina == null? null:parseInt(pagina), tamanhoPagina == null? null : parseInt(tamanhoPagina)); | |
703 | + | |
704 | + if(templates.isEmpty()){ | |
705 | + throw new ResourceNotFoundException(messages.getMessage("templates.nao.encontrados.filtro",filtro)); | |
706 | + } | |
707 | + | |
708 | + GenericEntity<List<Template>> entity = new GenericEntity<List<Template>>(templates){}; | |
709 | + | |
710 | + Long totalRegistros = daoTemplate.countTemplatesExcluidos(filtro); | |
711 | + | |
712 | + return Response.ok().entity(entity).header("total_registros", totalRegistros).build(); | |
713 | + } | |
651 | 714 | |
652 | 715 | public Template getTemplateExcluido(String nomeTemplate) throws ResourceNotFoundException{ |
653 | 716 | Template template = daoTemplate.getTemplateExcluido(nomeTemplate); | ... | ... |
... | ... | @@ -0,0 +1,21 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<datasources> | |
3 | + <datasource jta="true" jndi-name="java:/jdbc/templates" pool-name="jdbc/templates" enabled="true" use-java-context="true" use-ccm="true"> | |
4 | + <connection-url>${br.gov.ans.templates.db.connectionUrl}</connection-url> | |
5 | + <driver-class>br.gov.ans.framework.jdbc.AnsOracleDriver</driver-class> | |
6 | + <driver>ans</driver> | |
7 | + <security> | |
8 | + <user-name>USUARIO_GETD</user-name> | |
9 | + <password>${br.gov.ans.templates.db.password}</password> | |
10 | + </security> | |
11 | + <timeout> | |
12 | + <idle-timeout-minutes>2</idle-timeout-minutes> | |
13 | + </timeout> | |
14 | + <validation> | |
15 | + <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/> | |
16 | + <background-validation>true</background-validation> | |
17 | + <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/> | |
18 | + <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/> | |
19 | + </validation> | |
20 | + </datasource> | |
21 | +</datasources> | |
0 | 22 | \ No newline at end of file | ... | ... |
src/main/webapp/api-docs/api_data.js
... | ... | @@ -23,36 +23,8 @@ define({ "api": [ |
23 | 23 | "url": "", |
24 | 24 | "version": "0.0.0", |
25 | 25 | "filename": "templates-broker/src/main/webapp/api-docs/main.js", |
26 | - "group": "C__ANS_ans_templates_templates_broker_src_main_webapp_api_docs_main_js", | |
27 | - "groupTitle": "C__ANS_ans_templates_templates_broker_src_main_webapp_api_docs_main_js", | |
28 | - "name": "" | |
29 | - }, | |
30 | - { | |
31 | - "success": { | |
32 | - "fields": { | |
33 | - "Success 200": [ | |
34 | - { | |
35 | - "group": "Success 200", | |
36 | - "optional": false, | |
37 | - "field": "varname1", | |
38 | - "description": "<p>No type.</p>" | |
39 | - }, | |
40 | - { | |
41 | - "group": "Success 200", | |
42 | - "type": "String", | |
43 | - "optional": false, | |
44 | - "field": "varname2", | |
45 | - "description": "<p>With type.</p>" | |
46 | - } | |
47 | - ] | |
48 | - } | |
49 | - }, | |
50 | - "type": "", | |
51 | - "url": "", | |
52 | - "version": "0.0.0", | |
53 | - "filename": "templates-broker/target/templates-broker-0.1/api-docs/main.js", | |
54 | - "group": "C__ANS_ans_templates_templates_broker_target_templates_broker_0_1_api_docs_main_js", | |
55 | - "groupTitle": "C__ANS_ans_templates_templates_broker_target_templates_broker_0_1_api_docs_main_js", | |
26 | + "group": "C__git_templates_broker_src_main_webapp_api_docs_main_js", | |
27 | + "groupTitle": "C__git_templates_broker_src_main_webapp_api_docs_main_js", | |
56 | 28 | "name": "" |
57 | 29 | }, |
58 | 30 | { |
... | ... | @@ -434,7 +406,7 @@ define({ "api": [ |
434 | 406 | "type": "String", |
435 | 407 | "optional": false, |
436 | 408 | "field": "restrito", |
437 | - "description": "<p>Flag identificando se a atualização deste template � restrita.</p>" | |
409 | + "description": "<p>Flag identificando se a atualização deste template é restrita.</p>" | |
438 | 410 | } |
439 | 411 | ] |
440 | 412 | } |
... | ... | @@ -442,7 +414,7 @@ define({ "api": [ |
442 | 414 | "examples": [ |
443 | 415 | { |
444 | 416 | "title": "Exemplo de requisição:\t", |
445 | - "content": "\tendpoint: [PUT] http://<host>/templates-broker/service/templates/confirmacao-cadastro\n\n\tbody:\n {\n \"corpo\": \"Prezado {{fulano}}, seu cadastro foi realizado com sucesso.\",\n \"descricao\": \"Template de confirmação de cadastro.\",\n \"exemplo\": \"{\"fulano\":\"André Guimarães\"}\",\n \"nome\": \"confirmacao-cadastro\",\n \"responsavel\": \"andre.guimaraes\",\n \"restrito\": true,\n }", | |
417 | + "content": "\tendpoint: [POST] http://<host>/templates-broker/service/templates/confirmacao-cadastro\n\n\tbody:\n {\n \"corpo\": \"Prezado {{fulano}}, seu cadastro foi realizado com sucesso.\",\n \"descricao\": \"Template de confirmação de cadastro.\",\n \"exemplo\": \"{\"fulano\":\"André Guimarães\"}\",\n \"nome\": \"confirmacao-cadastro\",\n \"responsavel\": \"andre.guimaraes\",\n \"restrito\": true,\n }", | |
446 | 418 | "type": "json" |
447 | 419 | } |
448 | 420 | ], |
... | ... | @@ -604,7 +576,7 @@ define({ "api": [ |
604 | 576 | "type": "String", |
605 | 577 | "optional": false, |
606 | 578 | "field": "restrito", |
607 | - "description": "<p>Flag identificando se a atualização deste template � restrita.</p>" | |
579 | + "description": "<p>Flag identificando se a atualização deste template é restrita.</p>" | |
608 | 580 | } |
609 | 581 | ] |
610 | 582 | } |
... | ... | @@ -803,7 +775,7 @@ define({ "api": [ |
803 | 775 | "type": "Boolean", |
804 | 776 | "optional": false, |
805 | 777 | "field": "template.restrito", |
806 | - "description": "<p>Flag identificando se a atualização deste template � restrita.</p>" | |
778 | + "description": "<p>Flag identificando se a atualização deste template é restrita.</p>" | |
807 | 779 | } |
808 | 780 | ] |
809 | 781 | }, |
... | ... | @@ -1047,7 +1019,7 @@ define({ "api": [ |
1047 | 1019 | "type": "Boolean", |
1048 | 1020 | "optional": false, |
1049 | 1021 | "field": "resultado.template.restrito", |
1050 | - "description": "<p>Flag identificando se a atualização deste template � restrita.</p>" | |
1022 | + "description": "<p>Flag identificando se a atualização deste template é restrita.</p>" | |
1051 | 1023 | } |
1052 | 1024 | ] |
1053 | 1025 | }, |
... | ... | @@ -1070,5 +1042,196 @@ define({ "api": [ |
1070 | 1042 | }, |
1071 | 1043 | "filename": "templates-broker/src/main/java/br/gov/ans/templates/rest/TemplateResource.java", |
1072 | 1044 | "groupTitle": "Template" |
1045 | + }, | |
1046 | + { | |
1047 | + "type": "get", | |
1048 | + "url": "/templates", | |
1049 | + "title": "Listar templates excluídos", | |
1050 | + "name": "listTemplatesExcluidos", | |
1051 | + "group": "Template", | |
1052 | + "version": "1.0.0", | |
1053 | + "permission": [ | |
1054 | + { | |
1055 | + "name": "RO_ADMIN_TEMPLATE, RO_USUARIO_TEMPLATE" | |
1056 | + } | |
1057 | + ], | |
1058 | + "description": "<p>Consulta os templates que foram excluídos.</p>", | |
1059 | + "parameter": { | |
1060 | + "fields": { | |
1061 | + "Query Parameters": [ | |
1062 | + { | |
1063 | + "group": "Query Parameters", | |
1064 | + "type": "String", | |
1065 | + "optional": true, | |
1066 | + "field": "filtro", | |
1067 | + "description": "<p>Valor utilizado para filtrar os templates.</p>" | |
1068 | + }, | |
1069 | + { | |
1070 | + "group": "Query Parameters", | |
1071 | + "type": "String", | |
1072 | + "optional": true, | |
1073 | + "field": "itens", | |
1074 | + "defaultValue": "20", | |
1075 | + "description": "<p>Quantidade de templates que serão exibidos</p>" | |
1076 | + }, | |
1077 | + { | |
1078 | + "group": "Query Parameters", | |
1079 | + "type": "String", | |
1080 | + "optional": true, | |
1081 | + "field": "pag", | |
1082 | + "defaultValue": "1", | |
1083 | + "description": "<p>Número da página</p>" | |
1084 | + } | |
1085 | + ] | |
1086 | + } | |
1087 | + }, | |
1088 | + "examples": [ | |
1089 | + { | |
1090 | + "title": "Exemplo de requisição:\t", | |
1091 | + "content": "curl -i http://<host>/templates-broker/service/templates", | |
1092 | + "type": "json" | |
1093 | + } | |
1094 | + ], | |
1095 | + "success": { | |
1096 | + "fields": { | |
1097 | + "Sucesso - 200": [ | |
1098 | + { | |
1099 | + "group": "Sucesso - 200", | |
1100 | + "type": "List", | |
1101 | + "optional": false, | |
1102 | + "field": "resultado", | |
1103 | + "description": "<p>Lista com os templates encontrados.</p>" | |
1104 | + }, | |
1105 | + { | |
1106 | + "group": "Sucesso - 200", | |
1107 | + "type": "Template", | |
1108 | + "optional": false, | |
1109 | + "field": "resultado.template", | |
1110 | + "description": "<p>Objeto representando o template.</p>" | |
1111 | + }, | |
1112 | + { | |
1113 | + "group": "Sucesso - 200", | |
1114 | + "type": "String", | |
1115 | + "optional": false, | |
1116 | + "field": "resultado.template.corpo", | |
1117 | + "description": "<p>Corpo do template, conteúdo que as aplicações usarão para preencher e exibir os dados.</p>" | |
1118 | + }, | |
1119 | + { | |
1120 | + "group": "Sucesso - 200", | |
1121 | + "type": "String", | |
1122 | + "optional": false, | |
1123 | + "field": "resultado.template.dataCadastro", | |
1124 | + "description": "<p>Data de cadastro do template.</p>" | |
1125 | + }, | |
1126 | + { | |
1127 | + "group": "Sucesso - 200", | |
1128 | + "type": "String", | |
1129 | + "optional": false, | |
1130 | + "field": "resultado.template.descricao", | |
1131 | + "description": "<p>Descrição do template.</p>" | |
1132 | + }, | |
1133 | + { | |
1134 | + "group": "Sucesso - 200", | |
1135 | + "type": "String", | |
1136 | + "optional": false, | |
1137 | + "field": "resultado.template.exemplo", | |
1138 | + "description": "<p>Exemplo de request para preenchimento do template.</p>" | |
1139 | + }, | |
1140 | + { | |
1141 | + "group": "Sucesso - 200", | |
1142 | + "type": "String", | |
1143 | + "optional": false, | |
1144 | + "field": "resultado.template.nome", | |
1145 | + "description": "<p>Identificador do template</p>" | |
1146 | + }, | |
1147 | + { | |
1148 | + "group": "Sucesso - 200", | |
1149 | + "type": "String", | |
1150 | + "optional": false, | |
1151 | + "field": "resultado.template.responsavel", | |
1152 | + "description": "<p>Analista responsável pelo template.</p>" | |
1153 | + }, | |
1154 | + { | |
1155 | + "group": "Sucesso - 200", | |
1156 | + "type": "Boolean", | |
1157 | + "optional": false, | |
1158 | + "field": "resultado.template.restrito", | |
1159 | + "description": "<p>Flag identificando se a atualização deste template é restrita.</p>" | |
1160 | + } | |
1161 | + ] | |
1162 | + }, | |
1163 | + "examples": [ | |
1164 | + { | |
1165 | + "title": "Success-Response:", | |
1166 | + "content": "HTTP/1.1 200 OK\n{\n \"corpo\": \"Prezado {{fulano}}, seu cadastro foi realizado com sucesso.\",\n \"dataCadastro\": \"2017-03-14T16:57:47.405-03:00\",\n \"descricao\": \"Template de confirmação de cadastro.\",\n \"exemplo\": \"{\"fulano\":\"André Guimarães\"}\",\n \"nome\": \"confirmacao-cadastro\",\n \"responsavel\": \"andre.guimaraes\",\n \"restrito\": false,\n \"dataExclusao\":\"2017-08-14T16:57:47.405-03:00\"\n}", | |
1167 | + "type": "json" | |
1168 | + } | |
1169 | + ] | |
1170 | + }, | |
1171 | + "error": { | |
1172 | + "examples": [ | |
1173 | + { | |
1174 | + "title": "Error-Response:", | |
1175 | + "content": "HTTP/1.1 500 Internal Server Error\n{\n\t\"error\":\"Mensagem de erro.\"\n\t\"code\":\"código do erro\"\n}", | |
1176 | + "type": "json" | |
1177 | + } | |
1178 | + ] | |
1179 | + }, | |
1180 | + "filename": "templates-broker/src/main/java/br/gov/ans/templates/rest/TemplateResource.java", | |
1181 | + "groupTitle": "Template" | |
1182 | + }, | |
1183 | + { | |
1184 | + "type": "delete", | |
1185 | + "url": "/templates/excluidos/:template", | |
1186 | + "title": "Recuperar template", | |
1187 | + "name": "undeleteTemplate", | |
1188 | + "group": "Template", | |
1189 | + "version": "1.0.0", | |
1190 | + "permission": [ | |
1191 | + { | |
1192 | + "name": "RO_ADMIN_TEMPLATE" | |
1193 | + } | |
1194 | + ], | |
1195 | + "description": "<p>Recupera um template excluído.</p>", | |
1196 | + "parameter": { | |
1197 | + "fields": { | |
1198 | + "Path Parameters": [ | |
1199 | + { | |
1200 | + "group": "Path Parameters", | |
1201 | + "type": "String", | |
1202 | + "optional": false, | |
1203 | + "field": "template", | |
1204 | + "description": "<p>Identificador do template</p>" | |
1205 | + } | |
1206 | + ] | |
1207 | + } | |
1208 | + }, | |
1209 | + "examples": [ | |
1210 | + { | |
1211 | + "title": "Exemplo de requisição:\t", | |
1212 | + "content": "curl -X DELETE http://<host>/templates-broker/service/templates/excluidos/admp-template-novo-usuario", | |
1213 | + "type": "json" | |
1214 | + } | |
1215 | + ], | |
1216 | + "success": { | |
1217 | + "examples": [ | |
1218 | + { | |
1219 | + "title": "Success-Response:", | |
1220 | + "content": "HTTP/1.1 200 OK", | |
1221 | + "type": "json" | |
1222 | + } | |
1223 | + ] | |
1224 | + }, | |
1225 | + "error": { | |
1226 | + "examples": [ | |
1227 | + { | |
1228 | + "title": "Error-Response:", | |
1229 | + "content": "HTTP/1.1 500 Internal Server Error\n{\n\t\"error\":\"Mensagem de erro.\"\n\t\"code\":\"código do erro\"\n}", | |
1230 | + "type": "json" | |
1231 | + } | |
1232 | + ] | |
1233 | + }, | |
1234 | + "filename": "templates-broker/src/main/java/br/gov/ans/templates/rest/TemplateResource.java", | |
1235 | + "groupTitle": "Template" | |
1073 | 1236 | } |
1074 | 1237 | ] }); | ... | ... |
src/main/webapp/api-docs/api_data.json
... | ... | @@ -23,36 +23,8 @@ |
23 | 23 | "url": "", |
24 | 24 | "version": "0.0.0", |
25 | 25 | "filename": "templates-broker/src/main/webapp/api-docs/main.js", |
26 | - "group": "C__ANS_ans_templates_templates_broker_src_main_webapp_api_docs_main_js", | |
27 | - "groupTitle": "C__ANS_ans_templates_templates_broker_src_main_webapp_api_docs_main_js", | |
28 | - "name": "" | |
29 | - }, | |
30 | - { | |
31 | - "success": { | |
32 | - "fields": { | |
33 | - "Success 200": [ | |
34 | - { | |
35 | - "group": "Success 200", | |
36 | - "optional": false, | |
37 | - "field": "varname1", | |
38 | - "description": "<p>No type.</p>" | |
39 | - }, | |
40 | - { | |
41 | - "group": "Success 200", | |
42 | - "type": "String", | |
43 | - "optional": false, | |
44 | - "field": "varname2", | |
45 | - "description": "<p>With type.</p>" | |
46 | - } | |
47 | - ] | |
48 | - } | |
49 | - }, | |
50 | - "type": "", | |
51 | - "url": "", | |
52 | - "version": "0.0.0", | |
53 | - "filename": "templates-broker/target/templates-broker-0.1/api-docs/main.js", | |
54 | - "group": "C__ANS_ans_templates_templates_broker_target_templates_broker_0_1_api_docs_main_js", | |
55 | - "groupTitle": "C__ANS_ans_templates_templates_broker_target_templates_broker_0_1_api_docs_main_js", | |
26 | + "group": "C__git_templates_broker_src_main_webapp_api_docs_main_js", | |
27 | + "groupTitle": "C__git_templates_broker_src_main_webapp_api_docs_main_js", | |
56 | 28 | "name": "" |
57 | 29 | }, |
58 | 30 | { |
... | ... | @@ -434,7 +406,7 @@ |
434 | 406 | "type": "String", |
435 | 407 | "optional": false, |
436 | 408 | "field": "restrito", |
437 | - "description": "<p>Flag identificando se a atualização deste template � restrita.</p>" | |
409 | + "description": "<p>Flag identificando se a atualização deste template é restrita.</p>" | |
438 | 410 | } |
439 | 411 | ] |
440 | 412 | } |
... | ... | @@ -442,7 +414,7 @@ |
442 | 414 | "examples": [ |
443 | 415 | { |
444 | 416 | "title": "Exemplo de requisição:\t", |
445 | - "content": "\tendpoint: [PUT] http://<host>/templates-broker/service/templates/confirmacao-cadastro\n\n\tbody:\n {\n \"corpo\": \"Prezado {{fulano}}, seu cadastro foi realizado com sucesso.\",\n \"descricao\": \"Template de confirmação de cadastro.\",\n \"exemplo\": \"{\"fulano\":\"André Guimarães\"}\",\n \"nome\": \"confirmacao-cadastro\",\n \"responsavel\": \"andre.guimaraes\",\n \"restrito\": true,\n }", | |
417 | + "content": "\tendpoint: [POST] http://<host>/templates-broker/service/templates/confirmacao-cadastro\n\n\tbody:\n {\n \"corpo\": \"Prezado {{fulano}}, seu cadastro foi realizado com sucesso.\",\n \"descricao\": \"Template de confirmação de cadastro.\",\n \"exemplo\": \"{\"fulano\":\"André Guimarães\"}\",\n \"nome\": \"confirmacao-cadastro\",\n \"responsavel\": \"andre.guimaraes\",\n \"restrito\": true,\n }", | |
446 | 418 | "type": "json" |
447 | 419 | } |
448 | 420 | ], |
... | ... | @@ -604,7 +576,7 @@ |
604 | 576 | "type": "String", |
605 | 577 | "optional": false, |
606 | 578 | "field": "restrito", |
607 | - "description": "<p>Flag identificando se a atualização deste template � restrita.</p>" | |
579 | + "description": "<p>Flag identificando se a atualização deste template é restrita.</p>" | |
608 | 580 | } |
609 | 581 | ] |
610 | 582 | } |
... | ... | @@ -803,7 +775,7 @@ |
803 | 775 | "type": "Boolean", |
804 | 776 | "optional": false, |
805 | 777 | "field": "template.restrito", |
806 | - "description": "<p>Flag identificando se a atualização deste template � restrita.</p>" | |
778 | + "description": "<p>Flag identificando se a atualização deste template é restrita.</p>" | |
807 | 779 | } |
808 | 780 | ] |
809 | 781 | }, |
... | ... | @@ -1047,7 +1019,7 @@ |
1047 | 1019 | "type": "Boolean", |
1048 | 1020 | "optional": false, |
1049 | 1021 | "field": "resultado.template.restrito", |
1050 | - "description": "<p>Flag identificando se a atualização deste template � restrita.</p>" | |
1022 | + "description": "<p>Flag identificando se a atualização deste template é restrita.</p>" | |
1051 | 1023 | } |
1052 | 1024 | ] |
1053 | 1025 | }, |
... | ... | @@ -1070,5 +1042,196 @@ |
1070 | 1042 | }, |
1071 | 1043 | "filename": "templates-broker/src/main/java/br/gov/ans/templates/rest/TemplateResource.java", |
1072 | 1044 | "groupTitle": "Template" |
1045 | + }, | |
1046 | + { | |
1047 | + "type": "get", | |
1048 | + "url": "/templates", | |
1049 | + "title": "Listar templates excluídos", | |
1050 | + "name": "listTemplatesExcluidos", | |
1051 | + "group": "Template", | |
1052 | + "version": "1.0.0", | |
1053 | + "permission": [ | |
1054 | + { | |
1055 | + "name": "RO_ADMIN_TEMPLATE, RO_USUARIO_TEMPLATE" | |
1056 | + } | |
1057 | + ], | |
1058 | + "description": "<p>Consulta os templates que foram excluídos.</p>", | |
1059 | + "parameter": { | |
1060 | + "fields": { | |
1061 | + "Query Parameters": [ | |
1062 | + { | |
1063 | + "group": "Query Parameters", | |
1064 | + "type": "String", | |
1065 | + "optional": true, | |
1066 | + "field": "filtro", | |
1067 | + "description": "<p>Valor utilizado para filtrar os templates.</p>" | |
1068 | + }, | |
1069 | + { | |
1070 | + "group": "Query Parameters", | |
1071 | + "type": "String", | |
1072 | + "optional": true, | |
1073 | + "field": "itens", | |
1074 | + "defaultValue": "20", | |
1075 | + "description": "<p>Quantidade de templates que serão exibidos</p>" | |
1076 | + }, | |
1077 | + { | |
1078 | + "group": "Query Parameters", | |
1079 | + "type": "String", | |
1080 | + "optional": true, | |
1081 | + "field": "pag", | |
1082 | + "defaultValue": "1", | |
1083 | + "description": "<p>Número da página</p>" | |
1084 | + } | |
1085 | + ] | |
1086 | + } | |
1087 | + }, | |
1088 | + "examples": [ | |
1089 | + { | |
1090 | + "title": "Exemplo de requisição:\t", | |
1091 | + "content": "curl -i http://<host>/templates-broker/service/templates", | |
1092 | + "type": "json" | |
1093 | + } | |
1094 | + ], | |
1095 | + "success": { | |
1096 | + "fields": { | |
1097 | + "Sucesso - 200": [ | |
1098 | + { | |
1099 | + "group": "Sucesso - 200", | |
1100 | + "type": "List", | |
1101 | + "optional": false, | |
1102 | + "field": "resultado", | |
1103 | + "description": "<p>Lista com os templates encontrados.</p>" | |
1104 | + }, | |
1105 | + { | |
1106 | + "group": "Sucesso - 200", | |
1107 | + "type": "Template", | |
1108 | + "optional": false, | |
1109 | + "field": "resultado.template", | |
1110 | + "description": "<p>Objeto representando o template.</p>" | |
1111 | + }, | |
1112 | + { | |
1113 | + "group": "Sucesso - 200", | |
1114 | + "type": "String", | |
1115 | + "optional": false, | |
1116 | + "field": "resultado.template.corpo", | |
1117 | + "description": "<p>Corpo do template, conteúdo que as aplicações usarão para preencher e exibir os dados.</p>" | |
1118 | + }, | |
1119 | + { | |
1120 | + "group": "Sucesso - 200", | |
1121 | + "type": "String", | |
1122 | + "optional": false, | |
1123 | + "field": "resultado.template.dataCadastro", | |
1124 | + "description": "<p>Data de cadastro do template.</p>" | |
1125 | + }, | |
1126 | + { | |
1127 | + "group": "Sucesso - 200", | |
1128 | + "type": "String", | |
1129 | + "optional": false, | |
1130 | + "field": "resultado.template.descricao", | |
1131 | + "description": "<p>Descrição do template.</p>" | |
1132 | + }, | |
1133 | + { | |
1134 | + "group": "Sucesso - 200", | |
1135 | + "type": "String", | |
1136 | + "optional": false, | |
1137 | + "field": "resultado.template.exemplo", | |
1138 | + "description": "<p>Exemplo de request para preenchimento do template.</p>" | |
1139 | + }, | |
1140 | + { | |
1141 | + "group": "Sucesso - 200", | |
1142 | + "type": "String", | |
1143 | + "optional": false, | |
1144 | + "field": "resultado.template.nome", | |
1145 | + "description": "<p>Identificador do template</p>" | |
1146 | + }, | |
1147 | + { | |
1148 | + "group": "Sucesso - 200", | |
1149 | + "type": "String", | |
1150 | + "optional": false, | |
1151 | + "field": "resultado.template.responsavel", | |
1152 | + "description": "<p>Analista responsável pelo template.</p>" | |
1153 | + }, | |
1154 | + { | |
1155 | + "group": "Sucesso - 200", | |
1156 | + "type": "Boolean", | |
1157 | + "optional": false, | |
1158 | + "field": "resultado.template.restrito", | |
1159 | + "description": "<p>Flag identificando se a atualização deste template é restrita.</p>" | |
1160 | + } | |
1161 | + ] | |
1162 | + }, | |
1163 | + "examples": [ | |
1164 | + { | |
1165 | + "title": "Success-Response:", | |
1166 | + "content": "HTTP/1.1 200 OK\n{\n \"corpo\": \"Prezado {{fulano}}, seu cadastro foi realizado com sucesso.\",\n \"dataCadastro\": \"2017-03-14T16:57:47.405-03:00\",\n \"descricao\": \"Template de confirmação de cadastro.\",\n \"exemplo\": \"{\"fulano\":\"André Guimarães\"}\",\n \"nome\": \"confirmacao-cadastro\",\n \"responsavel\": \"andre.guimaraes\",\n \"restrito\": false,\n \"dataExclusao\":\"2017-08-14T16:57:47.405-03:00\"\n}", | |
1167 | + "type": "json" | |
1168 | + } | |
1169 | + ] | |
1170 | + }, | |
1171 | + "error": { | |
1172 | + "examples": [ | |
1173 | + { | |
1174 | + "title": "Error-Response:", | |
1175 | + "content": "HTTP/1.1 500 Internal Server Error\n{\n\t\"error\":\"Mensagem de erro.\"\n\t\"code\":\"código do erro\"\n}", | |
1176 | + "type": "json" | |
1177 | + } | |
1178 | + ] | |
1179 | + }, | |
1180 | + "filename": "templates-broker/src/main/java/br/gov/ans/templates/rest/TemplateResource.java", | |
1181 | + "groupTitle": "Template" | |
1182 | + }, | |
1183 | + { | |
1184 | + "type": "delete", | |
1185 | + "url": "/templates/excluidos/:template", | |
1186 | + "title": "Recuperar template", | |
1187 | + "name": "undeleteTemplate", | |
1188 | + "group": "Template", | |
1189 | + "version": "1.0.0", | |
1190 | + "permission": [ | |
1191 | + { | |
1192 | + "name": "RO_ADMIN_TEMPLATE" | |
1193 | + } | |
1194 | + ], | |
1195 | + "description": "<p>Recupera um template excluído.</p>", | |
1196 | + "parameter": { | |
1197 | + "fields": { | |
1198 | + "Path Parameters": [ | |
1199 | + { | |
1200 | + "group": "Path Parameters", | |
1201 | + "type": "String", | |
1202 | + "optional": false, | |
1203 | + "field": "template", | |
1204 | + "description": "<p>Identificador do template</p>" | |
1205 | + } | |
1206 | + ] | |
1207 | + } | |
1208 | + }, | |
1209 | + "examples": [ | |
1210 | + { | |
1211 | + "title": "Exemplo de requisição:\t", | |
1212 | + "content": "curl -X DELETE http://<host>/templates-broker/service/templates/excluidos/admp-template-novo-usuario", | |
1213 | + "type": "json" | |
1214 | + } | |
1215 | + ], | |
1216 | + "success": { | |
1217 | + "examples": [ | |
1218 | + { | |
1219 | + "title": "Success-Response:", | |
1220 | + "content": "HTTP/1.1 200 OK", | |
1221 | + "type": "json" | |
1222 | + } | |
1223 | + ] | |
1224 | + }, | |
1225 | + "error": { | |
1226 | + "examples": [ | |
1227 | + { | |
1228 | + "title": "Error-Response:", | |
1229 | + "content": "HTTP/1.1 500 Internal Server Error\n{\n\t\"error\":\"Mensagem de erro.\"\n\t\"code\":\"código do erro\"\n}", | |
1230 | + "type": "json" | |
1231 | + } | |
1232 | + ] | |
1233 | + }, | |
1234 | + "filename": "templates-broker/src/main/java/br/gov/ans/templates/rest/TemplateResource.java", | |
1235 | + "groupTitle": "Template" | |
1073 | 1236 | } |
1074 | 1237 | ] | ... | ... |
src/main/webapp/api-docs/api_project.js
src/main/webapp/api-docs/api_project.json