Add base project

This commit is contained in:
Pablo Bonilla 2021-07-03 15:48:27 -06:00
parent 472504e63e
commit d5706cae4f
No known key found for this signature in database
GPG Key ID: 46877262B8DE47E2
905 changed files with 121379 additions and 0 deletions

18
.browserslistrc Normal file
View File

@ -0,0 +1,18 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support
# You can see what browsers were selected by your queries by running:
# npx browserslist
last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
not IE 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11. To opt-in, remove the 'not' prefix on this line.
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

21
.circleci/config.yml Normal file
View File

@ -0,0 +1,21 @@
version: 2.1
jobs:
build-and-test:
environment:
_JAVA_OPTIONS: '-Dspring.profiles.active=prod'
docker:
- image: cimg/openjdk:11.0
steps:
- checkout
- run:
name: Build
command: mvn -B -DskipTests clean package -P prod
- run:
name: Test
command: mvn test -P prod
workflows:
datasurvey:
jobs:
- build-and-test

23
.editorconfig Normal file
View File

@ -0,0 +1,23 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
# Change these settings to your own preference
indent_style = space
indent_size = 4
[*.{ts,tsx,js,jsx,json,css,scss,yml,html,vue}]
indent_size = 2
[*.md]
trim_trailing_whitespace = false

8
.eslintignore Normal file
View File

@ -0,0 +1,8 @@
node_modules/
src/main/docker/
jest.conf.js
webpack/
target/
build/
node/
postcss.config.js

98
.eslintrc.json Normal file
View File

@ -0,0 +1,98 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@angular-eslint/eslint-plugin", "@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@angular-eslint/recommended",
"prettier",
"eslint-config-prettier"
],
"env": {
"browser": true,
"es6": true,
"commonjs": true
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "jhi",
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "jhi",
"style": "camelCase"
}
],
"@angular-eslint/relative-url-prefix": "error",
"@typescript-eslint/ban-types": [
"error",
{
"extendDefaults": true,
"types": {
"{}": false
}
}
],
"@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/member-ordering": [
"error",
{
"default": [
"public-static-field",
"protected-static-field",
"private-static-field",
"public-instance-field",
"protected-instance-field",
"private-instance-field",
"constructor",
"public-static-method",
"protected-static-method",
"private-static-method",
"public-instance-method",
"protected-instance-method",
"private-instance-method"
]
}
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-parameter-properties": ["warn", { "allows": ["public", "private", "protected"] }],
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"@typescript-eslint/unbound-method": "off",
"arrow-body-style": "error",
"curly": "error",
"eqeqeq": ["error", "always", { "null": "ignore" }],
"guard-for-in": "error",
"no-bitwise": "error",
"no-caller": "error",
"no-console": ["error", { "allow": ["warn", "error"] }],
"no-eval": "error",
"no-labels": "error",
"no-new": "error",
"no-new-wrappers": "error",
"object-shorthand": ["error", "always", { "avoidExplicitReturnArrows": true }],
"radix": "error",
"spaced-comment": ["warn", "always"]
}
}

150
.gitattributes vendored Normal file
View File

@ -0,0 +1,150 @@
# This file is inspired by https://github.com/alexkaratarakis/gitattributes
#
# Auto detect text files and perform LF normalization
# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
* text=auto
# The above will handle all files NOT found below
# These files are text and should be normalized (Convert crlf => lf)
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf
*.coffee text
*.css text
*.cql text
*.df text
*.ejs text
*.html text
*.java text
*.js text
*.json text
*.less text
*.properties text
*.sass text
*.scss text
*.sh text eol=lf
*.sql text
*.txt text
*.ts text
*.xml text
*.yaml text
*.yml text
# Documents
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.markdown text
*.md text
*.adoc text
*.textile text
*.mustache text
*.csv text
*.tab text
*.tsv text
*.txt text
AUTHORS text
CHANGELOG text
CHANGES text
CONTRIBUTING text
COPYING text
copyright text
*COPYRIGHT* text
INSTALL text
license text
LICENSE text
NEWS text
readme text
*README* text
TODO text
# Graphics
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.tif binary
*.tiff binary
*.ico binary
# SVG treated as an asset (binary) by default. If you want to treat it as text,
# comment-out the following line and uncomment the line after.
*.svg binary
#*.svg text
*.eps binary
# These files are binary and should be left untouched
# (binary is a macro for -text -diff)
*.class binary
*.jar binary
*.war binary
## LINTERS
.csslintrc text
.eslintrc text
.jscsrc text
.jshintrc text
.jshintignore text
.stylelintrc text
## CONFIGS
*.conf text
*.config text
.editorconfig text
.gitattributes text
.gitconfig text
.gitignore text
.htaccess text
*.npmignore text
## HEROKU
Procfile text
.slugignore text
## AUDIO
*.kar binary
*.m4a binary
*.mid binary
*.midi binary
*.mp3 binary
*.ogg binary
*.ra binary
## VIDEO
*.3gpp binary
*.3gp binary
*.as binary
*.asf binary
*.asx binary
*.fla binary
*.flv binary
*.m4v binary
*.mng binary
*.mov binary
*.mp4 binary
*.mpeg binary
*.mpg binary
*.swc binary
*.swf binary
*.webm binary
## ARCHIVES
*.7z binary
*.gz binary
*.rar binary
*.tar binary
*.zip binary
## FONTS
*.ttf binary
*.eot binary
*.otf binary
*.woff binary
*.woff2 binary

159
.gitignore vendored Normal file
View File

@ -0,0 +1,159 @@
######################
# Project Specific
######################
/src/main/webapp/content/css/main.css
/target/classes/static/**
/src/test/javascript/coverage/
######################
# Node
######################
/node/
node_tmp/
node_modules/
npm-debug.log.*
/.awcache/*
/.cache-loader/*
######################
# SASS
######################
.sass-cache/
######################
# Eclipse
######################
*.pydevproject
.project
.metadata
tmp/
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
.factorypath
/src/main/resources/rebel.xml
# External tool builders
.externalToolBuilders/**
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
# STS-specific
/.sts4-cache/*
######################
# IntelliJ
######################
.idea/
*.iml
*.iws
*.ipr
*.ids
*.orig
classes/
out/
######################
# Visual Studio Code
######################
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
######################
# Maven
######################
/log/
/target/
######################
# Gradle
######################
.gradle/
/build/
######################
# Package Files
######################
*.jar
*.war
*.ear
*.db
######################
# Windows
######################
# Windows image file caches
Thumbs.db
# Folder config file
Desktop.ini
######################
# Mac OSX
######################
.DS_Store
.svn
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
######################
# Directories
######################
/bin/
/deploy/
######################
# Logs
######################
*.log*
######################
# Others
######################
*.class
*.*~
*~
.merge_file*
######################
# Gradle Wrapper
######################
!gradle/wrapper/gradle-wrapper.jar
######################
# Maven Wrapper
######################
!.mvn/wrapper/maven-wrapper.jar
######################
# ESLint
######################
.eslintcache
######################
# Code coverage
######################
/coverage/
/.nyc_output/

5
.huskyrc Normal file
View File

@ -0,0 +1,5 @@
{
"hooks": {
"pre-commit": "lint-staged"
}
}

40
.jhipster/Categoria.json Normal file
View File

@ -0,0 +1,40 @@
{
"name": "Categoria",
"fields": [
{
"fieldName": "nombre",
"fieldType": "String",
"fieldValidateRules": ["required"]
},
{
"fieldName": "estado",
"fieldType": "EstadoCategoria",
"fieldValues": "ACTIVE,INACTIVE",
"fieldValidateRules": ["required"]
}
],
"relationships": [
{
"relationshipType": "one-to-many",
"otherEntityName": "encuesta",
"otherEntityRelationshipName": "categoria",
"relationshipName": "encuesta"
},
{
"relationshipType": "one-to-many",
"otherEntityName": "plantilla",
"otherEntityRelationshipName": "categoria",
"relationshipName": "plantilla"
}
],
"entityTableName": "categoria",
"dto": "no",
"pagination": "no",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"readOnly": false,
"embedded": false,
"applications": "*",
"changelogDate": "20210703210927"
}

View File

@ -0,0 +1,46 @@
{
"name": "EPreguntaAbierta",
"fields": [
{
"fieldName": "nombre",
"fieldType": "String",
"fieldValidateRules": ["required", "maxlength", "minlength"],
"fieldValidateRulesMaxlength": "500",
"fieldValidateRulesMinlength": "1"
},
{
"fieldName": "opcional",
"fieldType": "Boolean",
"fieldValidateRules": ["required"]
},
{
"fieldName": "orden",
"fieldType": "Integer",
"fieldValidateRules": ["required"]
}
],
"relationships": [
{
"relationshipType": "one-to-many",
"otherEntityName": "ePreguntaAbiertaRespuesta",
"otherEntityRelationshipName": "ePreguntaAbierta",
"relationshipName": "ePreguntaAbiertaRespuesta"
},
{
"relationshipType": "many-to-one",
"otherEntityName": "encuesta",
"otherEntityRelationshipName": "ePreguntaAbierta",
"relationshipName": "encuesta"
}
],
"entityTableName": "e_pregunta_abierta",
"dto": "no",
"pagination": "no",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"readOnly": false,
"embedded": false,
"applications": "*",
"changelogDate": "20210703210922"
}

View File

@ -0,0 +1,28 @@
{
"name": "EPreguntaAbiertaRespuesta",
"fields": [
{
"fieldName": "respuesta",
"fieldType": "String",
"fieldValidateRules": ["required"]
}
],
"relationships": [
{
"relationshipType": "many-to-one",
"otherEntityName": "ePreguntaAbierta",
"otherEntityRelationshipName": "ePreguntaAbiertaRespuesta",
"relationshipName": "ePreguntaAbierta"
}
],
"entityTableName": "e_pregunta_abierta_respuesta",
"dto": "no",
"pagination": "no",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"readOnly": false,
"embedded": false,
"applications": "*",
"changelogDate": "20210703210923"
}

View File

@ -0,0 +1,52 @@
{
"name": "EPreguntaCerrada",
"fields": [
{
"fieldName": "nombre",
"fieldType": "String",
"fieldValidateRules": ["required", "maxlength", "minlength"],
"fieldValidateRulesMaxlength": "500",
"fieldValidateRulesMinlength": "1"
},
{
"fieldName": "tipo",
"fieldType": "PreguntaCerradaTipo",
"fieldValues": "SINGLE,MULTIPLE",
"fieldValidateRules": ["required"]
},
{
"fieldName": "opcional",
"fieldType": "Boolean",
"fieldValidateRules": ["required"]
},
{
"fieldName": "orden",
"fieldType": "Integer",
"fieldValidateRules": ["required"]
}
],
"relationships": [
{
"relationshipType": "one-to-many",
"otherEntityName": "ePreguntaCerradaOpcion",
"otherEntityRelationshipName": "ePreguntaCerrada",
"relationshipName": "ePreguntaCerradaOpcion"
},
{
"relationshipType": "many-to-one",
"otherEntityName": "encuesta",
"otherEntityRelationshipName": "ePreguntaCerrada",
"relationshipName": "encuesta"
}
],
"entityTableName": "e_pregunta_cerrada",
"dto": "no",
"pagination": "no",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"readOnly": false,
"embedded": false,
"applications": "*",
"changelogDate": "20210703210924"
}

View File

@ -0,0 +1,40 @@
{
"name": "EPreguntaCerradaOpcion",
"fields": [
{
"fieldName": "nombre",
"fieldType": "String",
"fieldValidateRules": ["required", "maxlength", "minlength"],
"fieldValidateRulesMaxlength": "500",
"fieldValidateRulesMinlength": "1"
},
{
"fieldName": "orden",
"fieldType": "Integer",
"fieldValidateRules": ["required"]
},
{
"fieldName": "cantidad",
"fieldType": "Integer",
"fieldValidateRules": ["required"]
}
],
"relationships": [
{
"relationshipType": "many-to-one",
"otherEntityName": "ePreguntaCerrada",
"otherEntityRelationshipName": "ePreguntaCerradaOpcion",
"relationshipName": "ePreguntaCerrada"
}
],
"entityTableName": "e_pregunta_cerrada_opcion",
"dto": "no",
"pagination": "no",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"readOnly": false,
"embedded": false,
"applications": "*",
"changelogDate": "20210703210925"
}

97
.jhipster/Encuesta.json Normal file
View File

@ -0,0 +1,97 @@
{
"name": "Encuesta",
"fields": [
{
"fieldName": "nombre",
"fieldType": "String",
"fieldValidateRules": ["required", "maxlength", "minlength"],
"fieldValidateRulesMaxlength": "50",
"fieldValidateRulesMinlength": "1"
},
{
"fieldName": "descripcion",
"fieldType": "String"
},
{
"fieldName": "fechaCreacion",
"fieldType": "ZonedDateTime",
"fieldValidateRules": ["required"]
},
{
"fieldName": "fechaPublicacion",
"fieldType": "ZonedDateTime"
},
{
"fieldName": "fechaFinalizar",
"fieldType": "ZonedDateTime"
},
{
"fieldName": "fechaFinalizada",
"fieldType": "ZonedDateTime"
},
{
"fieldName": "calificacion",
"fieldType": "Double",
"fieldValidateRules": ["required"]
},
{
"fieldName": "acceso",
"fieldType": "AccesoEncuesta",
"fieldValues": "PUBLIC,PRIVATE",
"fieldValidateRules": ["required"]
},
{
"fieldName": "contrasenna",
"fieldType": "String"
},
{
"fieldName": "estado",
"fieldType": "EstadoEncuesta",
"fieldValues": "DRAFT,ACTIVE,FINISHED,DELETED",
"fieldValidateRules": ["required"]
}
],
"relationships": [
{
"relationshipType": "one-to-many",
"otherEntityName": "usuarioEncuesta",
"otherEntityRelationshipName": "encuesta",
"relationshipName": "usuarioEncuesta"
},
{
"relationshipType": "one-to-many",
"otherEntityName": "ePreguntaAbierta",
"otherEntityRelationshipName": "encuesta",
"relationshipName": "ePreguntaAbierta"
},
{
"relationshipType": "one-to-many",
"otherEntityName": "ePreguntaCerrada",
"otherEntityRelationshipName": "encuesta",
"relationshipName": "ePreguntaCerrada"
},
{
"relationshipType": "many-to-one",
"otherEntityName": "categoria",
"otherEntityRelationshipName": "encuesta",
"relationshipName": "categoria",
"otherEntityField": "nombre"
},
{
"relationshipType": "many-to-one",
"otherEntityName": "usuarioExtra",
"otherEntityRelationshipName": "encuesta",
"relationshipName": "usuarioExtra"
}
],
"entityTableName": "encuesta",
"dto": "no",
"pagination": "no",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"readOnly": false,
"embedded": false,
"applications": "*",
"changelogDate": "20210703210921"
}

36
.jhipster/Factura.json Normal file
View File

@ -0,0 +1,36 @@
{
"name": "Factura",
"fields": [
{
"fieldName": "nombreUsuario",
"fieldType": "String",
"fieldValidateRules": ["required"]
},
{
"fieldName": "nombrePlantilla",
"fieldType": "String",
"fieldValidateRules": ["required"]
},
{
"fieldName": "costo",
"fieldType": "Double",
"fieldValidateRules": ["required"]
},
{
"fieldName": "fecha",
"fieldType": "ZonedDateTime",
"fieldValidateRules": ["required"]
}
],
"relationships": [],
"entityTableName": "factura",
"dto": "no",
"pagination": "no",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"readOnly": false,
"embedded": false,
"applications": "*",
"changelogDate": "20210703210928"
}

View File

@ -0,0 +1,40 @@
{
"name": "PPreguntaAbierta",
"fields": [
{
"fieldName": "nombre",
"fieldType": "String",
"fieldValidateRules": ["required", "maxlength", "minlength"],
"fieldValidateRulesMaxlength": "500",
"fieldValidateRulesMinlength": "1"
},
{
"fieldName": "opcional",
"fieldType": "Boolean",
"fieldValidateRules": ["required"]
},
{
"fieldName": "orden",
"fieldType": "Integer",
"fieldValidateRules": ["required"]
}
],
"relationships": [
{
"relationshipType": "many-to-one",
"otherEntityName": "plantilla",
"otherEntityRelationshipName": "pPreguntaAbierta",
"relationshipName": "plantilla"
}
],
"entityTableName": "p_pregunta_abierta",
"dto": "no",
"pagination": "no",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"readOnly": false,
"embedded": false,
"applications": "*",
"changelogDate": "20210703210930"
}

View File

@ -0,0 +1,52 @@
{
"name": "PPreguntaCerrada",
"fields": [
{
"fieldName": "nombre",
"fieldType": "String",
"fieldValidateRules": ["required", "maxlength", "minlength"],
"fieldValidateRulesMaxlength": "500",
"fieldValidateRulesMinlength": "1"
},
{
"fieldName": "tipo",
"fieldType": "PreguntaCerradaTipo",
"fieldValues": "SINGLE,MULTIPLE",
"fieldValidateRules": ["required"]
},
{
"fieldName": "opcional",
"fieldType": "Boolean",
"fieldValidateRules": ["required"]
},
{
"fieldName": "orden",
"fieldType": "Integer",
"fieldValidateRules": ["required"]
}
],
"relationships": [
{
"relationshipType": "one-to-many",
"otherEntityName": "pPreguntaCerradaOpcion",
"otherEntityRelationshipName": "pPreguntaCerrada",
"relationshipName": "pPreguntaCerradaOpcion"
},
{
"relationshipType": "many-to-one",
"otherEntityName": "plantilla",
"otherEntityRelationshipName": "pPreguntaCerrada",
"relationshipName": "plantilla"
}
],
"entityTableName": "p_pregunta_cerrada",
"dto": "no",
"pagination": "no",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"readOnly": false,
"embedded": false,
"applications": "*",
"changelogDate": "20210703210931"
}

View File

@ -0,0 +1,35 @@
{
"name": "PPreguntaCerradaOpcion",
"fields": [
{
"fieldName": "nombre",
"fieldType": "String",
"fieldValidateRules": ["required", "maxlength", "minlength"],
"fieldValidateRulesMaxlength": "500",
"fieldValidateRulesMinlength": "1"
},
{
"fieldName": "orden",
"fieldType": "Integer",
"fieldValidateRules": ["required"]
}
],
"relationships": [
{
"relationshipType": "many-to-one",
"otherEntityName": "pPreguntaCerrada",
"otherEntityRelationshipName": "pPreguntaCerradaOpcion",
"relationshipName": "pPreguntaCerrada"
}
],
"entityTableName": "p_pregunta_cerrada_opcion",
"dto": "no",
"pagination": "no",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"readOnly": false,
"embedded": false,
"applications": "*",
"changelogDate": "20210703210932"
}

View File

@ -0,0 +1,36 @@
{
"name": "ParametroAplicacion",
"fields": [
{
"fieldName": "maxDiasEncuesta",
"fieldType": "Integer",
"fieldValidateRules": ["required"]
},
{
"fieldName": "minDiasEncuesta",
"fieldType": "Integer",
"fieldValidateRules": ["required"]
},
{
"fieldName": "maxCantidadPreguntas",
"fieldType": "Integer",
"fieldValidateRules": ["required"]
},
{
"fieldName": "minCantidadPreguntas",
"fieldType": "Integer",
"fieldValidateRules": ["required"]
}
],
"relationships": [],
"entityTableName": "parametro_aplicacion",
"dto": "no",
"pagination": "no",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"readOnly": false,
"embedded": false,
"applications": "*",
"changelogDate": "20210703210919"
}

74
.jhipster/Plantilla.json Normal file
View File

@ -0,0 +1,74 @@
{
"name": "Plantilla",
"fields": [
{
"fieldName": "nombre",
"fieldType": "String",
"fieldValidateRules": ["maxlength", "minlength"],
"fieldValidateRulesMaxlength": "50",
"fieldValidateRulesMinlength": "1"
},
{
"fieldName": "descripcion",
"fieldType": "String"
},
{
"fieldName": "fechaCreacion",
"fieldType": "ZonedDateTime",
"fieldValidateRules": ["required"]
},
{
"fieldName": "fechaPublicacionTienda",
"fieldType": "ZonedDateTime"
},
{
"fieldName": "estado",
"fieldType": "EstadoPlantilla",
"fieldValues": "DRAFT,ACTIVE,DELETED,DISABLED",
"fieldValidateRules": ["required"]
},
{
"fieldName": "precio",
"fieldType": "Double",
"fieldValidateRules": ["required"]
}
],
"relationships": [
{
"relationshipType": "one-to-many",
"otherEntityName": "pPreguntaCerrada",
"otherEntityRelationshipName": "plantilla",
"relationshipName": "pPreguntaCerrada"
},
{
"relationshipType": "one-to-many",
"otherEntityName": "pPreguntaAbierta",
"otherEntityRelationshipName": "plantilla",
"relationshipName": "pPreguntaAbierta"
},
{
"relationshipType": "many-to-one",
"otherEntityName": "categoria",
"otherEntityRelationshipName": "plantilla",
"relationshipName": "categoria",
"otherEntityField": "nombre"
},
{
"relationshipType": "many-to-many",
"otherEntityName": "usuarioExtra",
"otherEntityRelationshipName": "plantilla",
"relationshipName": "usuarioExtra",
"ownerSide": false
}
],
"entityTableName": "plantilla",
"dto": "no",
"pagination": "no",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"readOnly": false,
"embedded": false,
"applications": "*",
"changelogDate": "20210703210929"
}

View File

@ -0,0 +1,46 @@
{
"name": "UsuarioEncuesta",
"fields": [
{
"fieldName": "rol",
"fieldType": "RolColaborador",
"fieldValues": "READ,WRITE",
"fieldValidateRules": ["required"]
},
{
"fieldName": "estado",
"fieldType": "EstadoColaborador",
"fieldValues": "PENDING,ACTIVE",
"fieldValidateRules": ["required"]
},
{
"fieldName": "fechaAgregado",
"fieldType": "ZonedDateTime",
"fieldValidateRules": ["required"]
}
],
"relationships": [
{
"relationshipType": "many-to-one",
"otherEntityName": "usuarioExtra",
"otherEntityRelationshipName": "usuarioEncuesta",
"relationshipName": "usuarioExtra"
},
{
"relationshipType": "many-to-one",
"otherEntityName": "encuesta",
"otherEntityRelationshipName": "usuarioEncuesta",
"relationshipName": "encuesta"
}
],
"entityTableName": "usuario_encuesta",
"dto": "no",
"pagination": "no",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"readOnly": false,
"embedded": false,
"applications": "*",
"changelogDate": "20210703210926"
}

View File

@ -0,0 +1,62 @@
{
"name": "UsuarioExtra",
"fields": [
{
"fieldName": "nombre",
"fieldType": "String",
"fieldValidateRules": ["required"]
},
{
"fieldName": "iconoPerfil",
"fieldType": "String"
},
{
"fieldName": "fechaNacimiento",
"fieldType": "ZonedDateTime"
},
{
"fieldName": "estado",
"fieldType": "EstadoUsuario",
"fieldValues": "ACTIVE,SUSPENDED",
"fieldValidateRules": ["required"]
}
],
"relationships": [
{
"relationshipType": "one-to-one",
"otherEntityName": "user",
"otherEntityRelationshipName": "usuarioExtra",
"relationshipName": "user",
"ownerSide": true
},
{
"relationshipType": "one-to-many",
"otherEntityName": "encuesta",
"otherEntityRelationshipName": "usuarioExtra",
"relationshipName": "encuesta"
},
{
"relationshipType": "one-to-many",
"otherEntityName": "usuarioEncuesta",
"otherEntityRelationshipName": "usuarioExtra",
"relationshipName": "usuarioEncuesta"
},
{
"relationshipType": "many-to-many",
"otherEntityName": "plantilla",
"otherEntityRelationshipName": "usuarioExtra",
"relationshipName": "plantilla",
"ownerSide": true
}
],
"entityTableName": "usuario_extra",
"dto": "no",
"pagination": "no",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"readOnly": false,
"embedded": false,
"applications": "*",
"changelogDate": "20210703210920"
}

3
.lintstagedrc.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
'{,src/**/,webpack/}*.{md,json,yml,html,js,ts,tsx,css,scss,java}': ['prettier --write'],
};

