-
+
- data-field-id="${error.field}">
diff --git a/grails-app/controllers/working/docweb/EspecieController.groovy b/grails-app/controllers/working/docweb/EspecieController.groovy
new file mode 100644
index 0000000..bbc7bfe
--- /dev/null
+++ b/grails-app/controllers/working/docweb/EspecieController.groovy
@@ -0,0 +1,107 @@
+package working.docweb
+
+import static org.springframework.http.HttpStatus.*
+import grails.transaction.Transactional
+
+@Transactional(readOnly = true)
+class EspecieController {
+
+ static allowedMethods = [save: "POST", update: "PUT", delete: "DELETE"]
+
+ def index(Integer max) {
+ params.max = Math.min(max ?: 10, 100)
+ respond Especie.list(params), model:[especieCount: Especie.count()]
+ }
+
+ def show(Especie especie) {
+ respond especie
+ }
+
+ def create() {
+ respond new Especie(params)
+ }
+
+ @Transactional
+ def save(Especie especie) {
+ if (especie == null) {
+ transactionStatus.setRollbackOnly()
+ notFound()
+ return
+ }
+
+ if (especie.hasErrors()) {
+ transactionStatus.setRollbackOnly()
+ respond especie.errors, view:'create'
+ return
+ }
+
+ especie.save flush:true
+
+ request.withFormat {
+ form multipartForm {
+ flash.message = message(code: 'default.created.message', args: [message(code: 'especie.label', default: 'Especie'), especie.id])
+ redirect especie
+ }
+ '*' { respond especie, [status: CREATED] }
+ }
+ }
+
+ def edit(Especie especie) {
+ respond especie
+ }
+
+ @Transactional
+ def update(Especie especie) {
+ if (especie == null) {
+ transactionStatus.setRollbackOnly()
+ notFound()
+ return
+ }
+
+ if (especie.hasErrors()) {
+ transactionStatus.setRollbackOnly()
+ respond especie.errors, view:'edit'
+ return
+ }
+
+ especie.save flush:true
+
+ request.withFormat {
+ form multipartForm {
+ flash.message = message(code: 'default.updated.message', args: [message(code: 'especie.label', default: 'Especie'), especie.id])
+ redirect especie
+ }
+ '*'{ respond especie, [status: OK] }
+ }
+ }
+
+ @Transactional
+ def delete(Especie especie) {
+
+ if (especie == null) {
+ transactionStatus.setRollbackOnly()
+ notFound()
+ return
+ }
+
+ especie.delete flush:true
+
+ request.withFormat {
+ form multipartForm {
+ flash.message = message(code: 'default.deleted.message', args: [message(code: 'especie.label', default: 'Especie'), especie.id])
+ redirect action:"index", method:"GET"
+ }
+ '*'{ render status: NO_CONTENT }
+ }
+ }
+
+ protected void notFound() {
+ request.withFormat {
+ form multipartForm {
+ flash.message = message(code: 'default.not.found.message', args: [message(code: 'especie.label', default: 'Especie'), params.id])
+ redirect action: "index", method: "GET"
+ }
+ '*'{ render status: NOT_FOUND }
+ }
+ }
+}
diff --git a/grails-app/controllers/working/docweb/TipoDocumentoController.groovy b/grails-app/controllers/working/docweb/TipoDocumentoController.groovy
new file mode 100644
index 0000000..1c6f04e
--- /dev/null
+++ b/grails-app/controllers/working/docweb/TipoDocumentoController.groovy
@@ -0,0 +1,107 @@
+package working.docweb
+
+import static org.springframework.http.HttpStatus.*
+import grails.transaction.Transactional
+
+@Transactional(readOnly = true)
+class TipoDocumentoController {
+
+ static allowedMethods = [save: "POST", update: "PUT", delete: "DELETE"]
+
+ def index(Integer max) {
+ params.max = Math.min(max ?: 10, 100)
+ respond TipoDocumento.list(params), model:[tipoDocumentoCount: TipoDocumento.count()]
+ }
+
+ def show(TipoDocumento tipoDocumento) {
+ respond tipoDocumento
+ }
+
+ def create() {
+ respond new TipoDocumento(params)
+ }
+
+ @Transactional
+ def save(TipoDocumento tipoDocumento) {
+ if (tipoDocumento == null) {
+ transactionStatus.setRollbackOnly()
+ notFound()
+ return
+ }
+
+ if (tipoDocumento.hasErrors()) {
+ transactionStatus.setRollbackOnly()
+ respond tipoDocumento.errors, view:'create'
+ return
+ }
+
+ tipoDocumento.save flush:true
+
+ request.withFormat {
+ form multipartForm {
+ flash.message = message(code: 'default.created.message', args: [message(code: 'tipoDocumento.label', default: 'TipoDocumento'), tipoDocumento.id])
+ redirect tipoDocumento
+ }
+ '*' { respond tipoDocumento, [status: CREATED] }
+ }
+ }
+
+ def edit(TipoDocumento tipoDocumento) {
+ respond tipoDocumento
+ }
+
+ @Transactional
+ def update(TipoDocumento tipoDocumento) {
+ if (tipoDocumento == null) {
+ transactionStatus.setRollbackOnly()
+ notFound()
+ return
+ }
+
+ if (tipoDocumento.hasErrors()) {
+ transactionStatus.setRollbackOnly()
+ respond tipoDocumento.errors, view:'edit'
+ return
+ }
+
+ tipoDocumento.save flush:true
+
+ request.withFormat {
+ form multipartForm {
+ flash.message = message(code: 'default.updated.message', args: [message(code: 'tipoDocumento.label', default: 'TipoDocumento'), tipoDocumento.id])
+ redirect tipoDocumento
+ }
+ '*'{ respond tipoDocumento, [status: OK] }
+ }
+ }
+
+ @Transactional
+ def delete(TipoDocumento tipoDocumento) {
+
+ if (tipoDocumento == null) {
+ transactionStatus.setRollbackOnly()
+ notFound()
+ return
+ }
+
+ tipoDocumento.delete flush:true
+
+ request.withFormat {
+ form multipartForm {
+ flash.message = message(code: 'default.deleted.message', args: [message(code: 'tipoDocumento.label', default: 'TipoDocumento'), tipoDocumento.id])
+ redirect action:"index", method:"GET"
+ }
+ '*'{ render status: NO_CONTENT }
+ }
+ }
+
+ protected void notFound() {
+ request.withFormat {
+ form multipartForm {
+ flash.message = message(code: 'default.not.found.message', args: [message(code: 'tipoDocumento.label', default: 'TipoDocumento'), params.id])
+ redirect action: "index", method: "GET"
+ }
+ '*'{ render status: NOT_FOUND }
+ }
+ }
+}
diff --git a/grails-app/domain/working/docweb/Documento.groovy b/grails-app/domain/working/docweb/Documento.groovy
index 6d260f3..5a6e449 100644
--- a/grails-app/domain/working/docweb/Documento.groovy
+++ b/grails-app/domain/working/docweb/Documento.groovy
@@ -58,6 +58,11 @@ class Documento {
*/
TipoDocumento tipo
+ /***
+ * Indica a espécie documental, ou seja, a configuração da informação no documento de acordo com a disposição e a natureza das informações nele contidas
+ */
+ Especie especie
+
/***
* Idioma(s) em que é expresso o conteúdo do documento
*/
@@ -84,12 +89,32 @@ class Documento {
*/
String localizacao
+ /***
+ * Indicação do prazo estabelecido em tabela de temporalidade para o cumprimento da destinação
+ * O prazo é definido em dias e deverá ser calculado automaticamente de acordo com a Classe
+ */
+ Long prazoGuarda
+
+ /***
+ * Indicação da próxima ação de destinação (transferência, eliminação ou recolhimento) prevista para o documento,
+ * em cumprimento à tabela de temporalidade
+ */
+ String destinacaoPrevista
+
+ /***
+ * Indicação da quantidade de folhas/páginas de um documento
+ */
+ Integer quantidadeFolhas
+
+
static constraints = {
protocolo nullable: true, validator: { val, doc -> Documento.validarProtocolo(val, doc) }
titulo blank: false, size: 3..100
descricao nullable: true, size: 0..255
- tipo nullable: true
idioma nullable: true
+ prazoGuarda nullable: true
+ destinacaoPrevista nullable: true
+ quantidadeFolhas nullable: true
}
/***
diff --git a/grails-app/domain/working/docweb/Especie.groovy b/grails-app/domain/working/docweb/Especie.groovy
new file mode 100644
index 0000000..042fab1
--- /dev/null
+++ b/grails-app/domain/working/docweb/Especie.groovy
@@ -0,0 +1,14 @@
+package working.docweb
+
+class Especie {
+
+ String nome
+ static constraints = {
+ nome blank: false, unique: true
+ }
+
+ @Override
+ String toString() {
+ return (nome != null && nome != '') ? nome.toString() : super.toString()
+ }
+}
diff --git a/grails-app/domain/working/docweb/TipoDocumento.groovy b/grails-app/domain/working/docweb/TipoDocumento.groovy
index 9cee5c6..33cbc6e 100644
--- a/grails-app/domain/working/docweb/TipoDocumento.groovy
+++ b/grails-app/domain/working/docweb/TipoDocumento.groovy
@@ -2,6 +2,14 @@ package working.docweb
class TipoDocumento {
+ String nome
+
static constraints = {
+ nome blank: false, unique: true
+ }
+
+ @Override
+ String toString() {
+ return (nome != null && nome != '') ? nome.toString() : super.toString()
}
}
diff --git a/grails-app/init/docweb/BootStrap.groovy b/grails-app/init/docweb/BootStrap.groovy
index 60143e3..6e993d2 100644
--- a/grails-app/init/docweb/BootStrap.groovy
+++ b/grails-app/init/docweb/BootStrap.groovy
@@ -1,8 +1,29 @@
package docweb
+import working.docweb.Especie
+import working.docweb.TipoDocumento
+
class BootStrap {
def init = { servletContext ->
+
+ //Carga inicial de Tipos de documentos
+ if(!TipoDocumento.count()) {
+ new TipoDocumento(nome: "Tipo de Documento 001").save(failOnError: true)
+ new TipoDocumento(nome: "Tipo de Documento 002").save(failOnError: true)
+ new TipoDocumento(nome: "Tipo de Documento 003").save(failOnError: true)
+ new TipoDocumento(nome: "Tipo de Documento 004").save(failOnError: true)
+ new TipoDocumento(nome: "Tipo de Documento 005").save(failOnError: true)
+ }
+
+ //Carga inicial de Espécie Documental
+ if(!Especie.count()) {
+ new Especie(nome: "Aviso").save(failOnError: true)
+ new Especie(nome: "Declaração").save(failOnError: true)
+ new Especie(nome: "Despacho").save(failOnError: true)
+ new Especie(nome: "Memorando").save(failOnError: true)
+ new Especie(nome: "Ofício").save(failOnError: true)
+ }
}
def destroy = {
}
diff --git a/grails-app/views/documento/index.gsp b/grails-app/views/documento/index.gsp
index 56f149f..35fdcea 100644
--- a/grails-app/views/documento/index.gsp
+++ b/grails-app/views/documento/index.gsp
@@ -18,7 +18,7 @@