117
.mvn/wrapper/MavenWrapperDownloader.java vendored Normal file
View File

@ -0,0 +1,117 @@
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}

2
.mvn/wrapper/maven-wrapper.properties vendored Normal file
View File

@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

1
.npmrc Normal file
View File

@ -0,0 +1 @@
legacy-peer-deps = true

8
.prettierignore Normal file
View File

@ -0,0 +1,8 @@
node_modules
target
build
package-lock.json
.git
.mvn
gradle
.gradle

18
.prettierrc Normal file
View File

@ -0,0 +1,18 @@
# Prettier configuration
printWidth: 140
singleQuote: true
tabWidth: 2
useTabs: false
# js and ts rules:
arrowParens: avoid
# jsx and tsx rules:
jsxBracketSameLine: false
# java rules:
overrides:
- files: "*.java"
options:
tabWidth: 4

65
.yo-rc.json Normal file
View File

@ -0,0 +1,65 @@
{
"generator-jhipster": {
"applicationType": "monolith",
"gitCompany": "",
"baseName": "DataSurvey",
"packageName": "org.datasurvey",
"packageFolder": "org/datasurvey",
"serverPort": 8080,
"serviceDiscoveryType": false,
"authenticationType": "jwt",
"cacheProvider": "ehcache",
"enableHibernateCache": true,
"websocket": "spring-websocket",
"databaseType": "sql",
"devDatabaseType": "mysql",
"prodDatabaseType": "mysql",
"searchEngine": false,
"enableSwaggerCodegen": false,
"messageBroker": false,
"buildTool": "maven",
"useSass": true,
"clientPackageManager": "npm",
"testFrameworks": [],
"enableTranslation": true,
"nativeLanguage": "es",
"languages": ["es"],
"clientFramework": "angularX",
"jhiPrefix": "jhi",
"withAdminUi": true,
"jhipsterVersion": "7.1.0",
"skipClient": false,
"skipServer": false,
"skipUserManagement": false,
"skipCheckLengthOfIdentifier": false,
"skipFakeData": false,
"entitySuffix": "",
"dtoSuffix": "DTO",
"blueprints": [],
"otherModules": [],
"pages": [],
"creationTimestamp": 1624822968886,
"jwtSecretKey": "ZjRmZGRhNzFhNDI5OTRmYjkzZmQ0NzI5Yzc3YTYyODBkMjFjZGY1OWMwNzY5YTJkOTA1ZDY3YzE1MWEwMGRkYzg4ZTNlOGUwNTAzMzdiMWVjNDA4NjFiY2JhNTNhYzhkZjQ3N2MyMmY5YzA5ZTFiNzIzMjJjMTg4MmFlNTUyOTY=",
"devServerPort": 4200,
"clientTheme": "none",
"clientThemeVariant": "",
"reactive": false,
"entities": [
"ParametroAplicacion",
"UsuarioExtra",
"Encuesta",
"EPreguntaAbierta",
"EPreguntaAbiertaRespuesta",
"EPreguntaCerrada",
"EPreguntaCerradaOpcion",
"UsuarioEncuesta",
"Categoria",
"Factura",
"Plantilla",
"PPreguntaAbierta",
"PPreguntaCerrada",
"PPreguntaCerradaOpcion"
],
"lastLiquibaseTimestamp": 1625346572000
}
}

1
Procfile Normal file
View File

@ -0,0 +1 @@
web: java $JAVA_OPTS -Xmx256m -jar target/*.jar --spring.profiles.active=prod --server.port=$PORT

217
README.md Normal file
View File

@ -0,0 +1,217 @@
# DataSurvey
This application was generated using JHipster 7.1.0, you can find documentation and help at [https://www.jhipster.tech/documentation-archive/v7.1.0](https://www.jhipster.tech/documentation-archive/v7.1.0).
## Development
Before you can build this project, you must install and configure the following dependencies on your machine:
1. [Node.js][]: We use Node to run a development web server and build the project.
Depending on your system, you can install Node either from source or as a pre-packaged bundle.
After installing Node, you should be able to run the following command to install development tools.
You will only need to run this command when dependencies change in [package.json](package.json).
```
npm install
```
We use npm scripts and [Angular CLI][] with [Webpack][] as our build system.
Run the following commands in two separate terminals to create a blissful development experience where your browser
auto-refreshes when files change on your hard drive.
```
./mvnw
npm start
```
Npm is also used to manage CSS and JavaScript dependencies used in this application. You can upgrade dependencies by
specifying a newer version in [package.json](package.json). You can also run `npm update` and `npm install` to manage dependencies.
Add the `help` flag on any command to see how you can use it. For example, `npm help update`.
The `npm run` command will list all of the scripts available to run for this project.
### PWA Support
JHipster ships with PWA (Progressive Web App) support, and it's turned off by default. One of the main components of a PWA is a service worker.
The service worker initialization code is disabled by default. To enable it, uncomment the following code in `src/main/webapp/app/app.module.ts`:
```typescript
ServiceWorkerModule.register('ngsw-worker.js', { enabled: false }),
```
### Managing dependencies
For example, to add [Leaflet][] library as a runtime dependency of your application, you would run following command:
```
npm install --save --save-exact leaflet
```
To benefit from TypeScript type definitions from [DefinitelyTyped][] repository in development, you would run following command:
```
npm install --save-dev --save-exact @types/leaflet
```
Then you would import the JS and CSS files specified in library's installation instructions so that [Webpack][] knows about them:
Edit [src/main/webapp/app/app.module.ts](src/main/webapp/app/app.module.ts) file:
```
import 'leaflet/dist/leaflet.js';
```
Edit [src/main/webapp/content/scss/vendor.scss](src/main/webapp/content/scss/vendor.scss) file:
```
@import '~leaflet/dist/leaflet.css';
```
Note: There are still a few other things remaining to do for Leaflet that we won't detail here.
For further instructions on how to develop with JHipster, have a look at [Using JHipster in development][].
### Using Angular CLI
You can also use [Angular CLI][] to generate some custom client code.
For example, the following command:
```
ng generate component my-component
```
will generate few files:
```
create src/main/webapp/app/my-component/my-component.component.html
create src/main/webapp/app/my-component/my-component.component.ts
update src/main/webapp/app/app.module.ts
```
## Building for production
### Packaging as jar
To build the final jar and optimize the DataSurvey application for production, run:
```
./mvnw -Pprod clean verify
```
This will concatenate and minify the client CSS and JavaScript files. It will also modify `index.html` so it references these new files.
To ensure everything worked, run:
```
java -jar target/*.jar
```
Then navigate to [http://localhost:8080](http://localhost:8080) in your browser.
Refer to [Using JHipster in production][] for more details.
### Packaging as war
To package your application as a war in order to deploy it to an application server, run:
```
./mvnw -Pprod,war clean verify
```
## Testing
To launch your application's tests, run:
```
./mvnw verify
```
### Client tests
Unit tests are run by [Jest][]. They're located in [src/test/javascript/](src/test/javascript/) and can be run with:
```
npm test
```
For more information, refer to the [Running tests page][].
### Code quality
Sonar is used to analyse code quality. You can start a local Sonar server (accessible on http://localhost:9001) with:
```
docker-compose -f src/main/docker/sonar.yml up -d
```
Note: we have turned off authentication in [src/main/docker/sonar.yml](src/main/docker/sonar.yml) for out of the box experience while trying out SonarQube, for real use cases turn it back on.
You can run a Sonar analysis with using the [sonar-scanner](https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner) or by using the maven plugin.
Then, run a Sonar analysis:
```
./mvnw -Pprod clean verify sonar:sonar
```
If you need to re-run the Sonar phase, please be sure to specify at least the `initialize` phase since Sonar properties are loaded from the sonar-project.properties file.
```
./mvnw initialize sonar:sonar
```
For more information, refer to the [Code quality page][].
## Using Docker to simplify development (optional)
You can use Docker to improve your JHipster development experience. A number of docker-compose configuration are available in the [src/main/docker](src/main/docker) folder to launch required third party services.
For example, to start a mysql database in a docker container, run:
```
docker-compose -f src/main/docker/mysql.yml up -d
```
To stop it and remove the container, run:
```
docker-compose -f src/main/docker/mysql.yml down
```
You can also fully dockerize your application and all the services that it depends on.
To achieve this, first build a docker image of your app by running:
```
./mvnw -Pprod verify jib:dockerBuild
```
Then run:
```
docker-compose -f src/main/docker/app.yml up -d
```
For more information refer to [Using Docker and Docker-Compose][], this page also contains information on the docker-compose sub-generator (`jhipster docker-compose`), which is able to generate docker configurations for one or several JHipster applications.
## Continuous Integration (optional)
To configure CI for your project, run the ci-cd sub-generator (`jhipster ci-cd`), this will let you generate configuration files for a number of Continuous Integration systems. Consult the [Setting up Continuous Integration][] page for more information.
[jhipster homepage and latest documentation]: https://www.jhipster.tech
[jhipster 7.1.0 archive]: https://www.jhipster.tech/documentation-archive/v7.1.0
[using jhipster in development]: https://www.jhipster.tech/documentation-archive/v7.1.0/development/
[using docker and docker-compose]: https://www.jhipster.tech/documentation-archive/v7.1.0/docker-compose
[using jhipster in production]: https://www.jhipster.tech/documentation-archive/v7.1.0/production/
[running tests page]: https://www.jhipster.tech/documentation-archive/v7.1.0/running-tests/
[code quality page]: https://www.jhipster.tech/documentation-archive/v7.1.0/code-quality/
[setting up continuous integration]: https://www.jhipster.tech/documentation-archive/v7.1.0/setting-up-ci/
[node.js]: https://nodejs.org/
[webpack]: https://webpack.github.io/
[angular cli]: https://cli.angular.io/
[browsersync]: https://www.browsersync.io/
[jest]: https://facebook.github.io/jest/
[jasmine]: https://jasmine.github.io/2.0/introduction.html
[leaflet]: https://leafletjs.com/
[definitelytyped]: https://definitelytyped.org/

114
angular.json Normal file
View File

@ -0,0 +1,114 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"data-survey": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
},
"@schematics/angular:application": {
"strict": true
}
},
"root": "",
"sourceRoot": "src/main/webapp",
"prefix": "jhi",
"architect": {
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": {
"path": "./webpack/webpack.custom.js"
},
"outputPath": "target/classes/static/",
"index": "src/main/webapp/index.html",
"main": "src/main/webapp/main.ts",
"polyfills": "src/main/webapp/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/main/webapp/content",
"src/main/webapp/favicon.ico",
"src/main/webapp/manifest.webapp",
"src/main/webapp/robots.txt",
{
"glob": "*.{js,css,html,png}",
"input": "./node_modules/swagger-ui-dist",
"output": "swagger-ui",
"ignore": ["**/index.html"]
},
{ "glob": "axios.min.js", "input": "./node_modules/axios/dist", "output": "swagger-ui" },
{ "glob": "**/*", "input": "src/main/webapp/swagger-ui/", "output": "swagger-ui" }
],
"styles": ["src/main/webapp/content/scss/vendor.scss", "src/main/webapp/content/scss/global.scss"],
"scripts": []
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"serviceWorker": true,
"ngswConfigPath": "ngsw-config.json",
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
]
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-builders/custom-webpack:dev-server",
"options": {
"browserTarget": "data-survey:build:development",
"proxyConfig": "./webpack/proxy.conf.js",
"port": 4200
},
"configurations": {
"production": {
"browserTarget": "data-survey:build:production"
},
"development": {
"browserTarget": "data-survey:build:development"
}
},
"defaultConfiguration": "development"
},
"test": {
"builder": "@angular-builders/jest:run",
"options": {
"configPath": "jest.conf.js"
}
}
}
}
},
"defaultProject": "data-survey",
"cli": {
"packageManager": "npm"
}
}

20
checkstyle.xml Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<!-- Configure checker to use UTF-8 encoding -->
<property name="charset" value="UTF-8"/>
<!-- Configure checker to run on files with these extensions -->
<property name="fileExtensions" value=""/>
<!-- For detailed checkstyle configuration, see https://github.com/spring-io/nohttp/tree/master/nohttp-checkstyle -->
<module name="io.spring.nohttp.checkstyle.check.NoHttpCheck">
<property name="allowlist" value="^\Qhttp://maven.apache.org/POM/4.0.0&#10;^\Qhttp://www.w3.org/2001/XMLSchema-instance"/>
</module>
<!-- Allow suppression with comments
// CHECKSTYLE:OFF
... ignored content ...
// CHECKSTYLE:ON
-->
<module name="SuppressWithPlainTextCommentFilter"/>
</module>

196
datasurvey-ent.jdl Normal file
View File

@ -0,0 +1,196 @@
DEFAULT_MIN_LENGTH = 1
DEFAULT_MAX_LENGTH = 999
ENCUESTA_MAX_NOMBRE = 50
ENCUESTA_MIN_NOMBRE = 1
PREGUNTA_MAX_NOMBRE = 500
PREGUNTA_MIN_NOMBRE = 1
// ENUMS
enum EstadoUsuario {
ACTIVE, SUSPENDED
}
enum PreguntaCerradaTipo {
SINGLE, MULTIPLE
}
enum EstadoEncuesta {
DRAFT, ACTIVE, FINISHED, DELETED
}
enum EstadoPlantilla {
DRAFT, ACTIVE, DELETED, DISABLED
}
enum RolColaborador {
READ, WRITE
}
enum EstadoColaborador {
PENDING, ACTIVE
}
enum EstadoCategoria {
ACTIVE, INACTIVE
}
enum AccesoEncuesta {
PUBLIC, PRIVATE
}
// ENTITIES
entity ParametroAplicacion {
maxDiasEncuesta Integer required,
minDiasEncuesta Integer required,
maxCantidadPreguntas Integer required,
minCantidadPreguntas Integer required
}
entity UsuarioExtra {
nombre String required,
iconoPerfil String,
fechaNacimiento ZonedDateTime,
estado EstadoUsuario required,
// JHI_USER
}
// ENCUESTA
entity Encuesta {
nombre String required maxlength(ENCUESTA_MAX_NOMBRE) minlength(ENCUESTA_MIN_NOMBRE),
descripcion String,
fechaCreacion ZonedDateTime required,
fechaPublicacion ZonedDateTime,
fechaFinalizar ZonedDateTime,
fechaFinalizada ZonedDateTime,
calificacion Double required,
acceso AccesoEncuesta required,
contrasenna String,
estado EstadoEncuesta required
// ID_CATEGORIA
}
entity EPreguntaAbierta {
nombre String required maxlength(PREGUNTA_MAX_NOMBRE) minlength(PREGUNTA_MIN_NOMBRE),
opcional Boolean required,
orden Integer required
// ID_ENCUESTA
}
entity EPreguntaAbiertaRespuesta {
respuesta String required
// ID_ENCUESTA_PREGUNTA_ABIERTA
}
entity EPreguntaCerrada {
nombre String required maxlength(PREGUNTA_MAX_NOMBRE) minlength(PREGUNTA_MIN_NOMBRE),
tipo PreguntaCerradaTipo required
opcional Boolean required,
orden Integer required
// ID_ENCUESTA
}
entity EPreguntaCerradaOpcion {
nombre String required maxlength(PREGUNTA_MAX_NOMBRE) minlength(PREGUNTA_MIN_NOMBRE),
orden Integer required,
cantidad Integer required
// ID_ENCUESTA_PREGUNTA_CERRADA
}
entity UsuarioEncuesta {
rol RolColaborador required,
estado EstadoColaborador required,
fechaAgregado ZonedDateTime required
}
// -----------------------------------------
entity Categoria {
nombre String required
estado EstadoCategoria required
}
entity Factura {
nombreUsuario String required,
nombrePlantilla String required,
costo Double required,
fecha ZonedDateTime required,
// ID_USUARIO_EXTRA
}
// PLANTILLAS
entity Plantilla {
nombre String maxlength(ENCUESTA_MAX_NOMBRE) minlength(ENCUESTA_MIN_NOMBRE),
descripcion String,
fechaCreacion ZonedDateTime required,
fechaPublicacionTienda ZonedDateTime,
estado EstadoPlantilla required,
precio Double required
// ID_CATEGORIA
}
entity PPreguntaAbierta {
nombre String required maxlength(PREGUNTA_MAX_NOMBRE) minlength(PREGUNTA_MIN_NOMBRE),
opcional Boolean required,
orden Integer required
// ID_PLANTILLA
}
entity PPreguntaCerrada {
nombre String required maxlength(PREGUNTA_MAX_NOMBRE) minlength(PREGUNTA_MIN_NOMBRE),
tipo PreguntaCerradaTipo required,
opcional Boolean required,
orden Integer required
// ID_PLANTILLA
}
entity PPreguntaCerradaOpcion {
nombre String required maxlength(PREGUNTA_MAX_NOMBRE) minlength(PREGUNTA_MIN_NOMBRE),
orden Integer required
// ID_PLANTILLA_PREGUNTA_CERRADA
}
// -----------------------------------------
// Filters
filter ParametroAplicacion, UsuarioExtra, Encuesta, EPreguntaAbierta, EPreguntaAbiertaRespuesta
filter EPreguntaCerrada, EPreguntaCerradaOpcion, UsuarioEncuesta, Categoria, Factura
filter Plantilla, PPreguntaAbierta, PPreguntaCerrada, PPreguntaCerradaOpcion
// Relationship between UsuarioExtra and default User table to extend fields
relationship OneToOne {
UsuarioExtra to User
}
// UsuarioExtra
relationship OneToMany {
Categoria to Encuesta{categoria(nombre)}
Categoria to Plantilla{categoria(nombre)}
// Encuesta
UsuarioExtra to Encuesta
UsuarioExtra to UsuarioEncuesta
Encuesta to UsuarioEncuesta
Encuesta to EPreguntaAbierta
Encuesta to EPreguntaCerrada
EPreguntaAbierta to EPreguntaAbiertaRespuesta
EPreguntaCerrada to EPreguntaCerradaOpcion
// Plantilla
Plantilla to PPreguntaCerrada
Plantilla to PPreguntaAbierta
PPreguntaCerrada to PPreguntaCerradaOpcion
}
relationship ManyToMany {
UsuarioExtra to Plantilla
}
// -----------------------------------------

22
jest.conf.js Normal file
View File

@ -0,0 +1,22 @@
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const {
compilerOptions: { paths = {}, baseUrl = './' },
} = require('./tsconfig.json');
const environment = require('./webpack/environment');
module.exports = {
globals: {
...environment,
},
roots: ['<rootDir>', `<rootDir>/${baseUrl}`],
modulePaths: [`<rootDir>/${baseUrl}`],
setupFiles: ['jest-date-mock'],
cacheDirectory: '<rootDir>/target/jest-cache',
coverageDirectory: '<rootDir>/target/test-results/',
moduleNameMapper: pathsToModuleNameMapper(paths, { prefix: `<rootDir>/${baseUrl}/` }),
reporters: ['default', ['jest-junit', { outputDirectory: '<rootDir>/target/test-results/', outputName: 'TESTS-results-jest.xml' }]],
testResultsProcessor: 'jest-sonar-reporter',
testMatch: ['<rootDir>/src/main/webapp/app/**/@(*.)@(spec.ts)'],
testURL: 'http://localhost/',
};

310
mvnw vendored Normal file
View File

@ -0,0 +1,310 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
fi
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

182
mvnw.cmd vendored Normal file
View File

@ -0,0 +1,182 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

21
ngsw-config.json Normal file
View File

@ -0,0 +1,21 @@
{
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": ["/favicon.ico", "/index.html", "/manifest.webapp", "/*.css", "/*.js"]
}
},
{
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": ["/content/**", "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"]
}
}
]
}

25
npmw Normal file
View File

@ -0,0 +1,25 @@
#!/bin/sh
basedir=`dirname "$0"`
if [ -f "$basedir/mvnw" ]; then
builddir="target/node"
installCommand="$basedir/mvnw frontend:install-node-and-npm@install-node-and-npm"
else
builddir=".gradle/npm"
installCommand="$basedir/gradlew npmSetup"
fi
NPM_EXE="$basedir/$builddir/npm"
if ! [ -x "$NPM_EXE" ]; then
$installCommand || true
fi
if ! [ -x "$NPM_EXE" ]; then
echo "Using npm installed globally"
npm "$@"
else
echo "Using npm installed locally $($NPM_EXE --version)"
$NPM_EXE "$@"
fi

24
npmw.cmd Normal file
View File

@ -0,0 +1,24 @@
@echo off
@setlocal
set NPMW_DIR=%~dp0
if exist "%NPMW_DIR%\mvnw.cmd" (
set NPM_EXE=%NPMW_DIR%\target\node\npm.cmd
set INSTALL_NPM_COMMAND=%NPMW_DIR%\mvnw.cmd frontend:install-node-and-npm@install-node-and-npm
) else (
set NPM_EXE=%NPMW_DIR%\.gradle\npm\npm.cmd
set INSTALL_NPM_COMMAND=%NPMW_DIR%\gradlew.bat npmSetup
)
if not exist %NPM_EXE% (
call %INSTALL_NPM_COMMAND%
)
if not exist %NPM_EXE% goto globalNpm
%NPM_EXE% %*
:globalNpm
npm %*

47988
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

142
package.json Normal file
View File

@ -0,0 +1,142 @@
{
"name": "data-survey",
"version": "0.0.1-SNAPSHOT",
"private": true,
"description": "Description for DataSurvey",
"license": "UNLICENSED",
"scripts": {
"prettier:check": "prettier --check \"{,src/**/,webpack/}*.{md,json,yml,html,js,ts,tsx,css,scss,java}\"",
"prettier:format": "prettier --write \"{,src/**/,webpack/}*.{md,json,yml,html,js,ts,tsx,css,scss,java}\"",
"lint": "eslint . --ext .js,.ts",
"lint:fix": "npm run lint -- --fix",
"cleanup": "rimraf target/classes/static/",
"clean-www": "rimraf target/classes/static/app/{src,target/}",
"jest": "jest --coverage --logHeapUsage --maxWorkers=2 --config jest.conf.js",
"start": "ng serve --hmr",
"start-tls": "npm run webapp:dev -- --env.tls",
"serve": "npm run start",
"build": "npm run webapp:prod",
"pretest": "npm run lint",
"test": "ng test --coverage --log-heap-usage -w=2",
"test:watch": "npm run test -- --watch",
"watch": "concurrently npm:start npm:backend:start",
"webapp:build": "npm run clean-www && npm run webapp:build:dev",
"webapp:build:dev": "ng build --configuration development",
"webapp:build:prod": "ng build --configuration production",
"webapp:dev": "ng serve",
"webapp:dev-verbose": "ng serve --verbose",
"webapp:prod": "npm run clean-www && npm run webapp:build:prod",
"webapp:test": "npm run test",
"docker:db:up": "docker-compose -f src/main/docker/mysql.yml up -d",
"docker:db:down": "docker-compose -f src/main/docker/mysql.yml down -v --remove-orphans",
"docker:others:await": "",
"predocker:others:up": "",
"docker:others:up": "",
"docker:others:down": "",
"ci:e2e:prepare:docker": "npm run docker:db:up && npm run docker:others:up && docker ps -a",
"ci:e2e:prepare": "npm run ci:e2e:prepare:docker",
"ci:e2e:teardown:docker": "npm run docker:db:down --if-present && npm run docker:others:down && docker ps -a",
"ci:e2e:teardown": "npm run ci:e2e:teardown:docker",
"backend:info": "./mvnw -ntp enforcer:display-info --batch-mode",
"backend:doc:test": "./mvnw -ntp javadoc:javadoc --batch-mode",
"backend:nohttp:test": "./mvnw -ntp checkstyle:check --batch-mode",
"backend:start": "./mvnw -P-webapp",
"java:jar": "./mvnw -ntp verify -DskipTests --batch-mode",
"java:war": "./mvnw -ntp verify -DskipTests --batch-mode -Pwar",
"java:docker": "./mvnw -ntp verify -DskipTests jib:dockerBuild",
"backend:unit:test": "./mvnw -ntp -P-webapp verify --batch-mode -Dlogging.level.ROOT=OFF -Dlogging.level.org.zalando=OFF -Dlogging.level.tech.jhipster=OFF -Dlogging.level.org.datasurvey=OFF -Dlogging.level.org.springframework=OFF -Dlogging.level.org.springframework.web=OFF -Dlogging.level.org.springframework.security=OFF",
"backend:build-cache": "./mvnw dependency:go-offline",
"java:jar:dev": "npm run java:jar -- -Pdev,webapp",
"java:jar:prod": "npm run java:jar -- -Pprod",
"java:war:dev": "npm run java:war -- -Pdev,webapp",
"java:war:prod": "npm run java:war -- -Pprod",
"java:docker:dev": "npm run java:docker -- -Pdev,webapp",
"java:docker:prod": "npm run java:docker -- -Pprod",
"ci:backend:test": "npm run backend:info && npm run backend:doc:test && npm run backend:nohttp:test && npm run backend:unit:test",
"ci:server:package": "npm run java:$npm_package_config_packaging:$npm_package_config_default_environment",
"ci:e2e:package": "npm run java:$npm_package_config_packaging:$npm_package_config_default_environment -- -Pe2e -Denforcer.skip=true",
"preci:e2e:server:start": "npm run docker:db:await --if-present && npm run docker:others:await --if-present",
"ci:e2e:server:start": "java -jar target/e2e.$npm_package_config_packaging --spring.profiles.active=$npm_package_config_default_environment -Dlogging.level.ROOT=OFF -Dlogging.level.org.zalando=OFF -Dlogging.level.tech.jhipster=OFF -Dlogging.level.org.datasurvey=OFF -Dlogging.level.org.springframework=OFF -Dlogging.level.org.springframework.web=OFF -Dlogging.level.org.springframework.security=OFF --logging.level.org.springframework.web=ERROR",
"ci:frontend:build": "npm run webapp:build:$npm_package_config_default_environment",
"ci:frontend:test": "npm run ci:frontend:build && npm test"
},
"config": {
"backend_port": 8080,
"default_environment": "prod",
"packaging": "jar"
},
"dependencies": {
"@angular/common": "12.0.5",
"@angular/compiler": "12.0.5",
"@angular/core": "12.0.5",
"@angular/forms": "12.0.5",
"@angular/localize": "12.0.5",
"@angular/platform-browser": "12.0.5",
"@angular/platform-browser-dynamic": "12.0.5",
"@angular/router": "12.0.5",
"@fortawesome/angular-fontawesome": "0.9.0",
"@fortawesome/fontawesome-svg-core": "1.2.35",
"@fortawesome/free-solid-svg-icons": "5.15.3",
"@ng-bootstrap/ng-bootstrap": "9.1.3",
"@ngx-translate/core": "13.0.0",
"@ngx-translate/http-loader": "6.0.0",
"bootstrap": "4.6.0",
"dayjs": "1.10.5",
"ngx-infinite-scroll": "10.0.1",
"ngx-webstorage": "8.0.0",
"rxjs": "6.6.7",
"sockjs-client": "1.5.0",
"swagger-ui-dist": "3.50.0",
"tslib": "2.3.0",
"webstomp-client": "1.2.6",
"zone.js": "0.11.4"
},
"devDependencies": {
"@angular-builders/custom-webpack": "12.1.0",
"@angular-builders/jest": "12.1.0",
"@angular-eslint/eslint-plugin": "12.1.0",
"@angular/cli": "12.0.4",
"@angular/compiler-cli": "12.0.5",
"@angular/service-worker": "12.0.5",
"@types/jest": "26.0.23",
"@types/node": "15.12.2",
"@types/sockjs-client": "1.5.0",
"@typescript-eslint/eslint-plugin": "4.27.0",
"@typescript-eslint/parser": "4.27.0",
"browser-sync": "2.26.14",
"browser-sync-webpack-plugin": "2.3.0",
"concurrently": "6.2.0",
"copy-webpack-plugin": "9.0.0",
"eslint": "7.28.0",
"eslint-config-prettier": "8.3.0",
"eslint-webpack-plugin": "2.5.4",
"generator-jhipster": "7.1.0",
"husky": "4.3.8",
"jest": "27.0.4",
"jest-date-mock": "1.0.8",
"jest-junit": "12.2.0",
"jest-sonar-reporter": "2.0.0",
"lint-staged": "11.0.0",
"merge-jsons-webpack-plugin": "1.0.21",
"prettier": "2.3.1",
"prettier-plugin-java": "1.2.0",
"prettier-plugin-packagejson": "2.2.11",
"rimraf": "3.0.2",
"ts-jest": "27.0.3",
"typescript": "4.2.4",
"wait-on": "5.3.0",
"webpack-bundle-analyzer": "4.4.2",
"webpack-merge": "5.8.0",
"webpack-notifier": "1.13.0"
},
"engines": {
"node": ">=14.17.1"
},
"cacheDirectories": [
"node_modules"
],
"jestSonar": {
"reportPath": "target/test-results/jest",
"reportFile": "TESTS-results-sonar.xml"
}
}

1174
pom.xml Normal file

File diff suppressed because it is too large Load Diff

30
sonar-project.properties Normal file
View File

@ -0,0 +1,30 @@
sonar.projectKey=DataSurvey
sonar.projectName=DataSurvey generated by jhipster
sonar.projectVersion=1.0
sonar.sources=src/main/
sonar.host.url=http://localhost:9001
sonar.test.inclusions=src/test/**/*.*, src/main/webapp/app/**/*.spec.ts
sonar.coverage.jacoco.xmlReportPaths=target/site/**/jacoco*.xml
sonar.java.codeCoveragePlugin=jacoco
sonar.junit.reportPaths=target/surefire-reports,target/failsafe-reports
sonar.testExecutionReportPaths=target/test-results/jest/TESTS-results-sonar.xml
sonar.javascript.lcov.reportPaths=target/test-results/lcov.info
sonar.sourceEncoding=UTF-8
sonar.exclusions=src/main/webapp/content/**/*.*, src/main/webapp/i18n/*.js, target/classes/static/**/*.*
sonar.issue.ignore.multicriteria=S3437,S4502,S4684,UndocumentedApi
# Rule https://rules.sonarsource.com/java/RSPEC-3437 is ignored, as a JPA-managed field cannot be transient
sonar.issue.ignore.multicriteria.S3437.resourceKey=src/main/java/**/*
sonar.issue.ignore.multicriteria.S3437.ruleKey=squid:S3437
# Rule https://rules.sonarsource.com/java/RSPEC-1176 is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names should be self-explanatory
sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey=src/main/java/**/*
sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey=squid:UndocumentedApi
# Rule https://rules.sonarsource.com/java/RSPEC-4502 is ignored, as for JWT tokens we are not subject to CSRF attack
sonar.issue.ignore.multicriteria.S4502.resourceKey=src/main/java/**/*
sonar.issue.ignore.multicriteria.S4502.ruleKey=squid:S4502
# Rule https://rules.sonarsource.com/java/RSPEC-4684
sonar.issue.ignore.multicriteria.S4684.resourceKey=src/main/java/**/*
sonar.issue.ignore.multicriteria.S4684.ruleKey=java:S4684

28
src/main/docker/app.yml Normal file
View File

@ -0,0 +1,28 @@
# This configuration is intended for development purpose, it's **your** responsibility to harden it for production
version: '3.8'
services:
datasurvey-app:
image: datasurvey
environment:
- _JAVA_OPTIONS=-Xmx512m -Xms256m
- SPRING_PROFILES_ACTIVE=prod,api-docs
- MANAGEMENT_METRICS_EXPORT_PROMETHEUS_ENABLED=true
- SPRING_DATASOURCE_URL=jdbc:mysql://datasurvey-mysql:3306/datasurvey?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC&createDatabaseIfNotExist=true
- SPRING_LIQUIBASE_URL=jdbc:mysql://datasurvey-mysql:3306/datasurvey?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC&createDatabaseIfNotExist=true
- JHIPSTER_SLEEP=30 # gives time for other services to boot before the application
# If you want to expose these ports outside your dev PC,
# remove the "127.0.0.1:" prefix
ports:
- 127.0.0.1:8080:8080
datasurvey-mysql:
image: mysql:8.0.25
# volumes:
# - ~/volumes/jhipster/DataSurvey/mysql/:/var/lib/mysql/
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
- MYSQL_DATABASE=datasurvey
# If you want to expose these ports outside your dev PC,
# remove the "127.0.0.1:" prefix
ports:
- 127.0.0.1:3306:3306
command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8mb4 --explicit_defaults_for_timestamp

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
apiVersion: 1
providers:
- name: 'Prometheus'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: true
options:
path: /etc/grafana/provisioning/dashboards

View File

@ -0,0 +1,50 @@
apiVersion: 1
# list of datasources that should be deleted from the database
deleteDatasources:
- name: Prometheus
orgId: 1
# list of datasources to insert/update depending
# whats available in the database
datasources:
# <string, required> name of the datasource. Required
- name: Prometheus
# <string, required> datasource type. Required
type: prometheus
# <string, required> access mode. direct or proxy. Required
access: proxy
# <int> org id. will default to orgId 1 if not specified
orgId: 1
# <string> url
# On MacOS, replace localhost by host.docker.internal
url: http://localhost:9090
# <string> database password, if used
password:
# <string> database user, if used
user:
# <string> database name, if used
database:
# <bool> enable/disable basic auth
basicAuth: false
# <string> basic auth username
basicAuthUser: admin
# <string> basic auth password
basicAuthPassword: admin
# <bool> enable/disable with credentials headers
withCredentials:
# <bool> mark as default datasource. Max one per org
isDefault: true
# <map> fields that will be converted to json and stored in json_data
jsonData:
graphiteVersion: '1.1'
tlsAuth: false
tlsAuthWithCACert: false
# <string> json object of data that will be encrypted.
secureJsonData:
tlsCACert: '...'
tlsClientCert: '...'
tlsClientKey: '...'
version: 1
# <bool> allow users to edit datasources from the UI.
editable: true

View File

@ -0,0 +1,52 @@
## How to use JHCC docker compose
# To allow JHCC to reach JHipster application from a docker container note that we set the host as host.docker.internal
# To reach the application from a browser, you need to add '127.0.0.1 host.docker.internal' to your hosts file.
### Discovery mode
# JHCC support 3 kinds of discovery mode: Consul, Eureka and static
# In order to use one, please set SPRING_PROFILES_ACTIVE to one (and only one) of this values: consul,eureka,static
### Discovery properties
# According to the discovery mode choose as Spring profile, you have to set the right properties
# please note that current properties are set to run JHCC with default values, personalize them if needed
# and remove those from other modes. You can only have one mode active.
#### Eureka
# - EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE=http://admin:admin@host.docker.internal:8761/eureka/
#### Consul
# - SPRING_CLOUD_CONSUL_HOST=host.docker.internal
# - SPRING_CLOUD_CONSUL_PORT=8500
#### Static
# Add instances to "MyApp"
# - SPRING_CLOUD_DISCOVERY_CLIENT_SIMPLE_INSTANCES_MYAPP_0_URI=http://host.docker.internal:8081
# - SPRING_CLOUD_DISCOVERY_CLIENT_SIMPLE_INSTANCES_MYAPP_1_URI=http://host.docker.internal:8082
# Or add a new application named MyNewApp
# - SPRING_CLOUD_DISCOVERY_CLIENT_SIMPLE_INSTANCES_MYNEWAPP_0_URI=http://host.docker.internal:8080
# This configuration is intended for development purpose, it's **your** responsibility to harden it for production
#### IMPORTANT
# If you choose Consul or Eureka mode:
# Do not forget to remove the prefix "127.0.0.1" in front of their port in order to expose them.
# This is required because JHCC need to communicate with Consul or Eureka.
# - In Consul mode, the ports are in the consul.yml file.
# - In Eureka mode, the ports are in the jhipster-registry.yml file.
version: '3.8'
services:
jhipster-control-center:
image: 'jhipster/jhipster-control-center:v0.5.0'
command:
- /bin/sh
- -c
# Patch /etc/hosts to support resolving host.docker.internal to the internal IP address used by the host in all OSes
- echo "`ip route | grep default | cut -d ' ' -f3` host.docker.internal" | tee -a /etc/hosts > /dev/null && java -jar /jhipster-control-center.jar
environment:
- _JAVA_OPTIONS=-Xmx512m -Xms256m
- SPRING_PROFILES_ACTIVE=prod,api-docs,static
- JHIPSTER_SLEEP=30 # gives time for other services to boot before the application
- SPRING_SECURITY_USER_PASSWORD=admin
# The token should have the same value than the one declared in you Spring configuration under the jhipster.security.authentication.jwt.base64-secret configuration's entry
- JHIPSTER_SECURITY_AUTHENTICATION_JWT_BASE64_SECRET=ZjRmZGRhNzFhNDI5OTRmYjkzZmQ0NzI5Yzc3YTYyODBkMjFjZGY1OWMwNzY5YTJkOTA1ZDY3YzE1MWEwMGRkYzg4ZTNlOGUwNTAzMzdiMWVjNDA4NjFiY2JhNTNhYzhkZjQ3N2MyMmY5YzA5ZTFiNzIzMjJjMTg4MmFlNTUyOTY=
- SPRING_CLOUD_DISCOVERY_CLIENT_SIMPLE_INSTANCES_DATASURVEY_0_URI=http://host.docker.internal:8080
- LOGGING_FILE_NAME=/tmp/jhipster-control-center.log
# If you want to expose these ports outside your dev PC,
# remove the "127.0.0.1:" prefix
ports:
- 127.0.0.1:7419:7419

View File

@ -0,0 +1,4 @@
#!/bin/sh
echo "The application will start in ${JHIPSTER_SLEEP}s..." && sleep ${JHIPSTER_SLEEP}
exec java ${JAVA_OPTS} -noverify -XX:+AlwaysPreTouch -Djava.security.egd=file:/dev/./urandom -cp /app/resources/:/app/classes/:/app/libs/* "org.datasurvey.DataSurveyApp" "$@"

View File

@ -0,0 +1,31 @@
# This configuration is intended for development purpose, it's **your** responsibility to harden it for production
version: '3.8'
services:
datasurvey-prometheus:
image: prom/prometheus:v2.27.1
volumes:
- ./prometheus/:/etc/prometheus/
command:
- '--config.file=/etc/prometheus/prometheus.yml'
# If you want to expose these ports outside your dev PC,
# remove the "127.0.0.1:" prefix
ports:
- 127.0.0.1:9090:9090
# On MacOS, remove next line and replace localhost by host.docker.internal in prometheus/prometheus.yml and
# grafana/provisioning/datasources/datasource.yml
network_mode: 'host' # to test locally running service
datasurvey-grafana:
image: grafana/grafana:8.0.1
volumes:
- ./grafana/provisioning/:/etc/grafana/provisioning/
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
- GF_INSTALL_PLUGINS=grafana-piechart-panel
# If you want to expose these ports outside your dev PC,
# remove the "127.0.0.1:" prefix
ports:
- 127.0.0.1:3000:3000
# On MacOS, remove next line and replace localhost by host.docker.internal in prometheus/prometheus.yml and
# grafana/provisioning/datasources/datasource.yml
network_mode: 'host' # to test locally running service

15
src/main/docker/mysql.yml Normal file
View File

@ -0,0 +1,15 @@
# This configuration is intended for development purpose, it's **your** responsibility to harden it for production
version: '3.8'
services:
datasurvey-mysql:
image: mysql:8.0.25
# volumes:
# - ~/volumes/jhipster/DataSurvey/mysql/:/var/lib/mysql/
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
- MYSQL_DATABASE=datasurvey
# If you want to expose these ports outside your dev PC,
# remove the "127.0.0.1:" prefix
ports:
- 127.0.0.1:3306:3306
command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8mb4 --explicit_defaults_for_timestamp

View File

@ -0,0 +1,31 @@
# Sample global config for monitoring JHipster applications
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
evaluation_interval: 15s # By default, scrape targets every 15 seconds.
# scrape_timeout is set to the global default (10s).
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: 'jhipster'
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# Override the global default and scrape targets from this job every 5 seconds.
scrape_interval: 5s
# scheme defaults to 'http' enable https in case your application is server via https
#scheme: https
# basic auth is not needed by default. See https://www.jhipster.tech/monitoring/#configuring-metrics-forwarding for details
#basic_auth:
# username: admin
# password: admin
metrics_path: /management/prometheus
static_configs:
- targets:
# On MacOS, replace localhost by host.docker.internal
- localhost:8080

13
src/main/docker/sonar.yml Normal file
View File

@ -0,0 +1,13 @@
# This configuration is intended for development purpose, it's **your** responsibility to harden it for production
version: '3.8'
services:
datasurvey-sonar:
image: sonarqube:8.9.1-community
# Authentication is turned off for out of the box experience while trying out SonarQube
# For real use cases delete sonar.forceAuthentication variable or set sonar.forceAuthentication=true
environment:
- sonar.forceAuthentication=false
# If you want to expose these ports outside your dev PC,
# remove the "127.0.0.1:" prefix
ports:
- 127.0.0.1:9001:9000

View File

@ -0,0 +1,19 @@
package org.datasurvey;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import tech.jhipster.config.DefaultProfileUtil;
/**
* This is a helper Java class that provides an alternative to creating a {@code web.xml}.
* This will be invoked only when the application is deployed to a Servlet container like Tomcat, JBoss etc.
*/
public class ApplicationWebXml extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// set a default to use when no profile is configured.
DefaultProfileUtil.addDefaultProfile(application.application());
return application.sources(DataSurveyApp.class);
}
}

View File

@ -0,0 +1,103 @@
package org.datasurvey;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Optional;
import javax.annotation.PostConstruct;
import org.apache.commons.lang3.StringUtils;
import org.datasurvey.config.ApplicationProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.core.env.Environment;
import tech.jhipster.config.DefaultProfileUtil;
import tech.jhipster.config.JHipsterConstants;
@SpringBootApplication
@EnableConfigurationProperties({ LiquibaseProperties.class, ApplicationProperties.class })
public class DataSurveyApp {
private static final Logger log = LoggerFactory.getLogger(DataSurveyApp.class);
private final Environment env;
public DataSurveyApp(Environment env) {
this.env = env;
}
/**
* Initializes DataSurvey.
* <p>
* Spring profiles can be configured with a program argument --spring.profiles.active=your-active-profile
* <p>
* You can find more information on how profiles work with JHipster on <a href="https://www.jhipster.tech/profiles/">https://www.jhipster.tech/profiles/</a>.
*/
@PostConstruct
public void initApplication() {
Collection<String> activeProfiles = Arrays.asList(env.getActiveProfiles());
if (
activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) &&
activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_PRODUCTION)
) {
log.error(
"You have misconfigured your application! It should not run " + "with both the 'dev' and 'prod' profiles at the same time."
);
}
if (
activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) &&
activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_CLOUD)
) {
log.error(
"You have misconfigured your application! It should not " + "run with both the 'dev' and 'cloud' profiles at the same time."
);
}
}
/**
* Main method, used to run the application.
*
* @param args the command line arguments.
*/
public static void main(String[] args) {
SpringApplication app = new SpringApplication(DataSurveyApp.class);
DefaultProfileUtil.addDefaultProfile(app);
Environment env = app.run(args).getEnvironment();
logApplicationStartup(env);
}
private static void logApplicationStartup(Environment env) {
String protocol = Optional.ofNullable(env.getProperty("server.ssl.key-store")).map(key -> "https").orElse("http");
String serverPort = env.getProperty("server.port");
String contextPath = Optional
.ofNullable(env.getProperty("server.servlet.context-path"))
.filter(StringUtils::isNotBlank)
.orElse("/");
String hostAddress = "localhost";
try {
hostAddress = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
log.warn("The host name could not be determined, using `localhost` as fallback");
}
log.info(
"\n----------------------------------------------------------\n\t" +
"Application '{}' is running! Access URLs:\n\t" +
"Local: \t\t{}://localhost:{}{}\n\t" +
"External: \t{}://{}:{}{}\n\t" +
"Profile(s): \t{}\n----------------------------------------------------------",
env.getProperty("spring.application.name"),
protocol,
serverPort,
contextPath,
protocol,
hostAddress,
serverPort,
contextPath,
env.getActiveProfiles()
);
}
}

View File

@ -0,0 +1,13 @@
package org.datasurvey;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.annotation.Generated;
@Generated(value = "JHipster", comments = "Generated by JHipster 7.1.0")
@Retention(RetentionPolicy.SOURCE)
@Target({ ElementType.TYPE })
public @interface GeneratedByJHipster {
}

View File

@ -0,0 +1,111 @@
package org.datasurvey.aop.logging;
import java.util.Arrays;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.env.Environment;
import org.springframework.core.env.Profiles;
import tech.jhipster.config.JHipsterConstants;
/**
* Aspect for logging execution of service and repository Spring components.
*
* By default, it only runs with the "dev" profile.
*/
@Aspect
public class LoggingAspect {
private final Environment env;
public LoggingAspect(Environment env) {
this.env = env;
}
/**
* Pointcut that matches all repositories, services and Web REST endpoints.
*/
@Pointcut(
"within(@org.springframework.stereotype.Repository *)" +
" || within(@org.springframework.stereotype.Service *)" +
" || within(@org.springframework.web.bind.annotation.RestController *)"
)
public void springBeanPointcut() {
// Method is empty as this is just a Pointcut, the implementations are in the advices.
}
/**
* Pointcut that matches all Spring beans in the application's main packages.
*/
@Pointcut("within(org.datasurvey.repository..*)" + " || within(org.datasurvey.service..*)" + " || within(org.datasurvey.web.rest..*)")
public void applicationPackagePointcut() {
// Method is empty as this is just a Pointcut, the implementations are in the advices.
}
/**
* Retrieves the {@link Logger} associated to the given {@link JoinPoint}.
*
* @param joinPoint join point we want the logger for.
* @return {@link Logger} associated to the given {@link JoinPoint}.
*/
private Logger logger(JoinPoint joinPoint) {
return LoggerFactory.getLogger(joinPoint.getSignature().getDeclaringTypeName());
}
/**
* Advice that logs methods throwing exceptions.
*
* @param joinPoint join point for advice.
* @param e exception.
*/
@AfterThrowing(pointcut = "applicationPackagePointcut() && springBeanPointcut()", throwing = "e")
public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
if (env.acceptsProfiles(Profiles.of(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT))) {
logger(joinPoint)
.error(
"Exception in {}() with cause = \'{}\' and exception = \'{}\'",
joinPoint.getSignature().getName(),
e.getCause() != null ? e.getCause() : "NULL",
e.getMessage(),
e
);
} else {
logger(joinPoint)
.error(
"Exception in {}() with cause = {}",
joinPoint.getSignature().getName(),
e.getCause() != null ? e.getCause() : "NULL"
);
}
}
/**
* Advice that logs when a method is entered and exited.
*
* @param joinPoint join point for advice.
* @return result.
* @throws Throwable throws {@link IllegalArgumentException}.
*/
@Around("applicationPackagePointcut() && springBeanPointcut()")
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
Logger log = logger(joinPoint);
if (log.isDebugEnabled()) {
log.debug("Enter: {}() with argument[s] = {}", joinPoint.getSignature().getName(), Arrays.toString(joinPoint.getArgs()));
}
try {
Object result = joinPoint.proceed();
if (log.isDebugEnabled()) {
log.debug("Exit: {}() with result = {}", joinPoint.getSignature().getName(), result);
}
return result;
} catch (IllegalArgumentException e) {
log.error("Illegal argument: {} in {}()", Arrays.toString(joinPoint.getArgs()), joinPoint.getSignature().getName());
throw e;
}
}
}

View File

@ -0,0 +1,12 @@
package org.datasurvey.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Properties specific to Data Survey.
* <p>
* Properties are configured in the {@code application.yml} file.
* See {@link tech.jhipster.config.JHipsterProperties} for a good example.
*/
@ConfigurationProperties(prefix = "application", ignoreUnknownFields = false)
public class ApplicationProperties {}

View File

@ -0,0 +1,46 @@
package org.datasurvey.config;
import java.util.concurrent.Executor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;
import org.springframework.boot.autoconfigure.task.TaskExecutionProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import tech.jhipster.async.ExceptionHandlingAsyncTaskExecutor;
@Configuration
@EnableAsync
@EnableScheduling
public class AsyncConfiguration implements AsyncConfigurer {
private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class);
private final TaskExecutionProperties taskExecutionProperties;
public AsyncConfiguration(TaskExecutionProperties taskExecutionProperties) {
this.taskExecutionProperties = taskExecutionProperties;
}
@Override
@Bean(name = "taskExecutor")
public Executor getAsyncExecutor() {
log.debug("Creating Async Task Executor");
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(taskExecutionProperties.getPool().getCoreSize());
executor.setMaxPoolSize(taskExecutionProperties.getPool().getMaxSize());
executor.setQueueCapacity(taskExecutionProperties.getPool().getQueueCapacity());
executor.setThreadNamePrefix(taskExecutionProperties.getThreadNamePrefix());
return new ExceptionHandlingAsyncTaskExecutor(executor);
}
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return new SimpleAsyncUncaughtExceptionHandler();
}
}

View File

@ -0,0 +1,106 @@
package org.datasurvey.config;
import java.time.Duration;
import org.ehcache.config.builders.*;
import org.ehcache.jsr107.Eh107Configuration;
import org.hibernate.cache.jcache.ConfigSettings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
import org.springframework.boot.autoconfigure.orm.jpa.HibernatePropertiesCustomizer;
import org.springframework.boot.info.BuildProperties;
import org.springframework.boot.info.GitProperties;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.context.annotation.*;
import tech.jhipster.config.JHipsterProperties;
import tech.jhipster.config.cache.PrefixedKeyGenerator;
@Configuration
@EnableCaching
public class CacheConfiguration {
private GitProperties gitProperties;
private BuildProperties buildProperties;
private final javax.cache.configuration.Configuration<Object, Object> jcacheConfiguration;
public CacheConfiguration(JHipsterProperties jHipsterProperties) {
JHipsterProperties.Cache.Ehcache ehcache = jHipsterProperties.getCache().getEhcache();
jcacheConfiguration =
Eh107Configuration.fromEhcacheCacheConfiguration(
CacheConfigurationBuilder
.newCacheConfigurationBuilder(Object.class, Object.class, ResourcePoolsBuilder.heap(ehcache.getMaxEntries()))
.withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofSeconds(ehcache.getTimeToLiveSeconds())))
.build()
);
}
@Bean
public HibernatePropertiesCustomizer hibernatePropertiesCustomizer(javax.cache.CacheManager cacheManager) {
return hibernateProperties -> hibernateProperties.put(ConfigSettings.CACHE_MANAGER, cacheManager);
}
@Bean
public JCacheManagerCustomizer cacheManagerCustomizer() {
return cm -> {
createCache(cm, org.datasurvey.repository.UserRepository.USERS_BY_LOGIN_CACHE);
createCache(cm, org.datasurvey.repository.UserRepository.USERS_BY_EMAIL_CACHE);
createCache(cm, org.datasurvey.domain.User.class.getName());
createCache(cm, org.datasurvey.domain.Authority.class.getName());
createCache(cm, org.datasurvey.domain.User.class.getName() + ".authorities");
createCache(cm, org.datasurvey.domain.ParametroAplicacion.class.getName());
createCache(cm, org.datasurvey.domain.UsuarioExtra.class.getName());
createCache(cm, org.datasurvey.domain.UsuarioExtra.class.getName() + ".encuestas");
createCache(cm, org.datasurvey.domain.UsuarioExtra.class.getName() + ".usuarioEncuestas");
createCache(cm, org.datasurvey.domain.UsuarioExtra.class.getName() + ".plantillas");
createCache(cm, org.datasurvey.domain.Encuesta.class.getName());
createCache(cm, org.datasurvey.domain.Encuesta.class.getName() + ".usuarioEncuestas");
createCache(cm, org.datasurvey.domain.Encuesta.class.getName() + ".ePreguntaAbiertas");
createCache(cm, org.datasurvey.domain.Encuesta.class.getName() + ".ePreguntaCerradas");
createCache(cm, org.datasurvey.domain.EPreguntaAbierta.class.getName());
createCache(cm, org.datasurvey.domain.EPreguntaAbierta.class.getName() + ".ePreguntaAbiertaRespuestas");
createCache(cm, org.datasurvey.domain.EPreguntaAbiertaRespuesta.class.getName());
createCache(cm, org.datasurvey.domain.EPreguntaCerrada.class.getName());
createCache(cm, org.datasurvey.domain.EPreguntaCerrada.class.getName() + ".ePreguntaCerradaOpcions");
createCache(cm, org.datasurvey.domain.EPreguntaCerradaOpcion.class.getName());
createCache(cm, org.datasurvey.domain.UsuarioEncuesta.class.getName());
createCache(cm, org.datasurvey.domain.Categoria.class.getName());
createCache(cm, org.datasurvey.domain.Categoria.class.getName() + ".encuestas");
createCache(cm, org.datasurvey.domain.Categoria.class.getName() + ".plantillas");
createCache(cm, org.datasurvey.domain.Factura.class.getName());
createCache(cm, org.datasurvey.domain.Plantilla.class.getName());
createCache(cm, org.datasurvey.domain.Plantilla.class.getName() + ".pPreguntaCerradas");
createCache(cm, org.datasurvey.domain.Plantilla.class.getName() + ".pPreguntaAbiertas");
createCache(cm, org.datasurvey.domain.Plantilla.class.getName() + ".usuarioExtras");
createCache(cm, org.datasurvey.domain.PPreguntaAbierta.class.getName());
createCache(cm, org.datasurvey.domain.PPreguntaCerrada.class.getName());
createCache(cm, org.datasurvey.domain.PPreguntaCerrada.class.getName() + ".pPreguntaCerradaOpcions");
createCache(cm, org.datasurvey.domain.PPreguntaCerradaOpcion.class.getName());
// jhipster-needle-ehcache-add-entry
};
}
private void createCache(javax.cache.CacheManager cm, String cacheName) {
javax.cache.Cache<Object, Object> cache = cm.getCache(cacheName);
if (cache != null) {
cache.clear();
} else {
cm.createCache(cacheName, jcacheConfiguration);
}
}
@Autowired(required = false)
public void setGitProperties(GitProperties gitProperties) {
this.gitProperties = gitProperties;
}
@Autowired(required = false)
public void setBuildProperties(BuildProperties buildProperties) {
this.buildProperties = buildProperties;
}
@Bean
public KeyGenerator keyGenerator() {
return new PrefixedKeyGenerator(this.gitProperties, this.buildProperties);
}
}

View File

@ -0,0 +1,15 @@
package org.datasurvey.config;
/**
* Application constants.
*/
public final class Constants {
// Regex for acceptable logins
public static final String LOGIN_REGEX = "^(?>[a-zA-Z0-9!$&*+=?^_`{|}~.-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*)|(?>[_.@A-Za-z0-9-]+)$";
public static final String SYSTEM = "system";
public static final String DEFAULT_LANGUAGE = "es";
private Constants() {}
}

View File

@ -0,0 +1,16 @@
package org.datasurvey.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import tech.jhipster.config.JHipsterConstants;
@Configuration
@EnableJpaRepositories("org.datasurvey.repository")
@EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware")
@EnableTransactionManagement
public class DatabaseConfiguration {}

View File

@ -0,0 +1,20 @@
package org.datasurvey.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* Configure the converters to use the ISO format for dates by default.
*/
@Configuration
public class DateTimeFormatConfiguration implements WebMvcConfigurer {
@Override
public void addFormatters(FormatterRegistry registry) {
DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar();
registrar.setUseIsoFormat(true);
registrar.registerFormatters(registry);
}
}

View File

@ -0,0 +1,51 @@
package org.datasurvey.config;
import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.zalando.problem.ProblemModule;
import org.zalando.problem.violations.ConstraintViolationProblemModule;
@Configuration
public class JacksonConfiguration {
/**
* Support for Java date and time API.
* @return the corresponding Jackson module.
*/
@Bean
public JavaTimeModule javaTimeModule() {
return new JavaTimeModule();
}
@Bean
public Jdk8Module jdk8TimeModule() {
return new Jdk8Module();
}
/*
* Support for Hibernate types in Jackson.
*/
@Bean
public Hibernate5Module hibernate5Module() {
return new Hibernate5Module();
}
/*
* Module for serialization/deserialization of RFC7807 Problem.
*/
@Bean
public ProblemModule problemModule() {
return new ProblemModule();
}
/*
* Module for serialization/deserialization of ConstraintViolationProblem.
*/
@Bean
public ConstraintViolationProblemModule constraintViolationProblemModule() {
return new ConstraintViolationProblemModule();
}
}

View File

@ -0,0 +1,69 @@
package org.datasurvey.config;
import java.util.concurrent.Executor;
import javax.sql.DataSource;
import liquibase.integration.spring.SpringLiquibase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseDataSource;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.env.Profiles;
import tech.jhipster.config.JHipsterConstants;
import tech.jhipster.config.liquibase.SpringLiquibaseUtil;
@Configuration
public class LiquibaseConfiguration {
private final Logger log = LoggerFactory.getLogger(LiquibaseConfiguration.class);
private final Environment env;
public LiquibaseConfiguration(Environment env) {
this.env = env;
}
@Bean
public SpringLiquibase liquibase(
@Qualifier("taskExecutor") Executor executor,
@LiquibaseDataSource ObjectProvider<DataSource> liquibaseDataSource,
LiquibaseProperties liquibaseProperties,
ObjectProvider<DataSource> dataSource,
DataSourceProperties dataSourceProperties
) {
// If you don't want Liquibase to start asynchronously, substitute by this:
// SpringLiquibase liquibase = SpringLiquibaseUtil.createSpringLiquibase(liquibaseDataSource.getIfAvailable(), liquibaseProperties, dataSource.getIfUnique(), dataSourceProperties);
SpringLiquibase liquibase = SpringLiquibaseUtil.createAsyncSpringLiquibase(
this.env,
executor,
liquibaseDataSource.getIfAvailable(),
liquibaseProperties,
dataSource.getIfUnique(),
dataSourceProperties
);
liquibase.setChangeLog("classpath:config/liquibase/master.xml");
liquibase.setContexts(liquibaseProperties.getContexts());
liquibase.setDefaultSchema(liquibaseProperties.getDefaultSchema());
liquibase.setLiquibaseSchema(liquibaseProperties.getLiquibaseSchema());
liquibase.setLiquibaseTablespace(liquibaseProperties.getLiquibaseTablespace());
liquibase.setDatabaseChangeLogLockTable(liquibaseProperties.getDatabaseChangeLogLockTable());
liquibase.setDatabaseChangeLogTable(liquibaseProperties.getDatabaseChangeLogTable());
liquibase.setDropFirst(liquibaseProperties.isDropFirst());
liquibase.setLabels(liquibaseProperties.getLabels());
liquibase.setChangeLogParameters(liquibaseProperties.getParameters());
liquibase.setRollbackFile(liquibaseProperties.getRollbackFile());
liquibase.setTestRollbackOnUpdate(liquibaseProperties.isTestRollbackOnUpdate());
if (env.acceptsProfiles(Profiles.of(JHipsterConstants.SPRING_PROFILE_NO_LIQUIBASE))) {
liquibase.setShouldRun(false);
} else {
liquibase.setShouldRun(liquibaseProperties.isEnabled());
log.debug("Configuring Liquibase");
}
return liquibase;
}
}

View File

@ -0,0 +1,26 @@
package org.datasurvey.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.*;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import tech.jhipster.config.locale.AngularCookieLocaleResolver;
@Configuration
public class LocaleConfiguration implements WebMvcConfigurer {
@Bean
public LocaleResolver localeResolver() {
AngularCookieLocaleResolver cookieLocaleResolver = new AngularCookieLocaleResolver();
cookieLocaleResolver.setCookieName("NG_TRANSLATE_LANG_KEY");
return cookieLocaleResolver;
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
localeChangeInterceptor.setParamName("language");
registry.addInterceptor(localeChangeInterceptor);
}
}

View File

@ -0,0 +1,17 @@
package org.datasurvey.config;
import org.datasurvey.aop.logging.LoggingAspect;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
import tech.jhipster.config.JHipsterConstants;
@Configuration
@EnableAspectJAutoProxy
public class LoggingAspectConfiguration {
@Bean
@Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)
public LoggingAspect loggingAspect(Environment env) {
return new LoggingAspect(env);
}
}

View File

@ -0,0 +1,47 @@
package org.datasurvey.config;
import static tech.jhipster.config.logging.LoggingUtils.*;
import ch.qos.logback.classic.LoggerContext;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.config.JHipsterProperties;
/*
* Configures the console and Logstash log appenders from the app properties
*/
@Configuration
public class LoggingConfiguration {
public LoggingConfiguration(
@Value("${spring.application.name}") String appName,
@Value("${server.port}") String serverPort,
JHipsterProperties jHipsterProperties,
ObjectMapper mapper
) throws JsonProcessingException {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
Map<String, String> map = new HashMap<>();
map.put("app_name", appName);
map.put("app_port", serverPort);
String customFields = mapper.writeValueAsString(map);
JHipsterProperties.Logging loggingProperties = jHipsterProperties.getLogging();
JHipsterProperties.Logging.Logstash logstashProperties = loggingProperties.getLogstash();
if (loggingProperties.isUseJsonFormat()) {
addJsonConsoleAppender(context, customFields);
}
if (logstashProperties.isEnabled()) {
addLogstashTcpSocketAppender(context, customFields, logstashProperties);
}
if (loggingProperties.isUseJsonFormat() || logstashProperties.isEnabled()) {
addContextListener(context, customFields, loggingProperties);
}
}
}

View File

@ -0,0 +1,111 @@
package org.datasurvey.config;
import org.datasurvey.security.*;
import org.datasurvey.security.jwt.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.header.writers.ReferrerPolicyHeaderWriter;
import org.springframework.web.filter.CorsFilter;
import org.zalando.problem.spring.web.advice.security.SecurityProblemSupport;
import tech.jhipster.config.JHipsterProperties;
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
@Import(SecurityProblemSupport.class)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
private final JHipsterProperties jHipsterProperties;
private final TokenProvider tokenProvider;
private final CorsFilter corsFilter;
private final SecurityProblemSupport problemSupport;
public SecurityConfiguration(
TokenProvider tokenProvider,
CorsFilter corsFilter,
JHipsterProperties jHipsterProperties,
SecurityProblemSupport problemSupport
) {
this.tokenProvider = tokenProvider;
this.corsFilter = corsFilter;
this.problemSupport = problemSupport;
this.jHipsterProperties = jHipsterProperties;
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Override
public void configure(WebSecurity web) {
web
.ignoring()
.antMatchers(HttpMethod.OPTIONS, "/**")
.antMatchers("/app/**/*.{js,html}")
.antMatchers("/i18n/**")
.antMatchers("/content/**")
.antMatchers("/swagger-ui/**")
.antMatchers("/test/**");
}
@Override
public void configure(HttpSecurity http) throws Exception {
// @formatter:off
http
.csrf()
.disable()
.addFilterBefore(corsFilter, UsernamePasswordAuthenticationFilter.class)
.exceptionHandling()
.authenticationEntryPoint(problemSupport)
.accessDeniedHandler(problemSupport)
.and()
.headers()
.contentSecurityPolicy(jHipsterProperties.getSecurity().getContentSecurityPolicy())
.and()
.referrerPolicy(ReferrerPolicyHeaderWriter.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN)
.and()
.featurePolicy("geolocation 'none'; midi 'none'; sync-xhr 'none'; microphone 'none'; camera 'none'; magnetometer 'none'; gyroscope 'none'; fullscreen 'self'; payment 'none'")
.and()
.frameOptions()
.deny()
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
.antMatchers("/api/authenticate").permitAll()
.antMatchers("/api/register").permitAll()
.antMatchers("/api/activate").permitAll()
.antMatchers("/api/account/reset-password/init").permitAll()
.antMatchers("/api/account/reset-password/finish").permitAll()
.antMatchers("/api/admin/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/api/**").authenticated()
.antMatchers("/websocket/**").authenticated()
.antMatchers("/management/health").permitAll()
.antMatchers("/management/health/**").permitAll()
.antMatchers("/management/info").permitAll()
.antMatchers("/management/prometheus").permitAll()
.antMatchers("/management/**").hasAuthority(AuthoritiesConstants.ADMIN)
.and()
.httpBasic()
.and()
.apply(securityConfigurerAdapter());
// @formatter:on
}
private JWTConfigurer securityConfigurerAdapter() {
return new JWTConfigurer(tokenProvider);
}
}

View File

@ -0,0 +1,59 @@
package org.datasurvey.config;
import java.util.concurrent.TimeUnit;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.http.CacheControl;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import tech.jhipster.config.JHipsterConstants;
import tech.jhipster.config.JHipsterProperties;
@Configuration
@Profile({ JHipsterConstants.SPRING_PROFILE_PRODUCTION })
public class StaticResourcesWebConfiguration implements WebMvcConfigurer {
protected static final String[] RESOURCE_LOCATIONS = new String[] {
"classpath:/static/",
"classpath:/static/content/",
"classpath:/static/i18n/",
};
protected static final String[] RESOURCE_PATHS = new String[] {
"/*.js",
"/*.css",
"/*.svg",
"/*.png",
"*.ico",
"/content/**",
"/i18n/*",
};
private final JHipsterProperties jhipsterProperties;
public StaticResourcesWebConfiguration(JHipsterProperties jHipsterProperties) {
this.jhipsterProperties = jHipsterProperties;
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
ResourceHandlerRegistration resourceHandlerRegistration = appendResourceHandler(registry);
initializeResourceHandler(resourceHandlerRegistration);
}
protected ResourceHandlerRegistration appendResourceHandler(ResourceHandlerRegistry registry) {
return registry.addResourceHandler(RESOURCE_PATHS);
}
protected void initializeResourceHandler(ResourceHandlerRegistration resourceHandlerRegistration) {
resourceHandlerRegistration.addResourceLocations(RESOURCE_LOCATIONS).setCacheControl(getCacheControl());
}
protected CacheControl getCacheControl() {
return CacheControl.maxAge(getJHipsterHttpCacheProperty(), TimeUnit.DAYS).cachePublic();
}
private int getJHipsterHttpCacheProperty() {
return jhipsterProperties.getHttp().getCache().getTimeToLiveInDays();
}
}

View File

@ -0,0 +1,109 @@
package org.datasurvey.config;
import static java.net.URLDecoder.decode;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
import java.util.*;
import javax.servlet.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.web.server.*;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.env.Profiles;
import org.springframework.util.CollectionUtils;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import tech.jhipster.config.JHipsterConstants;
import tech.jhipster.config.JHipsterProperties;
/**
* Configuration of web application with Servlet 3.0 APIs.
*/
@Configuration
public class WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> {
private final Logger log = LoggerFactory.getLogger(WebConfigurer.class);
private final Environment env;
private final JHipsterProperties jHipsterProperties;
public WebConfigurer(Environment env, JHipsterProperties jHipsterProperties) {
this.env = env;
this.jHipsterProperties = jHipsterProperties;
}
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
if (env.getActiveProfiles().length != 0) {
log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiveProfiles());
}
log.info("Web application fully configured");
}
/**
* Customize the Servlet engine: Mime types, the document root, the cache.
*/
@Override
public void customize(WebServerFactory server) {
// When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
setLocationForStaticAssets(server);
}
private void setLocationForStaticAssets(WebServerFactory server) {
if (server instanceof ConfigurableServletWebServerFactory) {
ConfigurableServletWebServerFactory servletWebServer = (ConfigurableServletWebServerFactory) server;
File root;
String prefixPath = resolvePathPrefix();
root = new File(prefixPath + "target/classes/static/");
if (root.exists() && root.isDirectory()) {
servletWebServer.setDocumentRoot(root);
}
}
}
/**
* Resolve path prefix to static resources.
*/
private String resolvePathPrefix() {
String fullExecutablePath;
try {
fullExecutablePath = decode(this.getClass().getResource("").getPath(), StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
/* try without decoding if this ever happens */
fullExecutablePath = this.getClass().getResource("").getPath();
}
String rootPath = Paths.get(".").toUri().normalize().getPath();
String extractedPath = fullExecutablePath.replace(rootPath, "");
int extractionEndIndex = extractedPath.indexOf("target/");
if (extractionEndIndex <= 0) {
return "";
}
return extractedPath.substring(0, extractionEndIndex);
}
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = jHipsterProperties.getCors();
if (!CollectionUtils.isEmpty(config.getAllowedOrigins()) || !CollectionUtils.isEmpty(config.getAllowedOriginPatterns())) {
log.debug("Registering CORS filter");
source.registerCorsConfiguration("/api/**", config);
source.registerCorsConfiguration("/management/**", config);
source.registerCorsConfiguration("/v2/api-docs", config);
source.registerCorsConfiguration("/v3/api-docs", config);
source.registerCorsConfiguration("/swagger-resources", config);
source.registerCorsConfiguration("/swagger-ui/**", config);
}
return new CorsFilter(source);
}
}

View File

@ -0,0 +1,90 @@
package org.datasurvey.config;
import java.security.Principal;
import java.util.*;
import org.datasurvey.security.AuthoritiesConstants;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.server.*;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.config.annotation.*;
import org.springframework.web.socket.server.HandshakeInterceptor;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import tech.jhipster.config.JHipsterProperties;
@Configuration
@EnableWebSocketMessageBroker
public class WebsocketConfiguration implements WebSocketMessageBrokerConfigurer {
public static final String IP_ADDRESS = "IP_ADDRESS";
private final JHipsterProperties jHipsterProperties;
public WebsocketConfiguration(JHipsterProperties jHipsterProperties) {
this.jHipsterProperties = jHipsterProperties;
}
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config.enableSimpleBroker("/topic");
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
String[] allowedOrigins = Optional
.ofNullable(jHipsterProperties.getCors().getAllowedOrigins())
.map(origins -> origins.toArray(new String[0]))
.orElse(new String[0]);
registry
.addEndpoint("/websocket/tracker")
.setHandshakeHandler(defaultHandshakeHandler())
.setAllowedOrigins(allowedOrigins)
.withSockJS()
.setInterceptors(httpSessionHandshakeInterceptor());
}
@Bean
public HandshakeInterceptor httpSessionHandshakeInterceptor() {
return new HandshakeInterceptor() {
@Override
public boolean beforeHandshake(
ServerHttpRequest request,
ServerHttpResponse response,
WebSocketHandler wsHandler,
Map<String, Object> attributes
) throws Exception {
if (request instanceof ServletServerHttpRequest) {
ServletServerHttpRequest servletRequest = (ServletServerHttpRequest) request;
attributes.put(IP_ADDRESS, servletRequest.getRemoteAddress());
}
return true;
}
@Override
public void afterHandshake(
ServerHttpRequest request,
ServerHttpResponse response,
WebSocketHandler wsHandler,
Exception exception
) {}
};
}
private DefaultHandshakeHandler defaultHandshakeHandler() {
return new DefaultHandshakeHandler() {
@Override
protected Principal determineUser(ServerHttpRequest request, WebSocketHandler wsHandler, Map<String, Object> attributes) {
Principal principal = request.getPrincipal();
if (principal == null) {
Collection<SimpleGrantedAuthority> authorities = new ArrayList<>();
authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.ANONYMOUS));
principal = new AnonymousAuthenticationToken("WebsocketConfiguration", "anonymous", authorities);
}
return principal;
}
};
}
}

View File

@ -0,0 +1,40 @@
package org.datasurvey.config;
import org.datasurvey.security.AuthoritiesConstants;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.SimpMessageType;
import org.springframework.security.config.annotation.web.messaging.MessageSecurityMetadataSourceRegistry;
import org.springframework.security.config.annotation.web.socket.AbstractSecurityWebSocketMessageBrokerConfigurer;
@Configuration
public class WebsocketSecurityConfiguration extends AbstractSecurityWebSocketMessageBrokerConfigurer {
@Override
protected void configureInbound(MessageSecurityMetadataSourceRegistry messages) {
messages
.nullDestMatcher()
.authenticated()
.simpDestMatchers("/topic/tracker")
.hasAuthority(AuthoritiesConstants.ADMIN)
// matches any destination that starts with /topic/
// (i.e. cannot send messages directly to /topic/)
// (i.e. cannot subscribe to /topic/messages/* to get messages sent to
// /topic/messages-user<id>)
.simpDestMatchers("/topic/**")
.authenticated()
// message types other than MESSAGE and SUBSCRIBE
.simpTypeMatchers(SimpMessageType.MESSAGE, SimpMessageType.SUBSCRIBE)
.denyAll()
// catch all
.anyMessage()
.denyAll();
}
/**
* Disables CSRF for Websockets.
*/
@Override
protected boolean sameOriginDisabled() {
return true;
}
}

View File

@ -0,0 +1,4 @@
/**
* Spring Framework configuration files.
*/
package org.datasurvey.config;

View File

@ -0,0 +1,76 @@
package org.datasurvey.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.io.Serializable;
import java.time.Instant;
import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
/**
* Base abstract class for entities which will hold definitions for created, last modified, created by,
* last modified by attributes.
*/
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class AbstractAuditingEntity implements Serializable {
private static final long serialVersionUID = 1L;
@CreatedBy
@Column(name = "created_by", nullable = false, length = 50, updatable = false)
@JsonIgnore
private String createdBy;
@CreatedDate
@Column(name = "created_date", updatable = false)
@JsonIgnore
private Instant createdDate = Instant.now();
@LastModifiedBy
@Column(name = "last_modified_by", length = 50)
@JsonIgnore
private String lastModifiedBy;
@LastModifiedDate
@Column(name = "last_modified_date")
@JsonIgnore
private Instant lastModifiedDate = Instant.now();
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Instant getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Instant createdDate) {
this.createdDate = createdDate;
}
public String getLastModifiedBy() {
return lastModifiedBy;
}
public void setLastModifiedBy(String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}
public Instant getLastModifiedDate() {
return lastModifiedDate;
}
public void setLastModifiedDate(Instant lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
}

View File

@ -0,0 +1,61 @@
package org.datasurvey.domain;
import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* An authority (a security role) used by Spring Security.
*/
@Entity
@Table(name = "jhi_authority")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Authority implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull
@Size(max = 50)
@Id
@Column(length = 50)
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Authority)) {
return false;
}
return Objects.equals(name, ((Authority) o).name);
}
@Override
public int hashCode() {
return Objects.hashCode(name);
}
// prettier-ignore
@Override
public String toString() {
return "Authority{" +
"name='" + name + '\'' +
"}";
}
}

View File

@ -0,0 +1,179 @@
package org.datasurvey.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.datasurvey.domain.enumeration.EstadoCategoria;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A Categoria.
*/
@Entity
@Table(name = "categoria")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Categoria implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Column(name = "nombre", nullable = false)
private String nombre;
@NotNull
@Enumerated(EnumType.STRING)
@Column(name = "estado", nullable = false)
private EstadoCategoria estado;
@OneToMany(mappedBy = "categoria")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JsonIgnoreProperties(
value = { "usuarioEncuestas", "ePreguntaAbiertas", "ePreguntaCerradas", "categoria", "usuarioExtra" },
allowSetters = true
)
private Set<Encuesta> encuestas = new HashSet<>();
@OneToMany(mappedBy = "categoria")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JsonIgnoreProperties(value = { "pPreguntaCerradas", "pPreguntaAbiertas", "categoria", "usuarioExtras" }, allowSetters = true)
private Set<Plantilla> plantillas = new HashSet<>();
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Categoria id(Long id) {
this.id = id;
return this;
}
public String getNombre() {
return this.nombre;
}
public Categoria nombre(String nombre) {
this.nombre = nombre;
return this;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public EstadoCategoria getEstado() {
return this.estado;
}
public Categoria estado(EstadoCategoria estado) {
this.estado = estado;
return this;
}
public void setEstado(EstadoCategoria estado) {
this.estado = estado;
}
public Set<Encuesta> getEncuestas() {
return this.encuestas;
}
public Categoria encuestas(Set<Encuesta> encuestas) {
this.setEncuestas(encuestas);
return this;
}
public Categoria addEncuesta(Encuesta encuesta) {
this.encuestas.add(encuesta);
encuesta.setCategoria(this);
return this;
}
public Categoria removeEncuesta(Encuesta encuesta) {
this.encuestas.remove(encuesta);
encuesta.setCategoria(null);
return this;
}
public void setEncuestas(Set<Encuesta> encuestas) {
if (this.encuestas != null) {
this.encuestas.forEach(i -> i.setCategoria(null));
}
if (encuestas != null) {
encuestas.forEach(i -> i.setCategoria(this));
}
this.encuestas = encuestas;
}
public Set<Plantilla> getPlantillas() {
return this.plantillas;
}
public Categoria plantillas(Set<Plantilla> plantillas) {
this.setPlantillas(plantillas);
return this;
}
public Categoria addPlantilla(Plantilla plantilla) {
this.plantillas.add(plantilla);
plantilla.setCategoria(this);
return this;
}
public Categoria removePlantilla(Plantilla plantilla) {
this.plantillas.remove(plantilla);
plantilla.setCategoria(null);
return this;
}
public void setPlantillas(Set<Plantilla> plantillas) {
if (this.plantillas != null) {
this.plantillas.forEach(i -> i.setCategoria(null));
}
if (plantillas != null) {
plantillas.forEach(i -> i.setCategoria(this));
}
this.plantillas = plantillas;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Categoria)) {
return false;
}
return id != null && id.equals(((Categoria) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "Categoria{" +
"id=" + getId() +
", nombre='" + getNombre() + "'" +
", estado='" + getEstado() + "'" +
"}";
}
}

View File

@ -0,0 +1,177 @@
package org.datasurvey.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A EPreguntaAbierta.
*/
@Entity
@Table(name = "e_pregunta_abierta")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class EPreguntaAbierta implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Size(min = 1, max = 500)
@Column(name = "nombre", length = 500, nullable = false)
private String nombre;
@NotNull
@Column(name = "opcional", nullable = false)
private Boolean opcional;
@NotNull
@Column(name = "orden", nullable = false)
private Integer orden;
@OneToMany(mappedBy = "ePreguntaAbierta")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JsonIgnoreProperties(value = { "ePreguntaAbierta" }, allowSetters = true)
private Set<EPreguntaAbiertaRespuesta> ePreguntaAbiertaRespuestas = new HashSet<>();
@ManyToOne
@JsonIgnoreProperties(
value = { "usuarioEncuestas", "ePreguntaAbiertas", "ePreguntaCerradas", "categoria", "usuarioExtra" },
allowSetters = true
)
private Encuesta encuesta;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public EPreguntaAbierta id(Long id) {
this.id = id;
return this;
}
public String getNombre() {
return this.nombre;
}
public EPreguntaAbierta nombre(String nombre) {
this.nombre = nombre;
return this;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public Boolean getOpcional() {
return this.opcional;
}
public EPreguntaAbierta opcional(Boolean opcional) {
this.opcional = opcional;
return this;
}
public void setOpcional(Boolean opcional) {
this.opcional = opcional;
}
public Integer getOrden() {
return this.orden;
}
public EPreguntaAbierta orden(Integer orden) {
this.orden = orden;
return this;
}
public void setOrden(Integer orden) {
this.orden = orden;
}
public Set<EPreguntaAbiertaRespuesta> getEPreguntaAbiertaRespuestas() {
return this.ePreguntaAbiertaRespuestas;
}
public EPreguntaAbierta ePreguntaAbiertaRespuestas(Set<EPreguntaAbiertaRespuesta> ePreguntaAbiertaRespuestas) {
this.setEPreguntaAbiertaRespuestas(ePreguntaAbiertaRespuestas);
return this;
}
public EPreguntaAbierta addEPreguntaAbiertaRespuesta(EPreguntaAbiertaRespuesta ePreguntaAbiertaRespuesta) {
this.ePreguntaAbiertaRespuestas.add(ePreguntaAbiertaRespuesta);
ePreguntaAbiertaRespuesta.setEPreguntaAbierta(this);
return this;
}
public EPreguntaAbierta removeEPreguntaAbiertaRespuesta(EPreguntaAbiertaRespuesta ePreguntaAbiertaRespuesta) {
this.ePreguntaAbiertaRespuestas.remove(ePreguntaAbiertaRespuesta);
ePreguntaAbiertaRespuesta.setEPreguntaAbierta(null);
return this;
}
public void setEPreguntaAbiertaRespuestas(Set<EPreguntaAbiertaRespuesta> ePreguntaAbiertaRespuestas) {
if (this.ePreguntaAbiertaRespuestas != null) {
this.ePreguntaAbiertaRespuestas.forEach(i -> i.setEPreguntaAbierta(null));
}
if (ePreguntaAbiertaRespuestas != null) {
ePreguntaAbiertaRespuestas.forEach(i -> i.setEPreguntaAbierta(this));
}
this.ePreguntaAbiertaRespuestas = ePreguntaAbiertaRespuestas;
}
public Encuesta getEncuesta() {
return this.encuesta;
}
public EPreguntaAbierta encuesta(Encuesta encuesta) {
this.setEncuesta(encuesta);
return this;
}
public void setEncuesta(Encuesta encuesta) {
this.encuesta = encuesta;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof EPreguntaAbierta)) {
return false;
}
return id != null && id.equals(((EPreguntaAbierta) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "EPreguntaAbierta{" +
"id=" + getId() +
", nombre='" + getNombre() + "'" +
", opcional='" + getOpcional() + "'" +
", orden=" + getOrden() +
"}";
}
}

View File

@ -0,0 +1,99 @@
package org.datasurvey.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A EPreguntaAbiertaRespuesta.
*/
@Entity
@Table(name = "e_pregunta_abierta_respuesta")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class EPreguntaAbiertaRespuesta implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Column(name = "respuesta", nullable = false)
private String respuesta;
@ManyToOne
@JsonIgnoreProperties(value = { "ePreguntaAbiertaRespuestas", "encuesta" }, allowSetters = true)
private EPreguntaAbierta ePreguntaAbierta;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public EPreguntaAbiertaRespuesta id(Long id) {
this.id = id;
return this;
}
public String getRespuesta() {
return this.respuesta;
}
public EPreguntaAbiertaRespuesta respuesta(String respuesta) {
this.respuesta = respuesta;
return this;
}
public void setRespuesta(String respuesta) {
this.respuesta = respuesta;
}
public EPreguntaAbierta getEPreguntaAbierta() {
return this.ePreguntaAbierta;
}
public EPreguntaAbiertaRespuesta ePreguntaAbierta(EPreguntaAbierta ePreguntaAbierta) {
this.setEPreguntaAbierta(ePreguntaAbierta);
return this;
}
public void setEPreguntaAbierta(EPreguntaAbierta ePreguntaAbierta) {
this.ePreguntaAbierta = ePreguntaAbierta;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof EPreguntaAbiertaRespuesta)) {
return false;
}
return id != null && id.equals(((EPreguntaAbiertaRespuesta) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "EPreguntaAbiertaRespuesta{" +
"id=" + getId() +
", respuesta='" + getRespuesta() + "'" +
"}";
}
}

View File

@ -0,0 +1,197 @@
package org.datasurvey.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.datasurvey.domain.enumeration.PreguntaCerradaTipo;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A EPreguntaCerrada.
*/
@Entity
@Table(name = "e_pregunta_cerrada")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class EPreguntaCerrada implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Size(min = 1, max = 500)
@Column(name = "nombre", length = 500, nullable = false)
private String nombre;
@NotNull
@Enumerated(EnumType.STRING)
@Column(name = "tipo", nullable = false)
private PreguntaCerradaTipo tipo;
@NotNull
@Column(name = "opcional", nullable = false)
private Boolean opcional;
@NotNull
@Column(name = "orden", nullable = false)
private Integer orden;
@OneToMany(mappedBy = "ePreguntaCerrada")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JsonIgnoreProperties(value = { "ePreguntaCerrada" }, allowSetters = true)
private Set<EPreguntaCerradaOpcion> ePreguntaCerradaOpcions = new HashSet<>();
@ManyToOne
@JsonIgnoreProperties(
value = { "usuarioEncuestas", "ePreguntaAbiertas", "ePreguntaCerradas", "categoria", "usuarioExtra" },
allowSetters = true
)
private Encuesta encuesta;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public EPreguntaCerrada id(Long id) {
this.id = id;
return this;
}
public String getNombre() {
return this.nombre;
}
public EPreguntaCerrada nombre(String nombre) {
this.nombre = nombre;
return this;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public PreguntaCerradaTipo getTipo() {
return this.tipo;
}
public EPreguntaCerrada tipo(PreguntaCerradaTipo tipo) {
this.tipo = tipo;
return this;
}
public void setTipo(PreguntaCerradaTipo tipo) {
this.tipo = tipo;
}
public Boolean getOpcional() {
return this.opcional;
}
public EPreguntaCerrada opcional(Boolean opcional) {
this.opcional = opcional;
return this;
}
public void setOpcional(Boolean opcional) {
this.opcional = opcional;
}
public Integer getOrden() {
return this.orden;
}
public EPreguntaCerrada orden(Integer orden) {
this.orden = orden;
return this;
}
public void setOrden(Integer orden) {
this.orden = orden;
}
public Set<EPreguntaCerradaOpcion> getEPreguntaCerradaOpcions() {
return this.ePreguntaCerradaOpcions;
}
public EPreguntaCerrada ePreguntaCerradaOpcions(Set<EPreguntaCerradaOpcion> ePreguntaCerradaOpcions) {
this.setEPreguntaCerradaOpcions(ePreguntaCerradaOpcions);
return this;
}
public EPreguntaCerrada addEPreguntaCerradaOpcion(EPreguntaCerradaOpcion ePreguntaCerradaOpcion) {
this.ePreguntaCerradaOpcions.add(ePreguntaCerradaOpcion);
ePreguntaCerradaOpcion.setEPreguntaCerrada(this);
return this;
}
public EPreguntaCerrada removeEPreguntaCerradaOpcion(EPreguntaCerradaOpcion ePreguntaCerradaOpcion) {
this.ePreguntaCerradaOpcions.remove(ePreguntaCerradaOpcion);
ePreguntaCerradaOpcion.setEPreguntaCerrada(null);
return this;
}
public void setEPreguntaCerradaOpcions(Set<EPreguntaCerradaOpcion> ePreguntaCerradaOpcions) {
if (this.ePreguntaCerradaOpcions != null) {
this.ePreguntaCerradaOpcions.forEach(i -> i.setEPreguntaCerrada(null));
}
if (ePreguntaCerradaOpcions != null) {
ePreguntaCerradaOpcions.forEach(i -> i.setEPreguntaCerrada(this));
}
this.ePreguntaCerradaOpcions = ePreguntaCerradaOpcions;
}
public Encuesta getEncuesta() {
return this.encuesta;
}
public EPreguntaCerrada encuesta(Encuesta encuesta) {
this.setEncuesta(encuesta);
return this;
}
public void setEncuesta(Encuesta encuesta) {
this.encuesta = encuesta;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof EPreguntaCerrada)) {
return false;
}
return id != null && id.equals(((EPreguntaCerrada) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "EPreguntaCerrada{" +
"id=" + getId() +
", nombre='" + getNombre() + "'" +
", tipo='" + getTipo() + "'" +
", opcional='" + getOpcional() + "'" +
", orden=" + getOrden() +
"}";
}
}

View File

@ -0,0 +1,136 @@
package org.datasurvey.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A EPreguntaCerradaOpcion.
*/
@Entity
@Table(name = "e_pregunta_cerrada_opcion")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class EPreguntaCerradaOpcion implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Size(min = 1, max = 500)
@Column(name = "nombre", length = 500, nullable = false)
private String nombre;
@NotNull
@Column(name = "orden", nullable = false)
private Integer orden;
@NotNull
@Column(name = "cantidad", nullable = false)
private Integer cantidad;
@ManyToOne
@JsonIgnoreProperties(value = { "ePreguntaCerradaOpcions", "encuesta" }, allowSetters = true)
private EPreguntaCerrada ePreguntaCerrada;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public EPreguntaCerradaOpcion id(Long id) {
this.id = id;
return this;
}
public String getNombre() {
return this.nombre;
}
public EPreguntaCerradaOpcion nombre(String nombre) {
this.nombre = nombre;
return this;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public Integer getOrden() {
return this.orden;
}
public EPreguntaCerradaOpcion orden(Integer orden) {
this.orden = orden;
return this;
}
public void setOrden(Integer orden) {
this.orden = orden;
}
public Integer getCantidad() {
return this.cantidad;
}
public EPreguntaCerradaOpcion cantidad(Integer cantidad) {
this.cantidad = cantidad;
return this;
}
public void setCantidad(Integer cantidad) {
this.cantidad = cantidad;
}
public EPreguntaCerrada getEPreguntaCerrada() {
return this.ePreguntaCerrada;
}
public EPreguntaCerradaOpcion ePreguntaCerrada(EPreguntaCerrada ePreguntaCerrada) {
this.setEPreguntaCerrada(ePreguntaCerrada);
return this;
}
public void setEPreguntaCerrada(EPreguntaCerrada ePreguntaCerrada) {
this.ePreguntaCerrada = ePreguntaCerrada;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof EPreguntaCerradaOpcion)) {
return false;
}
return id != null && id.equals(((EPreguntaCerradaOpcion) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "EPreguntaCerradaOpcion{" +
"id=" + getId() +
", nombre='" + getNombre() + "'" +
", orden=" + getOrden() +
", cantidad=" + getCantidad() +
"}";
}
}

View File

@ -0,0 +1,389 @@
package org.datasurvey.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.datasurvey.domain.enumeration.AccesoEncuesta;
import org.datasurvey.domain.enumeration.EstadoEncuesta;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A Encuesta.
*/
@Entity
@Table(name = "encuesta")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Encuesta implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Size(min = 1, max = 50)
@Column(name = "nombre", length = 50, nullable = false)
private String nombre;
@Column(name = "descripcion")
private String descripcion;
@NotNull
@Column(name = "fecha_creacion", nullable = false)
private ZonedDateTime fechaCreacion;
@Column(name = "fecha_publicacion")
private ZonedDateTime fechaPublicacion;
@Column(name = "fecha_finalizar")
private ZonedDateTime fechaFinalizar;
@Column(name = "fecha_finalizada")
private ZonedDateTime fechaFinalizada;
@NotNull
@Column(name = "calificacion", nullable = false)
private Double calificacion;
@NotNull
@Enumerated(EnumType.STRING)
@Column(name = "acceso", nullable = false)
private AccesoEncuesta acceso;
@Column(name = "contrasenna")
private String contrasenna;
@NotNull
@Enumerated(EnumType.STRING)
@Column(name = "estado", nullable = false)
private EstadoEncuesta estado;
@OneToMany(mappedBy = "encuesta")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JsonIgnoreProperties(value = { "usuarioExtra", "encuesta" }, allowSetters = true)
private Set<UsuarioEncuesta> usuarioEncuestas = new HashSet<>();
@OneToMany(mappedBy = "encuesta")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JsonIgnoreProperties(value = { "ePreguntaAbiertaRespuestas", "encuesta" }, allowSetters = true)
private Set<EPreguntaAbierta> ePreguntaAbiertas = new HashSet<>();
@OneToMany(mappedBy = "encuesta")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JsonIgnoreProperties(value = { "ePreguntaCerradaOpcions", "encuesta" }, allowSetters = true)
private Set<EPreguntaCerrada> ePreguntaCerradas = new HashSet<>();
@ManyToOne
@JsonIgnoreProperties(value = { "encuestas", "plantillas" }, allowSetters = true)
private Categoria categoria;
@ManyToOne
@JsonIgnoreProperties(value = { "user", "encuestas", "usuarioEncuestas", "plantillas" }, allowSetters = true)
private UsuarioExtra usuarioExtra;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Encuesta id(Long id) {
this.id = id;
return this;
}
public String getNombre() {
return this.nombre;
}
public Encuesta nombre(String nombre) {
this.nombre = nombre;
return this;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getDescripcion() {
return this.descripcion;
}
public Encuesta descripcion(String descripcion) {
this.descripcion = descripcion;
return this;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public ZonedDateTime getFechaCreacion() {
return this.fechaCreacion;
}
public Encuesta fechaCreacion(ZonedDateTime fechaCreacion) {
this.fechaCreacion = fechaCreacion;
return this;
}
public void setFechaCreacion(ZonedDateTime fechaCreacion) {
this.fechaCreacion = fechaCreacion;
}
public ZonedDateTime getFechaPublicacion() {
return this.fechaPublicacion;
}
public Encuesta fechaPublicacion(ZonedDateTime fechaPublicacion) {
this.fechaPublicacion = fechaPublicacion;
return this;
}
public void setFechaPublicacion(ZonedDateTime fechaPublicacion) {
this.fechaPublicacion = fechaPublicacion;
}
public ZonedDateTime getFechaFinalizar() {
return this.fechaFinalizar;
}
public Encuesta fechaFinalizar(ZonedDateTime fechaFinalizar) {
this.fechaFinalizar = fechaFinalizar;
return this;
}
public void setFechaFinalizar(ZonedDateTime fechaFinalizar) {
this.fechaFinalizar = fechaFinalizar;
}
public ZonedDateTime getFechaFinalizada() {
return this.fechaFinalizada;
}
public Encuesta fechaFinalizada(ZonedDateTime fechaFinalizada) {
this.fechaFinalizada = fechaFinalizada;
return this;
}
public void setFechaFinalizada(ZonedDateTime fechaFinalizada) {
this.fechaFinalizada = fechaFinalizada;
}
public Double getCalificacion() {
return this.calificacion;
}
public Encuesta calificacion(Double calificacion) {
this.calificacion = calificacion;
return this;
}
public void setCalificacion(Double calificacion) {
this.calificacion = calificacion;
}
public AccesoEncuesta getAcceso() {
return this.acceso;
}
public Encuesta acceso(AccesoEncuesta acceso) {
this.acceso = acceso;
return this;
}
public void setAcceso(AccesoEncuesta acceso) {
this.acceso = acceso;
}
public String getContrasenna() {
return this.contrasenna;
}
public Encuesta contrasenna(String contrasenna) {
this.contrasenna = contrasenna;
return this;
}
public void setContrasenna(String contrasenna) {
this.contrasenna = contrasenna;
}
public EstadoEncuesta getEstado() {
return this.estado;
}
public Encuesta estado(EstadoEncuesta estado) {
this.estado = estado;
return this;
}
public void setEstado(EstadoEncuesta estado) {
this.estado = estado;
}
public Set<UsuarioEncuesta> getUsuarioEncuestas() {
return this.usuarioEncuestas;
}
public Encuesta usuarioEncuestas(Set<UsuarioEncuesta> usuarioEncuestas) {
this.setUsuarioEncuestas(usuarioEncuestas);
return this;
}
public Encuesta addUsuarioEncuesta(UsuarioEncuesta usuarioEncuesta) {
this.usuarioEncuestas.add(usuarioEncuesta);
usuarioEncuesta.setEncuesta(this);
return this;
}
public Encuesta removeUsuarioEncuesta(UsuarioEncuesta usuarioEncuesta) {
this.usuarioEncuestas.remove(usuarioEncuesta);
usuarioEncuesta.setEncuesta(null);
return this;
}
public void setUsuarioEncuestas(Set<UsuarioEncuesta> usuarioEncuestas) {
if (this.usuarioEncuestas != null) {
this.usuarioEncuestas.forEach(i -> i.setEncuesta(null));
}
if (usuarioEncuestas != null) {
usuarioEncuestas.forEach(i -> i.setEncuesta(this));
}
this.usuarioEncuestas = usuarioEncuestas;
}
public Set<EPreguntaAbierta> getEPreguntaAbiertas() {
return this.ePreguntaAbiertas;
}
public Encuesta ePreguntaAbiertas(Set<EPreguntaAbierta> ePreguntaAbiertas) {
this.setEPreguntaAbiertas(ePreguntaAbiertas);
return this;
}
public Encuesta addEPreguntaAbierta(EPreguntaAbierta ePreguntaAbierta) {
this.ePreguntaAbiertas.add(ePreguntaAbierta);
ePreguntaAbierta.setEncuesta(this);
return this;
}
public Encuesta removeEPreguntaAbierta(EPreguntaAbierta ePreguntaAbierta) {
this.ePreguntaAbiertas.remove(ePreguntaAbierta);
ePreguntaAbierta.setEncuesta(null);
return this;
}
public void setEPreguntaAbiertas(Set<EPreguntaAbierta> ePreguntaAbiertas) {
if (this.ePreguntaAbiertas != null) {
this.ePreguntaAbiertas.forEach(i -> i.setEncuesta(null));
}
if (ePreguntaAbiertas != null) {
ePreguntaAbiertas.forEach(i -> i.setEncuesta(this));
}
this.ePreguntaAbiertas = ePreguntaAbiertas;
}
public Set<EPreguntaCerrada> getEPreguntaCerradas() {
return this.ePreguntaCerradas;
}
public Encuesta ePreguntaCerradas(Set<EPreguntaCerrada> ePreguntaCerradas) {
this.setEPreguntaCerradas(ePreguntaCerradas);
return this;
}
public Encuesta addEPreguntaCerrada(EPreguntaCerrada ePreguntaCerrada) {
this.ePreguntaCerradas.add(ePreguntaCerrada);
ePreguntaCerrada.setEncuesta(this);
return this;
}
public Encuesta removeEPreguntaCerrada(EPreguntaCerrada ePreguntaCerrada) {
this.ePreguntaCerradas.remove(ePreguntaCerrada);
ePreguntaCerrada.setEncuesta(null);
return this;
}
public void setEPreguntaCerradas(Set<EPreguntaCerrada> ePreguntaCerradas) {
if (this.ePreguntaCerradas != null) {
this.ePreguntaCerradas.forEach(i -> i.setEncuesta(null));
}
if (ePreguntaCerradas != null) {
ePreguntaCerradas.forEach(i -> i.setEncuesta(this));
}
this.ePreguntaCerradas = ePreguntaCerradas;
}
public Categoria getCategoria() {
return this.categoria;
}
public Encuesta categoria(Categoria categoria) {
this.setCategoria(categoria);
return this;
}
public void setCategoria(Categoria categoria) {
this.categoria = categoria;
}
public UsuarioExtra getUsuarioExtra() {
return this.usuarioExtra;
}
public Encuesta usuarioExtra(UsuarioExtra usuarioExtra) {
this.setUsuarioExtra(usuarioExtra);
return this;
}
public void setUsuarioExtra(UsuarioExtra usuarioExtra) {
this.usuarioExtra = usuarioExtra;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Encuesta)) {
return false;
}
return id != null && id.equals(((Encuesta) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "Encuesta{" +
"id=" + getId() +
", nombre='" + getNombre() + "'" +
", descripcion='" + getDescripcion() + "'" +
", fechaCreacion='" + getFechaCreacion() + "'" +
", fechaPublicacion='" + getFechaPublicacion() + "'" +
", fechaFinalizar='" + getFechaFinalizar() + "'" +
", fechaFinalizada='" + getFechaFinalizada() + "'" +
", calificacion=" + getCalificacion() +
", acceso='" + getAcceso() + "'" +
", contrasenna='" + getContrasenna() + "'" +
", estado='" + getEstado() + "'" +
"}";
}
}

View File

@ -0,0 +1,136 @@
package org.datasurvey.domain;
import java.io.Serializable;
import java.time.ZonedDateTime;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A Factura.
*/
@Entity
@Table(name = "factura")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Factura implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Column(name = "nombre_usuario", nullable = false)
private String nombreUsuario;
@NotNull
@Column(name = "nombre_plantilla", nullable = false)
private String nombrePlantilla;
@NotNull
@Column(name = "costo", nullable = false)
private Double costo;
@NotNull
@Column(name = "fecha", nullable = false)
private ZonedDateTime fecha;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Factura id(Long id) {
this.id = id;
return this;
}
public String getNombreUsuario() {
return this.nombreUsuario;
}
public Factura nombreUsuario(String nombreUsuario) {
this.nombreUsuario = nombreUsuario;
return this;
}
public void setNombreUsuario(String nombreUsuario) {
this.nombreUsuario = nombreUsuario;
}
public String getNombrePlantilla() {
return this.nombrePlantilla;
}
public Factura nombrePlantilla(String nombrePlantilla) {
this.nombrePlantilla = nombrePlantilla;
return this;
}
public void setNombrePlantilla(String nombrePlantilla) {
this.nombrePlantilla = nombrePlantilla;
}
public Double getCosto() {
return this.costo;
}
public Factura costo(Double costo) {
this.costo = costo;
return this;
}
public void setCosto(Double costo) {
this.costo = costo;
}
public ZonedDateTime getFecha() {
return this.fecha;
}
public Factura fecha(ZonedDateTime fecha) {
this.fecha = fecha;
return this;
}
public void setFecha(ZonedDateTime fecha) {
this.fecha = fecha;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Factura)) {
return false;
}
return id != null && id.equals(((Factura) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "Factura{" +
"id=" + getId() +
", nombreUsuario='" + getNombreUsuario() + "'" +
", nombrePlantilla='" + getNombrePlantilla() + "'" +
", costo=" + getCosto() +
", fecha='" + getFecha() + "'" +
"}";
}
}

View File

@ -0,0 +1,136 @@
package org.datasurvey.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A PPreguntaAbierta.
*/
@Entity
@Table(name = "p_pregunta_abierta")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class PPreguntaAbierta implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Size(min = 1, max = 500)
@Column(name = "nombre", length = 500, nullable = false)
private String nombre;
@NotNull
@Column(name = "opcional", nullable = false)
private Boolean opcional;
@NotNull
@Column(name = "orden", nullable = false)
private Integer orden;
@ManyToOne
@JsonIgnoreProperties(value = { "pPreguntaCerradas", "pPreguntaAbiertas", "categoria", "usuarioExtras" }, allowSetters = true)
private Plantilla plantilla;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public PPreguntaAbierta id(Long id) {
this.id = id;
return this;
}
public String getNombre() {
return this.nombre;
}
public PPreguntaAbierta nombre(String nombre) {
this.nombre = nombre;
return this;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public Boolean getOpcional() {
return this.opcional;
}
public PPreguntaAbierta opcional(Boolean opcional) {
this.opcional = opcional;
return this;
}
public void setOpcional(Boolean opcional) {
this.opcional = opcional;
}
public Integer getOrden() {
return this.orden;
}
public PPreguntaAbierta orden(Integer orden) {
this.orden = orden;
return this;
}
public void setOrden(Integer orden) {
this.orden = orden;
}
public Plantilla getPlantilla() {
return this.plantilla;
}
public PPreguntaAbierta plantilla(Plantilla plantilla) {
this.setPlantilla(plantilla);
return this;
}
public void setPlantilla(Plantilla plantilla) {
this.plantilla = plantilla;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof PPreguntaAbierta)) {
return false;
}
return id != null && id.equals(((PPreguntaAbierta) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "PPreguntaAbierta{" +
"id=" + getId() +
", nombre='" + getNombre() + "'" +
", opcional='" + getOpcional() + "'" +
", orden=" + getOrden() +
"}";
}
}

View File

@ -0,0 +1,194 @@
package org.datasurvey.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.datasurvey.domain.enumeration.PreguntaCerradaTipo;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A PPreguntaCerrada.
*/
@Entity
@Table(name = "p_pregunta_cerrada")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class PPreguntaCerrada implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Size(min = 1, max = 500)
@Column(name = "nombre", length = 500, nullable = false)
private String nombre;
@NotNull
@Enumerated(EnumType.STRING)
@Column(name = "tipo", nullable = false)
private PreguntaCerradaTipo tipo;
@NotNull
@Column(name = "opcional", nullable = false)
private Boolean opcional;
@NotNull
@Column(name = "orden", nullable = false)
private Integer orden;
@OneToMany(mappedBy = "pPreguntaCerrada")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JsonIgnoreProperties(value = { "pPreguntaCerrada" }, allowSetters = true)
private Set<PPreguntaCerradaOpcion> pPreguntaCerradaOpcions = new HashSet<>();
@ManyToOne
@JsonIgnoreProperties(value = { "pPreguntaCerradas", "pPreguntaAbiertas", "categoria", "usuarioExtras" }, allowSetters = true)
private Plantilla plantilla;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public PPreguntaCerrada id(Long id) {
this.id = id;
return this;
}
public String getNombre() {
return this.nombre;
}
public PPreguntaCerrada nombre(String nombre) {
this.nombre = nombre;
return this;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public PreguntaCerradaTipo getTipo() {
return this.tipo;
}
public PPreguntaCerrada tipo(PreguntaCerradaTipo tipo) {
this.tipo = tipo;
return this;
}
public void setTipo(PreguntaCerradaTipo tipo) {
this.tipo = tipo;
}
public Boolean getOpcional() {
return this.opcional;
}
public PPreguntaCerrada opcional(Boolean opcional) {
this.opcional = opcional;
return this;
}
public void setOpcional(Boolean opcional) {
this.opcional = opcional;
}
public Integer getOrden() {
return this.orden;
}
public PPreguntaCerrada orden(Integer orden) {
this.orden = orden;
return this;
}
public void setOrden(Integer orden) {
this.orden = orden;
}
public Set<PPreguntaCerradaOpcion> getPPreguntaCerradaOpcions() {
return this.pPreguntaCerradaOpcions;
}
public PPreguntaCerrada pPreguntaCerradaOpcions(Set<PPreguntaCerradaOpcion> pPreguntaCerradaOpcions) {
this.setPPreguntaCerradaOpcions(pPreguntaCerradaOpcions);
return this;
}
public PPreguntaCerrada addPPreguntaCerradaOpcion(PPreguntaCerradaOpcion pPreguntaCerradaOpcion) {
this.pPreguntaCerradaOpcions.add(pPreguntaCerradaOpcion);
pPreguntaCerradaOpcion.setPPreguntaCerrada(this);
return this;
}
public PPreguntaCerrada removePPreguntaCerradaOpcion(PPreguntaCerradaOpcion pPreguntaCerradaOpcion) {
this.pPreguntaCerradaOpcions.remove(pPreguntaCerradaOpcion);
pPreguntaCerradaOpcion.setPPreguntaCerrada(null);
return this;
}
public void setPPreguntaCerradaOpcions(Set<PPreguntaCerradaOpcion> pPreguntaCerradaOpcions) {
if (this.pPreguntaCerradaOpcions != null) {
this.pPreguntaCerradaOpcions.forEach(i -> i.setPPreguntaCerrada(null));
}
if (pPreguntaCerradaOpcions != null) {
pPreguntaCerradaOpcions.forEach(i -> i.setPPreguntaCerrada(this));
}
this.pPreguntaCerradaOpcions = pPreguntaCerradaOpcions;
}
public Plantilla getPlantilla() {
return this.plantilla;
}
public PPreguntaCerrada plantilla(Plantilla plantilla) {
this.setPlantilla(plantilla);
return this;
}
public void setPlantilla(Plantilla plantilla) {
this.plantilla = plantilla;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof PPreguntaCerrada)) {
return false;
}
return id != null && id.equals(((PPreguntaCerrada) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "PPreguntaCerrada{" +
"id=" + getId() +
", nombre='" + getNombre() + "'" +
", tipo='" + getTipo() + "'" +
", opcional='" + getOpcional() + "'" +
", orden=" + getOrden() +
"}";
}
}

View File

@ -0,0 +1,118 @@
package org.datasurvey.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A PPreguntaCerradaOpcion.
*/
@Entity
@Table(name = "p_pregunta_cerrada_opcion")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class PPreguntaCerradaOpcion implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Size(min = 1, max = 500)
@Column(name = "nombre", length = 500, nullable = false)
private String nombre;
@NotNull
@Column(name = "orden", nullable = false)
private Integer orden;
@ManyToOne
@JsonIgnoreProperties(value = { "pPreguntaCerradaOpcions", "plantilla" }, allowSetters = true)
private PPreguntaCerrada pPreguntaCerrada;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public PPreguntaCerradaOpcion id(Long id) {
this.id = id;
return this;
}
public String getNombre() {
return this.nombre;
}
public PPreguntaCerradaOpcion nombre(String nombre) {
this.nombre = nombre;
return this;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public Integer getOrden() {
return this.orden;
}
public PPreguntaCerradaOpcion orden(Integer orden) {
this.orden = orden;
return this;
}
public void setOrden(Integer orden) {
this.orden = orden;
}
public PPreguntaCerrada getPPreguntaCerrada() {
return this.pPreguntaCerrada;
}
public PPreguntaCerradaOpcion pPreguntaCerrada(PPreguntaCerrada pPreguntaCerrada) {
this.setPPreguntaCerrada(pPreguntaCerrada);
return this;
}
public void setPPreguntaCerrada(PPreguntaCerrada pPreguntaCerrada) {
this.pPreguntaCerrada = pPreguntaCerrada;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof PPreguntaCerradaOpcion)) {
return false;
}
return id != null && id.equals(((PPreguntaCerradaOpcion) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "PPreguntaCerradaOpcion{" +
"id=" + getId() +
", nombre='" + getNombre() + "'" +
", orden=" + getOrden() +
"}";
}
}

View File

@ -0,0 +1,135 @@
package org.datasurvey.domain;
import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A ParametroAplicacion.
*/
@Entity
@Table(name = "parametro_aplicacion")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ParametroAplicacion implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Column(name = "max_dias_encuesta", nullable = false)
private Integer maxDiasEncuesta;
@NotNull
@Column(name = "min_dias_encuesta", nullable = false)
private Integer minDiasEncuesta;
@NotNull
@Column(name = "max_cantidad_preguntas", nullable = false)
private Integer maxCantidadPreguntas;
@NotNull
@Column(name = "min_cantidad_preguntas", nullable = false)
private Integer minCantidadPreguntas;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public ParametroAplicacion id(Long id) {
this.id = id;
return this;
}
public Integer getMaxDiasEncuesta() {
return this.maxDiasEncuesta;
}
public ParametroAplicacion maxDiasEncuesta(Integer maxDiasEncuesta) {
this.maxDiasEncuesta = maxDiasEncuesta;
return this;
}
public void setMaxDiasEncuesta(Integer maxDiasEncuesta) {
this.maxDiasEncuesta = maxDiasEncuesta;
}
public Integer getMinDiasEncuesta() {
return this.minDiasEncuesta;
}
public ParametroAplicacion minDiasEncuesta(Integer minDiasEncuesta) {
this.minDiasEncuesta = minDiasEncuesta;
return this;
}
public void setMinDiasEncuesta(Integer minDiasEncuesta) {
this.minDiasEncuesta = minDiasEncuesta;
}
public Integer getMaxCantidadPreguntas() {
return this.maxCantidadPreguntas;
}
public ParametroAplicacion maxCantidadPreguntas(Integer maxCantidadPreguntas) {
this.maxCantidadPreguntas = maxCantidadPreguntas;
return this;
}
public void setMaxCantidadPreguntas(Integer maxCantidadPreguntas) {
this.maxCantidadPreguntas = maxCantidadPreguntas;
}
public Integer getMinCantidadPreguntas() {
return this.minCantidadPreguntas;
}
public ParametroAplicacion minCantidadPreguntas(Integer minCantidadPreguntas) {
this.minCantidadPreguntas = minCantidadPreguntas;
return this;
}
public void setMinCantidadPreguntas(Integer minCantidadPreguntas) {
this.minCantidadPreguntas = minCantidadPreguntas;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ParametroAplicacion)) {
return false;
}
return id != null && id.equals(((ParametroAplicacion) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "ParametroAplicacion{" +
"id=" + getId() +
", maxDiasEncuesta=" + getMaxDiasEncuesta() +
", minDiasEncuesta=" + getMinDiasEncuesta() +
", maxCantidadPreguntas=" + getMaxCantidadPreguntas() +
", minCantidadPreguntas=" + getMinCantidadPreguntas() +
"}";
}
}

View File

@ -0,0 +1,300 @@
package org.datasurvey.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.datasurvey.domain.enumeration.EstadoPlantilla;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A Plantilla.
*/
@Entity
@Table(name = "plantilla")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Plantilla implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Size(min = 1, max = 50)
@Column(name = "nombre", length = 50)
private String nombre;
@Column(name = "descripcion")
private String descripcion;
@NotNull
@Column(name = "fecha_creacion", nullable = false)
private ZonedDateTime fechaCreacion;
@Column(name = "fecha_publicacion_tienda")
private ZonedDateTime fechaPublicacionTienda;
@NotNull
@Enumerated(EnumType.STRING)
@Column(name = "estado", nullable = false)
private EstadoPlantilla estado;
@NotNull
@Column(name = "precio", nullable = false)
private Double precio;
@OneToMany(mappedBy = "plantilla")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JsonIgnoreProperties(value = { "pPreguntaCerradaOpcions", "plantilla" }, allowSetters = true)
private Set<PPreguntaCerrada> pPreguntaCerradas = new HashSet<>();
@OneToMany(mappedBy = "plantilla")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JsonIgnoreProperties(value = { "plantilla" }, allowSetters = true)
private Set<PPreguntaAbierta> pPreguntaAbiertas = new HashSet<>();
@ManyToOne
@JsonIgnoreProperties(value = { "encuestas", "plantillas" }, allowSetters = true)
private Categoria categoria;
@ManyToMany(mappedBy = "plantillas")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JsonIgnoreProperties(value = { "user", "encuestas", "usuarioEncuestas", "plantillas" }, allowSetters = true)
private Set<UsuarioExtra> usuarioExtras = new HashSet<>();
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Plantilla id(Long id) {
this.id = id;
return this;
}
public String getNombre() {
return this.nombre;
}
public Plantilla nombre(String nombre) {
this.nombre = nombre;
return this;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getDescripcion() {
return this.descripcion;
}
public Plantilla descripcion(String descripcion) {
this.descripcion = descripcion;
return this;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public ZonedDateTime getFechaCreacion() {
return this.fechaCreacion;
}
public Plantilla fechaCreacion(ZonedDateTime fechaCreacion) {
this.fechaCreacion = fechaCreacion;
return this;
}
public void setFechaCreacion(ZonedDateTime fechaCreacion) {
this.fechaCreacion = fechaCreacion;
}
public ZonedDateTime getFechaPublicacionTienda() {
return this.fechaPublicacionTienda;
}
public Plantilla fechaPublicacionTienda(ZonedDateTime fechaPublicacionTienda) {
this.fechaPublicacionTienda = fechaPublicacionTienda;
return this;
}
public void setFechaPublicacionTienda(ZonedDateTime fechaPublicacionTienda) {
this.fechaPublicacionTienda = fechaPublicacionTienda;
}
public EstadoPlantilla getEstado() {
return this.estado;
}
public Plantilla estado(EstadoPlantilla estado) {
this.estado = estado;
return this;
}
public void setEstado(EstadoPlantilla estado) {
this.estado = estado;
}
public Double getPrecio() {
return this.precio;
}
public Plantilla precio(Double precio) {
this.precio = precio;
return this;
}
public void setPrecio(Double precio) {
this.precio = precio;
}
public Set<PPreguntaCerrada> getPPreguntaCerradas() {
return this.pPreguntaCerradas;
}
public Plantilla pPreguntaCerradas(Set<PPreguntaCerrada> pPreguntaCerradas) {
this.setPPreguntaCerradas(pPreguntaCerradas);
return this;
}
public Plantilla addPPreguntaCerrada(PPreguntaCerrada pPreguntaCerrada) {
this.pPreguntaCerradas.add(pPreguntaCerrada);
pPreguntaCerrada.setPlantilla(this);
return this;
}
public Plantilla removePPreguntaCerrada(PPreguntaCerrada pPreguntaCerrada) {
this.pPreguntaCerradas.remove(pPreguntaCerrada);
pPreguntaCerrada.setPlantilla(null);
return this;
}
public void setPPreguntaCerradas(Set<PPreguntaCerrada> pPreguntaCerradas) {
if (this.pPreguntaCerradas != null) {
this.pPreguntaCerradas.forEach(i -> i.setPlantilla(null));
}
if (pPreguntaCerradas != null) {
pPreguntaCerradas.forEach(i -> i.setPlantilla(this));
}
this.pPreguntaCerradas = pPreguntaCerradas;
}
public Set<PPreguntaAbierta> getPPreguntaAbiertas() {
return this.pPreguntaAbiertas;
}
public Plantilla pPreguntaAbiertas(Set<PPreguntaAbierta> pPreguntaAbiertas) {
this.setPPreguntaAbiertas(pPreguntaAbiertas);
return this;
}
public Plantilla addPPreguntaAbierta(PPreguntaAbierta pPreguntaAbierta) {
this.pPreguntaAbiertas.add(pPreguntaAbierta);
pPreguntaAbierta.setPlantilla(this);
return this;
}
public Plantilla removePPreguntaAbierta(PPreguntaAbierta pPreguntaAbierta) {
this.pPreguntaAbiertas.remove(pPreguntaAbierta);
pPreguntaAbierta.setPlantilla(null);
return this;
}
public void setPPreguntaAbiertas(Set<PPreguntaAbierta> pPreguntaAbiertas) {
if (this.pPreguntaAbiertas != null) {
this.pPreguntaAbiertas.forEach(i -> i.setPlantilla(null));
}
if (pPreguntaAbiertas != null) {
pPreguntaAbiertas.forEach(i -> i.setPlantilla(this));
}
this.pPreguntaAbiertas = pPreguntaAbiertas;
}
public Categoria getCategoria() {
return this.categoria;
}
public Plantilla categoria(Categoria categoria) {
this.setCategoria(categoria);
return this;
}
public void setCategoria(Categoria categoria) {
this.categoria = categoria;
}
public Set<UsuarioExtra> getUsuarioExtras() {
return this.usuarioExtras;
}
public Plantilla usuarioExtras(Set<UsuarioExtra> usuarioExtras) {
this.setUsuarioExtras(usuarioExtras);
return this;
}
public Plantilla addUsuarioExtra(UsuarioExtra usuarioExtra) {
this.usuarioExtras.add(usuarioExtra);
usuarioExtra.getPlantillas().add(this);
return this;
}
public Plantilla removeUsuarioExtra(UsuarioExtra usuarioExtra) {
this.usuarioExtras.remove(usuarioExtra);
usuarioExtra.getPlantillas().remove(this);
return this;
}
public void setUsuarioExtras(Set<UsuarioExtra> usuarioExtras) {
if (this.usuarioExtras != null) {
this.usuarioExtras.forEach(i -> i.removePlantilla(this));
}
if (usuarioExtras != null) {
usuarioExtras.forEach(i -> i.addPlantilla(this));
}
this.usuarioExtras = usuarioExtras;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Plantilla)) {
return false;
}
return id != null && id.equals(((Plantilla) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "Plantilla{" +
"id=" + getId() +
", nombre='" + getNombre() + "'" +
", descripcion='" + getDescripcion() + "'" +
", fechaCreacion='" + getFechaCreacion() + "'" +
", fechaPublicacionTienda='" + getFechaPublicacionTienda() + "'" +
", estado='" + getEstado() + "'" +
", precio=" + getPrecio() +
"}";
}
}

View File

@ -0,0 +1,231 @@
package org.datasurvey.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.io.Serializable;
import java.time.Instant;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import javax.persistence.*;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.StringUtils;
import org.datasurvey.config.Constants;
import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A user.
*/
@Entity
@Table(name = "jhi_user")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class User extends AbstractAuditingEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Pattern(regexp = Constants.LOGIN_REGEX)
@Size(min = 1, max = 50)
@Column(length = 50, unique = true, nullable = false)
private String login;
@JsonIgnore
@NotNull
@Size(min = 60, max = 60)
@Column(name = "password_hash", length = 60, nullable = false)
private String password;
@Size(max = 50)
@Column(name = "first_name", length = 50)
private String firstName;
@Size(max = 50)
@Column(name = "last_name", length = 50)
private String lastName;
@Email
@Size(min = 5, max = 254)
@Column(length = 254, unique = true)
private String email;
@NotNull
@Column(nullable = false)
private boolean activated = false;
@Size(min = 2, max = 10)
@Column(name = "lang_key", length = 10)
private String langKey;
@Size(max = 256)
@Column(name = "image_url", length = 256)
private String imageUrl;
@Size(max = 20)
@Column(name = "activation_key", length = 20)
@JsonIgnore
private String activationKey;
@Size(max = 20)
@Column(name = "reset_key", length = 20)
@JsonIgnore
private String resetKey;
@Column(name = "reset_date")
private Instant resetDate = null;
@JsonIgnore
@ManyToMany
@JoinTable(
name = "jhi_user_authority",
joinColumns = { @JoinColumn(name = "user_id", referencedColumnName = "id") },
inverseJoinColumns = { @JoinColumn(name = "authority_name", referencedColumnName = "name") }
)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@BatchSize(size = 20)
private Set<Authority> authorities = new HashSet<>();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLogin() {
return login;
}
// Lowercase the login before saving it in database
public void setLogin(String login) {
this.login = StringUtils.lowerCase(login, Locale.ENGLISH);
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public boolean isActivated() {
return activated;
}
public void setActivated(boolean activated) {
this.activated = activated;
}
public String getActivationKey() {
return activationKey;
}
public void setActivationKey(String activationKey) {
this.activationKey = activationKey;
}
public String getResetKey() {
return resetKey;
}
public void setResetKey(String resetKey) {
this.resetKey = resetKey;
}
public Instant getResetDate() {
return resetDate;
}
public void setResetDate(Instant resetDate) {
this.resetDate = resetDate;
}
public String getLangKey() {
return langKey;
}
public void setLangKey(String langKey) {
this.langKey = langKey;
}
public Set<Authority> getAuthorities() {
return authorities;
}
public void setAuthorities(Set<Authority> authorities) {
this.authorities = authorities;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof User)) {
return false;
}
return id != null && id.equals(((User) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "User{" +
"login='" + login + '\'' +
", firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", email='" + email + '\'' +
", imageUrl='" + imageUrl + '\'' +
", activated='" + activated + '\'' +
", langKey='" + langKey + '\'' +
", activationKey='" + activationKey + '\'' +
"}";
}
}

View File

@ -0,0 +1,160 @@
package org.datasurvey.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serializable;
import java.time.ZonedDateTime;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.datasurvey.domain.enumeration.EstadoColaborador;
import org.datasurvey.domain.enumeration.RolColaborador;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A UsuarioEncuesta.
*/
@Entity
@Table(name = "usuario_encuesta")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class UsuarioEncuesta implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Enumerated(EnumType.STRING)
@Column(name = "rol", nullable = false)
private RolColaborador rol;
@NotNull
@Enumerated(EnumType.STRING)
@Column(name = "estado", nullable = false)
private EstadoColaborador estado;
@NotNull
@Column(name = "fecha_agregado", nullable = false)
private ZonedDateTime fechaAgregado;
@ManyToOne
@JsonIgnoreProperties(value = { "user", "encuestas", "usuarioEncuestas", "plantillas" }, allowSetters = true)
private UsuarioExtra usuarioExtra;
@ManyToOne
@JsonIgnoreProperties(
value = { "usuarioEncuestas", "ePreguntaAbiertas", "ePreguntaCerradas", "categoria", "usuarioExtra" },
allowSetters = true
)
private Encuesta encuesta;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public UsuarioEncuesta id(Long id) {
this.id = id;
return this;
}
public RolColaborador getRol() {
return this.rol;
}
public UsuarioEncuesta rol(RolColaborador rol) {
this.rol = rol;
return this;
}
public void setRol(RolColaborador rol) {
this.rol = rol;
}
public EstadoColaborador getEstado() {
return this.estado;
}
public UsuarioEncuesta estado(EstadoColaborador estado) {
this.estado = estado;
return this;
}
public void setEstado(EstadoColaborador estado) {
this.estado = estado;
}
public ZonedDateTime getFechaAgregado() {
return this.fechaAgregado;
}
public UsuarioEncuesta fechaAgregado(ZonedDateTime fechaAgregado) {
this.fechaAgregado = fechaAgregado;
return this;
}
public void setFechaAgregado(ZonedDateTime fechaAgregado) {
this.fechaAgregado = fechaAgregado;
}
public UsuarioExtra getUsuarioExtra() {
return this.usuarioExtra;
}
public UsuarioEncuesta usuarioExtra(UsuarioExtra usuarioExtra) {
this.setUsuarioExtra(usuarioExtra);
return this;
}
public void setUsuarioExtra(UsuarioExtra usuarioExtra) {
this.usuarioExtra = usuarioExtra;
}
public Encuesta getEncuesta() {
return this.encuesta;
}
public UsuarioEncuesta encuesta(Encuesta encuesta) {
this.setEncuesta(encuesta);
return this;
}
public void setEncuesta(Encuesta encuesta) {
this.encuesta = encuesta;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof UsuarioEncuesta)) {
return false;
}
return id != null && id.equals(((UsuarioEncuesta) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "UsuarioEncuesta{" +
"id=" + getId() +
", rol='" + getRol() + "'" +
", estado='" + getEstado() + "'" +
", fechaAgregado='" + getFechaAgregado() + "'" +
"}";
}
}

View File

@ -0,0 +1,266 @@
package org.datasurvey.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.datasurvey.domain.enumeration.EstadoUsuario;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A UsuarioExtra.
*/
@Entity
@Table(name = "usuario_extra")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class UsuarioExtra implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Column(name = "nombre", nullable = false)
private String nombre;
@Column(name = "icono_perfil")
private String iconoPerfil;
@Column(name = "fecha_nacimiento")
private ZonedDateTime fechaNacimiento;
@NotNull
@Enumerated(EnumType.STRING)
@Column(name = "estado", nullable = false)
private EstadoUsuario estado;
@OneToOne
@JoinColumn(unique = true)
private User user;
@OneToMany(mappedBy = "usuarioExtra")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JsonIgnoreProperties(
value = { "usuarioEncuestas", "ePreguntaAbiertas", "ePreguntaCerradas", "categoria", "usuarioExtra" },
allowSetters = true
)
private Set<Encuesta> encuestas = new HashSet<>();
@OneToMany(mappedBy = "usuarioExtra")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JsonIgnoreProperties(value = { "usuarioExtra", "encuesta" }, allowSetters = true)
private Set<UsuarioEncuesta> usuarioEncuestas = new HashSet<>();
@ManyToMany
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JoinTable(
name = "rel_usuario_extra__plantilla",
joinColumns = @JoinColumn(name = "usuario_extra_id"),
inverseJoinColumns = @JoinColumn(name = "plantilla_id")
)
@JsonIgnoreProperties(value = { "pPreguntaCerradas", "pPreguntaAbiertas", "categoria", "usuarioExtras" }, allowSetters = true)
private Set<Plantilla> plantillas = new HashSet<>();
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public UsuarioExtra id(Long id) {
this.id = id;
return this;
}
public String getNombre() {
return this.nombre;
}
public UsuarioExtra nombre(String nombre) {
this.nombre = nombre;
return this;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getIconoPerfil() {
return this.iconoPerfil;
}
public UsuarioExtra iconoPerfil(String iconoPerfil) {
this.iconoPerfil = iconoPerfil;
return this;
}
public void setIconoPerfil(String iconoPerfil) {
this.iconoPerfil = iconoPerfil;
}
public ZonedDateTime getFechaNacimiento() {
return this.fechaNacimiento;
}
public UsuarioExtra fechaNacimiento(ZonedDateTime fechaNacimiento) {
this.fechaNacimiento = fechaNacimiento;
return this;
}
public void setFechaNacimiento(ZonedDateTime fechaNacimiento) {
this.fechaNacimiento = fechaNacimiento;
}
public EstadoUsuario getEstado() {
return this.estado;
}
public UsuarioExtra estado(EstadoUsuario estado) {
this.estado = estado;
return this;
}
public void setEstado(EstadoUsuario estado) {
this.estado = estado;
}
public User getUser() {
return this.user;
}
public UsuarioExtra user(User user) {
this.setUser(user);
return this;
}
public void setUser(User user) {
this.user = user;
}
public Set<Encuesta> getEncuestas() {
return this.encuestas;
}
public UsuarioExtra encuestas(Set<Encuesta> encuestas) {
this.setEncuestas(encuestas);
return this;
}
public UsuarioExtra addEncuesta(Encuesta encuesta) {
this.encuestas.add(encuesta);
encuesta.setUsuarioExtra(this);
return this;
}
public UsuarioExtra removeEncuesta(Encuesta encuesta) {
this.encuestas.remove(encuesta);
encuesta.setUsuarioExtra(null);
return this;
}
public void setEncuestas(Set<Encuesta> encuestas) {
if (this.encuestas != null) {
this.encuestas.forEach(i -> i.setUsuarioExtra(null));
}
if (encuestas != null) {
encuestas.forEach(i -> i.setUsuarioExtra(this));
}
this.encuestas = encuestas;
}
public Set<UsuarioEncuesta> getUsuarioEncuestas() {
return this.usuarioEncuestas;
}
public UsuarioExtra usuarioEncuestas(Set<UsuarioEncuesta> usuarioEncuestas) {
this.setUsuarioEncuestas(usuarioEncuestas);
return this;
}
public UsuarioExtra addUsuarioEncuesta(UsuarioEncuesta usuarioEncuesta) {
this.usuarioEncuestas.add(usuarioEncuesta);
usuarioEncuesta.setUsuarioExtra(this);
return this;
}
public UsuarioExtra removeUsuarioEncuesta(UsuarioEncuesta usuarioEncuesta) {
this.usuarioEncuestas.remove(usuarioEncuesta);
usuarioEncuesta.setUsuarioExtra(null);
return this;
}
public void setUsuarioEncuestas(Set<UsuarioEncuesta> usuarioEncuestas) {
if (this.usuarioEncuestas != null) {
this.usuarioEncuestas.forEach(i -> i.setUsuarioExtra(null));
}
if (usuarioEncuestas != null) {
usuarioEncuestas.forEach(i -> i.setUsuarioExtra(this));
}
this.usuarioEncuestas = usuarioEncuestas;
}
public Set<Plantilla> getPlantillas() {
return this.plantillas;
}
public UsuarioExtra plantillas(Set<Plantilla> plantillas) {
this.setPlantillas(plantillas);
return this;
}
public UsuarioExtra addPlantilla(Plantilla plantilla) {
this.plantillas.add(plantilla);
plantilla.getUsuarioExtras().add(this);
return this;
}
public UsuarioExtra removePlantilla(Plantilla plantilla) {
this.plantillas.remove(plantilla);
plantilla.getUsuarioExtras().remove(this);
return this;
}
public void setPlantillas(Set<Plantilla> plantillas) {
this.plantillas = plantillas;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof UsuarioExtra)) {
return false;
}
return id != null && id.equals(((UsuarioExtra) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "UsuarioExtra{" +
"id=" + getId() +
", nombre='" + getNombre() + "'" +
", iconoPerfil='" + getIconoPerfil() + "'" +
", fechaNacimiento='" + getFechaNacimiento() + "'" +
", estado='" + getEstado() + "'" +
"}";
}
}

View File

@ -0,0 +1,9 @@
package org.datasurvey.domain.enumeration;
/**
* The AccesoEncuesta enumeration.
*/
public enum AccesoEncuesta {
PUBLIC,
PRIVATE,
}

View File

@ -0,0 +1,9 @@
package org.datasurvey.domain.enumeration;
/**
* The EstadoCategoria enumeration.
*/
public enum EstadoCategoria {
ACTIVE,
INACTIVE,
}

View File

@ -0,0 +1,9 @@
package org.datasurvey.domain.enumeration;
/**
* The EstadoColaborador enumeration.
*/
public enum EstadoColaborador {
PENDING,
ACTIVE,
}

View File

@ -0,0 +1,11 @@
package org.datasurvey.domain.enumeration;
/**
* The EstadoEncuesta enumeration.
*/
public enum EstadoEncuesta {
DRAFT,
ACTIVE,
FINISHED,
DELETED,
}

View File

@ -0,0 +1,11 @@
package org.datasurvey.domain.enumeration;
/**
* The EstadoPlantilla enumeration.
*/
public enum EstadoPlantilla {
DRAFT,
ACTIVE,
DELETED,
DISABLED,
}

View File

@ -0,0 +1,9 @@
package org.datasurvey.domain.enumeration;
/**
* The EstadoUsuario enumeration.
*/
public enum EstadoUsuario {
ACTIVE,
SUSPENDED,
}

View File

@ -0,0 +1,9 @@
package org.datasurvey.domain.enumeration;
/**
* The PreguntaCerradaTipo enumeration.
*/
public enum PreguntaCerradaTipo {
SINGLE,
MULTIPLE,
}

View File

@ -0,0 +1,9 @@
package org.datasurvey.domain.enumeration;
/**
* The RolColaborador enumeration.
*/
public enum RolColaborador {
READ,
WRITE,
}

Some files were not shown because too many files have changed in this diff Show More