Mario Martínez Hernández 2 ヶ月 前
コミット
561bae8d8a
100 ファイル変更8612 行追加0 行削除
  1. 57 0
      .classpath
  2. 4 0
      .gitignore
  3. 39 0
      .project
  4. 14 0
      .vscode/launch.json
  5. 15 0
      .vscode/settings.json
  6. 286 0
      mvnw
  7. 161 0
      mvnw.cmd
  8. 183 0
      pom.xml
  9. 153 0
      src/main/java/META-INF/additional-spring-configuration-metadata.json
  10. 15 0
      src/main/java/es/uv/saic/SaicApplication.java
  11. 55 0
      src/main/java/es/uv/saic/config/ApplicationLocaleResolver.java
  12. 26 0
      src/main/java/es/uv/saic/config/AuthSuccessHandler.java
  13. 43 0
      src/main/java/es/uv/saic/config/Globals.java
  14. 22 0
      src/main/java/es/uv/saic/config/SchedulerConfig.java
  15. 149 0
      src/main/java/es/uv/saic/config/SecurityConfig.java
  16. 49 0
      src/main/java/es/uv/saic/config/WebConfig.java
  17. 147 0
      src/main/java/es/uv/saic/domain/Acreditacio.java
  18. 52 0
      src/main/java/es/uv/saic/domain/AcreditacioPK.java
  19. 44 0
      src/main/java/es/uv/saic/domain/AcreditacioRepository.java
  20. 190 0
      src/main/java/es/uv/saic/domain/AcreditacioTransfer.java
  21. 31 0
      src/main/java/es/uv/saic/domain/AnyDimensioDTO.java
  22. 191 0
      src/main/java/es/uv/saic/domain/Calendari.java
  23. 15 0
      src/main/java/es/uv/saic/domain/CalendariRepository.java
  24. 78 0
      src/main/java/es/uv/saic/domain/Categoria.java
  25. 34 0
      src/main/java/es/uv/saic/domain/CategoriaDocumentDTO.java
  26. 34 0
      src/main/java/es/uv/saic/domain/CategoriaPareDTO.java
  27. 30 0
      src/main/java/es/uv/saic/domain/CategoriaRepository.java
  28. 65 0
      src/main/java/es/uv/saic/domain/Datasource.java
  29. 10 0
      src/main/java/es/uv/saic/domain/DatasourceRepository.java
  30. 33 0
      src/main/java/es/uv/saic/domain/DimensioInstanciesDTO.java
  31. 140 0
      src/main/java/es/uv/saic/domain/Dimension.java
  32. 93 0
      src/main/java/es/uv/saic/domain/Document.java
  33. 40 0
      src/main/java/es/uv/saic/domain/DocumentDTO.java
  34. 31 0
      src/main/java/es/uv/saic/domain/DocumentRepository.java
  35. 34 0
      src/main/java/es/uv/saic/domain/DocumentTemplate.java
  36. 71 0
      src/main/java/es/uv/saic/domain/DummyDataTransfer.java
  37. 45 0
      src/main/java/es/uv/saic/domain/Email.java
  38. 36 0
      src/main/java/es/uv/saic/domain/EvidenciaIndicadorEnquesta.java
  39. 78 0
      src/main/java/es/uv/saic/domain/EvidenciaIndicadorEnquestaPK.java
  40. 29 0
      src/main/java/es/uv/saic/domain/EvidenciaIndicadorEnquestaRepository.java
  41. 64 0
      src/main/java/es/uv/saic/domain/EvidenciaTransfer.java
  42. 129 0
      src/main/java/es/uv/saic/domain/Grafica.java
  43. 60 0
      src/main/java/es/uv/saic/domain/GraficaPK.java
  44. 18 0
      src/main/java/es/uv/saic/domain/GraficaRepository.java
  45. 119 0
      src/main/java/es/uv/saic/domain/Indicador.java
  46. 240 0
      src/main/java/es/uv/saic/domain/IndicadorEnquesta.java
  47. 177 0
      src/main/java/es/uv/saic/domain/IndicadorEnquestaRepository.java
  48. 248 0
      src/main/java/es/uv/saic/domain/IndicadorEnquestaTmp.java
  49. 105 0
      src/main/java/es/uv/saic/domain/IndicadorEnquestaTmpRepository.java
  50. 143 0
      src/main/java/es/uv/saic/domain/Informe.java
  51. 60 0
      src/main/java/es/uv/saic/domain/InformeProcesPK.java
  52. 47 0
      src/main/java/es/uv/saic/domain/InformeProcessos.java
  53. 22 0
      src/main/java/es/uv/saic/domain/InformeRepository.java
  54. 134 0
      src/main/java/es/uv/saic/domain/Instancia.java
  55. 149 0
      src/main/java/es/uv/saic/domain/InstanciaDTO.java
  56. 82 0
      src/main/java/es/uv/saic/domain/InstanciaGanttDTO.java
  57. 172 0
      src/main/java/es/uv/saic/domain/InstanciaRepository.java
  58. 150 0
      src/main/java/es/uv/saic/domain/InstanciaTasca.java
  59. 187 0
      src/main/java/es/uv/saic/domain/InstanciaTascaRepository.java
  60. 214 0
      src/main/java/es/uv/saic/domain/InstanciaTascaTransfer.java
  61. 77 0
      src/main/java/es/uv/saic/domain/InstanciaTascaVer.java
  62. 36 0
      src/main/java/es/uv/saic/domain/InstanciaTascaVerPK.java
  63. 28 0
      src/main/java/es/uv/saic/domain/InstanciaTascaVerRepository.java
  64. 68 0
      src/main/java/es/uv/saic/domain/InstanciaTascaVersioTransfer.java
  65. 178 0
      src/main/java/es/uv/saic/domain/InstanciaTransfer.java
  66. 99 0
      src/main/java/es/uv/saic/domain/Link.java
  67. 18 0
      src/main/java/es/uv/saic/domain/LinkRepository.java
  68. 85 0
      src/main/java/es/uv/saic/domain/Noticia.java
  69. 16 0
      src/main/java/es/uv/saic/domain/NoticiaRepository.java
  70. 213 0
      src/main/java/es/uv/saic/domain/Organ.java
  71. 64 0
      src/main/java/es/uv/saic/domain/OrganEquivalent.java
  72. 61 0
      src/main/java/es/uv/saic/domain/OrganEquivalentPK.java
  73. 51 0
      src/main/java/es/uv/saic/domain/OrganPK.java
  74. 76 0
      src/main/java/es/uv/saic/domain/OrganRepository.java
  75. 126 0
      src/main/java/es/uv/saic/domain/Plantilla.java
  76. 62 0
      src/main/java/es/uv/saic/domain/PlantillaComentario.java
  77. 66 0
      src/main/java/es/uv/saic/domain/PlantillaConversation.java
  78. 24 0
      src/main/java/es/uv/saic/domain/PlantillaRepository.java
  79. 198 0
      src/main/java/es/uv/saic/domain/Proces.java
  80. 75 0
      src/main/java/es/uv/saic/domain/ProcesRepository.java
  81. 124 0
      src/main/java/es/uv/saic/domain/Rol.java
  82. 17 0
      src/main/java/es/uv/saic/domain/RolRepository.java
  83. 101 0
      src/main/java/es/uv/saic/domain/ScheduledTasks.java
  84. 64 0
      src/main/java/es/uv/saic/domain/SupervisionSearchParams.java
  85. 81 0
      src/main/java/es/uv/saic/domain/SysStatus.java
  86. 15 0
      src/main/java/es/uv/saic/domain/SysStatusRepository.java
  87. 256 0
      src/main/java/es/uv/saic/domain/Tasca.java
  88. 53 0
      src/main/java/es/uv/saic/domain/TascaRepository.java
  89. 76 0
      src/main/java/es/uv/saic/domain/TascaVersioTransfer.java
  90. 42 0
      src/main/java/es/uv/saic/domain/Tipus.java
  91. 11 0
      src/main/java/es/uv/saic/domain/TipusRepository.java
  92. 31 0
      src/main/java/es/uv/saic/domain/TreeDTOAny.java
  93. 33 0
      src/main/java/es/uv/saic/domain/TreeDTODimensio.java
  94. 149 0
      src/main/java/es/uv/saic/domain/TreeDTOInstancia.java
  95. 33 0
      src/main/java/es/uv/saic/domain/TreeDTOOrgan.java
  96. 210 0
      src/main/java/es/uv/saic/domain/Usuari.java
  97. 98 0
      src/main/java/es/uv/saic/domain/UsuariRepository.java
  98. 128 0
      src/main/java/es/uv/saic/domain/UsuarisRol.java
  99. 64 0
      src/main/java/es/uv/saic/domain/UsuarisRolRepository.java
  100. 63 0
      src/main/java/es/uv/saic/domain/Wiki.java

+ 57 - 0
.classpath

@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+			<attribute name="optional" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+			<attribute name="test" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" path="target/generated-sources/annotations">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+			<attribute name="ignore_optional_problems" value="true"/>
+			<attribute name="m2e-apt" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+			<attribute name="test" value="true"/>
+			<attribute name="optional" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+			<attribute name="ignore_optional_problems" value="true"/>
+			<attribute name="m2e-apt" value="true"/>
+			<attribute name="test" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

+ 4 - 0
.gitignore

@@ -0,0 +1,4 @@
+/target/**
+.deployables
+.settings
+/target/

+ 39 - 0
.project

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>UV_SAIC</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+	</natures>
+	<filteredResources>
+		<filter>
+			<id>1743099718695</id>
+			<name></name>
+			<type>30</type>
+			<matcher>
+				<id>org.eclipse.core.resources.regexFilterMatcher</id>
+				<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
+			</matcher>
+		</filter>
+	</filteredResources>
+</projectDescription>

+ 14 - 0
.vscode/launch.json

@@ -0,0 +1,14 @@
+{
+    "configurations": [
+        {
+            "type": "java",
+            "name": "Spring Boot-SaicApplication<saic>",
+            "request": "launch",
+            "cwd": "${workspaceFolder}",
+            "mainClass": "es.uv.saic.SaicApplication",
+            "projectName": "saic",
+            "envFile": "${workspaceFolder}/.env",
+            "args": "--spring.profiles.active=local"
+        }
+    ]
+}

+ 15 - 0
.vscode/settings.json

@@ -0,0 +1,15 @@
+{
+    "sqltools.connections": [
+        {
+            "server": "coddono.uv.es",
+            "port": 9042,
+            "previewLimit": 50,
+            "driver": "Cassandra",
+            "name": "coddono",
+            "database": "acd425",
+            "username": "acd425",
+            "password": "acd425"
+        }
+    ],
+    "java.configuration.updateBuildConfiguration": "interactive"
+}

+ 286 - 0
mvnw

@@ -0,0 +1,286 @@
+#!/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
+#
+#    https://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.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven2 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)`"
+  # TODO classpath?
+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
+    jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
+    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 command -v wget > /dev/null; then
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Found wget ... using wget"
+        fi
+        wget "$jarUrl" -O "$wrapperJarPath"
+    elif command -v curl > /dev/null; then
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Found curl ... using curl"
+        fi
+        curl -o "$wrapperJarPath" "$jarUrl"
+    else
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Falling back to using Java to download"
+        fi
+        javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+        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
+
+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 "$@"

+ 161 - 0
mvnw.cmd

@@ -0,0 +1,161 @@
+@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    https://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 Maven2 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 key stroke 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 my 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.4.2/maven-wrapper-0.4.2.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% (
+    echo Found %WRAPPER_JAR%
+) else (
+    echo Couldn't find %WRAPPER_JAR%, downloading it ...
+	echo Downloading from: %DOWNLOAD_URL%
+    powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
+    echo Finished downloading %WRAPPER_JAR%
+)
+@REM End of extension
+
+%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%

+ 183 - 0
pom.xml

@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.springframework.boot</groupId>
+		<artifactId>spring-boot-starter-parent</artifactId>
+		<version>3.3.0</version>
+		<relativePath/> <!-- lookup parent from repository -->
+	</parent>
+	<groupId>es.uv.saic</groupId>
+	<artifactId>saic</artifactId>
+	<version>3.0.0</version>
+	<name>saic</name>
+	<description>saic</description>
+
+	<properties>
+		<java.version>17</java.version>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+	</properties>
+	
+	<dependencies>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-web</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-devtools</artifactId>
+			<scope>runtime</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-test</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-actuator</artifactId>
+		</dependency>
+		<dependency>
+	        <groupId>de.codecentric</groupId>
+	        <artifactId>spring-boot-admin-starter-client</artifactId>
+	        <version>3.3.0</version>
+    	</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-thymeleaf</artifactId>
+		</dependency>
+		<dependency>
+		    <groupId>org.springframework.boot</groupId>
+		    <artifactId>spring-boot-properties-migrator</artifactId>
+		    <scope>runtime</scope>
+		</dependency>
+		<dependency>
+		    <groupId>nz.net.ultraq.thymeleaf</groupId>
+		    <artifactId>thymeleaf-layout-dialect</artifactId>
+		</dependency>
+		<dependency>
+		    <groupId>org.thymeleaf.extras</groupId>
+		    <artifactId>thymeleaf-extras-springsecurity6</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-security</artifactId>
+		</dependency>
+		<dependency>
+		    <groupId>org.springframework.security</groupId>
+		    <artifactId>spring-security-ldap</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.postgresql</groupId>
+			<artifactId>postgresql</artifactId>
+			<scope>runtime</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-data-jpa</artifactId>
+		</dependency>
+		<dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-mail</artifactId>
+        </dependency>
+			
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-configuration-processor</artifactId>
+			<optional>true</optional>
+		</dependency>
+		
+		<dependency>
+		  <groupId>junit</groupId>
+		  <artifactId>junit</artifactId>
+		  <scope>test</scope>
+		</dependency>
+		
+		<dependency>
+		  <groupId>fr.opensagres.xdocreport</groupId>
+		  <artifactId>fr.opensagres.xdocreport.document.docx</artifactId>
+		  <version>2.0.0</version>
+		</dependency>
+				
+		<dependency>
+		  <groupId>fr.opensagres.xdocreport</groupId>
+		  <artifactId>fr.opensagres.xdocreport.template.velocity</artifactId>
+		  <version>2.0.0</version>
+		</dependency>	
+		
+		<dependency>
+		    <groupId>com.mysql</groupId>
+		    <artifactId>mysql-connector-j</artifactId>
+		</dependency>
+		
+		<dependency>
+			<groupId>org.jsoup</groupId>
+			<artifactId>jsoup</artifactId>
+			<version>1.15.3</version>
+		</dependency>
+				
+		<dependency>
+		    <groupId>org.apache.commons</groupId>
+		    <artifactId>commons-csv</artifactId>
+		    <version>1.11.0</version>
+		</dependency>
+		
+		<dependency>
+		    <groupId>org.apache.commons</groupId>
+		    <artifactId>commons-io</artifactId>
+		    <version>1.3.2</version>
+		</dependency>
+		
+		<dependency>
+		    <groupId>commons-io</groupId>
+		    <artifactId>commons-io</artifactId>
+		    <version>2.16.1</version>
+		</dependency>
+		<!-- 
+		<dependency>
+		    <groupId>org.jacoco</groupId> 
+		    <artifactId>jacoco-maven-plugin</artifactId>
+		    <version>0.8.12</version>
+		</dependency>
+	  	 -->
+	</dependencies>
+	
+
+	<build>
+		<finalName>uv_saic</finalName>
+		<plugins>
+			<plugin>
+				<groupId>org.springframework.boot</groupId>
+				<artifactId>spring-boot-maven-plugin</artifactId>
+				<configuration>
+					<parameters>true</parameters>
+				</configuration>
+			</plugin>
+			<!-- 
+			<plugin>
+			    <groupId>org.jacoco</groupId>
+			    <artifactId>jacoco-maven-plugin</artifactId>
+			    <version>0.8.12</version>
+			    <executions>
+			        <execution>
+			            <id>jacoco-initialize</id>
+			            <goals>
+			                <goal>prepare-agent</goal>
+			            </goals>
+			        </execution>
+			        <execution>
+			            <id>jacoco-site</id>
+			            <phase>package</phase>
+			            <goals>
+			                <goal>report</goal>
+			            </goals>
+			        </execution>
+			    </executions>
+			</plugin>
+			-->
+		</plugins>
+	</build>
+
+
+</project>

+ 153 - 0
src/main/java/META-INF/additional-spring-configuration-metadata.json

@@ -0,0 +1,153 @@
+{"properties": [
+  {
+    "name": "saic.data.filePath",
+    "type": "java.lang.String",
+    "description": "Path to store uploaded evidences"
+  },
+  {
+    "name": "saic.data.templates.filePath",
+    "type": "java.lang.String",
+    "description": "Path in where templates are stored"
+  },
+  {
+    "name": "saic.data.templates.logoPath",
+    "type": "java.lang.String",
+    "description": "Path in where logos are stored"
+  },
+  {
+    "name": "saic.mailer.reminder.enabled",
+    "type": "java.lang.String",
+    "description": "Enables or disables the mailer reminders (when assigned task is expired)"
+  },
+  {
+    "name": "saic.mailer.queue.enabled",
+    "type": "java.lang.String",
+    "description": "Enables or disables the mailer queue"
+  },
+  {
+    "name": "saic.mailer.calendar.enabled",
+    "type": "java.lang.String",
+    "description": "Enables or disables the email reminders related to the calendar (instance planifier)"
+  },
+  {
+    "name": "saic.mailer.maxMailsPerRound",
+    "type": "java.lang.String",
+    "description": "Defines de max number of emails that will be sended in a single round"
+  },
+  {
+    "name": "saic.parser.surveys.path",
+    "type": "java.lang.String",
+    "description": "A description for 'saic.parser.surveys.path'"
+  },
+  {
+    "name": "saic.uqserver.dbname.grau",
+    "type": "java.lang.String",
+    "description": "Defines the DB name for 'grau'"
+  },
+  {
+    "name": "saic.uqserver.dbname.master",
+    "type": "java.lang.String",
+    "description": "Defines the DB name for 'master'"
+  },
+  {
+    "name": "saic.uqserver.host",
+    "type": "java.lang.String",
+    "description": "A description for 'saic.uqserver.host'"
+  },
+  {
+    "name": "saic.uqserver.user",
+    "type": "java.lang.String",
+    "description": "Defines the final survey DB username"
+  },
+  {
+    "name": "saic.uqserver.passwd",
+    "type": "java.lang.String",
+    "description": "Defines the final survey DB password"
+  },
+  {
+    "name": "saic.uqserver2.host",
+    "type": "java.lang.String",
+    "description": "Defines the intermediate survey DB host"
+  },
+  {
+    "name": "saic.uqserver2.user",
+    "type": "java.lang.String",
+    "description": "Defines the intermediate survey DB username"
+  },
+  {
+    "name": "saic.uqserver2.passwd",
+    "type": "java.lang.String",
+    "description": "Defines the intermediate survey DB password"
+  },
+  {
+    "name": "saic.uqserver2.dbname.prof",
+    "type": "java.lang.String",
+    "description": "Defines de DB name for 'prof'"
+  },
+  {
+    "name": "saic.uqserver2.dbname.otros",
+    "type": "java.lang.String",
+    "description": "Defines de DB name for 'otros'"
+  },
+  {
+    "name": "saic.uqserver2.dbname.doct",
+    "type": "java.lang.String",
+    "description": "Defines the DB name for 'doctorado'"
+  },
+  {
+    "name": "saic.uqserver2.dbname.master",
+    "type": "java.lang.String",
+    "description": "Defines the DB name for 'master'"
+  },
+  {
+    "name": "saic.data.doctorado",
+    "type": "java.lang.String",
+    "description": "Defines the path to 'doctorado' data files"
+  },
+  {
+    "name": "saic.data.evdocente",
+    "type": "java.lang.String",
+    "description": "Defines the path to 'evdocente' data files"
+  },
+  {
+    "name": "saic.data.master",
+    "type": "java.lang.String",
+    "description": "Defines the path to 'master' data files"
+  },
+  {
+    "name": "saic.scheduler.expired.enabled",
+    "type": "java.lang.String",
+    "description": "Enables or disables the email reminders related to procedure tasks expiration"
+  },
+  {
+    "name": "saic.data.tmpPath",
+    "type": "java.lang.String",
+    "description": "Path to the temporal directory"
+  },
+  {
+    "name": "saic.data.templates.fileNotFound",
+    "type": "java.lang.String",
+    "description": "Path to the file that will be returned when the requested file does not exist"
+  },
+  {
+    "name": "saic.parser.surveys.enabled",
+    "type": "java.lang.String",
+    "description": "Enables or disables the surveys related scheduled tasks"
+  },
+  {
+    "name": "saic.actuator.validIp",
+    "type": "java.lang.String",
+    "description": "Actuator endpoints access will be restricted to the specified IP address"
+  },
+  {
+    "name": "saic.url.public",
+    "type": "java.lang.String",
+    "description": "A description for 'saic.url.public'"
+  },
+  {
+    "name": "saic.url.domain",
+    "type": "java.lang.String",
+    "description": "A description for 'saic.url.domain'"
+  }
+
+]}

+ 15 - 0
src/main/java/es/uv/saic/SaicApplication.java

@@ -0,0 +1,15 @@
+package es.uv.saic;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+@SpringBootApplication
+@EnableScheduling
+public class SaicApplication {
+	
+	public static void main(String[] args) {
+		SpringApplication.run(SaicApplication.class, args);
+	}
+
+}

+ 55 - 0
src/main/java/es/uv/saic/config/ApplicationLocaleResolver.java

@@ -0,0 +1,55 @@
+package es.uv.saic.config;
+
+import java.util.Locale;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.authentication.AnonymousAuthenticationToken;
+import org.springframework.security.core.context.SecurityContext;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.web.servlet.i18n.SessionLocaleResolver;
+
+import es.uv.saic.domain.Usuari;
+import es.uv.saic.service.UsuariService;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+
+@Configuration
+public class ApplicationLocaleResolver extends SessionLocaleResolver {
+    @Autowired
+    UsuariService us;
+
+    @Override
+    public Locale resolveLocale(HttpServletRequest request) {
+        SecurityContext securityContext = SecurityContextHolder.getContext();
+        Locale userLocale = Locale.forLanguageTag("ca"); 
+        if(!(securityContext.getAuthentication() instanceof AnonymousAuthenticationToken)) {
+        	Usuari usuari = ((Usuari)securityContext.getAuthentication().getPrincipal());
+        	String locale = usuari.getLocale();
+        	userLocale = locale == null ? userLocale : Locale.forLanguageTag(locale);
+        }
+        
+        return userLocale;
+    }
+
+    @Override
+    public void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale) {
+        super.setLocale(request, response, locale);
+
+        SecurityContext securityContext = SecurityContextHolder.getContext();
+        if(!(securityContext.getAuthentication() instanceof AnonymousAuthenticationToken)) {
+        	Usuari usuari = ((Usuari)securityContext.getAuthentication().getPrincipal());
+	        usuari.setLocale(locale.toLanguageTag());
+	        us.save(usuari);
+        }        
+    }
+    
+    @Override
+    protected Locale determineDefaultLocale(HttpServletRequest request) {
+    	if (this.getDefaultLocale() == null) {
+    		Locale locale = this.resolveLocale(request);
+    		this.setDefaultLocale(locale);
+    	}
+    	return this.getDefaultLocale();
+    }
+}

+ 26 - 0
src/main/java/es/uv/saic/config/AuthSuccessHandler.java

@@ -0,0 +1,26 @@
+package es.uv.saic.config;
+
+import java.io.IOException;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+
+import org.springframework.security.core.Authentication;
+import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
+import org.springframework.security.web.savedrequest.DefaultSavedRequest;
+
+public class AuthSuccessHandler implements AuthenticationSuccessHandler{
+	
+	@Override
+	public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication auth)
+	        throws IOException,  ServletException {
+	    request.getSession(false).setMaxInactiveInterval(3600); //3600
+		if(request.getSession().getAttribute("SPRING_SECURITY_SAVED_REQUEST") != null){
+			DefaultSavedRequest defaultSavedRequest = (DefaultSavedRequest) request.getSession().getAttribute("SPRING_SECURITY_SAVED_REQUEST");
+	    	response.sendRedirect(defaultSavedRequest.getRedirectUrl());
+		}
+		else{
+			response.sendRedirect(request.getContextPath()+"/procedures?_new=1");
+		}
+	}
+}

+ 43 - 0
src/main/java/es/uv/saic/config/Globals.java

@@ -0,0 +1,43 @@
+package es.uv.saic.config;
+
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.util.Date;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+
+@Configuration
+@ConfigurationProperties(prefix="globals")
+public class Globals {
+
+	private String filePath = "/tmp/uploads/";
+	//private String filePath = "/DATA/saic-data/files/";
+
+	public String getFilePath() {
+		return filePath;
+	}
+	
+	public String getFileName(String npi, int curs, int informe, String apartat, int item) {
+		return npi+"_"+Integer.toString(curs)+"_"+Integer.toString(informe)+"_"+apartat+Integer.toString(item);
+	}
+	
+	public int getCurrentYear() {
+
+		Date date = new Date();
+		LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
+		int month = localDate.getMonthValue();
+		int year = localDate.getYear();
+		
+		if(month < 9) {
+			return year-1;
+		}
+		else {
+			return year;
+		}
+	}
+	
+
+	
+}

+ 22 - 0
src/main/java/es/uv/saic/config/SchedulerConfig.java

@@ -0,0 +1,22 @@
+package es.uv.saic.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.SchedulingConfigurer;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
+import org.springframework.scheduling.config.ScheduledTaskRegistrar;
+
+@Configuration
+public class SchedulerConfig implements SchedulingConfigurer {
+    private final int POOL_SIZE = 10;
+
+    @Override
+    public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
+        ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
+
+        threadPoolTaskScheduler.setPoolSize(this.POOL_SIZE);
+        threadPoolTaskScheduler.setThreadNamePrefix("saic-mailer-");
+        threadPoolTaskScheduler.initialize();
+
+        scheduledTaskRegistrar.setTaskScheduler(threadPoolTaskScheduler);
+    }
+}

+ 149 - 0
src/main/java/es/uv/saic/config/SecurityConfig.java

@@ -0,0 +1,149 @@
+package es.uv.saic.config;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.authorization.AuthorizationDecision;
+import org.springframework.security.authorization.AuthorizationManager;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.http.SessionCreationPolicy;
+import org.springframework.security.core.session.SessionRegistry;
+import org.springframework.security.core.session.SessionRegistryImpl;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.security.ldap.DefaultSpringSecurityContextSource;
+import org.springframework.security.web.SecurityFilterChain;
+import org.springframework.security.web.access.intercept.RequestAuthorizationContext;
+import org.springframework.security.web.authentication.session.CompositeSessionAuthenticationStrategy;
+import org.springframework.security.web.authentication.session.ConcurrentSessionControlAuthenticationStrategy;
+import org.springframework.security.web.authentication.session.RegisterSessionAuthenticationStrategy;
+import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy;
+import org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy;
+import org.springframework.security.web.session.HttpSessionEventPublisher;
+import org.springframework.security.web.util.matcher.IpAddressMatcher;
+
+import es.uv.saic.service.AuthProvider;
+import jakarta.servlet.http.HttpServletRequest;
+
+
+@Configuration
+@EnableWebSecurity
+@EnableMethodSecurity
+public class SecurityConfig {
+
+	@Autowired
+	AuthProvider authProvider;
+	
+	@Value("${saic.actuator.validIp}")
+	private String validIp;
+	
+	@Bean
+	public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
+		http.authorizeHttpRequests((auth) -> auth
+	        	.requestMatchers("/", "/css/**", "/js/**", "/img/**", "/logos/*", "/logos/**").permitAll()
+	        	.requestMatchers("/login**").permitAll()
+	        	.requestMatchers("/keepalive").permitAll()
+	        	.requestMatchers("/actuator/**").access(hasIpAddress(this.validIp))
+	        )
+	        .authorizeHttpRequests((auth)-> auth
+	            .anyRequest().fullyAuthenticated()
+	        )
+	        .formLogin((form) -> form
+	            .loginPage("/login")
+	            .defaultSuccessUrl("/procedures?_new=1",true)
+	            .failureUrl("/login?error=noauth")
+	            .successHandler(new AuthSuccessHandler())
+	            .permitAll()
+	        )
+	        .logout((logout) -> logout
+	        	.logoutSuccessUrl("/login")
+	        	.invalidateHttpSession(true)
+	        	.clearAuthentication(true)
+	        	.deleteCookies("JSESSIONID")
+                .deleteCookies("SESSION")
+             )
+	        .csrf((csrf) -> csrf.disable());
+		
+		http.sessionManagement((session) -> session
+				.sessionAuthenticationErrorUrl("/login?error=expired")
+				.invalidSessionUrl("/login?error=expired")
+				.maximumSessions(1)
+				.expiredUrl("/login?error=expired")
+				.maxSessionsPreventsLogin(false)
+			    .sessionRegistry(sessionRegistry())
+		    )
+			.sessionManagement((session) -> session
+				.sessionAuthenticationStrategy(concurrentSession())
+			    .sessionFixation()
+			    .newSession()
+			    .sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
+			);
+	
+		http.headers((headers) -> headers
+				.frameOptions((options) -> options.sameOrigin())
+		    );
+	
+	    return http.build();
+	}
+	
+	private static AuthorizationManager<RequestAuthorizationContext> hasIpAddress(String ipAddress) {
+        IpAddressMatcher ipAddressMatcher = new IpAddressMatcher(ipAddress);
+        return (authentication, context) -> {
+            HttpServletRequest request = context.getRequest();
+            return new AuthorizationDecision(ipAddressMatcher.matches(request));
+        };
+    }
+	    
+    @Bean
+    public AuthenticationManager authenticationManager(HttpSecurity http) throws Exception {
+        return http.getSharedObject(AuthenticationManagerBuilder.class)
+        		   .authenticationProvider(authProvider)
+        		   .build();
+    }
+    
+    @Bean
+    public SessionRegistry sessionRegistry() {
+        return new SessionRegistryImpl();
+    }
+    
+    @Bean
+    public DefaultSpringSecurityContextSource contextSource() {
+        return  new DefaultSpringSecurityContextSource(
+                Collections.singletonList("ldap://ldap.uv.es"), "dc=uv,dc=es");
+    }
+    
+    @Bean
+    public PasswordEncoder passwordEncoder() {
+        return new BCryptPasswordEncoder();
+    }
+    
+    @Bean
+    public HttpSessionEventPublisher httpSessionEventPublisher() {
+        return new HttpSessionEventPublisher();
+    }
+     
+    @Bean
+    public CompositeSessionAuthenticationStrategy concurrentSession() {
+
+         ConcurrentSessionControlAuthenticationStrategy concurrentAuthenticationStrategy = new ConcurrentSessionControlAuthenticationStrategy(sessionRegistry());
+         concurrentAuthenticationStrategy.setMaximumSessions(1);
+         concurrentAuthenticationStrategy.setExceptionIfMaximumExceeded(true);
+         List<SessionAuthenticationStrategy> delegateStrategies = new ArrayList<SessionAuthenticationStrategy>();
+         delegateStrategies.add(concurrentAuthenticationStrategy);
+         delegateStrategies.add(new SessionFixationProtectionStrategy());
+         delegateStrategies.add(new RegisterSessionAuthenticationStrategy(sessionRegistry()));
+
+         CompositeSessionAuthenticationStrategy authenticationStrategy =  new CompositeSessionAuthenticationStrategy(delegateStrategies);
+         return authenticationStrategy;
+     }
+	
+}

+ 49 - 0
src/main/java/es/uv/saic/config/WebConfig.java

@@ -0,0 +1,49 @@
+package es.uv.saic.config;
+
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.autoconfigure.web.servlet.ConditionalOnMissingFilterBean;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.Ordered;
+import org.springframework.web.filter.ForwardedHeaderFilter;
+import org.springframework.web.servlet.LocaleResolver;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
+
+import jakarta.servlet.DispatcherType;
+
+@Configuration
+public class WebConfig implements WebMvcConfigurer{
+	
+	@Bean(name = "localeResolver")
+	public LocaleResolver localeResolver() {
+	    return new ApplicationLocaleResolver();
+	}
+	
+	@Bean
+	public LocaleChangeInterceptor localeChangeInterceptor() {
+	    LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
+	    lci.setParamName("lang");
+	    return lci;
+	}
+	
+	@Override
+	public void addInterceptors(InterceptorRegistry registry) {
+	    registry.addInterceptor(localeChangeInterceptor());
+	}
+	
+	@Bean
+	@ConditionalOnMissingFilterBean(ForwardedHeaderFilter.class)
+	@ConditionalOnProperty(value = "server.forward-headers-strategy", havingValue = "native")
+	public FilterRegistrationBean<ForwardedHeaderFilter> forwardedHeaderFilter() {
+	    ForwardedHeaderFilter filter = new ForwardedHeaderFilter();
+	    FilterRegistrationBean<ForwardedHeaderFilter> registration = new FilterRegistrationBean<>(filter);
+	    registration.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.ASYNC, DispatcherType.ERROR);
+	    registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
+	    return registration;
+	}
+	
+	
+}

+ 147 - 0
src/main/java/es/uv/saic/domain/Acreditacio.java

@@ -0,0 +1,147 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.IdClass;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+
+@Entity
+@Table(name="acreditacions")
+@NamedQuery(name="Acreditacio.findAll", query="SELECT t FROM Acreditacio t")
+@IdClass(AcreditacioPK.class)
+public class Acreditacio  implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+	
+	@Id
+	private String tlugar;
+	
+	@Id
+	private Integer lugar;
+	
+	@Column(name="curs_impla")
+	private Integer cursImpla;
+	
+	@Column(name="data_verif")
+	@Temporal(TemporalType.TIMESTAMP)
+	private Date dataVerif;
+	
+	@Column(name="data_renov")
+	@Temporal(TemporalType.TIMESTAMP)
+	private Date dataRenov;
+	
+	@Column(name="data_acred")
+	@Temporal(TemporalType.TIMESTAMP)
+	private Date dataAcred;
+	
+	@Column(name="data_segui")
+	@Temporal(TemporalType.TIMESTAMP)
+	private Date dataSegui;
+	
+	private String grup;
+	
+	@Column(name="grup_num")
+	private Integer grupNum;
+	
+	@Column(name="grup_curs")
+	private Integer grupCurs;
+	
+	private Boolean inter;
+
+	private Boolean recom;
+
+	private Boolean segui;
+		
+	public Acreditacio() {}
+	
+
+	public String getTlugar() {
+		return tlugar;
+	}
+	public void setTlugar(String tlugar) {
+		this.tlugar = tlugar;
+	}
+	public Integer getLugar() {
+		return lugar;
+	}
+	public void setLugar(Integer lugar) {
+		this.lugar = lugar;
+	}
+	public Integer getCursImpla() {
+		return cursImpla;
+	}
+	public void setCursImpla(Integer cursImpla) {
+		this.cursImpla = cursImpla;
+	}
+	public Date getDataVerif() {
+		return dataVerif;
+	}
+	public void setDataVerif(Date dataVerif) {
+		this.dataVerif = dataVerif;
+	}
+	public Date getDataRenov() {
+		return dataRenov;
+	}
+	public void setDataRenov(Date dataRenov) {
+		this.dataRenov = dataRenov;
+	}
+	public Date getDataAcred() {
+		return dataAcred;
+	}
+	public void setDataAcred(Date dataAcred) {
+		this.dataAcred = dataAcred;
+	}
+	public Date getDataSegui() {
+		return dataSegui;
+	}
+	public void setDataSegui(Date dataSegui) {
+		this.dataSegui = dataSegui;
+	}
+	public String getGrup() {
+		return grup;
+	}
+	public void setGrup(String grup) {
+		this.grup = grup;
+	}
+	public Integer getGrupCurs() {
+		return grupCurs;
+	}
+	public void setGrupCurs(Integer grupCurs) {
+		this.grupCurs = grupCurs;
+	}
+	public Boolean getInter() {
+		return inter;
+	}
+	public void setInter(Boolean inter) {
+		this.inter = inter;
+	}
+	public Integer getGrupNum() {
+		return grupNum;
+	}
+	public void setGrupNum(Integer grupNum) {
+		this.grupNum = grupNum;
+	}
+	public Boolean getRecom() {
+		return recom;
+	}
+	public void setRecom(Boolean recom) {
+		this.recom = recom;
+	}
+	public Boolean getSegui() {
+		return segui;
+	}
+	public void setSegui(Boolean segui) {
+		this.segui = segui;
+	}
+	public static long getSerialversionuid() {
+		return serialVersionUID;
+	}
+	
+}

+ 52 - 0
src/main/java/es/uv/saic/domain/AcreditacioPK.java

@@ -0,0 +1,52 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+public class AcreditacioPK implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	private String tlugar;
+	private Integer lugar;
+	
+	public AcreditacioPK() {}
+	
+	public AcreditacioPK(String tlugar, Integer lugar) {
+		this.tlugar = tlugar;
+		this.lugar = lugar;
+	}
+
+	public String getTlugar() {
+		return tlugar;
+	}
+
+	public void setTlugar(String tlugar) {
+		this.tlugar = tlugar;
+	}
+
+	public Integer getLugar() {
+		return lugar;
+	}
+
+	public void setLugar(Integer lugar) {
+		this.lugar = lugar;
+	}
+
+	@Override
+	public int hashCode() {
+		return Objects.hash(lugar, tlugar);
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		AcreditacioPK other = (AcreditacioPK) obj;
+		return Objects.equals(lugar, other.lugar) && Objects.equals(tlugar, other.tlugar);
+	}
+
+}

+ 44 - 0
src/main/java/es/uv/saic/domain/AcreditacioRepository.java

@@ -0,0 +1,44 @@
+package es.uv.saic.domain;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface AcreditacioRepository extends JpaRepository<Acreditacio, AcreditacioPK> {
+
+	@Query(value="SELECT ac.* FROM acreditacions ac "
+			+ "	LEFT JOIN organs og ON ac.tlugar = og.tlugar AND ac.lugar = og.lugar "
+			+ " WHERE og.actiu "
+			+ "	ORDER BY grup_curs DESC, grup_num ASC; ", nativeQuery=true)
+	List<Acreditacio> getAll(); 
+	
+	@Query(value="SELECT * FROM acreditacions "
+			+ "	  WHERE grup_curs = date_part('year', CURRENT_DATE) AND grup_num >= date_part('month', CURRENT_DATE) "
+			+ "   ORDER BY grup_num", nativeQuery=true)
+	List<Acreditacio> getNextsCurrentYear(); 
+	
+	@Query(value="SELECT * FROM acreditacions  WHERE grup_curs = ?1 AND grup_num = ?2  ORDER BY grup_num", nativeQuery=true)
+	List<Acreditacio> getByCursGrup(Integer curs, Integer grup); 
+	
+	@Query(value="SELECT ac.* FROM acreditacions ac "
+			+ "   LEFT JOIN organs og ON ac.lugar = og.lugar AND ac.tlugar = og.tlugar"
+			+ "	  WHERE ac.grup_curs = ?1 AND ac.grup_num = ?2 AND og.tambit = ?3 ORDER BY grup_num", nativeQuery=true)
+	List<Acreditacio> getByCursGrupTambit(Integer curs, Integer grup, String tambit); 
+	
+	@Query(value="SELECT * FROM acreditacions  WHERE grup_curs = ?1  ORDER BY grup_num", nativeQuery=true)
+	List<Acreditacio> getByCurs(Integer curs); 
+	
+	@Query(value="SELECT * FROM acreditacions "
+			+ "   WHERE tlugar = ?1 AND lugar = ?2 "
+			+ "	  ORDER BY data_acred DESC LIMIT 1;", nativeQuery=true)
+	Acreditacio getByOrgan(String tlugar, Integer lugar);
+	
+	@Query(value="SELECT * FROM acreditacions "
+			+ "   WHERE (tlugar, lugar) IN(SELECT tlugar, lugar FROM organs WHERE tlugar2 = ?1 AND lugar2 = ?2)"
+			+ "	  ORDER BY grup_curs, grup_num", nativeQuery=true)
+	List<Acreditacio> getByCentre(String tlugar, Integer lugar);
+	
+}

+ 190 - 0
src/main/java/es/uv/saic/domain/AcreditacioTransfer.java

@@ -0,0 +1,190 @@
+package es.uv.saic.domain;
+
+import java.util.Date;
+
+public class AcreditacioTransfer {
+
+	private Integer idAcreditacio;
+	private Integer ruct;
+	private Integer lugar;
+	private String tambit;
+	private String nomCas;
+	private String nomVal;
+	private Integer lugarCentre;
+	private String nomCentreCas;
+	private String nomCentreVal;
+	private String grup;
+	private Integer grupNum;
+	private Integer grupCurs;
+	private Boolean inter;
+	private Date dataVerif;
+	private String dataVerifStr;
+	private Date dataRenov;
+	private String dataRenovStr;
+	private Date dataSegui;
+	private String dataSeguiStr;
+	private Date dataAcred;
+	private String dataAcredStr;
+	private Integer cursImpla;
+	
+	public AcreditacioTransfer() {}
+	
+	public AcreditacioTransfer(Acreditacio a, Organ o) {
+		this.idAcreditacio = 0;
+		this.ruct = o.getRuct();
+		this.lugar = o.getId().getLugar();
+		this.tambit = o.getTambit();
+		this.nomCas = o.getNomCas();
+		this.nomVal = o.getNomVal();
+		this.lugarCentre = o.getOrgan().getId().getLugar();
+		this.nomCentreCas = o.getOrgan().getNomCas();
+		this.nomCentreVal = o.getOrgan().getNomVal();
+		this.grup = a.getGrup();
+		this.grupNum = a.getGrupNum();
+		this.grupCurs = a.getGrupCurs();
+		this.inter = a.getInter();
+		this.dataVerif = a.getDataVerif();
+		this.dataVerifStr = String.format("%1$td/%1$tm/%1$tY", dataVerif);
+		this.dataRenov = a.getDataRenov();
+		this.dataRenovStr = String.format("%1$td/%1$tm/%1$tY", dataRenov);
+		this.dataSegui = a.getDataSegui();
+		this.dataSeguiStr = String.format("%1$td/%1$tm/%1$tY", dataSegui);
+		this.dataAcred = a.getDataAcred();
+		this.dataAcredStr = String.format("%1$td/%1$tm/%1$tY", dataAcred);
+		this.cursImpla = a.getCursImpla();
+	}
+	
+	public Integer getIdAcreditacio() {
+		return idAcreditacio;
+	}
+	public void setIdAcreditacio(Integer idAcreditacio) {
+		this.idAcreditacio = idAcreditacio;
+	}
+	public Integer getRuct() {
+		return ruct;
+	}
+	public void setRuct(Integer ruct) {
+		this.ruct = ruct;
+	}
+	public String getTambit() {
+		return tambit;
+	}
+	public void setTambit(String tambit) {
+		this.tambit = tambit;
+	}
+	public String getNomCas() {
+		return nomCas;
+	}
+	public void setNomCas(String nomCas) {
+		this.nomCas = nomCas;
+	}
+	public String getNomVal() {
+		return nomVal;
+	}
+	public void setNomVal(String nomVal) {
+		this.nomVal = nomVal;
+	}
+	public String getGrup() {
+		return grup;
+	}
+	public void setGrup(String grup) {
+		this.grup = grup;
+	}
+	public Integer getGrupNum() {
+		return grupNum;
+	}
+	public void setGrupNum(Integer grupNum) {
+		this.grupNum = grupNum;
+	}
+	public Integer getGrupCurs() {
+		return grupCurs;
+	}
+	public void setGrupCurs(Integer grupCurs) {
+		this.grupCurs = grupCurs;
+	}
+	public Boolean getInter() {
+		return inter;
+	}
+	public void setInter(Boolean inter) {
+		this.inter = inter;
+	}
+	public Date getDataVerif() {
+		return dataVerif;
+	}
+	public void setDataVerif(Date dataVerif) {
+		this.dataVerif = dataVerif;
+	}
+	public Date getDataRenov() {
+		return dataRenov;
+	}
+	public void setDataRenov(Date dataRenov) {
+		this.dataRenov = dataRenov;
+	}
+	public Date getDataSegui() {
+		return dataSegui;
+	}
+	public void setDataSegui(Date dataSegui) {
+		this.dataSegui = dataSegui;
+	}
+	public Date getDataAcred() {
+		return dataAcred;
+	}
+	public void setDataAcred(Date dataAcred) {
+		this.dataAcred = dataAcred;
+	}
+	public Integer getCursImpla() {
+		return cursImpla;
+	}
+	public void setCursImpla(Integer cursImpla) {
+		this.cursImpla = cursImpla;
+	}
+	public String getDataVerifStr() {
+		return dataVerifStr;
+	}
+	public void setDataVerifStr(String dataVerfiStr) {
+		this.dataVerifStr = dataVerfiStr;
+	}
+	public String getDataRenovStr() {
+		return dataRenovStr;
+	}
+	public void setDataRenovStr(String dataRenovStr) {
+		this.dataRenovStr = dataRenovStr;
+	}
+	public String getDataSeguiStr() {
+		return dataSeguiStr;
+	}
+	public void setDataSeguiStr(String dataSeguiStr) {
+		this.dataSeguiStr = dataSeguiStr;
+	}
+	public String getDataAcredStr() {
+		return dataAcredStr;
+	}
+	public void setDataAcredStr(String dataAcredStr) {
+		this.dataAcredStr = dataAcredStr;
+	}
+	public Integer getLugar() {
+		return lugar;
+	}
+	public void setLugar(Integer lugar) {
+		this.lugar = lugar;
+	}
+	public Integer getLugarCentre() {
+		return lugarCentre;
+	}
+	public void setLugarCentre(Integer lugarCentre) {
+		this.lugarCentre = lugarCentre;
+	}
+	public String getNomCentreCas() {
+		return nomCentreCas;
+	}
+	public void setNomCentreCas(String nomCentreCas) {
+		this.nomCentreCas = nomCentreCas;
+	}
+	public String getNomCentreVal() {
+		return nomCentreVal;
+	}
+	public void setNomCentreVal(String nomCentreVal) {
+		this.nomCentreVal = nomCentreVal;
+	}
+
+}

+ 31 - 0
src/main/java/es/uv/saic/domain/AnyDimensioDTO.java

@@ -0,0 +1,31 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class AnyDimensioDTO implements Serializable  {
+	private static final long serialVersionUID = 1L;
+	
+	private String text;
+	private List<DimensioInstanciesDTO> children;
+	
+	public AnyDimensioDTO() {}
+	
+	public AnyDimensioDTO(String text, List<DimensioInstanciesDTO> children) {
+		this.text = text;
+		this.children = children;
+	}
+	
+	public String getText() {
+		return text;
+	}
+	public void setText(String text) {
+		this.text = text;
+	}
+	public List<DimensioInstanciesDTO> getChildren() {
+		return children;
+	}
+	public void setChildren(List<DimensioInstanciesDTO> children) {
+		this.children = children;
+	}
+}

+ 191 - 0
src/main/java/es/uv/saic/domain/Calendari.java

@@ -0,0 +1,191 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.Transient;
+
+@Entity
+@Table(name="calendari")
+@NamedQuery(name="Calendari.findAll", query="SELECT t FROM Calendari t")
+public class Calendari implements Serializable {
+	private static final long serialVersionUID = 1L;
+	
+	@Id
+	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	@Column(name="id_calendari")
+	private Integer idCalendari;
+	
+	private Integer tipus;
+	
+	@Column(name="titol_cas")
+	private String titolCas;
+	
+	@Column(name="titol_val")
+	private String titolVal;
+	
+	private String ambit;
+	
+	@Temporal(TemporalType.DATE)
+	private Date data;
+	
+	@Transient
+	private String dataStr;
+	
+	private Integer idProces;
+	
+	private String titulacions;
+	
+	private String centres;
+	
+	private String color;
+	
+	private String status;
+	
+	public Calendari() {}
+
+	public Calendari(Integer idCalendari, Integer tipus, String titolCas, String titolVal, String ambit, Date data,
+			Integer idProces, String titulacions, String centres, String color) {
+		
+		this.idCalendari = idCalendari;
+		this.tipus = tipus;
+		this.titolCas = titolCas;
+		this.titolVal = titolVal;
+		this.ambit = ambit;
+		this.data = data;
+		this.dataStr = new SimpleDateFormat("yyyy-MM-dd").format(data);
+		this.idProces = idProces;
+		this.titulacions = titulacions;
+		this.centres = centres;
+		this.color = color;
+	}
+	
+	public Calendari(Integer idCalendari, Integer tipus, String titolCas, String titolVal, String ambit, Date data,
+			Integer idProces, String titulacions, String centres, String color, String status) {
+		
+		this.idCalendari = idCalendari;
+		this.tipus = tipus;
+		this.titolCas = titolCas;
+		this.titolVal = titolVal;
+		this.ambit = ambit;
+		this.data = data;
+		this.dataStr = new SimpleDateFormat("yyyy-MM-dd").format(data);
+		this.idProces = idProces;
+		this.titulacions = titulacions;
+		this.centres = centres;
+		this.color = color;
+		this.status = status;
+	}
+
+	public Integer getIdCalendari() {
+		return idCalendari;
+	}
+
+	public void setIdCalendari(Integer idCalendari) {
+		this.idCalendari = idCalendari;
+	}
+
+	public Integer getTipus() {
+		return tipus;
+	}
+
+	public void setTipus(Integer tipus) {
+		this.tipus = tipus;
+	}
+
+	public String getTitolCas() {
+		return titolCas;
+	}
+
+	public void setTitolCas(String titolCas) {
+		this.titolCas = titolCas;
+	}
+
+	public String getTitolVal() {
+		return titolVal;
+	}
+
+	public void setTitolVal(String titolVal) {
+		this.titolVal = titolVal;
+	}
+
+	public String getAmbit() {
+		return ambit;
+	}
+
+	public void setAmbit(String ambit) {
+		this.ambit = ambit;
+	}
+
+	public Date getData() {
+		return data;
+	}
+
+	public void setData(Date data) {
+		this.data = data;
+		this.dataStr = new SimpleDateFormat("yyyy-MM-dd").format(data);
+	}
+	
+	public String getDataStr() {
+		return dataStr;
+	}
+
+	public void setDataStr(String dataStr) {
+		this.dataStr = dataStr;
+	}
+
+	public Integer getIdProces() {
+		return idProces;
+	}
+
+	public void setIdProces(Integer idProces) {
+		this.idProces = idProces;
+	}
+
+	public String getTitulacions() {
+		return titulacions;
+	}
+
+	public void setTitulacions(String titulacions) {
+		this.titulacions = titulacions;
+	}
+
+	public String getCentres() {
+		return centres;
+	}
+
+	public void setCentres(String centres) {
+		this.centres = centres;
+	}
+
+	public String getColor() {
+		return color;
+	}
+
+	public void setColor(String color) {
+		this.color = color;
+	}
+	
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	public static long getSerialversionuid() {
+		return serialVersionUID;
+	}
+	
+}

+ 15 - 0
src/main/java/es/uv/saic/domain/CalendariRepository.java

@@ -0,0 +1,15 @@
+package es.uv.saic.domain;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface CalendariRepository extends JpaRepository<Calendari, Integer> {
+
+	@Query(value="SELECT * FROM calendari WHERE data = current_date AND status = 'P';", nativeQuery=true)
+	List<Calendari> getNextEvents(); 
+	
+}

+ 78 - 0
src/main/java/es/uv/saic/domain/Categoria.java

@@ -0,0 +1,78 @@
+package es.uv.saic.domain;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+
+@Entity
+@Table(name="categories")
+@NamedQuery(name="Categoria.findAll", query="SELECT i FROM Categoria i")
+public class Categoria {
+
+	@Id
+	@Column(name="id_categoria")
+	private Integer idCategoria;
+	private Integer pare;
+	private Integer ordre;
+	private String tipus;
+	private String nomVal;
+	private String nomCas;
+	private String tambit;
+	
+	public Categoria() {}
+	
+	public Categoria(Integer idCategoria, Integer pare, Integer ordre, String tipus, String nomVal, String nomCas, String tambit) {
+		this.idCategoria = idCategoria;
+		this.tipus = tipus;
+		this.nomVal = nomVal;
+		this.nomCas = nomCas;
+		this.pare = pare;
+		this.ordre = ordre;
+		this.tambit = tambit;
+	}
+	
+	public Integer getIdCategoria() {
+		return idCategoria;
+	}
+	public void setIdCategoria(Integer idCategoria) {
+		this.idCategoria = idCategoria;
+	}
+	public String getTipus() {
+		return tipus;
+	}
+	public void setTipus(String tipus) {
+		this.tipus = tipus;
+	}
+	public String getNomVal() {
+		return nomVal;
+	}
+	public void setNomVal(String nomVal) {
+		this.nomVal = nomVal;
+	}
+	public String getNomCas() {
+		return nomCas;
+	}
+	public void setNomCas(String nomCas) {
+		this.nomCas = nomCas;
+	}
+	public Integer getPare() {
+		return pare;
+	}
+	public void setPare(Integer pare) {
+		this.pare = pare;
+	}
+	public Integer getOrdre() {
+		return ordre;
+	}
+	public void setOrdre(Integer ordre) {
+		this.ordre = ordre;
+	}
+	public String getTambit() {
+		return tambit;
+	}
+	public void setTambit(String tambit) {
+		this.tambit = tambit;
+	}
+}

+ 34 - 0
src/main/java/es/uv/saic/domain/CategoriaDocumentDTO.java

@@ -0,0 +1,34 @@
+package es.uv.saic.domain;
+
+import java.util.List;
+
+public class CategoriaDocumentDTO {
+
+	private String text;
+	private List<DocumentDTO> children;
+	
+	public CategoriaDocumentDTO() {}
+
+	public CategoriaDocumentDTO(String text, List<DocumentDTO> children) {
+		this.text = text;
+		this.children = children;
+	}
+
+	public String getText() {
+		return text;
+	}
+
+	public void setText(String text) {
+		this.text = text;
+	}
+
+	public List<DocumentDTO> getChildren() {
+		return children;
+	}
+
+	public void setChildren(List<DocumentDTO> children) {
+		this.children = children;
+	}
+	
+	
+}

+ 34 - 0
src/main/java/es/uv/saic/domain/CategoriaPareDTO.java

@@ -0,0 +1,34 @@
+package es.uv.saic.domain;
+
+import java.util.List;
+
+public class CategoriaPareDTO {
+
+	private String text;
+	private List<CategoriaDocumentDTO> children;
+	
+	public CategoriaPareDTO() {}
+
+	public CategoriaPareDTO(String text, List<CategoriaDocumentDTO> children) {
+		this.text = text;
+		this.children = children;
+	}
+
+	public String getText() {
+		return text;
+	}
+
+	public void setText(String text) {
+		this.text = text;
+	}
+
+	public List<CategoriaDocumentDTO> getChildren() {
+		return children;
+	}
+
+	public void setChildren(List<CategoriaDocumentDTO> children) {
+		this.children = children;
+	}
+	
+	
+}

+ 30 - 0
src/main/java/es/uv/saic/domain/CategoriaRepository.java

@@ -0,0 +1,30 @@
+package es.uv.saic.domain;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface CategoriaRepository  extends JpaRepository<Categoria, Integer> {
+	
+	@Query(value="SELECT * FROM categories WHERE pare = ?1 AND (tambit = ?2 OR tambit = 'U') ORDER BY ordre ASC;", nativeQuery=true)
+	List<Categoria> findByPareTambitAndU(Integer pare, String tambit); 
+
+	@Query(value="SELECT * FROM categories WHERE pare = ?1 AND (tambit = ?2) ORDER BY ordre ASC;", nativeQuery=true)
+	List<Categoria> findByPareTambit(Integer pare, String tambit); 
+
+	@Query(value="SELECT * FROM categories WHERE tipus = ?1 AND (tambit = ?2 OR tambit = 'U') ORDER BY ordre ASC;", nativeQuery=true)
+	List<Categoria> findByTipusTambitAndU(String tipus, String tambit); 
+
+	@Query(value="SELECT * FROM categories WHERE tipus = ?1 AND (tambit = ?2) ORDER BY ordre ASC;", nativeQuery=true)
+	List<Categoria> findByTipusTambit(String tipus, String tambit); 
+	
+	@Query(value="SELECT * FROM categories WHERE pare IS NULL AND (tambit = ?1) ORDER BY ordre ASC;", nativeQuery=true)
+	List<Categoria> findFirstLevel(String ambit);
+
+	@Query(value="SELECT * FROM categories WHERE pare IS NULL AND (tambit = ?1 OR tambit = 'U') ORDER BY ordre ASC;", nativeQuery=true)
+	List<Categoria> findFirstLevelAndU(String ambit);
+
+}

+ 65 - 0
src/main/java/es/uv/saic/domain/Datasource.java

@@ -0,0 +1,65 @@
+package es.uv.saic.domain;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+
+@Entity
+@Table(name="datasources")
+@NamedQuery(name="Datasource.findAll", query="SELECT i FROM Datasource i")
+public class Datasource {
+
+    @Id
+	@Column(name="id_datasource")
+    Integer id;
+
+    String nom;
+
+    String driver;
+
+    String conn;
+
+    public Datasource(){}
+
+    public Datasource(Integer id, String nom, String driver, String conn) {
+        this.id = id;
+        this.nom = nom;
+        this.driver = driver;
+        this.conn = conn;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getNom() {
+        return nom;
+    }
+
+    public void setNom(String nom) {
+        this.nom = nom;
+    }
+
+    public String getDriver() {
+        return driver;
+    }
+
+    public void setDriver(String driver) {
+        this.driver = driver;
+    }
+
+    public String getConn() {
+        return conn;
+    }
+
+    public void setConn(String conn) {
+        this.conn = conn;
+    }
+
+}

+ 10 - 0
src/main/java/es/uv/saic/domain/DatasourceRepository.java

@@ -0,0 +1,10 @@
+package es.uv.saic.domain;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface DatasourceRepository  extends JpaRepository<Datasource, Integer> {
+
+    
+}

+ 33 - 0
src/main/java/es/uv/saic/domain/DimensioInstanciesDTO.java

@@ -0,0 +1,33 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class DimensioInstanciesDTO implements Serializable  {
+	private static final long serialVersionUID = 1L;
+	
+	private String text;
+	private List<InstanciaDTO> children;
+	
+	public DimensioInstanciesDTO() {}
+	
+	public DimensioInstanciesDTO(String text, List<InstanciaDTO> children) {
+		this.text = text;
+		this.children = children;
+	}
+	
+	public String getText() {
+		return text;
+	}
+	public void setText(String text) {
+		this.text = text;
+	}
+	public List<InstanciaDTO> getChildren() {
+		return children;
+	}
+	public void setChildren(List<InstanciaDTO> children) {
+		this.children = children;
+	}
+
+	
+}

+ 140 - 0
src/main/java/es/uv/saic/domain/Dimension.java

@@ -0,0 +1,140 @@
+package es.uv.saic.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Dimension {
+
+	private String titulacion;
+	private String dimension;
+	private List<Indicador> indicadores;
+	
+	public Dimension(){}
+	public Dimension(String titulacion, String dimension) {
+		this.titulacion = titulacion;
+		this.dimension = dimension;
+		this.indicadores = new ArrayList<Indicador>();
+	}
+	
+	public String getTitulacion() {
+		return titulacion;
+	}
+	
+	public void setTitulacion(String titulacion) {
+		this.titulacion = titulacion;
+	}
+	
+	public String getDimension() {
+		return dimension;
+	}
+	
+	public void setDimension(String dimension) {
+		this.dimension = dimension;
+	}
+	public List<Indicador> getIndicadores() {
+		return indicadores;
+	}
+	
+	public void setIndicadores(List<Indicador> indicadores) {
+		this.indicadores = indicadores;
+	}
+	
+	public boolean add(Indicador arg0) {
+		return indicadores.add(arg0);
+	}
+	
+	public Indicador get(int arg0) {
+		return indicadores.get(arg0);
+	}
+	
+	public boolean isEmpty() {
+		return indicadores.isEmpty();
+	}
+	
+	public Indicador set(int arg0, Indicador arg1) {
+		return indicadores.set(arg0, arg1);
+	}
+	
+	public int size() {
+		return indicadores.size();
+	}
+
+	public Indicador newIndicador(String indicador) {
+		return new Indicador(indicador);
+	}
+
+	public class Indicador{
+		private String indicador;
+		private List<Indicador> subindicadores;
+		private List<CursoValor> valores;
+		
+		public Indicador(){}
+		public Indicador(String indicador){
+			this.indicador = indicador;
+			this.valores = new ArrayList<CursoValor>();
+			this.subindicadores = new ArrayList<Indicador>();
+		}
+
+		public String getIndicador() {
+			return this.indicador;
+		}
+		
+		public void setIndicador(String indicador) {
+			this.indicador = indicador;
+		}
+		
+		public List<CursoValor> getValores() {
+			return this.valores;
+		}
+	
+		public boolean add(CursoValor arg0) {
+			return this.valores.add(arg0);
+		}
+	
+		public boolean isEmpty() {
+			return this.valores.isEmpty();
+		}
+	
+		public int size() {
+			return this.valores.size();
+		}
+		
+		public boolean addCursoValor(String curso, String valor) {
+			return this.add(new CursoValor(curso, valor));
+		}
+
+		public boolean addSubindicador(Indicador arg0) {
+			return this.subindicadores.add(arg0);
+		}
+		
+		public List<Indicador> getSubindicadores(){
+			return this.subindicadores;
+		}
+
+		public class CursoValor{
+			private String curso;
+			private String valor;
+			
+			public CursoValor(){ }
+			
+			public CursoValor(String curso, String valor) {
+				this.curso = curso;
+				this.valor = valor;
+			}
+			
+			public String getCurso() {
+				return curso;
+			}
+			public void setCurso(String curso) {
+				this.curso = curso;
+			}
+			public String getValor() {
+				return valor;
+			}
+			public void setValor(String valor) {
+				this.valor = valor;
+			}
+		}
+	}
+	
+}

+ 93 - 0
src/main/java/es/uv/saic/domain/Document.java

@@ -0,0 +1,93 @@
+package es.uv.saic.domain;
+
+import java.util.Date;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.JoinColumns;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+@Entity
+@Table(name="documents")
+@NamedQuery(name="Document.findAll", query="SELECT i FROM Document i")
+public class Document {
+	
+	@Id
+	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	@Column(name="id_document")
+	private Integer idDocument;
+	
+	@ManyToOne 
+	@JoinColumn(name="id_categoria")
+	private Categoria categoria;
+	
+	@ManyToOne
+	@JoinColumns({
+		@JoinColumn(name="lugar", referencedColumnName="lugar"),
+		@JoinColumn(name="tlugar", referencedColumnName="tlugar")
+		})
+	@JsonIgnore
+	private Organ organ;
+	
+	private String nom;
+	
+	private String ruta;
+	
+	private Date data;
+	
+	private boolean visible;
+	
+
+	public Integer getIdDocument() {
+		return idDocument;
+	}
+	public void setIdDocument(Integer idDocument) {
+		this.idDocument = idDocument;
+	}
+	public Categoria getCategoria() {
+		return categoria;
+	}
+	public void setCategoria(Categoria categoria) {
+		this.categoria = categoria;
+	}
+	public Organ getOrgan() {
+		return organ;
+	}
+	public void setOrgan(Organ organ) {
+		this.organ = organ;
+	}
+	public String getNom() {
+		return nom;
+	}
+	public void setNom(String nom) {
+		this.nom = nom;
+	}
+	public String getRuta() {
+		return ruta;
+	}
+	public void setRuta(String ruta) {
+		this.ruta = ruta;
+	}
+	public Date getData() {
+		return data;
+	}
+	public void setData(Date data) {
+		this.data = data;
+	}
+	public boolean isVisible() {
+		return visible;
+	}
+	public void setVisible(boolean visible) {
+		this.visible = visible;
+	}
+	
+	
+}

+ 40 - 0
src/main/java/es/uv/saic/domain/DocumentDTO.java

@@ -0,0 +1,40 @@
+package es.uv.saic.domain;
+
+public class DocumentDTO {
+
+	private String text;
+	private String ruta;
+	
+	public DocumentDTO() {}
+	
+	public DocumentDTO(String text, String ruta, String data, String size) {
+		String template = """
+			<a style="width:100;display:flex;" target="_blank" href="/download/document/[ruta]">
+				<span style="width:100%;display:flex;">
+					<span style="width:80%;text-align:left;">[text]</span>
+					<span>[data]</span>
+					&nbsp;&nbsp;&nbsp;
+					<span> ([size])</span>
+				</span>
+			</a>
+		""";
+		this.text = template.replace("[ruta]", ruta).replace("[text]", text).replace("[data]", data).replace("[size]", size);
+		this.ruta = ruta;
+	}
+	
+	public String getText() {
+		return text;
+	}
+	public void setText(String text) {
+		this.text = text;
+	}
+	public String getRuta() {
+		return ruta;
+	}
+	public void setRuta(String ruta) {
+		this.ruta = ruta;
+	}
+	
+	
+	
+}

+ 31 - 0
src/main/java/es/uv/saic/domain/DocumentRepository.java

@@ -0,0 +1,31 @@
+package es.uv.saic.domain;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+public interface DocumentRepository  extends JpaRepository<Document, Integer> {
+	
+	@Query(value="SELECT * FROM documents WHERE id_categoria = ?1 AND ((lugar = ?2 AND tlugar = ?3) OR lugar = 0) AND visible LIMIT 1;", nativeQuery=true)
+	Document findByCategoriaOrgan(Integer categoria, Integer lugar, String tlugar); 
+	
+	@Query(value="SELECT * FROM documents WHERE id_categoria = ?1 AND ((lugar = ?2 AND tlugar = ?3) OR lugar = 0) AND visible", nativeQuery=true)
+	List<Document> findAllByCategoriaOrgan(Integer categoria, Integer lugar, String tlugar);
+	
+	@Query(value="SELECT * FROM documents d LEFT JOIN categories c ON d.id_categoria = c.id_categoria WHERE c.nom_val = ?1 AND visible", nativeQuery=true)
+	List<Document> findByCategoriaNom(String nom); 
+	
+	@Query(value="SELECT * FROM documents d LEFT JOIN categories c ON d.id_categoria = c.id_categoria WHERE c.tipus = ?1 AND visible", nativeQuery=true)
+	List<Document> findByCategoriaTipus(String tipus); 
+	
+	@Transactional
+    @Modifying(flushAutomatically = true, clearAutomatically = true)
+	@Query(value="UPDATE documents SET visible = false WHERE lugar = ?1 AND tlugar = ?2", nativeQuery=true)
+	void archiveByOrgan(Integer lugar, String tlugar);
+
+}

+ 34 - 0
src/main/java/es/uv/saic/domain/DocumentTemplate.java

@@ -0,0 +1,34 @@
+package es.uv.saic.domain;
+
+import fr.opensagres.xdocreport.document.images.IImageProvider;
+import fr.opensagres.xdocreport.template.annotations.FieldMetadata;
+import fr.opensagres.xdocreport.template.annotations.ImageMetadata;
+
+public class DocumentTemplate {
+
+	@SuppressWarnings("unused")
+	private static final long serialVersionUID = 1L;
+	private final String centre;
+	private final String curs;
+	private final IImageProvider logo;
+
+	public DocumentTemplate(String centre, String curs, IImageProvider logo) {
+		this.centre = centre;
+		this.curs = curs;
+		this.logo = logo;
+	}
+
+	public String getCentre() {
+		return centre;
+	}
+
+	public String getCurs() {
+		return curs;
+	}
+
+	@FieldMetadata( images = { @ImageMetadata( name = "logo" ) }, description="Logo"  )
+    public IImageProvider getLogo(){
+        return this.logo;
+    }
+	  
+}

+ 71 - 0
src/main/java/es/uv/saic/domain/DummyDataTransfer.java

@@ -0,0 +1,71 @@
+package es.uv.saic.domain;
+
+public class DummyDataTransfer {
+
+	public String text;
+	public String text2;
+	public String text3;
+	public int value;
+	public int value2;
+	public int value3;
+	
+	
+	public String getText() {
+		return text;
+	}
+	public void setText(String text) {
+		this.text = text;
+	}
+	public int getValue() {
+		return value;
+	}
+	public void setValue(int value) {
+		this.value = value;
+	}
+	public String getText2() {
+		return text2;
+	}
+	public void setText2(String text2) {
+		this.text2 = text2;
+	}
+	public int getValue2() {
+		return value2;
+	}
+	public void setValue2(int value2) {
+		this.value2 = value2;
+	}
+	public String getText3() {
+		return text3;
+	}
+	public void setText3(String text3) {
+		this.text3 = text3;
+	}
+	public int getValue3() {
+		return value3;
+	}
+	public void setValue3(int value3) {
+		this.value3 = value3;
+	}
+	public boolean equals (Object o) {
+		if(o == null) { return false; }
+		if (this.getClass() != o.getClass()) { return false; }
+		DummyDataTransfer x = (DummyDataTransfer) o;
+		if (x.text.equals(this.text)) return true;
+        return false;
+	}
+	
+	public int hashCode() {
+		final int prime = 31;
+		int hash = 17;
+		hash = hash * prime + this.text.hashCode();
+		hash = hash * prime + this.text2.hashCode();
+		hash = hash * prime + this.text3.hashCode();
+		hash = hash * prime + Integer.toString(this.value).hashCode();
+		hash = hash * prime + Integer.toString(this.value2).hashCode();
+		hash = hash * prime + Integer.toString(this.value3).hashCode();
+		
+		return hash;
+	}
+	
+	
+}

+ 45 - 0
src/main/java/es/uv/saic/domain/Email.java

@@ -0,0 +1,45 @@
+package es.uv.saic.domain;
+
+
+public class Email {
+
+	private Usuari ususari;
+	private InstanciaTasca instanciaTasca;
+	private String to;
+	private String subject;
+	private String body;
+	
+	public Usuari getUsusari() {
+		return ususari;
+	}
+	public void setUsusari(Usuari ususari) {
+		this.ususari = ususari;
+	}
+	public InstanciaTasca getInstanciaTasca() {
+		return instanciaTasca;
+	}
+	public void setInstanciaTasca(InstanciaTasca instanciaTasca) {
+		this.instanciaTasca = instanciaTasca;
+	}
+	public String getTo() {
+		return to;
+	}
+	public void setTo(String to) {
+		this.to = to;
+	}
+	public String getSubject() {
+		return subject;
+	}
+	public void setSubject(String subject) {
+		this.subject = subject;
+	}
+	public String getBody() {
+		return body;
+	}
+	public void setBody(String body) {
+		this.body = body;
+	}
+	
+	
+	
+}

+ 36 - 0
src/main/java/es/uv/saic/domain/EvidenciaIndicadorEnquesta.java

@@ -0,0 +1,36 @@
+package es.uv.saic.domain;
+
+import jakarta.persistence.EmbeddedId;
+import jakarta.persistence.Entity;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+
+@Entity
+@Table(name="evidencia_indicador_enquesta")
+@NamedQuery(name="EvidenciaIndicadorEnquesta.findAll", query="SELECT n FROM EvidenciaIndicadorEnquesta n")
+public class EvidenciaIndicadorEnquesta {
+	
+	@EmbeddedId
+	private EvidenciaIndicadorEnquestaPK id;
+	
+	private String media;
+	
+	public EvidenciaIndicadorEnquesta(){}
+
+	public EvidenciaIndicadorEnquestaPK getId() {
+		return id;
+	}
+
+	public void setId(EvidenciaIndicadorEnquestaPK id) {
+		this.id = id;
+	}
+
+	public String getMedia() {
+		return media;
+	}
+
+	public void setMedia(String media) {
+		this.media = media;
+	}	
+
+}

+ 78 - 0
src/main/java/es/uv/saic/domain/EvidenciaIndicadorEnquestaPK.java

@@ -0,0 +1,78 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+
+public class EvidenciaIndicadorEnquestaPK  implements Serializable {
+	
+	private static final long serialVersionUID = 1L;
+	
+	private String proces;
+	private String evidencia;
+	private String enquesta;
+	private String indicador;
+	
+	public EvidenciaIndicadorEnquestaPK() {}
+
+	public String getProces() {
+		return proces;
+	}
+
+	public void setProces(String proces) {
+		this.proces = proces;
+	}
+
+	public String getEvidencia() {
+		return evidencia;
+	}
+
+	public void setEvidencia(String evidencia) {
+		this.evidencia = evidencia;
+	}
+
+	public String getEnquesta() {
+		return enquesta;
+	}
+
+	public void setEnquesta(String enquesta) {
+		this.enquesta = enquesta;
+	}
+
+	public String getIndicador() {
+		return indicador;
+	}
+
+	public void setIndicador(String indicador) {
+		this.indicador = indicador;
+	}
+	
+	public static long getSerialversionuid() {
+		return serialVersionUID;
+	}
+	
+	public boolean equals(Object other) {
+		if (this == other) {
+			return true;
+		}
+		if (!(other instanceof EvidenciaIndicadorEnquestaPK)) {
+			return false;
+		}
+		EvidenciaIndicadorEnquestaPK castOther = (EvidenciaIndicadorEnquestaPK)other;
+		return 
+			this.proces.equals(castOther.proces)
+			&& this.evidencia.equals(castOther.evidencia)
+			&& this.enquesta.equals(castOther.enquesta)
+			&& this.indicador.equals(castOther.indicador);
+	}
+
+	public int hashCode() {
+		final int prime = 31;
+		int hash = 17;
+		hash = hash * prime + this.proces.hashCode();
+		hash = hash * prime + this.evidencia.hashCode();
+		hash = hash * prime + this.enquesta.hashCode();
+		hash = hash * prime + this.indicador.hashCode();
+		
+		return hash;
+	}
+	
+}

+ 29 - 0
src/main/java/es/uv/saic/domain/EvidenciaIndicadorEnquestaRepository.java

@@ -0,0 +1,29 @@
+package es.uv.saic.domain;
+
+import java.util.List;
+
+import jakarta.transaction.Transactional;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface EvidenciaIndicadorEnquestaRepository extends JpaRepository<EvidenciaIndicadorEnquesta, EvidenciaIndicadorEnquestaPK>  {
+
+	@Query("SELECT a FROM EvidenciaIndicadorEnquesta a")
+	List<EvidenciaIndicadorEnquesta> findAll();
+	
+	@Query(value="SELECT * FROM evidencia_indicador_enquesta WHERE proces = ?1 AND evidencia = ?2 AND enquesta = ?3", nativeQuery=true)
+	List<EvidenciaIndicadorEnquesta> getIndicadors(String proces, String evidencia, String enquesta);
+	
+	@Query(value="SELECT * FROM evidencia_indicador_enquesta WHERE proces = ?1 AND evidencia = ?2", nativeQuery=true)
+	List<EvidenciaIndicadorEnquesta> getByProcesEvidencia(String proces, String evidencia);
+	
+	@Modifying
+	@Transactional
+	@Query(value="DELETE FROM evidencia_indicador_enquesta WHERE proces = ?1 AND evidencia = ?2", nativeQuery=true)
+	void removeByProcesEvidencia(String proces, String evidencia);
+
+}

+ 64 - 0
src/main/java/es/uv/saic/domain/EvidenciaTransfer.java

@@ -0,0 +1,64 @@
+package es.uv.saic.domain;
+
+import java.math.BigInteger;
+import java.util.Date;
+
+public class EvidenciaTransfer {
+	private String evidencia;
+	private String codiEvidencia;
+	private String nomEvidenciaCas;
+	private String nomEvidenciaVal;
+	private Integer curs;
+	private Date data;
+	private String nomProces;
+	private BigInteger idTascai;
+	
+	public String getEvidencia() {
+		return evidencia;
+	}
+	public void setEvidencia(String evidencia) {
+		this.evidencia = evidencia;
+	}
+	public String getCodiEvidencia() {
+		return codiEvidencia;
+	}
+	public void setCodiEvidencia(String codiEvidencia) {
+		this.codiEvidencia = codiEvidencia;
+	}
+	public Date getData() {
+		return data;
+	}
+	public void setData(Date data) {
+		this.data = data;
+	}
+	public String getNomProces() {
+		return nomProces;
+	}
+	public void setNomProces(String nomProces) {
+		this.nomProces = nomProces;
+	}
+	public BigInteger getIdTascai() {
+		return idTascai;
+	}
+	public void setIdTascai(BigInteger idTascai) {
+		this.idTascai = idTascai;
+	}
+	public String getNomEvidenciaCas() {
+		return nomEvidenciaCas;
+	}
+	public void setNomEvidenciaCas(String nomEvidenciaCas) {
+		this.nomEvidenciaCas = nomEvidenciaCas;
+	}
+	public String getNomEvidenciaVal() {
+		return nomEvidenciaVal;
+	}
+	public void setNomEvidenciaVal(String nomEvidenciaVal) {
+		this.nomEvidenciaVal = nomEvidenciaVal;
+	}
+	public Integer getCurs() {
+		return curs;
+	}
+	public void setCurs(Integer curs) {
+		this.curs = curs;
+	}
+}

+ 129 - 0
src/main/java/es/uv/saic/domain/Grafica.java

@@ -0,0 +1,129 @@
+package es.uv.saic.domain;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.EmbeddedId;
+import jakarta.persistence.Entity;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+
+@Entity
+@Table(name="grafiques")
+@NamedQuery(name="Grafica.findAll", query="SELECT g FROM Grafica g")
+public class Grafica {
+
+	@EmbeddedId
+	private GraficaPK idGrafica;
+	
+	private String dimensio;
+	
+	private String enquesta;
+	
+	private String indicador;
+	
+	private Integer g;
+	
+	@Column(name="nom_cas")
+	private String nomCas;
+	
+	@Column(name="nom_val")
+	private String nomVal;
+	
+	private String unitats;
+	
+	private boolean negar;
+	
+	private boolean likert;
+	
+	private Integer ordre;
+	
+	public Grafica() {}
+
+	public GraficaPK getIdGrafica() {
+		return idGrafica;
+	}
+
+	public void setIdGrafica(GraficaPK idGrafica) {
+		this.idGrafica = idGrafica;
+	}
+
+	public String getDimensio() {
+		return dimensio;
+	}
+
+	public void setDimensio(String dimensio) {
+		this.dimensio = dimensio;
+	}
+
+	public String getEnquesta() {
+		return enquesta;
+	}
+
+	public void setEnquesta(String enquesta) {
+		this.enquesta = enquesta;
+	}
+
+	public String getIndicador() {
+		return indicador;
+	}
+
+	public void setIndicador(String indicador) {
+		this.indicador = indicador;
+	}
+
+	public Integer getG() {
+		return g;
+	}
+
+	public void setG(Integer g) {
+		this.g = g;
+	}
+
+	public String getNomCas() {
+		return nomCas;
+	}
+
+	public void setNomCas(String nomCas) {
+		this.nomCas = nomCas;
+	}
+
+	public String getNomVal() {
+		return nomVal;
+	}
+
+	public void setNomVal(String nomVal) {
+		this.nomVal = nomVal;
+	}
+
+	public String getUnitats() {
+		return unitats;
+	}
+
+	public void setUnitats(String unitats) {
+		this.unitats = unitats;
+	}
+
+	public boolean isNegar() {
+		return negar;
+	}
+
+	public void setNegar(boolean negar) {
+		this.negar = negar;
+	}
+
+	public boolean isLikert() {
+		return likert;
+	}
+
+	public void setLikert(boolean likert) {
+		this.likert = likert;
+	}
+
+	public Integer getOrdre() {
+		return ordre;
+	}
+
+	public void setOrdre(Integer ordre) {
+		this.ordre = ordre;
+	}
+	
+}

+ 60 - 0
src/main/java/es/uv/saic/domain/GraficaPK.java

@@ -0,0 +1,60 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Embeddable;
+
+@Embeddable
+public class GraficaPK implements Serializable {
+	
+	private static final long serialVersionUID = 1L;
+	
+	@Column(name="id_grafica")
+	private String idGrafica;
+	private String estudi;
+	private String ambit;
+	
+	public GraficaPK() { }
+	
+	public String getIdGrafica() {
+		return idGrafica;
+	}
+	public void setIdGrafica(String idGrafica) {
+		this.idGrafica = idGrafica;
+	}
+	public String getEstudi() {
+		return estudi;
+	}
+	public void setEstudi(String estudi) {
+		this.estudi = estudi;
+	}
+	public String getAmbit() {
+		return ambit;
+	}
+	public void setAmbit(String ambit) {
+		this.ambit = ambit;
+	}
+
+	@Override
+	public int hashCode() {
+		return Objects.hash(ambit, estudi, idGrafica);
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		GraficaPK other = (GraficaPK) obj;
+		return Objects.equals(ambit, other.ambit) && Objects.equals(estudi, other.estudi)
+				&& Objects.equals(idGrafica, other.idGrafica);
+	}
+	
+	
+	
+}

+ 18 - 0
src/main/java/es/uv/saic/domain/GraficaRepository.java

@@ -0,0 +1,18 @@
+package es.uv.saic.domain;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface GraficaRepository  extends JpaRepository<Grafica, GraficaPK> {
+
+	@Query(value="SELECT * FROM grafiques WHERE ambit LIKE ?1", nativeQuery=true)
+	List<Grafica> findLikeAmbit(String ambit);
+	
+	@Query(value="SELECT * FROM grafiques WHERE ambit LIKE ?1 AND UPPER(estudi) = UPPER(?2)", nativeQuery=true)
+	List<Grafica> findLikeAmbitAndEstudi(String ambit, String estudi);
+	
+}

+ 119 - 0
src/main/java/es/uv/saic/domain/Indicador.java

@@ -0,0 +1,119 @@
+package es.uv.saic.domain;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Optional;
+
+public class Indicador {
+	
+	private String dimension;
+	private String indicador;
+	private String valor;
+	private String ambit;
+	private List<CursoValor> valores;
+	
+	public Indicador() {
+		this.valores = new ArrayList<CursoValor>();
+	}
+	
+	public Indicador(String dimension, String indicador, String valor) {
+		this.dimension = dimension;
+		this.indicador = indicador;
+		this.valor = valor;
+		this.valores = new ArrayList<CursoValor>();
+	}
+
+	public String getDimension() {
+		return dimension;
+	}
+	
+	public void setDimension(String dimension) {
+		this.dimension = dimension;
+	}
+	
+	public String getIndicador() {
+		return indicador;
+	}
+
+	public void setIndicador(String indicador) {
+		this.indicador = indicador;
+	}
+
+	public String getValor() {
+		return valor;
+	}
+
+	public void setValor(String valor) {
+		this.valor = valor;
+	}
+	
+	public String getAmbit() {
+		return ambit;
+	}
+
+	public void setAmbit(String ambit) {
+		this.ambit = ambit;
+	}
+
+	public List<CursoValor> getValores() {
+		return valores;
+	}
+
+	public void setValores(List<CursoValor> valores) {
+		this.valores = valores;
+	}
+	
+	public void addCursoValor(String curso, String valor) {
+		this.valores.add(new CursoValor(curso, valor));
+	}
+	
+	public void obtenerValor() {
+		this.valor = this.maxCursoValor().getValor().toString();
+	}
+	
+	public CursoValor maxCursoValor() {
+		Optional<CursoValor> v = this.valores.stream().max(Comparator.comparing(CursoValor::getCurso));
+		if(v.isPresent()) {
+			return v.get();
+		}
+		else {
+			return null;
+		}
+	}
+
+
+	public class CursoValor{
+		private String periodo;
+		private String valor;
+		private Integer curso;
+		
+		public CursoValor(){ }
+		
+		public CursoValor(String periodo, String valor) {
+			this.periodo = periodo;
+			this.valor = valor;
+			this.curso = Integer.parseInt(periodo.split("-")[1]);
+		}
+		
+		public String getPeriodo() {
+			return periodo;
+		}
+		public void setPeriodo(String periodo) {
+			this.periodo = periodo;
+		}
+		public Integer getCurso() {
+			return curso;
+		}
+		public void setValor(Integer curso) {
+			this.curso = curso;
+		}
+		public String getValor() {
+			return valor;
+		}
+		public void setValor(String valor) {
+			this.valor = valor;
+		}
+	}
+
+}

+ 240 - 0
src/main/java/es/uv/saic/domain/IndicadorEnquesta.java

@@ -0,0 +1,240 @@
+package es.uv.saic.domain;
+
+import java.sql.Timestamp;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+
+@Entity
+@Table(name="indicador_enquesta")
+@NamedQuery(name="IndicadorEnquesta.findAll", query="SELECT n FROM IndicadorEnquesta n")
+public class IndicadorEnquesta {
+ 
+	@Id 
+	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	@Column(name="id", updatable = false, nullable = false)
+	private Integer id;
+	private String valor;
+	private String num;
+	private Integer titulacio;
+	private Integer centre;
+	private Integer curs;
+	private String enquesta;
+	private String indicador;
+	private String ambit;
+	private String tipus;
+	private String estudi;
+	private String cursd;
+	private String cursEnquesta;
+	private String centreOrigen;
+	private String titulacioOrigen;
+	private Integer nenq;
+	private Integer ruct;
+	@Temporal(TemporalType.TIMESTAMP)
+	private Timestamp data;
+	
+	public IndicadorEnquesta(){}
+	
+	public Integer getId() {
+		return id;
+	}
+	
+	public void setId(Integer id) {
+		this.id = id;
+	}
+	
+	public Integer getTitulacio() {
+		return titulacio;
+	}
+
+	public void setTitulacio(Integer titulacio) {
+		this.titulacio = titulacio;
+	}
+	
+	public Integer getCentre() {
+		return centre;
+	}
+
+	public void setCentre(Integer centre) {
+		this.centre = centre;
+	}
+
+	public Integer getCurs() {
+		return curs;
+	}
+
+	public void setCurs(Integer curs) {
+		this.curs = curs;
+	}
+
+	public String getEnquesta() {
+		return enquesta;
+	}
+
+	public void setEnquesta(String enquesta) {
+		this.enquesta = enquesta;
+	}
+
+	public String getIndicador() {
+		return indicador;
+	}
+
+	public void setIndicador(String indicador) {
+		this.indicador = indicador;
+	}
+	
+	public String getValor() {
+		return valor;
+	}
+	
+	public void setValor(String valor) {
+		this.valor = valor;
+	}
+	
+	public String getNum() {
+		return num;
+	}
+	
+	public void setNum(String num) {
+		this.num = num;
+	}
+	
+	public String getAmbit() {
+		return ambit;
+	}
+	
+	public void setAmbit(String ambit) {
+		this.ambit = ambit;
+	}
+	
+	public String getTipus() {
+		return tipus;
+	}
+	
+	public void setTipus(String tipus) {
+		this.tipus = tipus;
+	}
+	
+	public String getEstudi() {
+		return estudi;
+	}
+	
+	public void setEstudi(String estudi) {
+		this.estudi = estudi;
+	}
+	
+	public String getCursd() {
+		return cursd;
+	}
+	
+	public void setCursd(String cursd) {
+		this.cursd = cursd;
+	}
+	
+	public String getCursEnquesta() {
+		return cursEnquesta;
+	}
+
+	public void setCursEnquesta(String cursEnquesta) {
+		this.cursEnquesta = cursEnquesta;
+	}
+
+	public String getCentreOrigen() {
+		return centreOrigen;
+	}
+
+	public void setCentreOrigen(String centreOrigen) {
+		this.centreOrigen = centreOrigen;
+	}
+
+	public String getTitulacioOrigen() {
+		return titulacioOrigen;
+	}
+
+	public void setTitulacioOrigen(String titulacioOrigen) {
+		this.titulacioOrigen = titulacioOrigen;
+	}
+
+	public Integer getNenq() {
+		return nenq;
+	}
+
+	public void setNenq(Integer nenq) {
+		this.nenq = nenq;
+	}
+
+	public Integer getRuct() {
+		return ruct;
+	}
+
+	public void setRuct(Integer ruct) {
+		this.ruct = ruct;
+	}
+
+	public Timestamp getData() {
+		return data;
+	}
+
+	public void setData(Timestamp data) {
+		this.data = data;
+	}
+	
+	public boolean equals(Object other) {
+		if (this == other) {
+			return true;
+		}
+		if (!(other instanceof IndicadorEnquesta)) {
+			return false;
+		}
+		IndicadorEnquesta castOther = (IndicadorEnquesta)other;
+		return 
+			this.id.equals(castOther.id) &&
+			this.valor.equals(castOther.valor) &&
+			this.num.equals(castOther.num) &&
+			this.centre.equals(castOther.centre) &&
+			this.titulacio.equals(castOther.titulacio) &&
+			this.curs.equals(castOther.curs) &&
+			this.ambit.equals(castOther.ambit) &&
+			this.enquesta.equals(castOther.enquesta) &&
+			this.indicador.equals(castOther.indicador) &&
+			this.cursd.equals(castOther.cursd) &&
+			this.cursEnquesta.equals(castOther.cursEnquesta) &&
+			this.titulacioOrigen.equals(castOther.titulacioOrigen) &&
+			this.centreOrigen.equals(castOther.centreOrigen) &&
+			this.nenq.equals(castOther.nenq) &&
+			this.ruct.equals(castOther.ruct)&&
+			this.data.equals(castOther.data);
+	}
+
+	public int hashCode() {
+		final int prime = 31;
+		int hash = 17;
+		hash = hash * prime + this.id.hashCode();
+		hash = hash * prime + this.valor.hashCode();
+		hash = hash * prime + this.num.hashCode();
+		hash = hash * prime + this.centre.hashCode();
+		hash = hash * prime + this.titulacio.hashCode();
+		hash = hash * prime + this.curs.hashCode();
+		hash = hash * prime + this.ambit.hashCode();
+		hash = hash * prime + this.enquesta.hashCode();
+		hash = hash * prime + this.indicador.hashCode();
+		hash = hash * prime + this.cursd.hashCode();
+		hash = hash * prime + this.cursEnquesta.hashCode();
+		hash = hash * prime + this.titulacioOrigen.hashCode();
+		hash = hash * prime + this.centreOrigen.hashCode();
+		hash = hash * prime + this.nenq.hashCode();
+		hash = hash * prime + this.ruct.hashCode();
+		hash = hash * prime + this.data.hashCode();
+		
+		return hash;
+	}
+
+		
+}

+ 177 - 0
src/main/java/es/uv/saic/domain/IndicadorEnquestaRepository.java

@@ -0,0 +1,177 @@
+package es.uv.saic.domain;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+public interface IndicadorEnquestaRepository extends JpaRepository<IndicadorEnquesta, Long> {
+	
+	@Query("SELECT i FROM IndicadorEnquesta i")
+	List<IndicadorEnquesta> findAll();
+	
+	@Query(value="SELECT DISTINCT(CONCAT(enquesta, '_', indicador)) FROM indicador_enquesta ORDER BY 1 ASC", nativeQuery=true)
+	List<String> findTypes();
+	
+	@Query(value="SELECT * FROM indicador_enquesta WHERE enquesta = ?1 AND curs = ?2 AND ambit = ?3 AND estudi = ?4", nativeQuery=true)
+	List<IndicadorEnquesta> findByEnquestaCursAmbitEstudi(String enquesta, Integer curs, String ambit, String estudi);
+	
+	@Query(value="SELECT * FROM indicador_enquesta WHERE enquesta = ?1 AND curs = ?2 AND ambit = ?3 AND estudi = ?4 "
+			+ "AND centre = ?5 AND (titulacio = ?6 OR titulacio IN(SELECT lugar_eq FROM organs_equivalents WHERE tlugar = 'T' AND lugar = ?6))", nativeQuery=true)
+	List<IndicadorEnquesta> findByEnquestaCursAmbitEstudiCentreTitulacio(String enquesta, Integer curs, String ambit, String estudi,
+																		 Integer centre, Integer titulacio);
+	
+	@Query(value="SELECT * FROM indicador_enquesta WHERE enquesta = ?1 AND curs = ?2 AND ambit = ?3 AND estudi = ?4 AND centre = ?5", nativeQuery=true)
+	List<IndicadorEnquesta> findByEnquestaCursAmbitEstudiCentre(String enquesta, Integer curs, String ambit, String estudi,
+																		 Integer centre);
+	
+	@Query(value="SELECT LOWER(ei.enquesta) AS enquesta, LOWER(ei.indicador) AS indicador, ei.valor, LOWER(ei.ambit) AS ambit, ei.tipus, ei.cursd "
+			+ "FROM indicador_enquesta ei "
+			+ "JOIN evidencia_indicador_enquesta eie ON LOWER(ei.enquesta) = LOWER(eie.enquesta) AND LOWER(ei.indicador) = LOWER(eie.indicador) "
+			+ "WHERE eie.evidencia = ?1 AND eie.proces = ?2 AND ei.curs = ?5 AND ei.ambit = 'T' "
+			+ "AND ei.centre = ?4 AND (ei.titulacio = ?3 OR ei.titulacio IN(SELECT lugar_eq FROM organs_equivalents WHERE tlugar_eq = 'T' AND tlugar = 'T' AND lugar = ?3)) "
+			+ "UNION "
+			+ "SELECT LOWER(ei.enquesta) AS enquesta, LOWER(ei.indicador) AS indicador, ei.valor, LOWER(ei.ambit) AS ambit, ei.tipus, ei.cursd  "
+			+ "FROM indicador_enquesta ei "
+			+ "JOIN evidencia_indicador_enquesta eie ON LOWER(ei.enquesta) = LOWER(eie.enquesta) AND LOWER(ei.indicador) = LOWER(eie.indicador) "
+			+ "WHERE eie.evidencia = ?1 AND eie.proces = ?2 AND ei.curs = ?5 AND ei.ambit = 'C' "
+			+ "AND ei.centre = ?4 "
+			+ "UNION "
+			+ "SELECT LOWER(ei.enquesta) AS enquesta, LOWER(ei.indicador) AS indicador, ei.valor, LOWER(ei.ambit) AS ambit, ei.tipus, ei.cursd  "
+			+ "FROM indicador_enquesta ei "
+			+ "JOIN evidencia_indicador_enquesta eie ON LOWER(ei.enquesta) = LOWER(eie.enquesta) AND LOWER(ei.indicador) = LOWER(eie.indicador) "
+			+ "WHERE eie.evidencia = ?1 AND eie.proces = ?2 AND ei.curs = ?5 AND ei.ambit = 'U'", nativeQuery=true)
+	List<IndicadorEnquestaValor> getAssociatedInds(String evidencia, String proces, Integer titulacio, Integer centre, Integer curs);
+	
+	@Query(value="SELECT LOWER(ei.enquesta) AS enquesta, LOWER(ei.indicador) AS indicador, ei.valor, LOWER(ei.ambit) AS ambit, ei.tipus, ei.cursd, ei.titulacio "
+			+ "FROM indicador_enquesta ei "
+			+ "WHERE ei.curs = ?3 AND ei.ambit = 'T' AND ei.centre = ?2 "
+			+ "AND (ei.titulacio = ?1 OR ei.titulacio IN(SELECT lugar_eq FROM organs_equivalents WHERE tlugar_eq = 'T' AND tlugar = 'T' AND lugar = ?1)) "
+			+ "UNION "
+			+ "SELECT LOWER(ei.enquesta) AS enquesta, LOWER(ei.indicador) AS indicador, ei.valor, LOWER(ei.ambit) AS ambit, ei.tipus, ei.cursd, 0 AS titulacio  "
+			+ "FROM indicador_enquesta ei "
+			+ "WHERE ei.curs = ?3 AND ei.ambit = 'C' AND ei.centre = ?2 "
+			+ "UNION "
+			+ "SELECT LOWER(ei.enquesta) AS enquesta, LOWER(ei.indicador) AS indicador, ei.valor, LOWER(ei.ambit) AS ambit, ei.tipus, ei.cursd, 0 AS titulacio  "
+			+ "FROM indicador_enquesta ei "
+			+ "WHERE ei.curs = ?3 AND ei.ambit = 'U' "
+			+ "ORDER BY 7 DESC ", nativeQuery=true)
+	List<IndicadorEnquestaValor> getAllInds(Integer titulacio, Integer centre, Integer curs);
+	
+	@Query(value="SELECT LOWER(ei.enquesta) AS enquesta, LOWER(ei.indicador) AS indicador, ei.valor, ei.num, LOWER(ei.ambit) AS ambit, ei.tipus, ei.cursd, ei.titulacio "
+			+ "FROM indicador_enquesta ei "
+			+ "WHERE ei.curs = ?3 AND upper(ei.ambit) = 'T' AND ei.centre = ?2 "
+			+ "AND (ei.titulacio = ?1 OR ei.titulacio IN(SELECT lugar_eq FROM organs_equivalents WHERE tlugar_eq = 'T' AND tlugar = 'T' AND lugar = ?1)) "
+			+ "UNION "
+			+ "SELECT LOWER(ei.enquesta) AS enquesta, LOWER(ei.indicador) AS indicador, ei.valor, ei.num, LOWER(ei.ambit) AS ambit, ei.tipus, ei.cursd, 0 AS titulacio  "
+			+ "FROM indicador_enquesta ei "
+			+ "WHERE ei.curs = ?3 AND upper(ei.ambit) = 'C' AND ei.centre = ?2 AND upper(ei.estudi) IN(?4, 'U') "
+			+ "UNION "
+			+ "SELECT LOWER(ei.enquesta) AS enquesta, LOWER(ei.indicador) AS indicador, ei.valor, ei.num, LOWER(ei.ambit) AS ambit, ei.tipus, ei.cursd, 0 AS titulacio  "
+			+ "FROM indicador_enquesta ei "
+			+ "WHERE ei.curs = ?3 AND upper(ei.ambit) = 'U' AND upper(ei.estudi) IN(?4, 'U') "
+			+ "ORDER BY 7 DESC ", nativeQuery=true)
+	List<IndicadorEnquestaValor> getAllIndValsByEstudi(Integer titulacio, Integer centre, Integer curs, String estudi);
+	
+	@Query(value="SELECT ei.* "
+			+ "FROM indicador_enquesta ei "
+			+ "WHERE ei.curs = ?3 AND upper(ei.ambit) = 'T' AND ei.centre = ?2 "
+			+ "AND (ei.titulacio = ?1 OR ei.titulacio IN(SELECT lugar_eq FROM organs_equivalents WHERE tlugar_eq = 'T' AND tlugar = 'T' AND lugar = ?1)) "
+			+ "UNION "
+			+ "SELECT ei.*  "
+			+ "FROM indicador_enquesta ei "
+			+ "WHERE ei.curs = ?3 AND upper(ei.ambit) = 'C' AND ei.centre = ?2 AND upper(ei.estudi) IN(?4, 'U') "
+			+ "UNION "
+			+ "SELECT ei.*  "
+			+ "FROM indicador_enquesta ei "
+			+ "WHERE ei.curs = ?3 AND upper(ei.ambit) = 'U' AND upper(ei.estudi) IN(?4, 'U') "
+			+ "ORDER BY 7 DESC ", nativeQuery=true)
+	List<IndicadorEnquesta> getAllIndsByEstudi(Integer titulacio, Integer centre, Integer curs, String estudi);
+		
+	@Query(value="SELECT DISTINCT gr.dimensio, gr.estudi, ie.ambit, gr.ordre, ie.indicador, curs, valor FROM indicador_enquesta ie "
+			+ "		INNER JOIN grafiques gr ON ie.indicador = gr.indicador AND ie.enquesta = gr.enquesta AND LOWER(ie.estudi) = LOWER(gr.estudi) "
+			+ "		WHERE UPPER(ie.ambit) = 'T' AND LOWER(ie.estudi) = LOWER(?3) AND titulacio IN (?1) AND centre = ?2 AND curs > ?4 AND tipus = 'avg' "
+			+ "UNION "
+			+ "SELECT DISTINCT gr.dimensio, gr.estudi, ie.ambit, gr.ordre, ie.indicador, curs, valor FROM indicador_enquesta ie "
+			+ "		INNER JOIN grafiques gr ON ie.indicador = gr.indicador AND ie.enquesta = gr.enquesta AND (LOWER(ie.estudi) = LOWER(gr.estudi) OR LOWER(ie.estudi) = 'u') "
+			+ "		WHERE UPPER(ie.ambit) = 'C' AND (LOWER(ie.estudi) = LOWER(?3) OR LOWER(ie.estudi) = 'u') AND centre = ?2 AND curs > ?4 AND tipus = 'avg' "
+			+ "UNION "
+			+ "SELECT DISTINCT gr.dimensio, gr.estudi, ie.ambit, gr.ordre, ie.indicador, curs, valor FROM indicador_enquesta ie "
+			+ "		INNER JOIN grafiques gr ON ie.indicador = gr.indicador AND ie.enquesta = gr.enquesta AND (LOWER(ie.estudi) = LOWER(gr.estudi) OR LOWER(ie.estudi) = 'u') "
+			+ "		WHERE UPPER(ie.ambit) = 'U' AND (LOWER(ie.estudi) = LOWER(?3) OR LOWER(ie.estudi) = 'u') AND curs > ?4 AND tipus = 'avg' "
+			+ "ORDER BY 1, 2, 3, 4, 5, 6 ", nativeQuery=true)
+	List<IndicadorDTO> getGraphData(List<Integer> titulacions, Integer centre, String estudi, Integer cursMax);
+	
+	@Query(value="SELECT DISTINCT gr.dimensio, gr.estudi, ie.ambit, gr.ordre, ie.indicador, curs, valor FROM indicador_enquesta ie "
+			+ "		INNER JOIN grafiques gr ON ie.indicador = gr.indicador AND ie.enquesta = gr.enquesta AND (LOWER(ie.estudi) = LOWER(gr.estudi) OR LOWER(ie.estudi) = 'u') "
+			+ "		WHERE UPPER(ie.ambit) = 'C' AND (LOWER(ie.estudi) = LOWER(?2) OR LOWER(ie.estudi) = 'u') AND centre = ?1 AND curs > ?3 AND tipus = 'avg' "
+			+ "UNION "
+			+ "SELECT DISTINCT gr.dimensio, gr.estudi, ie.ambit, gr.ordre, ie.indicador, curs, valor FROM indicador_enquesta ie "
+			+ "		INNER JOIN grafiques gr ON ie.indicador = gr.indicador AND ie.enquesta = gr.enquesta AND (LOWER(ie.estudi) = LOWER(gr.estudi) OR LOWER(ie.estudi) = 'u') "
+			+ "		WHERE UPPER(ie.ambit) = 'U' AND (LOWER(ie.estudi) = LOWER(?2) OR LOWER(ie.estudi) = 'u') AND curs > ?3 AND tipus = 'avg' "
+			+ "ORDER BY 1, 2, 3, 4, 5, 6 ", nativeQuery=true)
+	List<IndicadorDTO> getGraphData(Integer centre, String estudi, Integer cursMax);
+	
+	@Transactional
+	@Modifying(clearAutomatically=true, flushAutomatically=true)
+	@Query(value="DELETE FROM indicador_enquesta WHERE centre IN(111, 121, 641, 642) AND ambit = 'C';", nativeQuery=true)
+	int deleteCentroNoAdscrito();
+	
+	@Transactional
+	@Modifying(clearAutomatically=true, flushAutomatically=true)
+	@Query(value="DELETE FROM indicador_enquesta WHERE enquesta = ?1", nativeQuery=true)
+	int deleteByEnquesta(String enquesta);
+	
+	@Transactional
+	@Modifying(clearAutomatically=true, flushAutomatically=true)
+	@Query(value="DELETE FROM indicador_enquesta WHERE enquesta = ?1 AND curs = ?2", nativeQuery=true)
+	int deleteByEnquestaCurs(String enquesta, Integer curs);
+	
+	@Transactional
+	@Modifying(clearAutomatically=true, flushAutomatically=true)
+	@Query(value="DELETE FROM indicador_enquesta WHERE enquesta = ?1 AND curs = ?2 AND ambit IN('C', 'U'); "
+			+ "INSERT INTO indicador_enquesta (curs, enquesta, indicador, num, titulacio, valor, centre, ambit, tipus, estudi, cursd) "
+			+ "(SELECT ?2 AS curs, enquesta, indicador, num, titulacio, valor, centre, ambit, tipus, estudi, cursd "
+			+ "FROM indicador_enquesta WHERE enquesta = ?1 AND curs = ?2-1 AND ambit IN('C', 'U')); "
+			+ "INSERT INTO indicador_enquesta (curs, enquesta, indicador, num, titulacio, valor, centre, ambit, tipus, estudi, cursd) "
+			+ "(SELECT ?2 AS curs, enquesta, indicador, num, titulacio, valor, centre, ambit, tipus, estudi, cursd "
+			+ "FROM indicador_enquesta WHERE enquesta = ?1 AND curs = ?2-1 AND ambit IN('T') "
+			+ "AND titulacio NOT IN(SELECT DISTINCT(titulacio) FROM indicador_enquesta WHERE enquesta = ?1 AND curs = ?2 AND ambit IN('T')));", nativeQuery=true)
+	int fixBiennials(String enquesta, Integer curs);
+	
+	@Transactional
+	@Modifying(clearAutomatically=true, flushAutomatically=true)
+	@Query(value="INSERT INTO indicador_enquesta (curs, enquesta, indicador, titulacio, centre, ambit, tipus, estudi, cursd, valor, centre_origen, titulacio_origen, curs_enquesta, nenq, ruct, data) "
+			+ "SELECT curs, enquesta, indicador, titulacio, centre, ambit, tipus, estudi, cursd, valor, centre_origen, titulacio_origen, curs_enquesta, nenq, ruct, data "
+			+ "FROM indicador_enquesta_tmp "
+			+ "WHERE enquesta = ?1", nativeQuery=true)
+	int consolidateByEnquesta(String enquesta);
+	
+
+	public static interface IndicadorEnquestaValor {
+		String getEnquesta();
+		String getIndicador();
+		String getValor();
+		String getNum();
+		String getAmbit();
+		String getTipus();
+		String getMin();
+		String getMax();
+		Integer getCurs();
+		String getCursd();
+		String getMedia();
+	}
+	
+	public static interface IndicadorDTO {
+    	String getDimensio();
+    	String getIndicador();
+    	String getAmbit();
+    	String getCurs();
+    	String getValor();
+	}
+}
+

+ 248 - 0
src/main/java/es/uv/saic/domain/IndicadorEnquestaTmp.java

@@ -0,0 +1,248 @@
+package es.uv.saic.domain;
+
+import java.sql.Timestamp;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+
+@Entity
+@Table(name="indicador_enquesta_tmp")
+@NamedQuery(name="IndicadorEnquestaTmp.findAll", query="SELECT n FROM IndicadorEnquestaTmp n")
+public class IndicadorEnquestaTmp {
+ 
+	@Id 
+	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	@Column(name="id", updatable = false, nullable = false)
+	private Integer id;
+	private String valor;
+	private String num;
+	private Integer titulacio;
+	private Integer centre;
+	private Integer curs;
+	private String enquesta;
+	private String indicador;
+	private String ambit;
+	private String tipus;
+	private String estudi;
+	private String cursd;
+	private String usuari;
+	private String cursEnquesta;
+	private String centreOrigen;
+	private String titulacioOrigen;
+	private Integer nenq;
+	private Integer ruct;
+	
+	@Temporal(TemporalType.TIMESTAMP)
+	private Timestamp data; 
+	
+	public IndicadorEnquestaTmp(){}
+	
+	public Integer getId() {
+		return id;
+	}
+	
+	public void setId(Integer id) {
+		this.id = id;
+	}
+	
+	public Integer getTitulacio() {
+		return titulacio;
+	}
+
+	public void setTitulacio(Integer titulacio) {
+		this.titulacio = titulacio;
+	}
+	
+	public Integer getCentre() {
+		return centre;
+	}
+
+	public void setCentre(Integer centre) {
+		this.centre = centre;
+	}
+
+	public Integer getCurs() {
+		return curs;
+	}
+
+	public void setCurs(Integer curs) {
+		this.curs = curs;
+	}
+
+	public String getEnquesta() {
+		return enquesta;
+	}
+
+	public void setEnquesta(String enquesta) {
+		this.enquesta = enquesta;
+	}
+
+	public String getIndicador() {
+		return indicador;
+	}
+
+	public void setIndicador(String indicador) {
+		this.indicador = indicador;
+	}
+	
+	public String getValor() {
+		return valor;
+	}
+	
+	public void setValor(String valor) {
+		this.valor = valor;
+	}
+	
+	public String getNum() {
+		return num;
+	}
+	
+	public void setNum(String num) {
+		this.num = num;
+	}
+	
+	public String getAmbit() {
+		return ambit;
+	}
+	
+	public void setAmbit(String ambit) {
+		this.ambit = ambit;
+	}
+	
+	public String getTipus() {
+		return tipus;
+	}
+	
+	public void setTipus(String tipus) {
+		this.tipus = tipus;
+	}
+	
+	public String getEstudi() {
+		return estudi;
+	}
+	
+	public void setEstudi(String estudi) {
+		this.estudi = estudi;
+	}
+	
+	public String getCursd() {
+		return cursd;
+	}
+	
+	public void setCursd(String cursd) {
+		this.cursd = cursd;
+	}
+	
+	public String getUsuari() {
+		return usuari;
+	}
+
+	public void setUsuari(String usuari) {
+		this.usuari = usuari;
+	}
+
+	public Timestamp getData() {
+		return data;
+	}
+
+	public void setData(Timestamp data) {
+		this.data = data;
+	}
+	
+	public String getCursEnquesta() {
+		return cursEnquesta;
+	}
+
+	public void setCursEnquesta(String cursEnquesta) {
+		this.cursEnquesta = cursEnquesta;
+	}
+
+	public String getCentreOrigen() {
+		return centreOrigen;
+	}
+
+	public void setCentreOrigen(String centreOrigen) {
+		this.centreOrigen = centreOrigen;
+	}
+
+	public String getTitulacioOrigen() {
+		return titulacioOrigen;
+	}
+
+	public void setTitulacioOrigen(String titulacioOrigen) {
+		this.titulacioOrigen = titulacioOrigen;
+	}
+
+	public Integer getNenq() {
+		return nenq;
+	}
+
+	public void setNenq(Integer nenq) {
+		this.nenq = nenq;
+	}
+
+	public Integer getRuct() {
+		return ruct;
+	}
+
+	public void setRuct(Integer ruct) {
+		this.ruct = ruct;
+	}
+
+	public boolean equals(Object other) {
+		if (this == other) {
+			return true;
+		}
+		if (!(other instanceof IndicadorEnquestaTmp)) {
+			return false;
+		}
+		IndicadorEnquestaTmp castOther = (IndicadorEnquestaTmp)other;
+		return 
+			this.id.equals(castOther.id) &&
+			this.valor.equals(castOther.valor) &&
+			this.num.equals(castOther.num) &&
+			this.centre.equals(castOther.centre) &&
+			this.titulacio.equals(castOther.titulacio) &&
+			this.curs.equals(castOther.curs) &&
+			this.ambit.equals(castOther.ambit) &&
+			this.enquesta.equals(castOther.enquesta) &&
+			this.indicador.equals(castOther.indicador) &&
+			this.cursd.equals(castOther.cursd) &&
+			this.usuari.equals(castOther.usuari) &&
+			this.data.toString().equals(castOther.data.toString()) &&
+			this.cursEnquesta.equals(castOther.cursEnquesta) &&
+			this.titulacioOrigen.equals(castOther.titulacioOrigen) &&
+			this.centreOrigen.equals(castOther.centreOrigen) &&
+			this.nenq.equals(castOther.nenq) &&
+			this.ruct.equals(castOther.ruct);
+	}
+
+	public int hashCode() {
+		final int prime = 31;
+		int hash = 17;
+		hash = hash * prime + this.id.hashCode();
+		hash = hash * prime + this.valor.hashCode();
+		hash = hash * prime + this.centre.hashCode();
+		hash = hash * prime + this.titulacio.hashCode();
+		hash = hash * prime + this.curs.hashCode();
+		hash = hash * prime + this.ambit.hashCode();
+		hash = hash * prime + this.enquesta.hashCode();
+		hash = hash * prime + this.indicador.hashCode();
+		hash = hash * prime + this.usuari.hashCode();
+		hash = hash * prime + this.data.toString().hashCode();
+		hash = hash * prime + this.cursEnquesta.hashCode();
+		hash = hash * prime + this.titulacioOrigen.hashCode();
+		hash = hash * prime + this.centreOrigen.hashCode();
+		hash = hash * prime + this.nenq.hashCode();
+		hash = hash * prime + this.ruct.hashCode();
+		
+		return hash;
+	}	
+}

+ 105 - 0
src/main/java/es/uv/saic/domain/IndicadorEnquestaTmpRepository.java

@@ -0,0 +1,105 @@
+package es.uv.saic.domain;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+public interface IndicadorEnquestaTmpRepository extends JpaRepository<IndicadorEnquestaTmp, Long> {
+	
+	@Query("SELECT i FROM IndicadorEnquestaTmp i")
+	List<IndicadorEnquestaTmp> findAll();
+	
+	@Query(value="SELECT * FROM indicador_enquesta_tmp WHERE enquesta = ?1 AND curs = ?2 AND ambit = ?3 AND estudi = ?4", nativeQuery=true)
+	List<IndicadorEnquestaTmp> findByEnquestaCursAmbitEstudi(String enquesta, Integer curs, String ambit, String estudi);
+	
+	@Transactional
+	@Modifying(clearAutomatically=true, flushAutomatically=true)
+	@Query(value="DELETE FROM indicador_enquesta_tmp WHERE enquesta = ?1", nativeQuery=true)
+	int deleteByEnquesta(String enquesta);
+	
+	@Transactional
+	@Modifying(clearAutomatically=true, flushAutomatically=true)
+	@Query(value="DELETE FROM indicador_enquesta_tmp WHERE enquesta = ?1 AND curs = ?2 AND ambit = ?3 AND estudi = ?4", nativeQuery=true)
+	int deleteByEnquestaCursAmbitEstudi(String enquesta, Integer curs, String ambit, String estudi);
+	
+	@Query(value="SELECT curs, enquesta, indicador, titulacio, centre, ambit, tipus, estudi, cursd FROM indicador_enquesta_tmp "
+			+ "WHERE enquesta = ?1 "
+			+ "GROUP BY curs, enquesta, indicador, titulacio, centre, ambit, tipus, estudi, cursd "
+			+ "HAVING COUNT(*) > 1", nativeQuery=true)
+	List<IndicadorEnquestaTmpDup> checkDupicates(String enquesta);
+	
+	@Query(value="SELECT COUNT(*) FROM indicador_enquesta_tmp WHERE enquesta = ?1", nativeQuery=true)
+	Integer countByEnquesta(String enquesta);
+	
+	@Query(value="SELECT curs, enquesta, indicador, titulacio, centre, ambit, tipus, estudi, cursd "
+				+ "FROM indicador_enquesta_tmp WHERE enquesta = ?1 "
+				+ "INTERSECT "
+				+ "SELECT curs, enquesta, indicador, titulacio, centre, ambit, tipus, estudi, cursd "
+				+ "FROM indicador_enquesta WHERE enquesta = ?1", nativeQuery=true)
+	List<IndicadorEnquestaTmpDup> checkIntegrity(String enquesta);
+
+	@Query(nativeQuery=true, value="""
+		WITH deleted AS (
+			DELETE FROM indicador_enquesta
+			WHERE (curs, enquesta, indicador, COALESCE(titulacio, -1), COALESCE(centre, -1), ambit, tipus, estudi, COALESCE(cursd, '')) IN(
+				SELECT curs, enquesta, indicador, COALESCE(titulacio, -1) AS titulacio, COALESCE(centre, -1) AS centre, ambit, 
+					   tipus, estudi, COALESCE(cursd, '') AS cursd 
+				FROM indicador_enquesta_tmp WHERE enquesta = ?1
+				INTERSECT 
+				SELECT curs, enquesta, indicador, COALESCE(titulacio, -1) AS titulacio, COALESCE(centre, -1) AS centre, ambit, 
+					   tipus, estudi, COALESCE(cursd, '') AS cursd  
+				FROM indicador_enquesta WHERE enquesta = ?1) 
+			RETURNING *)
+		SELECT COUNT(*) FROM deleted; """)
+	Integer deleteFromCurrent(String enquesta);
+
+	@Query(nativeQuery=true, value="""
+		WITH deleted AS (
+			DELETE FROM indicador_enquesta_tmp
+			WHERE (curs, enquesta, indicador, COALESCE(titulacio, -1), COALESCE(centre, -1), ambit, tipus, estudi, COALESCE(cursd, '')) IN(
+				SELECT curs, enquesta, indicador, COALESCE(titulacio, -1) AS titulacio, COALESCE(centre, -1) AS centre, ambit, 
+					   tipus, estudi, COALESCE(cursd, '') AS cursd 
+				FROM indicador_enquesta_tmp WHERE enquesta = ?1
+				INTERSECT 
+				SELECT curs, enquesta, indicador, COALESCE(titulacio, -1) AS titulacio, COALESCE(centre, -1) AS centre, ambit, 
+					   tipus, estudi, COALESCE(cursd, '') AS cursd  
+				FROM indicador_enquesta WHERE enquesta = ?1) 
+			RETURNING *)
+		SELECT COUNT(*) FROM deleted; """)
+	Integer deleteFromPending(String enquesta);
+
+	@Query(nativeQuery=true, value="""
+		WITH deleted AS (
+			DELETE FROM
+			indicador_enquesta_tmp AS a
+			USING indicador_enquesta_tmp AS b
+			WHERE
+				a.enquesta = ?1 AND b.enquesta = ?1 AND a.id < b.id
+				AND COALESCE(a.curs, -1) = COALESCE(b.curs, -1) AND COALESCE(a.enquesta, '') = COALESCE(b.enquesta, '') 
+				AND COALESCE(a.indicador, '') = COALESCE(b.indicador, '') AND COALESCE(a.titulacio, -1) = COALESCE(b.titulacio, -1) 
+				AND COALESCE(a.centre, -1) = COALESCE(b.centre, -1) AND COALESCE(a.ambit, '') = COALESCE(b.ambit, '') 
+				AND COALESCE(a.tipus, '') = COALESCE(b.tipus, '') AND COALESCE(a.estudi, '') = COALESCE(b.estudi, '') 
+				AND COALESCE(a.cursd, '') = COALESCE(b.cursd, '')
+			RETURNING *)
+		SELECT COUNT(*) FROM deleted; """)
+	Integer deleteDuplicates(String enquesta);
+	
+	public static interface IndicadorEnquestaTmpDup {
+    	String getCurs();
+    	String getCursd();
+    	String getEnquesta();
+    	String getTipus();
+    	String getAmbit();
+    	String getEstudi();
+    	String getIndicador();
+    	String getTitulacio();
+    	String getCentre();
+	}
+
+}
+

+ 143 - 0
src/main/java/es/uv/saic/domain/Informe.java

@@ -0,0 +1,143 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.util.List;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+
+@Entity
+@Table(name="informes")
+@NamedQuery(name="Informe.findAll", query="SELECT i FROM Informe i")
+public class Informe implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@Column(name="id_informe")
+	private Integer idInforme;
+	
+	private String nom;
+	
+	@Column(name="titol_cas")
+	private String titolCas;
+	
+	@Column(name="titol_val")
+	private String titolVal;
+	
+	@Column(name="descripcio_cas")
+	private String descripcioCas;
+	
+	@Column(name="descripcio_val")
+	private String descripcioVal;
+	
+	private boolean combinat;
+	
+	@Column(name="grup_web")
+	private String grupWeb;
+	
+	private Integer ordre;
+	
+	private String tambit;
+	
+	@OneToMany(fetch=FetchType.EAGER)
+    @JoinColumn(name = "id_informe", referencedColumnName = "id_informe")
+	private List<InformeProcessos> processos;
+
+	public Informe() {}
+	
+	public Integer getIdInforme() {
+		return idInforme;
+	}
+
+	public void setIdInforme(Integer idInforme) {
+		this.idInforme = idInforme;
+	}
+
+	public String getNom() {
+		return nom;
+	}
+
+	public void setNom(String nom) {
+		this.nom = nom;
+	}
+
+	public String getTitolCas() {
+		return titolCas;
+	}
+
+	public void setTitolCas(String titolCas) {
+		this.titolCas = titolCas;
+	}
+
+	public String getTitolVal() {
+		return titolVal;
+	}
+
+	public void setTitolVal(String titolVal) {
+		this.titolVal = titolVal;
+	}
+
+	public String getDescripcioCas() {
+		return descripcioCas;
+	}
+
+	public void setDescripcioCas(String descripcioCas) {
+		this.descripcioCas = descripcioCas;
+	}
+
+	public String getDescripcioVal() {
+		return descripcioVal;
+	}
+
+	public void setDescripcioVal(String descripcioVal) {
+		this.descripcioVal = descripcioVal;
+	}
+
+	public boolean isCombinat() {
+		return combinat;
+	}
+
+	public void setCombinat(boolean combinat) {
+		this.combinat = combinat;
+	}
+
+	public String getGrupWeb() {
+		return grupWeb;
+	}
+
+	public void setGrupWeb(String grupWeb) {
+		this.grupWeb = grupWeb;
+	}
+
+	public List<InformeProcessos> getProcessos() {
+		return processos;
+	}
+
+	public void setProcessos(List<InformeProcessos> processos) {
+		this.processos = processos;
+	}
+
+	public Integer getOrdre() {
+		return ordre;
+	}
+
+	public void setOrdre(Integer ordre) {
+		this.ordre = ordre;
+	}
+
+	public String getTambit() {
+		return tambit;
+	}
+
+	public void setTambit(String tambit) {
+		this.tambit = tambit;
+	}
+	
+	
+}

+ 60 - 0
src/main/java/es/uv/saic/domain/InformeProcesPK.java

@@ -0,0 +1,60 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+
+import jakarta.persistence.Column;
+
+public class InformeProcesPK implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Column(name="id_informe")
+	private Integer idInforme;
+	
+	@Column(name="nom_proces")
+	private String nomProces;
+	
+	public InformeProcesPK() {}
+	
+	public InformeProcesPK(Integer idInforme, String nomProces) {
+		this.idInforme = idInforme;
+		this.nomProces = nomProces;
+	}
+
+	public Integer getIdInforme() {
+		return idInforme;
+	}
+
+	public void setIdInforme(Integer idInforme) {
+		this.idInforme = idInforme;
+	}
+
+	public String getNomProces() {
+		return nomProces;
+	}
+
+	public void setNomProces(String nomProces) {
+		this.nomProces = nomProces;
+	}
+
+	public boolean equals(Object other) {
+		if (this == other) {
+			return true;
+		}
+		if (!(other instanceof InformeProcesPK)) {
+			return false;
+		}
+		InformeProcesPK castOther = (InformeProcesPK)other;
+		return 
+			this.idInforme.equals(castOther.idInforme)
+			&& this.nomProces.equals(castOther.nomProces);
+	}
+
+	public int hashCode() {
+		final int prime = 31;
+		int hash = 17;
+		hash = hash * prime + this.idInforme.hashCode();
+		hash = hash * prime + this.nomProces.hashCode();
+		
+		return hash;
+	}
+}

+ 47 - 0
src/main/java/es/uv/saic/domain/InformeProcessos.java

@@ -0,0 +1,47 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.IdClass;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+
+@Entity
+@Table(name="informes_processos")
+@IdClass(InformeProcesPK.class)
+@NamedQuery(name="InformeProcessos.findAll", query="SELECT i FROM InformeProcessos i")
+public class InformeProcessos implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@Column(name="id_informe")
+	private Integer idInforme;
+	
+	@Id
+	@Column(name="nom_proces")
+	private String nomProces;
+	
+	public InformeProcessos() {}
+
+	public Integer getIdInforme() {
+		return idInforme;
+	}
+
+	public void setIdInforme(Integer idInforme) {
+		this.idInforme = idInforme;
+	}
+
+	public String getNomProces() {
+		return nomProces;
+	}
+
+	public void setNomProces(String nomProces) {
+		this.nomProces = nomProces;
+	}
+	
+	
+	
+}

+ 22 - 0
src/main/java/es/uv/saic/domain/InformeRepository.java

@@ -0,0 +1,22 @@
+package es.uv.saic.domain;
+
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface InformeRepository extends JpaRepository<Informe, Integer> {
+	
+	@Query(value=("SELECT * FROM informes WHERE grup_web = ?1 ORDER BY ordre ASC"), nativeQuery=true)
+	public List<Informe> findByGrupWeb(String grupWeb);
+	
+	@Query(value=("SELECT * FROM informes WHERE grup_web = ?1 AND tambit IN('A', ?2) ORDER BY ordre ASC"), nativeQuery=true)
+	public List<Informe> findByGrupWebTambit(String grupWeb, String tambit);
+	
+	@Query(value=("SELECT * FROM informes WHERE NOT combinat ORDER BY ordre ASC"), nativeQuery=true)
+	public List<Informe> getNonCombined();
+}
+

+ 134 - 0
src/main/java/es/uv/saic/domain/Instancia.java

@@ -0,0 +1,134 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+
+import jakarta.persistence.*;
+
+import java.util.Date;
+import java.util.List;
+
+
+/**
+ * The persistent class for the instancies database table.
+ * 
+ */
+@Entity
+@Table(name="instancies")
+@NamedQuery(name="Instancia.findAll", query="SELECT i FROM Instancia i")
+public class Instancia implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@Column(name="id_instancia")
+	private BigInteger idInstancia;
+
+	private Integer centre;
+
+	private String estat;
+
+	private Integer titulacio;
+	
+	@Temporal(TemporalType.DATE)
+	@Column(name="data")
+	private Date data;
+
+	//bi-directional many-to-one association to Organ
+	@ManyToOne
+	@JoinColumns({
+		@JoinColumn(name="lugar", referencedColumnName="lugar"),
+		@JoinColumn(name="tlugar", referencedColumnName="tlugar")
+		})
+	private Organ organ;
+
+	//bi-directional many-to-one association to Proces
+	@ManyToOne
+	@JoinColumn(name="id_proces")
+	private Proces proces;
+
+	//bi-directional many-to-one association to InstanciaTasca
+	@OneToMany(mappedBy="instancia")
+	private List<InstanciaTasca> instanciesTasques;
+
+	public Instancia() {
+	}
+
+	public BigInteger getIdInstancia() {
+		return this.idInstancia;
+	}
+
+	public void setIdInstancia(BigInteger idInstancia) {
+		this.idInstancia = idInstancia;
+	}
+
+	public Integer getCentre() {
+		return this.centre;
+	}
+
+	public void setCentre(Integer centre) {
+		this.centre = centre;
+	}
+
+	public String getEstat() {
+		return this.estat;
+	}
+
+	public void setEstat(String estat) {
+		this.estat = estat;
+	}
+
+	public Integer getTitulacio() {
+		return this.titulacio;
+	}
+
+	public void setTitulacio(Integer titulacio) {
+		this.titulacio = titulacio;
+	}
+	
+	public Date getData() {
+		return data;
+	}
+
+	public void setData(Date data) {
+		this.data = data;
+	}
+
+	public Organ getOrgan() {
+		return this.organ;
+	}
+
+	public void setOrgan(Organ organ) {
+		this.organ = organ;
+	}
+
+	public Proces getProces() {
+		return this.proces;
+	}
+
+	public void setProces(Proces proces) {
+		this.proces = proces;
+	}
+
+	public List<InstanciaTasca> getInstanciaTasca() {
+		return this.instanciesTasques;
+	}
+
+	public void setInstanciaTasca(List<InstanciaTasca> instanciaTasca) {
+		this.instanciesTasques = instanciaTasca;
+	}
+
+	public InstanciaTasca addInstanciaTasca(InstanciaTasca instanciaTasca) {
+		getInstanciaTasca().add(instanciaTasca);
+		instanciaTasca.setInstancia(this);
+
+		return instanciaTasca;
+	}
+
+	public InstanciaTasca removeInstanciaTasca(InstanciaTasca instanciaTasca) {
+		getInstanciaTasca().remove(instanciaTasca);
+		instanciaTasca.setInstancia(null);
+
+		return instanciaTasca;
+	}
+
+}

+ 149 - 0
src/main/java/es/uv/saic/domain/InstanciaDTO.java

@@ -0,0 +1,149 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+
+import org.springframework.context.i18n.LocaleContextHolder;
+
+public class InstanciaDTO implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	private BigInteger idInstancia;
+	private BigInteger idInstanciaTasca;
+	private Integer centre;
+	private String estat;
+	private Integer titulacio;
+	private String tlugar;
+	private Integer lugar;
+	private String nomProces;
+	private String descVal;
+	private String descCas;
+	private String ambit;
+	private String text;
+
+	public InstanciaDTO() {}
+	
+	public InstanciaDTO(Instancia i) {
+		String locale = LocaleContextHolder.getLocale().getLanguage();
+		this.idInstancia = i.getIdInstancia();
+		this.centre = i.getCentre();
+		this.estat = i.getEstat();
+		this.titulacio = i.getTitulacio();
+		this.lugar = i.getOrgan().getId().getLugar();
+		this.tlugar = i.getOrgan().getId().getTlugar();
+		this.nomProces = i.getProces().getNomProces();
+		this.descVal = i.getProces().getTitolVal();
+		this.descCas = i.getProces().getTitolCas();
+		this.ambit = i.getProces().getAmbit(); 
+		
+		String icon = "<span class=\"btn gantt-legend-done\" style=\"border-width:5px;border-radius:50%;width:20px;height:20px;margin-top:-2px\"></span>";
+		if(this.estat.equals("A")) {
+			icon = "<span class=\"btn gantt-legend-active\" style=\"border-width:5px;border-radius:50%;width:20px;height:20px;margin-top:-2px\"></span>";
+		}
+		else if(this.estat.equals("C")) {
+			icon = "<span class=\"btn gantt-legend-closed\" style=\"border-width:5px;border-radius:50%;width:20px;height:20px;margin-top:-2px\"></span>";
+		}
+		
+		this.text = icon+" <a target=\"_blank\" href=\"/procedure/"+i.getIdInstancia().toString()+"\">"+i.getProces().getNomProces() + " - " + (locale.equals("es") ? i.getProces().getTitolCas() : i.getProces().getTitolVal()) +"</a>";
+	}
+
+	public BigInteger getIdInstancia() {
+		return this.idInstancia;
+	}
+
+	public void setIdInstancia(BigInteger idInstancia) {
+		this.idInstancia = idInstancia;
+	}
+
+	public Integer getCentre() {
+		return this.centre;
+	}
+
+	public void setCentre(Integer centre) {
+		this.centre = centre;
+	}
+
+	public String getEstat() {
+		return this.estat;
+	}
+
+	public void setEstat(String estat) {
+		this.estat = estat;
+	}
+
+	public Integer getTitulacio() {
+		return this.titulacio;
+	}
+
+	public void setTitulacio(Integer titulacio) {
+		this.titulacio = titulacio;
+	}
+
+	public String getTlugar() {
+		return tlugar;
+	}
+
+	public void setTlugar(String tlugar) {
+		this.tlugar = tlugar;
+	}
+
+	public Integer getLugar() {
+		return lugar;
+	}
+
+	public void setLugar(Integer lugar) {
+		this.lugar = lugar;
+	}
+
+	public String getNomProces() {
+		return nomProces;
+	}
+
+	public void setNomProces(String nomProces) {
+		this.nomProces = nomProces;
+	}
+
+	public String getDescVal() {
+		return descVal;
+	}
+
+	public void setDescVal(String descVal) {
+		this.descVal = descVal;
+	}
+
+	public String getDescCas() {
+		return descCas;
+	}
+
+	public void setDescCas(String descCas) {
+		this.descCas = descCas;
+	}
+
+	public String getAmbit() {
+		return ambit;
+	}
+
+	public void setAmbit(String ambit) {
+		this.ambit = ambit;
+	}
+
+	public String getText() {
+		return text;
+	}
+
+	public void setText(String text) {
+		this.text = text;
+	}
+	
+	public BigInteger getIdInstanciaTasca() {
+		return idInstanciaTasca;
+	}
+
+	public void setIdInstanciaTasca(BigInteger idInstanciaTasca) {
+		this.idInstanciaTasca = idInstanciaTasca;
+	}
+	
+	
+
+
+}

+ 82 - 0
src/main/java/es/uv/saic/domain/InstanciaGanttDTO.java

@@ -0,0 +1,82 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+
+public class InstanciaGanttDTO implements Serializable  {
+	private static final long serialVersionUID = 1L;
+	
+	private Integer id;
+	private String name;
+	private String start;
+	private String end;
+	private Integer progress;
+	private String custom_class;
+	private String dependencies;
+	private String type;
+	
+	public InstanciaGanttDTO() {}
+	
+	public InstanciaGanttDTO(Integer id, String name, String start, String end, Integer progress, String custom_class,
+			String dependencies, String type) {
+		this.id = id;
+		this.name = name;
+		this.start = start;
+		this.end = end;
+		this.progress = progress;
+		this.custom_class = custom_class;
+		this.dependencies = dependencies;
+		this.type = type;
+	}
+	
+	public Integer getId() {
+		return id;
+	}
+	public void setId(Integer id) {
+		this.id = id;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public String getStart() {
+		return start;
+	}
+	public void setStart(String start) {
+		this.start = start;
+	}
+	public String getEnd() {
+		return end;
+	}
+	public void setEnd(String end) {
+		this.end = end;
+	}
+	public Integer getProgress() {
+		return progress;
+	}
+	public void setProgress(Integer progress) {
+		this.progress = progress;
+	}
+	public String getCustom_class() {
+		return custom_class;
+	}
+	public void setCustom_class(String custom_class) {
+		this.custom_class = custom_class;
+	}
+	public String getDependencies() {
+		return dependencies;
+	}
+	public void setDependencies(String dependencies) {
+		this.dependencies = dependencies;
+	}
+	public String getType() {
+		return type;
+	}
+	public void setType(String type) {
+		this.type = type;
+	}
+	
+	
+
+}

+ 172 - 0
src/main/java/es/uv/saic/domain/InstanciaRepository.java

@@ -0,0 +1,172 @@
+package es.uv.saic.domain;
+
+
+import java.math.BigInteger;
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+public interface InstanciaRepository extends JpaRepository<Instancia, BigInteger> {
+	
+	@Query(value=("SELECT id_instancia FROM instancies"), nativeQuery=true)
+	List<BigInteger> findAllIds();
+	
+	@Query(value=("SELECT * FROM instancies WHERE tlugar = ?2 AND lugar = ?3 AND centre = ?4 AND titulacio = ?5 AND estat = 'F' "
+			+ "AND id_proces IN(SELECT id_proces FROM processos WHERE nom_proces = ?1 AND curs_avaluat = ?6)"), nativeQuery=true)
+	List<Instancia> findOlders(String proces, String tlugar, Integer lugar, Integer centre, Integer titulacio, Integer curs);
+	
+	@Query(value=("SELECT * FROM instancies WHERE id_instancia IN( "
+			+ "SELECT ti.id_instancia FROM tasquesi ti "
+			+ "LEFT JOIN tasques ta ON ti.id_tasca = ta.id_tasca "
+			+ "LEFT JOIN instancies ie ON ie.id_instancia = ti.id_instancia "
+			+ "LEFT JOIN processos pr ON pr.id_proces = ie.id_proces "
+			+ "WHERE ie.tlugar = ?2 AND ie.lugar = ?3 AND ie.centre = ?4 AND ie.titulacio = ?5 AND ie.estat = 'F' "
+			+ "      AND pr.nom_proces = ?1 AND pr.curs_avaluat = ?6 AND ta.id_tascap = ?7 AND ti.estat = ?8 "
+			+ ");"), nativeQuery=true)
+	List<Instancia> findOlders(String proces, String tlugar, Integer lugar, Integer centre, Integer titulacio, Integer curs, Integer idtascap, String estat);
+	
+	@Query(value=("SELECT * FROM instancies WHERE id_proces = ?1"), nativeQuery=true)
+	List<Instancia> findByIdProces(Integer idProces);
+	
+	@Query(value=("SELECT * FROM instancies WHERE tlugar = ?1 AND lugar = ?2 AND centre = ?3 AND titulacio = ?4 "
+			+ "AND id_proces IN(SELECT id_proces FROM processos WHERE nom_proces IN (?6) AND curs_avaluat = ?5)"), nativeQuery=true)
+	List<Instancia> findByOrganCursNom(String tlugar, Integer lugar, Integer centre, Integer titulacio, Integer curs, List<String> nom);
+
+	@Query(value=("""
+			SELECT ia.* FROM instancies ia
+			LEFT JOIN organs og ON ia.lugar = og.lugar AND ia.tlugar = og.tlugar
+			LEFT JOIN processos pr ON ia.id_proces = pr.id_proces 
+			WHERE og.lugar2 = ?1 AND og.tlugar2 = 'C' AND pr.curs_avaluat = ?2 AND pr.nom_proces IN(?3);
+		"""), nativeQuery=true)
+	List<Instancia> findByCentreCursNom(Integer lugar2, Integer curs, List<String> nom);
+	
+	@Query(value=("""
+		SELECT ins.id_instancia AS id, pr.titol_cas AS titCas, pr.titol_val AS titVal, 
+			MIN(LEAST(ins.data, ta.data_lim - 31)) AS start, MAX(GREATEST(ta.data_lim, tai.data_fet)) AS end, 100 AS progress, 
+			CASE WHEN pr.sub_titol IS NULL THEN pr.nom_proces 
+			  WHEN pr.sub_titol IS NOT NULL THEN CONCAT(pr.nom_proces, ' (', pr.sub_titol, ')') 
+			END AS name, 
+			CASE WHEN ins.estat = 'F' THEN 'gantt-task-done' 
+			  WHEN ins.estat NOT IN('F', 'C') AND MAX(ta.data_lim) < current_date THEN 'gantt-task-pending' 
+			  WHEN ins.estat NOT IN('F', 'C') AND MAX(ta.data_lim) >= current_date THEN 'gantt-task-delayed' 
+			  WHEN ins.estat = 'C' THEN 'gantt-task-closed' 
+			END AS custom_class 
+		FROM instancies ins 
+		LEFT JOIN processos pr ON pr.id_proces = ins.id_proces 
+		LEFT JOIN tasques ta ON ins.id_proces = ta.id_proces 
+		LEFT JOIN tasquesi tai ON ins.id_instancia = tai.id_instancia 
+		WHERE ins.tlugar = ?1 AND ins.lugar = ?2 AND ins.centre = ?3 AND ins.titulacio IN(?4) 
+			AND EXTRACT(YEAR FROM ins.data) >= ?5 AND EXTRACT(YEAR FROM ins.data) <= ?6 
+		GROUP BY ins.id_instancia, pr.nom_proces, pr.sub_titol, pr.titol_cas, pr.titol_val, ins.data, ins.estat 
+		ORDER BY 5;"""), nativeQuery=true)
+	List<InstanciaGanttDTO> findByOrganBetweenCurs(String tlugar, Integer lugar, Integer centre, List<Integer> titulacio, Integer cursIni, Integer cursFi);
+	
+	@Query(value=("SELECT res.id_instancia FROM (SELECT DISTINCT ia.id_instancia, pr.curs_avaluat, ia.centre, ia.titulacio, pr.id_proces FROM instancies ia, processos pr " + 
+			"WHERE ia.id_proces = pr.id_proces " + 
+			"AND pr.nom_proces IN (?4) AND pr.curs_avaluat IN (?3) AND ia.titulacio IN (?2) AND ia.centre IN (?1) " + 
+			"ORDER BY pr.curs_avaluat, ia.centre, ia.titulacio, pr.id_proces) AS res"), nativeQuery=true)
+	List<BigInteger> filterSupervisables(List<Integer> centres, List<Integer> titulacions, List<Integer> cursos, List<String> procediments);
+	
+	@Query(value=("SELECT res.id_instancia FROM (SELECT DISTINCT ia.id_instancia, pr.curs_avaluat, ia.centre, ia.titulacio, pr.id_proces FROM instancies ia, processos pr " + 
+			"WHERE ia.id_proces = pr.id_proces " + 
+			"AND pr.nom_proces = ?4 AND pr.curs_avaluat = ?3 AND ia.titulacio = ?2 AND ia.centre = ?1 " + 
+			"ORDER BY pr.curs_avaluat, ia.centre, ia.titulacio, pr.id_proces) AS res"), nativeQuery=true)
+	BigInteger filterSupervisable(Integer centre, Integer titulacio, Integer curs, String procediment);
+	
+	@Query(value=("SELECT res.id_instancia FROM (SELECT DISTINCT ia.id_instancia, pr.curs_avaluat, ia.centre, ia.titulacio, pr.id_proces  " + 
+			"FROM tasques ta, tasquesi ti, instancies ia, processos pr  " + 
+			"WHERE ta.id_tasca = ti.id_tasca AND ti.id_instancia = ia.id_instancia AND ta.id_proces = pr.id_proces  " + 
+			"AND ia.centre IN (?1) AND ia.titulacio IN (?2) AND pr.curs_avaluat IN (?3) AND ta.codi_evidencia IN (?4)  " +
+			"ORDER BY pr.curs_avaluat, ia.centre, ia.titulacio, pr.id_proces) AS res"), nativeQuery=true)
+	List<BigInteger> filterSupervisablesByEvidencies(List<Integer> centres, List<Integer> titulacions, List<Integer> cursos, List<String> evidencies);
+	
+    @Transactional
+	@Query(value="WITH y AS( " + 
+			"  INSERT INTO instancies " + 
+			"  SELECT CAST((id_proces*1000 + lugar2) as bigint)*10000 + lugar, id_proces, tlugar, lugar, lugar2 centre, lugar titulacio, 'A' estat, NOW() AS data " + 
+			"  FROM processos p, organs o  " + 
+			"  WHERE id_proces=?1 AND ambit='T' AND lugar IN (?2) RETURNING id_instancia, id_proces " + 
+			"), x AS( " + 
+			"INSERT INTO tasquesi(id_tascai, id_instancia, id_tasca, version)  " + 
+			"  SELECT (y.id_instancia*10000 + id_tascap) *100, y.id_instancia, id_tasca, 0 " + 
+			"  FROM tasques t, y  " + 
+			"  WHERE t.id_proces = y.id_proces " + 
+			"  ORDER BY id_tascap " + 
+			") " + 
+			"SELECT id_instancia FROM y;", nativeQuery=true)
+    BigInteger instantiateT(Integer idProces, Integer titulacio);
+	
+    @Transactional
+	@Query(value="WITH y AS( " + 
+			"  INSERT INTO instancies " + 
+			"  SELECT CAST((id_proces*1000 + lugar) AS bigint)*10000 + 1, id_proces, tlugar, lugar, lugar  centre, ?3 titulacio, 'A' estat, NOW() AS data " + 
+			"  FROM processos p, organs o " + 
+			"  WHERE id_proces=?1 AND ambit='C' AND o.tlugar='C' AND lugar IN (?2) RETURNING id_instancia, id_proces " + 
+			"), x AS( " + 
+			"  INSERT INTO tasquesi(id_tascai, id_instancia, id_tasca, version) " + 
+			"  (SELECT (y.id_instancia*10000 + id_tascap) *100, y.id_instancia, id_tasca, 0 " + 
+			"  FROM tasques t, y " + 
+			"  WHERE y.id_proces=t.id_proces " + 
+			"  ORDER BY id_tascap) RETURNING id_tascai " + 
+			") " + 
+			"SELECT id_instancia FROM y;", nativeQuery=true)
+	BigInteger instantiateC(Integer idProces, Integer centre, Integer titulacio);
+    
+    @Transactional
+	@Query(value="WITH y AS( " + 
+			"  INSERT INTO instancies " + 
+			"  SELECT CAST((id_proces*1000) AS bigint)*10000 + 1, id_proces, 'C' AS tlugar, 0 lugar, 0 centre, ?2 titulacio, 'A' estat, NOW() AS data " + 
+			"  FROM processos p " + 
+			"  WHERE id_proces=?1 AND ambit='U' RETURNING id_instancia, id_proces " + 
+			"), x AS( " + 
+			"  INSERT INTO tasquesi(id_tascai, id_instancia, id_tasca, version) " + 
+			"  (SELECT (y.id_instancia*10000 + id_tascap) *100, y.id_instancia, id_tasca, 0 " + 
+			"  FROM tasques t, y " + 
+			"  WHERE y.id_proces=t.id_proces " + 
+			"  ORDER BY id_tascap) RETURNING id_tascai " + 
+			") " + 
+			"SELECT id_instancia FROM y;", nativeQuery=true)
+	BigInteger instantiateU(Integer idProces, Integer titulacio);
+	
+    @Transactional
+    @Modifying(flushAutomatically = true, clearAutomatically = true)
+	@Query(value="WITH x AS(SELECT id_instancia FROM instancies WHERE id_instancia = ?1) " + 
+			"INSERT INTO tasquesi(id_tascai, id_instancia, id_tasca, version) " + 
+			"SELECT (x.id_instancia*10000 + id_tascap) *100, x.id_instancia, id_tasca, 0 " + 
+			"FROM tasques t, x WHERE t.id_proces = ?2 ORDER BY id_tascap;", nativeQuery=true)
+    void instantiateTasks(BigInteger idInstancia, Integer idProces);
+    
+    @Transactional
+	@Query(value="UPDATE tasquesi SET estat='A', data=NOW() WHERE id_tascai IN(SELECT MIN(id_tascai) FROM tasquesi WHERE id_instancia = ?1) RETURNING id_tascai;", nativeQuery=true)
+	BigInteger activateInstantiatedTask(BigInteger idInstancia);
+    
+    @Transactional
+    @Modifying(flushAutomatically = true, clearAutomatically = true)
+	@Query(value="DELETE FROM instancies WHERE id_instancia = ?1", nativeQuery=true)
+    Integer deleteInstance(BigInteger idInstancia);
+    
+    @Transactional
+    @Modifying(flushAutomatically = true, clearAutomatically = true)
+	@Query(value="DELETE FROM tasquesi WHERE id_instancia = ?1", nativeQuery=true)
+    Integer clearInstance(BigInteger idInstancia);
+    
+    
+    public static interface InstanciaGanttDTO {
+    	BigInteger getId();
+    	String getName();
+		String getTitCas();
+		String getTitVal();
+    	String getStart();
+    	String getEnd();
+    	Integer getProgress();
+    	String getCustom_class();
+	}
+    
+	
+}
+

+ 150 - 0
src/main/java/es/uv/saic/domain/InstanciaTasca.java

@@ -0,0 +1,150 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+
+import jakarta.persistence.*;
+import java.util.Date;
+
+
+/**
+ * The persistent class for the tasquesi database table.
+ * 
+ */
+@Entity
+@Table(name="tasquesi")
+@NamedQuery(name="InstanciaTasca.findAll", query="SELECT t FROM InstanciaTasca t")
+public class InstanciaTasca implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@Column(name="id_tascai")
+	private BigInteger idInstanciaTasca;
+
+	@Temporal(TemporalType.DATE)
+	@Column(name="data_fet")
+	private Date dataFet;
+	
+	@Temporal(TemporalType.DATE)
+	@Column(name="data")
+	private Date data;
+	
+	@Temporal(TemporalType.TIMESTAMP)
+	@Column(name="data_mod")
+	private Date dataMod;
+	
+	private Integer version;
+
+	private String estat;
+
+	private String evidencia;
+	
+	private String text;
+
+	//bi-directional many-to-one association to Instancia
+	@ManyToOne
+	@JoinColumn(name="id_instancia")
+	private Instancia instancia;
+
+	//bi-directional many-to-one association to Tasca
+	@ManyToOne
+	@JoinColumn(name="id_tasca")
+	private Tasca tasca;
+
+	//bi-directional many-to-one association to Usuari
+	@ManyToOne
+	@JoinColumn(name="usuari_fet")
+	private Usuari usuari;
+
+	public InstanciaTasca() {
+	}
+
+	public BigInteger getIdInstanciaTasca() {
+		return this.idInstanciaTasca;
+	}
+
+	public void setIdInstanciaTasca(BigInteger idInstanciaTasca) {
+		this.idInstanciaTasca = idInstanciaTasca;
+	}
+
+	public Date getDataFet() {
+		return this.dataFet;
+	}
+
+	public void setDataFet(Date dataFet) {
+		this.dataFet = dataFet;
+	}
+	
+	public Date getData() {
+		return this.data;
+	}
+
+	public void setData(Date data) {
+		this.data = data;
+	}
+	
+	public Date getDataMod() {
+		return dataMod;
+	}
+
+	public void setDataMod(Date dataMod) {
+		this.dataMod = dataMod;
+	}
+
+	public Integer getVersion() {
+		return this.version;
+	}
+
+	public void setVersion(Integer version) {
+		this.version = version;
+	}
+	
+	public String getEstat() {
+		return this.estat;
+	}
+
+	public void setEstat(String estat) {
+		this.estat = estat;
+	}
+
+	public String getEvidencia() {
+		return this.evidencia;
+	}
+
+	public void setEvidencia(String evidencia) {
+		this.evidencia = evidencia;
+	}
+	
+	public String getText() {
+		return this.text;
+	}
+
+	public void setText(String text) {
+		this.text = text;
+	}
+
+	public Instancia getInstancia() {
+		return this.instancia;
+	}
+
+	public void setInstancia(Instancia instancia) {
+		this.instancia = instancia;
+	}
+
+	public Tasca getTasca() {
+		return this.tasca;
+	}
+
+	public void setTasca(Tasca tasca) {
+		this.tasca = tasca;
+	}
+
+	public Usuari getUsuari() {
+		return this.usuari;
+	}
+
+	public void setUsuari(Usuari usuari) {
+		this.usuari = usuari;
+	}
+
+}

+ 187 - 0
src/main/java/es/uv/saic/domain/InstanciaTascaRepository.java

@@ -0,0 +1,187 @@
+package es.uv.saic.domain;
+
+import java.math.BigInteger;
+import java.util.Date;
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+public interface InstanciaTascaRepository extends JpaRepository<InstanciaTasca, BigInteger> {
+	
+	@Query(nativeQuery=true, value=("""
+		WITH x AS(SELECT id_tasca, max(version) AS version FROM tasquesi WHERE id_instancia = ?1 GROUP BY id_tasca) 
+		SELECT ti.* FROM tasquesi ti, x WHERE ti.id_tasca = x.id_tasca AND ti.version = x.version AND id_instancia = ?1 ORDER BY id_tasca ASC; """))
+	public List<InstanciaTasca> findByInstancia(BigInteger idInstancia);
+	
+	@Query(nativeQuery=true, value=("""
+		SELECT ti.* FROM tasquesi ti 
+		LEFT JOIN tasques ta ON ti.id_tasca = ta.id_tasca 
+		WHERE id_instancia = ?1 AND id_tascap = ?2 
+		ORDER BY version DESC LIMIT 1; """))
+	public InstanciaTasca findByInstanciaTascap(BigInteger idInstancia, Integer tascap);
+	
+	@Query(nativeQuery=true, value=("""
+		SELECT * FROM tasquesi WHERE id_instancia = ?1 AND id_tasca = ?2 AND version < ?3 ORDER BY data_fet DESC; """))
+	public List<InstanciaTasca> findOlderVerions(BigInteger idInstancia, Integer idTasca, Integer version);
+	
+	@Query(nativeQuery=true, value=("""
+		SELECT * FROM tasquesi WHERE id_instancia = ?1 AND estat = 'A' 
+		AND version = (SELECT MAX(version) AS version FROM tasquesi WHERE id_instancia = ?1 AND estat = 'A'); """))
+	public InstanciaTasca findActiveByInstancia(BigInteger idInstancia);
+	
+	@Query(nativeQuery=true, value=("""
+		SELECT * FROM tasquesi WHERE estat  = 'A' AND id_tasca IN(SELECT id_tasca FROM tasques WHERE tipus = ?1)"""))
+	public List<InstanciaTasca> findActivesByType(Integer type);
+	
+	@Query(nativeQuery=true, value=("""
+		SELECT DISTINCT(ins.id_instancia) FROM instancies ins, usuaris_rols usr, tasques tas, tasquesi tasi 
+		WHERE ins.estat = 'A' 
+		AND ins.tlugar = usr.tlugar AND ins.lugar = usr.lugar 
+		AND usr.vigent = TRUE AND usr.usuari = ?1 AND ins.id_instancia = tasi.id_instancia 
+		AND tas.id_proces = ins.id_proces AND tas.id_rol = usr.id_rol 
+		AND tas.id_tasca = tasi.id_tasca AND tasi.id_tascai = ?2; """))
+	public BigInteger isUserAutorized(String usuari, BigInteger idTascai);
+	
+	@Query(nativeQuery=true, value=("""
+		SELECT DISTINCT(ins.id_instancia) FROM instancies ins, usuaris_rols usr, tasques tas, tasquesi tasi, rols rl 
+		WHERE ins.estat = 'A' AND ins.centre = usr.lugar 
+		AND usr.vigent = TRUE AND usr.usuari = ?1 AND ins.id_instancia = tasi.id_instancia 
+		AND tas.id_proces = ins.id_proces AND tas.id_rol = usr.id_rol 
+		AND rl.id_rol = usr.id_rol AND rl.ambit = 'C' 
+		AND tas.id_tasca = tasi.id_tasca AND tasi.id_tascai = ?2; """	))
+	public BigInteger isUserAutorizedByAmbitC(String usuari, BigInteger idTascai);
+	
+	@Query("SELECT i FROM InstanciaTasca i WHERE i.instancia.centre = ?1 AND i.instancia.titulacio = ?2 AND i.tasca.proces.nomProces = ?3 AND i.estat = 'E' AND i.tasca.proces.cursAvaluat < ?4")
+	public List<InstanciaTasca> findOlderByProces(Integer centre, Integer titulacio, String nomProces, Integer minCurs);
+
+	@Query(nativeQuery=true, value=("""
+		WITH x AS( 
+			SELECT id_tasca AS id_current FROM tasques WHERE id_proces = ?2 AND id_tascap = ?3 
+		) 
+		SELECT * FROM tasquesi t, x WHERE id_instancia = ?1 AND t.id_tasca = x.id_current 
+		AND version = (SELECT MAX(version) FROM tasquesi t, x WHERE t.id_tasca = x.id_current AND id_instancia = ?1); """))
+	public InstanciaTasca findNext(BigInteger idInstancia, Integer idProces, Integer idTascap);
+	
+	@Query(nativeQuery=true, value=("""
+		SELECT us.* FROM usuaris us, usuaris_rols usr, tasques tas, tasquesi tasi, instancies ins  
+		WHERE us.usuari = usr.usuari AND tasi.id_tasca = tas.id_tasca AND tasi.estat = 'A' 
+		AND ins.lugar = usr.lugar AND ins.tlugar = usr.tlugar AND ins.id_instancia = tasi.id_instancia AND ins.id_instancia = ?1 """))
+	public List<Usuari> getUsers(BigInteger idInstancia);
+	
+	@Query(nativeQuery=true, value=("""
+		SELECT ti.id_tascai, ti.id_instancia, ti.id_tasca, ti.version, ti.estat, ti.usuari_fet, ti.data_fet, ti.evidencia 
+		FROM tasquesi ti, tasques ta   
+		WHERE ti.id_tasca = ta.id_tasca AND ti.estat = 'A' AND ta.data_lim > NOW(); """))
+	public List<InstanciaTasca> getPastTasks();
+	
+	@Query(nativeQuery=true, value=("""
+		SELECT ti.* FROM tasquesi ti 
+		JOIN tasques ta ON ta.id_tasca = ti.id_tasca 
+		WHERE ti.id_instancia = ?1 AND ta.informe AND estat = 'E' 
+		ORDER BY ta.id_tascap DESC, ti.version DESC  
+		LIMIT 1; """))
+	public InstanciaTasca getReportFromInstancia(BigInteger idInstancia);
+	
+	@Query(nativeQuery=true, value=("""
+		SELECT ti.* FROM tasquesi ti LEFT JOIN tasques ta 
+		ON ti.id_tasca = ta.id_tasca 
+		WHERE ti.id_instancia = ( 
+			SELECT id_instancia FROM instancies 
+			WHERE id_proces = ?1 AND tlugar = ?2 AND lugar = ?3 
+			AND centre = ?4 AND titulacio = ?5 AND estat = 'F' 
+		) 
+		AND ti.estat = 'E' AND ta.informe 
+		ORDER BY ti.id_tascai DESC, ti.version DESC LIMIT 1; """))
+	public InstanciaTasca getReportFromProcesOrgan(Integer idProces, String tlugar, Integer lugar,
+												   Integer centre, Integer titulacio);
+
+	@Query(nativeQuery=true, value=("""
+		SELECT ti.* FROM tasquesi ti LEFT JOIN tasques ta 
+		ON ti.id_tasca = ta.id_tasca 
+		WHERE ti.id_instancia = ( 
+				SELECT id_instancia FROM instancies ic 
+				LEFT JOIN processos pr ON ic.id_proces = pr.id_proces 
+				WHERE pr.nom_proces = ?1 AND ic.tlugar = ?2 AND ic.lugar = ?3 
+				AND ic.centre = ?4 AND ic.titulacio = ?5 AND ic.estat = 'F' 
+				ORDER BY pr.curs_avaluat DESC LIMIT 1 
+			) 
+		AND ti.estat = 'E' AND ta.informe 
+		ORDER BY ti.id_tascai DESC, ti.version DESC LIMIT 1; """))
+	public InstanciaTasca getReportFromNomProcesOrgan(String nomProces, String tlugar, Integer lugar,
+												      Integer centre, Integer titulacio);
+	
+	@Query(nativeQuery=true, value=("""
+			SELECT i.titulacio, pr.id_proces AS idProces, pr.nom_proces AS nomProces, pr.ambit, pr.curs_avaluat AS cursAvaluat, ti.id_tascai, 
+			           ti.id_instancia AS idInstancia, ti.id_tasca AS idTasca, ti.version, ti.estat, ti.usuari_fet AS usuariFet, ti.data_fet AS dataFet, 
+			           ti.evidencia FROM tasquesi ti 
+			LEFT JOIN tasques ta ON ta.id_tasca = ti.id_tasca 
+			LEFT JOIN instancies i ON i.id_instancia = ti.id_instancia 
+			LEFT JOIN processos pr ON pr.id_proces = i.id_proces 
+			WHERE (pr.nom_proces = ?1 OR pr.nom_proces IN(
+				SELECT nom_proces_eq FROM processos_equivalents WHERE nom_proces = ?1 AND (estudi = ?4 OR estudi = 'GM') AND ambit = 'T'
+				)) 
+			AND i.titulacio = ?2 AND pr.ambit = 'T' 
+			AND i.estat = 'F' AND ti.estat = 'E' AND ta.informe 
+			UNION 
+			SELECT i.titulacio, pr.id_proces AS idProces, pr.nom_proces AS nomProces, pr.ambit, pr.curs_avaluat AS cursAvaluat, ti.id_tascai, 
+			       ti.id_instancia AS idInstancia, ti.id_tasca AS idTasca, ti.version, ti.estat, ti.usuari_fet AS usuariFet, ti.data_fet AS dataFet, 
+			       ti.evidencia FROM tasquesi ti 
+			LEFT JOIN tasques ta ON ta.id_tasca = ti.id_tasca 
+			LEFT JOIN instancies i ON i.id_instancia = ti.id_instancia 
+			LEFT JOIN processos pr ON pr.id_proces = i.id_proces 
+			WHERE pr.nom_proces IN(SELECT nom_proces_eq FROM processos_equivalents WHERE nom_proces = ?1 AND (estudi = ?4 OR estudi = 'GM') AND ambit = 'C') 
+			AND i.centre = ?3 AND pr.ambit = 'C' 
+			AND i.estat = 'F' AND ti.estat = 'E' AND ta.informe 
+			ORDER BY cursAvaluat DESC FETCH FIRST 1 ROW ONLY; """))
+	public TascaInformeTransfer getLastByProcName(String proc, Integer tit, Integer centre, String estudi);	
+	
+	@Transactional
+    @Modifying(flushAutomatically = true, clearAutomatically = true)
+	@Query(value=("UPDATE tasquesi SET estat = null WHERE estat = 'A' AND id_instancia = ?1"), nativeQuery=true)
+	public void deactivateAll(BigInteger idInstancia);
+	
+	@Transactional
+    @Modifying(flushAutomatically = true, clearAutomatically = true)
+	@Query(value=("DELETE FROM tasquesi WHERE id_instancia = ?1 AND id_tasca = ?2"), nativeQuery=true)
+	public void removeAllVersions(BigInteger idInstancia, Integer idTasca);
+	
+	@Transactional
+    @Modifying(flushAutomatically = true, clearAutomatically = true)
+	@Query(value=("DELETE FROM tasquesi WHERE id_tascai = ?1"), nativeQuery=true)
+	public void remove(BigInteger idInstanciaTasca);
+	
+	public static interface TascaVersioTransfer {
+		BigInteger getIdInstanciaTasca();
+		String getUsuariFet();
+		Date getDataFet();
+		Integer getVersion();
+		String getNomEvidenciaVal();
+		String getNomEvidenciaCas();
+		String getCodiEvidencia();
+		String getEstat();
+		Integer getTipus();
+	}
+	
+	public static interface TascaInformeTransfer {
+		Integer getTitulacio();
+		Integer getIdProces();
+		String getNomProces();
+		String getAmbit();
+		Integer getCursAvaluat();
+		Integer getIdTascai();
+		Integer getIdInstancia();
+		Integer getIdTasca();
+		Integer getVersio();
+		String getEstat();
+		String getUsuariFet();
+		Date getDataFet();
+		String getEvidencia();
+	}
+	
+}
+

+ 214 - 0
src/main/java/es/uv/saic/domain/InstanciaTascaTransfer.java

@@ -0,0 +1,214 @@
+package es.uv.saic.domain;
+
+import java.math.BigInteger;
+import java.util.Date;
+import java.util.List;
+
+public class InstanciaTascaTransfer {
+
+	private BigInteger idInstanciaTasca; 
+	private Integer idTasca;
+	private Integer idProces;
+	private String estat;
+	private Integer idTascap;
+	private String centre;
+	private String titulacio;
+	private Date dataLim;
+	private Integer tipus;
+	private String codiEvidencia;
+	private String nomEvidenciaCas;
+	private String nomEvidenciaVal;
+	private String titolCas;
+	private String titolVal;
+	private String descripcioCas;
+	private String descripcioVal;
+	private Date dataFet;
+	private Date dataMod;
+	private String usuariFet;
+	private String evidencia;
+	private String text;
+	private boolean isAssignedToUser;
+	private boolean isExpired;
+	private List<EvidenciaTransfer> oldEvidences;
+	private List<TascaVersioTransfer> versions;
+	private String descripcioRolCas;
+	private String descripcioRolVal;
+	private String estatInstancia;
+	private String opcions;
+	
+	public BigInteger getIdInstanciaTasca() {
+		return idInstanciaTasca;
+	}
+	public void setIdInstanciaTasca(BigInteger idInstanciaTasca) {
+		this.idInstanciaTasca = idInstanciaTasca;
+	}
+	public String getEstat() {
+		return estat;
+	}
+	public void setEstat(String estat) {
+		this.estat = estat;
+	}
+	public Integer getIdTascap() {
+		return idTascap;
+	}
+	public void setIdTascap(Integer idtascap) {
+		this.idTascap = idtascap;
+	}
+	public String getCentre() {
+		return centre;
+	}
+	public void setCentre(String centre) {
+		this.centre = centre;
+	}
+	public String getTitulacio() {
+		return titulacio;
+	}
+	public void setTitulacio(String titulacio) {
+		this.titulacio = titulacio;
+	}
+	public Date getDataLim() {
+		return dataLim;
+	}
+	public void setDataLim(Date dataLim) {
+		this.dataLim = dataLim;
+	}
+	public String getCodiEvidencia() {
+		return codiEvidencia;
+	}
+	public void setCodiEvidencia(String codiEvidencia) {
+		this.codiEvidencia = codiEvidencia;
+	}
+	public String getNomEvidenciaCas() {
+		return nomEvidenciaCas;
+	}
+	public void setNomEvidenciaCas(String nomEvidenciaCas) {
+		this.nomEvidenciaCas = nomEvidenciaCas;
+	}
+	public String getNomEvidenciaVal() {
+		return nomEvidenciaVal;
+	}
+	public void setNomEvidenciaVal(String nomEvidenciaVal) {
+		this.nomEvidenciaVal = nomEvidenciaVal;
+	}
+	public String getTitolCas() {
+		return titolCas;
+	}
+	public void setTitolCas(String titolCas) {
+		this.titolCas = titolCas;
+	}
+	public String getTitolVal() {
+		return titolVal;
+	}
+	public void setTitolVal(String titolVal) {
+		this.titolVal = titolVal;
+	}
+	public String getDescripcioCas() {
+		return descripcioCas;
+	}
+	public void setDescripcioCas(String descripcioCas) {
+		this.descripcioCas = descripcioCas;
+	}
+	public String getDescripcioVal() {
+		return descripcioVal;
+	}
+	public void setDescripcioVal(String descripcioVal) {
+		this.descripcioVal = descripcioVal;
+	}
+	public Date getDataFet() {
+		return dataFet;
+	}
+	public void setDataFet(Date dataFet) {
+		this.dataFet = dataFet;
+	}
+	public String getUsuariFet() {
+		return usuariFet;
+	}
+	public void setUsuariFet(String usuariFet) {
+		this.usuariFet = usuariFet;
+	}
+	public boolean getIsAssignedToUser() {
+		return isAssignedToUser;
+	}
+	public void setAssignedToUser(boolean isAssignedToUser) {
+		this.isAssignedToUser = isAssignedToUser;
+	}
+	public boolean getIsExpired() {
+		return isExpired;
+	}
+	public void setIsExpired(boolean isExpired) {
+		this.isExpired = isExpired;
+	}
+	public Integer getIdTasca() {
+		return idTasca;
+	}
+	public void setIdTasca(Integer idTasca) {
+		this.idTasca = idTasca;
+	}
+	public Integer getIdProces() {
+		return idProces;
+	}
+	public void setIdProces(Integer idProces) {
+		this.idProces = idProces;
+	}
+	public Integer getTipus() {
+		return tipus;
+	}
+	public void setTipus(Integer tipus) {
+		this.tipus = tipus;
+	}
+	public String getEvidencia() {
+		return evidencia;
+	}
+	public void setEvidencia(String evidencia) {
+		this.evidencia = evidencia;
+	}
+	public String getText() {
+		return text;
+	}
+	public void setText(String text) {
+		this.text = text;
+	}
+	public List<EvidenciaTransfer> getOldEvidences() {
+		return oldEvidences;
+	}
+	public void setOldEvidences(List<EvidenciaTransfer> oldEvidences) {
+		this.oldEvidences = oldEvidences;
+	}
+	public String getDescripcioRolCas() {
+		return descripcioRolCas;
+	}
+	public void setDescripcioRolCas(String descripcioRolCas) {
+		this.descripcioRolCas = descripcioRolCas;
+	}
+	public String getDescripcioRolVal() {
+		return descripcioRolVal;
+	}
+	public void setDescripcioRolVal(String descripcioRolVal) {
+		this.descripcioRolVal = descripcioRolVal;
+	}
+	public List<TascaVersioTransfer> getVersions() {
+		return versions; 
+	}
+	public void setVersions(List<TascaVersioTransfer> versions) {
+		this.versions = versions;
+	}
+	public String getEstatInstancia() {
+		return estatInstancia;
+	}
+	public void setEstatInstancia(String estatInstancia) {
+		this.estatInstancia = estatInstancia;
+	}
+	public String getOpcions() {
+		return opcions;
+	}
+	public void setOpcions(String opcions) {
+		this.opcions = opcions;
+	}
+	public Date getDataMod() {
+		return dataMod;
+	}
+	public void setDataMod(Date dataMod) {
+		this.dataMod = dataMod;
+	}
+	
+}

+ 77 - 0
src/main/java/es/uv/saic/domain/InstanciaTascaVer.java

@@ -0,0 +1,77 @@
+package es.uv.saic.domain;
+
+import java.math.BigInteger;
+import java.sql.Timestamp;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.IdClass;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+
+@Entity
+@Table(name="tasquesi_ver")
+@IdClass(InstanciaTascaVerPK.class)
+@NamedQuery(name="InstanciaTascaVer.findAll", query="SELECT n FROM InstanciaTascaVer n")
+public class InstanciaTascaVer {
+
+    @Id
+    @Column(name="id_tascai")
+	private BigInteger idInstanciaTasca;
+
+    @Id
+    @Temporal(TemporalType.TIMESTAMP)
+	@Column(name="data_mod")
+	private Timestamp dataMod;
+    
+    private String usuari;
+
+    private String text;
+
+    public InstanciaTascaVer(){}
+
+    public InstanciaTascaVer(BigInteger idInstanciaTasca, String usuari, String text, Timestamp dataMod) {
+        this.idInstanciaTasca = idInstanciaTasca;
+        this.usuari = usuari;
+        this.text = text;
+        this.dataMod = dataMod;
+    }
+
+    public BigInteger getIdInstanciaTasca() {
+        return idInstanciaTasca;
+    }
+
+    public void setIdInstanciaTasca(BigInteger idInstanciaTasca) {
+        this.idInstanciaTasca = idInstanciaTasca;
+    }
+
+    public String getUsuari() {
+        return usuari;
+    }
+
+    public void setUsuari(String usuari) {
+        this.usuari = usuari;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    public Timestamp getDataMod() {
+        return dataMod;
+    }
+
+    public void setDataMod(Timestamp dataMod) {
+        this.dataMod = dataMod;
+    }
+
+    
+
+}

+ 36 - 0
src/main/java/es/uv/saic/domain/InstanciaTascaVerPK.java

@@ -0,0 +1,36 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+import java.sql.Timestamp;
+
+public class InstanciaTascaVerPK implements Serializable  {
+    private static final long serialVersionUID = 1L;
+
+	private BigInteger idInstanciaTasca;
+    private Timestamp dataMod;
+
+    public InstanciaTascaVerPK(){}
+
+    public InstanciaTascaVerPK(BigInteger idInstanciaTasca, Timestamp dataMod) {
+        this.idInstanciaTasca = idInstanciaTasca;
+        this.dataMod = dataMod;
+    }
+
+    public BigInteger getIdInstanciaTasca() {
+        return idInstanciaTasca;
+    }
+
+    public void setIdInstanciaTasca(BigInteger idInstanciaTasca) {
+        this.idInstanciaTasca = idInstanciaTasca;
+    }
+
+    public Timestamp getdataMod() {
+        return dataMod;
+    }
+
+    public void setDataMod(Timestamp dataMod) {
+        this.dataMod = dataMod;
+    }
+
+}

+ 28 - 0
src/main/java/es/uv/saic/domain/InstanciaTascaVerRepository.java

@@ -0,0 +1,28 @@
+package es.uv.saic.domain;
+
+import java.math.BigInteger;
+import java.util.Date;
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+public interface InstanciaTascaVerRepository extends JpaRepository<InstanciaTascaVer, InstanciaTascaVerPK> {
+
+
+	@Query(value=("SELECT * FROM tasquesi_ver WHERE id_tascai = ?1 AND data_mod = ?2"), nativeQuery=true)
+	public InstanciaTascaVer findById(BigInteger idInstanciaTasca, Date dataMod);
+
+	@Query(value=("SELECT * FROM tasquesi_ver WHERE id_tascai = ?1 ORDER BY data_mod DESC"), nativeQuery=true)
+	public List<InstanciaTascaVer> findByIdInstanciaTasca(BigInteger idInstanciaTasca);
+
+	@Transactional
+    @Modifying(flushAutomatically = true, clearAutomatically = true)
+	@Query(value=("DELETE FROM tasquesi_ver WHERE id_tascai IN(SELECT id_tascai FROM tasquesi WHERE id_instancia = ?1)"), nativeQuery=true)
+	public void deleteByIdInstancia(BigInteger idInstancia);
+
+}

+ 68 - 0
src/main/java/es/uv/saic/domain/InstanciaTascaVersioTransfer.java

@@ -0,0 +1,68 @@
+package es.uv.saic.domain;
+
+import java.math.BigInteger;
+import java.util.Date;
+
+public class InstanciaTascaVersioTransfer {
+
+	private BigInteger idInstanciaTasca;
+	private String usuariFet;
+	private Date dataFet;
+	private Integer version;
+	private String nomEvidenciaVal;
+	private String nomEvidenciaCas;
+	private String codiEvidencia;
+	private String estat;
+	
+	
+	public BigInteger getIdInstanciaTasca() {
+		return idInstanciaTasca;
+	}
+	public void setIdInstanciaTasca(BigInteger idInstanciaTasca) {
+		this.idInstanciaTasca = idInstanciaTasca;
+	}
+	public String getUsuariFet() {
+		return usuariFet;
+	}
+	public void setUsuariFet(String usuariFet) {
+		this.usuariFet = usuariFet;
+	}
+	public Date getDataFet() {
+		return dataFet;
+	}
+	public void setDataFet(Date dataFet) {
+		this.dataFet = dataFet;
+	}
+	public Integer getVersio() {
+		return version;
+	}
+	public void setVersio(Integer version) {
+		this.version = version;
+	}
+	public String getNomEvidenciaVal() {
+		return nomEvidenciaVal;
+	}
+	public void setNomEvidenciaVal(String nomEvidenciaVal) {
+		this.nomEvidenciaVal = nomEvidenciaVal;
+	}
+	public String getNomEvidenciaCas() {
+		return nomEvidenciaCas;
+	}
+	public void setNomEvidenciaCas(String nomEvidenciaCas) {
+		this.nomEvidenciaCas = nomEvidenciaCas;
+	}
+	public String getCodiEvidencia() {
+		return codiEvidencia;
+	}
+	public void setCodiEvidencia(String codiEvidencia) {
+		this.codiEvidencia = codiEvidencia;
+	}
+	public String getEstat() {
+		return estat;
+	}
+	public void setEstat(String estat) {
+		this.estat = estat;
+	}
+	
+	
+}

+ 178 - 0
src/main/java/es/uv/saic/domain/InstanciaTransfer.java

@@ -0,0 +1,178 @@
+package es.uv.saic.domain;
+
+import java.math.BigInteger;
+import java.util.Date;
+
+public class InstanciaTransfer {
+
+	private BigInteger idInstancia;
+	private Integer idProces;
+	private String nomProces;
+	private String titolCas;
+	private String titolVal;
+	private String descripcioCas;
+	private String descripcioVal;
+	private String centreCas;
+	private String centreVal;
+	private String titulacioCas;
+	private String titulacioVal;
+	private Integer ruct;
+	private String estat;
+	private Integer cursAvaluat;
+	private Integer cursActivacio;
+	private String nomTascaActivaCas;
+	private String nomTascaActivaVal;
+	private String descTascaActivaCas;
+	private String descTascaActivaVal;
+	private Date dataLimTascaActiva;
+	private Date dataTascaActiva;
+	private Integer idTascapActiva;
+	private boolean tascaActivaExpired;
+	private boolean tascaActivaAssignedToUser;	
+
+	public BigInteger getIdInstancia() {
+		return idInstancia;
+	}
+	public void setIdInstancia(BigInteger idInstancia) {
+		this.idInstancia = idInstancia;
+	}
+	public Integer getIdProces() {
+		return idProces;
+	}
+	public void setIdProces(Integer idProces) {
+		this.idProces = idProces;
+	}
+	public String getNomProces() {
+		return nomProces;
+	}
+	public void setNomProces(String nomProces) {
+		this.nomProces = nomProces;
+	}
+	public String getTitolCas() {
+		return titolCas;
+	}
+	public void setTitolCas(String titolCas) {
+		this.titolCas = titolCas;
+	}
+	public String getTitolVal() {
+		return titolVal;
+	}
+	public void setTitolVal(String titolVal) {
+		this.titolVal = titolVal;
+	}
+	public String getDescripcioCas() {
+		return descripcioCas;
+	}
+	public void setDescripcioCas(String descripcioCas) {
+		this.descripcioCas = descripcioCas;
+	}
+	public String getDescripcioVal() {
+		return descripcioVal;
+	}
+	public void setDescripcioVal(String descripcioVal) {
+		this.descripcioVal = descripcioVal;
+	}
+	public String getCentreCas() {
+		return centreCas;
+	}
+	public void setCentreCas(String centreCas) {
+		this.centreCas = centreCas;
+	}
+	public String getCentreVal() {
+		return centreVal;
+	}
+	public void setCentreVal(String centreVal) {
+		this.centreVal = centreVal;
+	}
+	public String getTitulacioCas() {
+		return titulacioCas;
+	}
+	public void setTitulacioCas(String titulacioCas) {
+		this.titulacioCas = titulacioCas;
+	}
+	public String getTitulacioVal() {
+		return titulacioVal;
+	}
+	public void setTitulacioVal(String titulacioVal) {
+		this.titulacioVal = titulacioVal;
+	}
+	public Integer getRuct() {
+		return ruct;
+	}
+	public void setRuct(Integer ruct) {
+		this.ruct = ruct;
+	}
+	public String getEstat() {
+		return estat;
+	}
+	public void setEstat(String estat) {
+		this.estat = estat;
+	}
+	public Integer getCursAvaluat() {
+		return cursAvaluat;
+	}
+	public void setCursAvaluat(Integer cursAvaluat) {
+		this.cursAvaluat = cursAvaluat;
+	}
+	public Integer getCursActivacio() {
+		return cursActivacio;
+	}
+	public void setCursActivacio(Integer cursActivacio) {
+		this.cursActivacio = cursActivacio;
+	}
+	public String getNomTascaActivaCas() {
+		return nomTascaActivaCas;
+	}
+	public void setNomTascaActivaCas(String nomTascaActiva) {
+		this.nomTascaActivaCas = nomTascaActiva;
+	}
+	public Date getDataTascaActiva() {
+		return dataTascaActiva;
+	}
+	public void setDataTascaActiva(Date dataTascaActiva) {
+		this.dataTascaActiva = dataTascaActiva;
+	}
+	public Date getDataLimTascaActiva() {
+		return dataLimTascaActiva;
+	}
+	public void setDataLimTascaActiva(Date dataLimTascaActiva) {
+		this.dataLimTascaActiva = dataLimTascaActiva;
+	}
+	public String getNomTascaActivaVal() {
+		return nomTascaActivaVal;
+	}
+	public void setNomTascaActivaVal(String nomTascaActivaVal) {
+		this.nomTascaActivaVal = nomTascaActivaVal;
+	}
+	public String getDescTascaActivaCas() {
+		return descTascaActivaCas;
+	}
+	public void setDescTascaActivaCas(String descTascaActivaCas) {
+		this.descTascaActivaCas = descTascaActivaCas;
+	}
+	public String getDescTascaActivaVal() {
+		return descTascaActivaVal;
+	}
+	public void setDescTascaActivaVal(String descTascaActivaVal) {
+		this.descTascaActivaVal = descTascaActivaVal;
+	}
+	public Integer getIdTascapActiva() {
+		return idTascapActiva;
+	}
+	public void setIdTascapActiva(Integer idTascapActiva) {
+		this.idTascapActiva = idTascapActiva;
+	}
+	public boolean getTascaActivaExpired() {
+		return tascaActivaExpired;
+	}
+	public void setTascaActivaExpired(boolean expired) {
+		this.tascaActivaExpired = expired;
+	}
+	public boolean getTascaActivaAssignedToUser() {
+		return tascaActivaAssignedToUser;
+	}
+	public void setTascaActivaAssignedToUser(boolean tascaActivaAssignedToUser) {
+		this.tascaActivaAssignedToUser = tascaActivaAssignedToUser;
+	}
+
+}

+ 99 - 0
src/main/java/es/uv/saic/domain/Link.java

@@ -0,0 +1,99 @@
+package es.uv.saic.domain;
+
+import java.util.Date;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+
+@Entity
+@Table(name="links")
+@NamedQuery(name="Link.findAll", query="SELECT i FROM Link i")
+public class Link {
+	
+	@Id
+	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	@Column(name="id")
+	private Integer id;
+
+	@Column(name="ruct")
+	private Integer ruct;
+
+	@Column(name="token")
+	private String token;
+	
+    @Column(name="link")
+	private String link;
+
+    @Column(name="data")
+	private Date data;
+	
+    @Column(name="data_exp")
+	private Date dataExp;
+	
+    @Column(name="visites")
+	private Integer visites;
+
+    public Link(){}
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getRuct() {
+        return ruct;
+    }
+
+    public void setRuct(Integer ruct) {
+        this.ruct = ruct;
+    }
+
+    public String getToken() {
+        return token;
+    }
+
+    public void setToken(String token) {
+        this.token = token;
+    }
+
+    public String getLink() {
+        return link;
+    }
+
+    public void setLink(String link) {
+        this.link = link;
+    }
+
+    public Date getData() {
+        return data;
+    }
+
+    public void setData(Date data) {
+        this.data = data;
+    }
+
+    public Date getDataExp() {
+        return dataExp;
+    }
+
+    public void setDataExp(Date dataExp) {
+        this.dataExp = dataExp;
+    }
+
+    public Integer getVisites() {
+        return visites;
+    }
+
+    public void setVisites(Integer visites) {
+        this.visites = visites;
+    }
+	
+}

+ 18 - 0
src/main/java/es/uv/saic/domain/LinkRepository.java

@@ -0,0 +1,18 @@
+package es.uv.saic.domain;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface LinkRepository extends JpaRepository<Link, Integer>  {
+
+    @Query(value="SELECT * FROM links WHERE token = ?1 AND data_exp > CURRENT_DATE;", nativeQuery=true)
+	Link findByToken(String token); 
+
+    @Query(value="SELECT * FROM links WHERE ruct = ?1 AND data_exp > CURRENT_DATE;", nativeQuery=true)
+	List<Link> findByRuct(Integer ruct); 
+    
+}

+ 85 - 0
src/main/java/es/uv/saic/domain/Noticia.java

@@ -0,0 +1,85 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import jakarta.persistence.*;
+
+
+/**
+ * The persistent class for the noticia database table.
+ * 
+ */
+@Entity
+@NamedQuery(name="Noticia.findAll", query="SELECT n FROM Noticia n")
+public class Noticia implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@Column(name="id_noticia")
+	private Integer idNoticia;
+
+	@Column(name="texto_c")
+	private String textoC;
+
+	@Column(name="texto_v")
+	private String textoV;
+
+	@Column(name="titulo_c")
+	private String tituloC;
+
+	@Column(name="titulo_v")
+	private String tituloV;
+
+	private Boolean visible;
+
+	public Noticia() {
+	}
+
+	public Integer getIdNoticia() {
+		return this.idNoticia;
+	}
+
+	public void setIdNoticia(Integer idNoticia) {
+		this.idNoticia = idNoticia;
+	}
+
+	public String getTextoC() {
+		return this.textoC;
+	}
+
+	public void setTextoC(String textoC) {
+		this.textoC = textoC;
+	}
+
+	public String getTextoV() {
+		return this.textoV;
+	}
+
+	public void setTextoV(String textoV) {
+		this.textoV = textoV;
+	}
+
+	public String getTituloC() {
+		return this.tituloC;
+	}
+
+	public void setTituloC(String tituloC) {
+		this.tituloC = tituloC;
+	}
+
+	public String getTituloV() {
+		return this.tituloV;
+	}
+
+	public void setTituloV(String tituloV) {
+		this.tituloV = tituloV;
+	}
+
+	public Boolean getVisible() {
+		return this.visible;
+	}
+
+	public void setVisible(Boolean visible) {
+		this.visible = visible;
+	}
+
+}

+ 16 - 0
src/main/java/es/uv/saic/domain/NoticiaRepository.java

@@ -0,0 +1,16 @@
+package es.uv.saic.domain;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface NoticiaRepository extends JpaRepository<Noticia, Long> {
+	
+	@Query("SELECT i FROM Noticia i WHERE i.visible = true")
+	List<Noticia> findVisibles();
+	
+}
+

+ 213 - 0
src/main/java/es/uv/saic/domain/Organ.java

@@ -0,0 +1,213 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import jakarta.persistence.*;
+import java.util.List;
+import java.util.stream.Collectors;
+
+
+@Entity
+@Table(name="organs")
+@NamedQuery(name="Organ.findAll", query="SELECT o FROM Organ o")
+public class Organ implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@EmbeddedId
+	private OrganPK id;
+
+	private Boolean actiu;
+
+	@Column(name="nom_cas")
+	private String nomCas;
+
+	@Column(name="nom_val")
+	private String nomVal;
+
+	private Integer ruct;
+	
+	private String tambit;
+
+	//bi-directional many-to-one association to Instancia
+	@OneToMany(mappedBy="organ")
+	private List<Instancia> instancias;
+	
+	//bi-directional many-to-one association to Organ
+	@ManyToOne
+	@JoinColumns({
+		@JoinColumn(name="lugar2", referencedColumnName="lugar"),
+		@JoinColumn(name="tlugar2", referencedColumnName="tlugar")
+		})
+	private Organ organ;
+
+	//bi-directional many-to-one association to Organ
+	@OneToMany(mappedBy="organ")
+	private List<Organ> organsFill;
+	
+	@OneToMany()
+	@JoinColumns({
+		@JoinColumn(name="lugar", referencedColumnName="lugar"),
+		@JoinColumn(name="tlugar", referencedColumnName="tlugar")
+		})
+	private List<OrganEquivalent> organsEquivalents;
+
+	//bi-directional many-to-one association to UsuarisRol
+	@OneToMany(mappedBy="organ")
+	private List<UsuarisRol> usuarisRols;
+	
+	@OneToOne()
+	@JoinColumns({
+		@JoinColumn(name="lugar", referencedColumnName="lugar"),
+		@JoinColumn(name="tlugar", referencedColumnName="tlugar")
+	})
+	private Acreditacio acreditacio;
+	
+	@Transient
+	private String codis;
+
+	public Organ() {}
+
+	public OrganPK getId() {
+		return this.id;
+	}
+
+	public void setId(OrganPK id) {
+		this.id = id;
+	}
+
+	public Boolean getActiu() {
+		return this.actiu;
+	}
+
+	public void setActiu(Boolean actiu) {
+		this.actiu = actiu;
+	}
+
+	public String getNomCas() {
+		return this.nomCas;
+	}
+
+	public void setNomCas(String nomCas) {
+		this.nomCas = nomCas;
+	}
+
+	public String getNomVal() {
+		return this.nomVal;
+	}
+
+	public void setNomVal(String nomVal) {
+		this.nomVal = nomVal;
+	}
+
+	public Integer getRuct() {
+		return this.ruct;
+	}
+
+	public void setRuct(Integer ruct) {
+		this.ruct = ruct;
+	}
+	
+	public String getTambit() {
+		return this.tambit;
+	}
+
+	public void setTambit(String tambit) {
+		this.tambit = tambit;
+	}
+	
+	public Organ getOrgan() {
+		return this.organ;
+	}
+
+	public void setOrgan(Organ organ) {
+		this.organ = organ;
+	}
+
+	public List<Organ> getOrgansFill() {
+		return organsFill;
+	}
+	
+	public Organ addOrganFill(Organ o) {
+		this.getOrgansFill().add(o);
+		return o;
+	}
+	
+	public Organ removeOrganFill(Organ o) {
+		this.getOrgansFill().remove(o);
+		return o;
+	}
+
+	public void setOrgansFill(List<Organ> organsFill) {
+		this.organsFill = organsFill;
+	}
+
+	public List<Instancia> getInstancies() {
+		return this.instancias;
+	}
+
+	public void setInstancies(List<Instancia> instancias) {
+		this.instancias = instancias;
+	}
+
+	public Instancia addInstancia(Instancia instancia) {
+		this.getInstancies().add(instancia);
+		instancia.setOrgan(this);
+
+		return instancia;
+	}
+
+	public Instancia removeInstancia(Instancia instancia) {
+		this.getInstancies().remove(instancia);
+		instancia.setOrgan(null);
+
+		return instancia;
+	}
+
+	public List<UsuarisRol> getUsuarisRols() {
+		return this.usuarisRols;
+	}
+
+	public void setUsuarisRols(List<UsuarisRol> usuarisRols) {
+		this.usuarisRols = usuarisRols;
+	}
+
+	public UsuarisRol addUsuarisRol(UsuarisRol usuarisRol) {
+		getUsuarisRols().add(usuarisRol);
+		usuarisRol.setOrgan(this);
+
+		return usuarisRol;
+	}
+
+	public UsuarisRol removeUsuarisRol(UsuarisRol usuarisRol) {
+		getUsuarisRols().remove(usuarisRol);
+		usuarisRol.setOrgan(null);
+
+		return usuarisRol;
+	}
+	
+	public Acreditacio getAcreditacio() {
+		return acreditacio;
+	}
+
+	public void setAcreditacio(Acreditacio acreditacio) {
+		this.acreditacio = acreditacio;
+	}
+
+	@Transient
+	public String getCodis() {
+		return codis;
+	}
+	
+	@Transient
+	public void setCodis() {
+		this.codis = organsEquivalents.stream()
+									  .map(i->i.getLugarEq().toString())
+									  .collect(Collectors.joining(", "));
+		if(this.codis.isEmpty()) {
+			this.codis = this.getId().getLugar().toString();
+		}
+		else {
+			this.codis = this.getId().getLugar().toString() +", "+ this.codis;
+		}
+	}
+
+}

+ 64 - 0
src/main/java/es/uv/saic/domain/OrganEquivalent.java

@@ -0,0 +1,64 @@
+package es.uv.saic.domain;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.IdClass;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+
+@Entity
+@Table(name="organs_equivalents")
+@NamedQuery(name="OrganEquivalent.findAll", query="SELECT o FROM OrganEquivalent o")
+@IdClass(OrganEquivalentPK.class)
+public class OrganEquivalent {
+
+	@Id
+	private String tlugar;
+	
+	@Id
+	private Integer lugar;
+	
+	@Id
+	@Column(name="tlugar_eq")
+	private String tlugarEq;
+	
+	@Id
+	@Column(name="lugar_eq")
+	private Integer lugarEq;
+	
+	public OrganEquivalent() {}
+
+	public String getTlugar() {
+		return tlugar;
+	}
+
+	public void setTlugar(String tlugar) {
+		this.tlugar = tlugar;
+	}
+
+	public Integer getLugar() {
+		return lugar;
+	}
+
+	public void setLugar(Integer lugar) {
+		this.lugar = lugar;
+	}
+
+	public String getTlugarEq() {
+		return tlugarEq;
+	}
+
+	public void setTlugarEq(String tlugarEq) {
+		this.tlugarEq = tlugarEq;
+	}
+
+	public Integer getLugarEq() {
+		return lugarEq;
+	}
+
+	public void setLugarEq(Integer lugarEq) {
+		this.lugarEq = lugarEq;
+	}
+	
+}

+ 61 - 0
src/main/java/es/uv/saic/domain/OrganEquivalentPK.java

@@ -0,0 +1,61 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+public class OrganEquivalentPK implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	private String tlugar;
+	private Integer lugar;
+	private String tlugarEq;
+	private Integer lugarEq;
+	
+	public OrganEquivalentPK() {}
+	
+	public String getTlugar() {
+		return tlugar;
+	}
+	public void setTlugar(String tlugar) {
+		this.tlugar = tlugar;
+	}
+	public Integer getLugar() {
+		return lugar;
+	}
+	public void setLugar(Integer lugar) {
+		this.lugar = lugar;
+	}
+	public String getTlugarEq() {
+		return tlugarEq;
+	}
+	public void setTlugarEq(String tlugarEq) {
+		this.tlugarEq = tlugarEq;
+	}
+	public Integer getLugarEq() {
+		return lugarEq;
+	}
+	public void setLugarEq(Integer lugarEq) {
+		this.lugarEq = lugarEq;
+	}
+
+	@Override
+	public int hashCode() {
+		return Objects.hash(lugar, lugarEq, tlugar, tlugarEq);
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		OrganEquivalentPK other = (OrganEquivalentPK) obj;
+		return Objects.equals(lugar, other.lugar) && Objects.equals(lugarEq, other.lugarEq)
+				&& Objects.equals(tlugar, other.tlugar) && Objects.equals(tlugarEq, other.tlugarEq);
+	}
+	
+	
+
+}

+ 51 - 0
src/main/java/es/uv/saic/domain/OrganPK.java

@@ -0,0 +1,51 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import jakarta.persistence.*;
+
+@Embeddable
+public class OrganPK implements Serializable {
+	//default serial version id, required for serializable classes.
+	private static final long serialVersionUID = 1L;
+
+	private String tlugar;
+
+	private Integer lugar;
+
+	public OrganPK() {
+	}
+	public String getTlugar() {
+		return this.tlugar;
+	}
+	public void setTlugar(String tlugar) {
+		this.tlugar = tlugar;
+	}
+	public Integer getLugar() {
+		return this.lugar;
+	}
+	public void setLugar(Integer lugar) {
+		this.lugar = lugar;
+	}
+
+	public boolean equals(Object other) {
+		if (this == other) {
+			return true;
+		}
+		if (!(other instanceof OrganPK)) {
+			return false;
+		}
+		OrganPK castOther = (OrganPK)other;
+		return 
+			this.tlugar.equals(castOther.tlugar)
+			&& this.lugar.equals(castOther.lugar);
+	}
+
+	public int hashCode() {
+		final int prime = 31;
+		int hash = 17;
+		hash = hash * prime + this.tlugar.hashCode();
+		hash = hash * prime + this.lugar.hashCode();
+		
+		return hash;
+	}
+}

+ 76 - 0
src/main/java/es/uv/saic/domain/OrganRepository.java

@@ -0,0 +1,76 @@
+package es.uv.saic.domain;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface OrganRepository extends JpaRepository<Organ, OrganPK> {
+
+	@Query("SELECT i FROM Organ i WHERE i.id.tlugar = ?1 AND i.id.lugar = ?2")
+	public Organ findByTlugarLugar(String tlugar, Integer lugar);
+	
+	@Query(value=("SELECT * FROM organs WHERE ruct = ?1 AND actiu"), nativeQuery=true)
+	public Organ findByRuct(Integer ruct);
+
+	@Query(value=("""
+		SELECT lugar FROM organs WHERE tlugar = ?1 AND lugar = ?2
+		UNION 
+		SELECT lugar FROM organs_equivalents WHERE tlugar_eq = ?1 AND lugar_eq = ?2; """), nativeQuery=true)
+	public List<Integer> exists(String tlugar, Integer lugar);
+	
+	@Query(value=("SELECT * FROM organs "
+			+ "WHERE tlugar = 'C' "
+			+ "AND lugar IN(SELECT DISTINCT centre FROM instancies)"), nativeQuery=true)
+	public List<Organ> findCurrentCentres();
+	
+	@Query(value=("SELECT DISTINCT titulacio FROM instancies WHERE centre IN(?1)"), nativeQuery=true)
+	public List<Integer> findTitulacionsByCentre(List<Integer> centre);
+
+	@Query(value=("SELECT * FROM organs WHERE actiu = true AND tlugar = 'T' AND tlugar2 = 'C' AND lugar = ?1 ORDER BY nom_val"), nativeQuery=true)
+	public Organ findByTitulacio(Integer titulacio);
+	
+	@Query(value=("SELECT * FROM organs WHERE tlugar = 'T' AND tlugar2 = 'C' AND lugar = ?1 ORDER BY nom_val"), nativeQuery=true)
+	public Organ findSupervisableByTitulacio(Integer titulacio);
+	
+	@Query(value=("SELECT * FROM organs WHERE tlugar = 'T' AND lugar NOT IN (0, 1, 2) AND actiu ORDER BY nom_val"), nativeQuery=true)
+	public List<Organ> findAllTitulacions();
+	
+	@Query(value=("SELECT * FROM organs WHERE tlugar = 'C' ORDER BY nom_val"), nativeQuery=true)
+	public List<Organ> findAllCentres();
+	
+	@Query(value=("SELECT * FROM organs WHERE tlugar = 'C' AND actiu ORDER BY nom_val"), nativeQuery=true)
+	public List<Organ> findAllActiveCentres();
+	
+	@Query(value=("SELECT * FROM organs WHERE tlugar = 'T' AND lugar NOT IN (0, 1, 2) AND actiu ORDER BY nom_val"), nativeQuery=true)
+	public List<Organ> findActiveTitulacions();
+	
+	@Query(value=("SELECT * FROM organs WHERE tlugar = 'C' AND actiu ORDER BY nom_val"), nativeQuery=true)
+	public List<Organ> findActiveCentres();
+	
+	@Query(value=("SELECT * FROM organs WHERE tlugar = 'T' AND lugar NOT IN (0, 1, 2) AND tlugar2 = 'C' AND lugar2 = ?1 AND actiu ORDER BY tambit, nom_val"), nativeQuery=true)
+	public List<Organ> findActiveTitulacionsByCentre(Integer centre);	
+	
+	@Query(value=("SELECT * FROM organs WHERE tlugar = 'T' AND lugar NOT IN (0, 1, 2) AND tlugar2 = 'C' AND lugar2 = ?1 AND CAST(lugar/1000 AS integer) = ?2 AND actiu ORDER BY nom_val"), nativeQuery=true)
+	public List<Organ> findActiveTitulacionsByTypeCentre(Integer centre, Integer type);	
+	
+	@Query(value=("SELECT * FROM organs WHERE tlugar = 'T' AND lugar NOT IN (0, 1, 2) AND tlugar2 = 'C' AND lugar2 = ?1 AND tambit = ?2 AND actiu ORDER BY nom_val"), nativeQuery=true)
+	public List<Organ> findActiveTitulacionsByCentreTambit(Integer centre, String tambit);
+	
+	@Query(value=("SELECT * FROM organs WHERE tlugar = 'T' AND lugar NOT IN (0, 1, 2) AND tlugar2 = 'C' AND lugar2 IN(?1) AND actiu ORDER BY nom_val"), nativeQuery=true)
+	public List<Organ> findAllTitulacionsByCentres(List<Integer> centres);
+	
+	@Query(value=("SELECT * FROM organs WHERE tlugar = 'T' AND lugar IN(SELECT lugar FROM usuaris_rols WHERE usuari = ?1 AND tlugar = 'T') AND actiu ORDER BY nom_val"), nativeQuery=true)
+	public List<Organ> findTitulacionsByUsuari(String usuari);
+	
+	@Query(value=("SELECT DISTINCT * FROM organs WHERE lugar IN(SELECT lugar FROM usuaris_rols WHERE usuari = ?1 AND tlugar = 'C') " + 
+			"OR lugar IN(SELECT org.lugar2 FROM organs org, usuaris_rols usr WHERE usr.usuari = ?1 AND usr.tlugar = 'T' AND org.lugar = usr.lugar) " + 
+			"AND actiu ORDER BY nom_val"), nativeQuery=true)
+	public List<Organ> findCentresByUsuari(String usuari);
+	
+	@Query(value=("SELECT lugar_eq FROM organs_equivalents WHERE lugar = ?1 AND tlugar = ?2 AND tlugar_eq = ?2 ORDER BY lugar_eq DESC"), nativeQuery=true)
+	public List<Integer> getEquivalents(Integer lugar, String tlugar);
+	
+}

+ 126 - 0
src/main/java/es/uv/saic/domain/Plantilla.java

@@ -0,0 +1,126 @@
+package es.uv.saic.domain;
+
+import java.sql.Timestamp;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+
+@Entity
+@Table(name="plantilles")
+@NamedQuery(name="Plantilla.findAll", query="SELECT t FROM Plantilla t")
+public class Plantilla {
+
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	@Column(name="id_plantilla")
+	private Integer idPlantilla;
+	
+	@Column(name="versio")
+	private Integer versio;
+	
+	@Column(name="codi")
+	private String codi;
+	
+	@Column(name="nom_cas")
+	private String nomCas;
+	
+	@Column(name="nom_val")
+	private String nomVal;
+	
+	@Column(name="data_creacio")
+	private Timestamp data_creacio;
+	
+	@Column(name="data_mod")
+	private Timestamp data_mod;
+	
+	@Column(name="text")
+	private String text;
+	
+	@Column(name="ambit")
+	private String ambit;
+
+	public Integer getIdPlantilla() {
+		return idPlantilla;
+	}
+
+	public void setIdPlantilla(Integer idPlantilla) {
+		this.idPlantilla = idPlantilla;
+	}
+
+	public Integer getVersio() {
+		return versio;
+	}
+
+	public void setVersio(Integer versio) {
+		this.versio = versio;
+	}
+
+	public String getCodi() {
+		return codi;
+	}
+
+	public void setCodi(String codi) {
+		this.codi = codi;
+	}
+
+	public String getNomCas() {
+		return nomCas;
+	}
+
+	public void setNomCas(String nomCas) {
+		this.nomCas = nomCas;
+	}
+
+	public String getNomVal() {
+		return nomVal;
+	}
+
+	public void setNomVal(String nomVal) {
+		this.nomVal = nomVal;
+	}
+
+	public Timestamp getData_creacio() {
+		return data_creacio;
+	}
+
+	public void setData_creacio(Timestamp data_creacio) {
+		this.data_creacio = data_creacio;
+	}
+
+	public Timestamp getData_mod() {
+		return data_mod;
+	}
+
+	public void setData_mod(Timestamp data_mod) {
+		this.data_mod = data_mod;
+	}
+
+	public String getText() {
+		return text;
+	}
+
+	public void setText(String text) {
+		this.text = text;
+	}
+
+	public String getAmbit() {
+		return ambit;
+	}
+
+	public void setAmbit(String ambit) {
+		this.ambit = ambit;
+	}
+
+	public static long getSerialversionuid() {
+		return serialVersionUID;
+	}
+	
+	
+}

+ 62 - 0
src/main/java/es/uv/saic/domain/PlantillaComentario.java

@@ -0,0 +1,62 @@
+package es.uv.saic.domain;
+
+public class PlantillaComentario {
+	
+	private String uid;
+	private String author;
+	private String authorName;
+	private String content;
+	private String createdAt;
+	private String modifiedAt;
+	
+	public PlantillaComentario() {}
+	
+	public PlantillaComentario(String uid, String author, String authorName, String content, String createdAt,
+			String modifiedAt) {
+		this.uid = uid;
+		this.author = author;
+		this.authorName = authorName;
+		this.content = content;
+		this.createdAt = createdAt;
+		this.modifiedAt = modifiedAt;
+	}
+	public String getUid() {
+		return uid;
+	}
+	public void setUid(String uid) {
+		this.uid = uid;
+	}
+	public String getAuthor() {
+		return author;
+	}
+	public void setAuthor(String author) {
+		this.author = author;
+	}
+	public String getAuthorName() {
+		return authorName;
+	}
+	public void setAuthorName(String authorName) {
+		this.authorName = authorName;
+	}
+	public String getContent() {
+		return content;
+	}
+	public void setContent(String content) {
+		this.content = content;
+	}
+	public String getCreatedAt() {
+		return createdAt;
+	}
+	public void setCreatedAt(String createdAt) {
+		this.createdAt = createdAt;
+	}
+	public String getModifiedAt() {
+		return modifiedAt;
+	}
+	public void setModifiedAt(String modifiedAt) {
+		this.modifiedAt = modifiedAt;
+	}
+	
+	
+
+}

+ 66 - 0
src/main/java/es/uv/saic/domain/PlantillaConversation.java

@@ -0,0 +1,66 @@
+package es.uv.saic.domain;
+
+import java.util.Collection;
+import java.util.List;
+
+public class PlantillaConversation {
+
+	private String uid;
+	private List<PlantillaComentario> comments;
+	
+	public PlantillaConversation() {}
+	
+	public PlantillaConversation(String uid, List<PlantillaComentario> comments) {
+		this.uid = uid;
+		this.comments = comments;
+	}
+
+	public String getUid() {
+		return uid;
+	}
+
+	public void setUid(String uid) {
+		this.uid = uid;
+	}
+
+	public List<PlantillaComentario> getComments() {
+		return comments;
+	}
+
+	public void setComments(List<PlantillaComentario> comments) {
+		this.comments = comments;
+	}
+	
+	public boolean add(PlantillaComentario arg0) {
+		return comments.add(arg0);
+	}
+
+	public boolean addAll(Collection<? extends PlantillaComentario> arg0) {
+		return comments.addAll(arg0);
+	}
+
+	public boolean addAll(int arg0, Collection<? extends PlantillaComentario> arg1) {
+		return comments.addAll(arg0, arg1);
+	}
+
+	public void clear() {
+		comments.clear();
+	}
+
+	public boolean contains(Object arg0) {
+		return comments.contains(arg0);
+	}
+
+	public PlantillaComentario get(int arg0) {
+		return comments.get(arg0);
+	}
+
+	public PlantillaComentario remove(int arg0) {
+		return comments.remove(arg0);
+	}
+
+	public int size() {
+		return comments.size();
+	}
+	
+}

+ 24 - 0
src/main/java/es/uv/saic/domain/PlantillaRepository.java

@@ -0,0 +1,24 @@
+package es.uv.saic.domain;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+
+@Repository
+public interface PlantillaRepository extends JpaRepository<Plantilla, Integer> {
+
+	Plantilla findByIdPlantilla(Integer idPlantilla);
+	
+	@Query(value=("SELECT * FROM plantilles WHERE "
+			+ "id_plantilla IN(SELECT CAST(codi_evidencia AS INTEGER) FROM tasques WHERE tipus = 11 AND codi_evidencia IS NOT NULL) "
+			+ "AND id_plantilla = ?1"), nativeQuery=true)
+	List<Plantilla> findUsedByIdPlantilla(Integer idPlantilla);
+	
+	@Query(value=("SELECT * FROM plantilles WHERE "
+			+ "versio = ?1 AND codi = ?2 AND ambit = ?3"), nativeQuery=true)
+	Plantilla findByVersioCodiAmbit(Integer versio, String codi, String ambit);
+	
+}

+ 198 - 0
src/main/java/es/uv/saic/domain/Proces.java

@@ -0,0 +1,198 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import jakarta.persistence.*;
+import java.util.List;
+
+
+@Entity
+@Table(name="processos")
+@NamedQuery(name="Proces.findAll", query="SELECT p FROM Proces p")
+public class Proces implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@Column(name="id_proces")
+	private Integer idProces;
+
+	private String ambit;
+
+	@Column(name="curs_activacio")
+	private Integer cursActivacio;
+
+	@Column(name="curs_avaluat")
+	private Integer cursAvaluat;
+
+	@Column(name="descripcio_cas")
+	private String descripcioCas;
+
+	@Column(name="descripcio_val")
+	private String descripcioVal;
+
+	@Column(name="nom_proces")
+	private String nomProces;
+
+	@Column(name="titol_cas")
+	private String titolCas;
+
+	@Column(name="titol_val")
+	private String titolVal;
+	
+	private String comentaris;
+
+	private String versio;
+
+	@Column(name="sub_titol")
+	private String subTitol;
+
+	//bi-directional many-to-one association to Instancia
+	@OneToMany(mappedBy="proces")
+	private List<Instancia> instancies;
+
+	//bi-directional many-to-one association to Tasca
+	@OneToMany(mappedBy="proces")
+	private List<Tasca> tasques;	
+
+	public Proces() {}
+
+	public Integer getIdProces() {
+		return this.idProces;
+	}
+
+	public void setIdProces(Integer idProces) {
+		this.idProces = idProces;
+	}
+
+	public String getAmbit() {
+		return this.ambit;
+	}
+
+	public void setAmbit(String ambit) {
+		this.ambit = ambit;
+	}
+
+	public Integer getCursActivacio() {
+		return this.cursActivacio;
+	}
+
+	public void setCursActivacio(Integer cursActivacio) {
+		this.cursActivacio = cursActivacio;
+	}
+
+	public Integer getCursAvaluat() {
+		return this.cursAvaluat;
+	}
+
+	public void setCursAvaluat(Integer cursAvaluat) {
+		this.cursAvaluat = cursAvaluat;
+	}
+
+	public String getDescripcioCas() {
+		return this.descripcioCas;
+	}
+
+	public void setDescripcioCas(String descripcioCas) {
+		this.descripcioCas = descripcioCas;
+	}
+
+	public String getDescripcioVal() {
+		return this.descripcioVal;
+	}
+
+	public void setDescripcioVal(String descripcioVal) {
+		this.descripcioVal = descripcioVal;
+	}
+
+	public String getNomProces() {
+		return this.nomProces;
+	}
+
+	public void setNomProces(String nomProces) {
+		this.nomProces = nomProces;
+	}
+
+	public String getTitolCas() {
+		return this.titolCas;
+	}
+
+	public void setTitolCas(String titolCas) {
+		this.titolCas = titolCas;
+	}
+
+	public String getTitolVal() {
+		return this.titolVal;
+	}
+
+	public void setTitolVal(String titolVal) {
+		this.titolVal = titolVal;
+	}
+	
+	public String getComentaris() {
+		return this.comentaris;
+	}
+
+	public void setComentaris(String comentaris) {
+		this.comentaris = comentaris;
+	}
+
+	public String getVersio() {
+		return this.versio;
+	}
+
+	public void setVersio(String versio) {
+		this.versio = versio;
+	}
+
+	public String getSubTitol() {
+		return this.subTitol;
+	}
+
+	public void setSubTitol(String subTitol) {
+		this.subTitol = subTitol;
+	}
+
+	public List<Instancia> getInstancies() {
+		return this.instancies;
+	}
+
+	public void setInstancies(List<Instancia> instancies) {
+		this.instancies = instancies;
+	}
+
+	public Instancia addInstancia(Instancia instancia) {
+		getInstancies().add(instancia);
+		instancia.setProces(this);
+
+		return instancia;
+	}
+
+	public Instancia removeInstancia(Instancia instancia) {
+		getInstancies().remove(instancia);
+		instancia.setProces(null);
+
+		return instancia;
+	}
+
+	public List<Tasca> getTasques() {
+		return this.tasques;
+	}
+
+	public void setTasques(List<Tasca> tasques) {
+		this.tasques = tasques;
+	}
+
+	public Tasca addTasca(Tasca tasca) {
+		getTasques().add(tasca);
+		tasca.setProces(this);
+
+		return tasca;
+	}
+
+	public Tasca removeTasca(Tasca tasca) {
+		getTasques().remove(tasca);
+		tasca.setProces(null);
+ 
+		return tasca;
+	}
+
+}

+ 75 - 0
src/main/java/es/uv/saic/domain/ProcesRepository.java

@@ -0,0 +1,75 @@
+package es.uv.saic.domain;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ProcesRepository extends JpaRepository<Proces, Integer> {
+
+	@Query("SELECT i FROM Proces i WHERE i.nomProces = ?1")
+	List<Proces> findByName(String nom);
+	
+	@Query("SELECT i FROM Proces i WHERE i.nomProces = ?1 AND i.cursAvaluat = ?2")
+	List<Proces> findByNameCurs(String nom, Integer curs);
+	
+	@Query(value="SELECT DISTINCT id_proces FROM processos WHERE curs_avaluat IN (?1) AND id_proces IN("
+			+ "SELECT id_proces FROM instancies WHERE centre IN(?2) AND titulacio IN(?3) AND nom_proces = ?4)", nativeQuery=true)
+	List<Integer> findProcsByCentreTitulacioCursNom(List<Integer> cursos, List<Integer> centres, List<Integer> titulacions, String nom);
+
+	@Query(value="SELECT DISTINCT id_proces FROM processos WHERE curs_avaluat IN (?1) AND id_proces IN("
+			+ "SELECT id_proces FROM instancies WHERE centre IN(?2) AND titulacio IN(?3)) ", nativeQuery=true)
+	List<Integer> findProcsByCentreTitulacioCurs(List<Integer> cursos, List<Integer> centres, List<Integer> titulacions);
+	
+	@Query(value="SELECT DISTINCT curs_avaluat FROM processos WHERE id_proces IN("
+			+ "SELECT id_proces FROM instancies WHERE centre IN(?1) AND titulacio IN(?2))", nativeQuery=true)
+	List<Integer> findCursosByCentreTitulacio(List<Integer> centres, List<Integer> titulacions);
+
+	@Query(nativeQuery=true, value=("""
+			SELECT T1.txt FROM(
+				SELECT CASE
+						WHEN 
+							ta.tipus IN(2, 20) 
+						THEN 
+							CONCAT(ta.id_tascap, '@{shape: hex, label: \"', 
+							CASE WHEN LENGTH(ta.titol_cas) > 497 THEN CONCAT(LEFT(ta.titol_cas, 497), '...') ELSE ta.titol_cas END,
+							' <br> <strong>Asignado a:</strong> ', ro.descripcio_cas, '<br> <strong>Fecha límite:</strong> ', ta.data_lim, '\"}')
+						WHEN
+							ta.tipus IN(21, 22) 
+						THEN 
+							CONCAT(ta.id_tascap, '@{shape: procs, label: \"', 
+							CASE WHEN LENGTH(ta.titol_cas) > 497 THEN CONCAT(LEFT(ta.titol_cas, 497), '...') ELSE ta.titol_cas END,
+							' <br> <strong>Asignado a:</strong> ', ro.descripcio_cas, '<br> <strong>Fecha límite:</strong> ', ta.data_lim, '\"}')
+						WHEN
+							ta.tipus IN(1, 11, 12, 14, 15) 
+						THEN 
+							CONCAT(ta.id_tascap, '@{shape: lean-r, label: \"', 
+							CASE WHEN LENGTH(ta.titol_cas) > 497 THEN CONCAT(LEFT(ta.titol_cas, 497), '...') ELSE ta.titol_cas END,
+							' <br> <strong>Asignado a:</strong> ', ro.descripcio_cas, '<br> <strong>Fecha límite:</strong> ', ta.data_lim, '\"}')
+						ELSE 
+							CONCAT(ta.id_tascap, '[\"', 
+							CASE WHEN LENGTH(ta.titol_cas) > 497 THEN CONCAT(LEFT(ta.titol_cas, 497), '...') ELSE ta.titol_cas END,
+							' <br> <strong>Asignado a:</strong> ', ro.descripcio_cas, '<br> <strong>Fecha límite:</strong> ', ta.data_lim, '\"]')
+					END AS txt, ta.id_tascap, 1 AS ordr 
+				FROM tasques ta LEFT JOIN rols ro ON ro.id_rol = ta.id_rol 
+				WHERE ta.id_proces IN(SELECT id_proces FROM processos WHERE nom_proces = ?1 ORDER BY id_proces DESC LIMIT 1)
+				UNION
+				SELECT CASE
+							WHEN tipus = 2 OR tipus = 20 THEN CONCAT(id_tascap, '-->|SÍ|', id_tasca_seg)
+					ELSE 
+							CONCAT(id_tascap, '-->', id_tasca_seg) 
+					END AS txt, id_tascap, 2 AS ordr 
+				FROM tasques 
+				WHERE id_proces IN(SELECT id_proces FROM processos WHERE nom_proces = ?1 ORDER BY id_proces DESC LIMIT 1) AND id_tasca_seg != 9999
+				UNION
+				SELECT CONCAT(id_tascap, '-->|NO|', id_tasca_seg2) AS txt, id_tascap, 2 AS ordr 
+				FROM tasques 
+				WHERE (tipus = 2 OR tipus = 20) AND id_proces IN(SELECT id_proces FROM processos WHERE nom_proces = ?1 ORDER BY id_proces DESC LIMIT 1) AND id_tasca_seg2 != 9999
+				ORDER BY ordr ASC, id_tascap ASC
+			) AS T1; """))
+	public List<String> getFlowDiagram(String proc);
+	
+}
+

+ 124 - 0
src/main/java/es/uv/saic/domain/Rol.java

@@ -0,0 +1,124 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import jakarta.persistence.*;
+import java.util.List;
+
+
+@Entity
+@Table(name="rols")
+@NamedQuery(name="Rol.findAll", query="SELECT r FROM Rol r")
+public class Rol implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@Column(name="id_rol")
+	private Integer idRol;
+
+	private String ambit;
+
+	@Column(name="descripcio_cas")
+	private String descripcioCas;
+	
+	@Column(name="descripcio_val")
+	private String descripcioVal;
+
+	@Column(name="nom_rol")
+	private String nomRol;
+
+	//bi-directional many-to-one association to Tasca
+	@OneToMany(mappedBy="rol")
+	private List<Tasca> tasques;
+
+	//bi-directional many-to-one association to UsuarisRol
+	@OneToMany(mappedBy="rol")
+	private List<UsuarisRol> usuarisRols;
+
+	public Rol() {
+	}
+
+	public Integer getIdRol() {
+		return this.idRol;
+	}
+
+	public void setIdRol(Integer idRol) {
+		this.idRol = idRol;
+	}
+
+	public String getAmbit() {
+		return this.ambit;
+	}
+
+	public void setAmbit(String ambit) {
+		this.ambit = ambit;
+	}
+	
+	public String getDescripcioCas() {
+		return descripcioCas;
+	}
+
+	public void setDescripcioCas(String descripcioCas) {
+		this.descripcioCas = descripcioCas;
+	}
+
+	public String getDescripcioVal() {
+		return descripcioVal;
+	}
+
+	public void setDescripcioVal(String descripcioVal) {
+		this.descripcioVal = descripcioVal;
+	}
+
+	public String getNomRol() {
+		return this.nomRol;
+	}
+
+	public void setNomRol(String nomRol) {
+		this.nomRol = nomRol;
+	}
+
+	public List<Tasca> getTasques() {
+		return this.tasques;
+	}
+
+	public void setTasques(List<Tasca> tasques) {
+		this.tasques = tasques;
+	}
+
+	public Tasca addTasque(Tasca tasca) {
+		getTasques().add(tasca);
+		tasca.setRol(this);
+
+		return tasca;
+	}
+
+	public Tasca removeTasque(Tasca tasca) {
+		getTasques().remove(tasca);
+		tasca.setRol(null);
+
+		return tasca;
+	}
+
+	public List<UsuarisRol> getUsuarisRols() {
+		return this.usuarisRols;
+	}
+
+	public void setUsuarisRols(List<UsuarisRol> usuarisRols) {
+		this.usuarisRols = usuarisRols;
+	}
+
+	public UsuarisRol addUsuarisRol(UsuarisRol usuarisRol) {
+		getUsuarisRols().add(usuarisRol);
+		usuarisRol.setRol(this);
+
+		return usuarisRol;
+	}
+
+	public UsuarisRol removeUsuarisRol(UsuarisRol usuarisRol) {
+		getUsuarisRols().remove(usuarisRol);
+		usuarisRol.setRol(null);
+
+		return usuarisRol;
+	}
+
+}

+ 17 - 0
src/main/java/es/uv/saic/domain/RolRepository.java

@@ -0,0 +1,17 @@
+package es.uv.saic.domain;
+
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+
+@Repository
+public interface RolRepository extends JpaRepository<Rol, Integer> {
+
+	@Query(value=("SELECT * FROM rols WHERE id_rol NOT IN (1) ORDER BY descripcio_cas"), nativeQuery=true)
+	List<Rol> findAssignables();
+
+}

+ 101 - 0
src/main/java/es/uv/saic/domain/ScheduledTasks.java

@@ -0,0 +1,101 @@
+package es.uv.saic.domain;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.Date;
+import java.util.List;
+
+import jakarta.mail.MessagingException;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import es.uv.saic.service.CalendariService;
+import es.uv.saic.service.EmailService;
+import es.uv.saic.service.InstanciaService;
+import es.uv.saic.service.InstanciaTascaService;
+import es.uv.saic.service.ParserService;
+import es.uv.saic.service.SysStatusService;
+import es.uv.saic.service.UsuariService;
+
+@Component
+@SuppressWarnings("unused")
+public class ScheduledTasks {
+	
+	@Autowired
+	private EmailService es;
+	@Autowired
+	private InstanciaService it;
+	@Autowired
+	private InstanciaTascaService its;
+	@Autowired
+	private UsuariService us;
+	@Autowired
+	private ParserService ps;
+	@Autowired
+	private CalendariService cs;
+	@Autowired
+	private SysStatusService sss;
+	@Value("${saic.mailer.queue.enabled}")
+	private String queueEnabled;
+	@Value("${saic.mailer.reminder.enabled}")
+	private String reminderEnabled;
+	@Value("${saic.mailer.calendar.enabled}")
+	private String calendarEnabled;
+	@Value("${saic.mailer.maxMailsPerRound}")
+	private Integer maxMailsPerRound;
+	@Value("${saic.parser.surveys.enabled}")
+	private String parserEnabled;
+	@Value("${saic.scheduler.expired.enabled}")
+	private String expiredEnabled;
+
+	@Scheduled(fixedDelay = 300000)
+	public void sendInstanceMails() {
+		if(Boolean.parseBoolean(this.queueEnabled)) {
+			Integer counter = 0;
+			while(!es.pendingQueueIsEmpty() && counter < maxMailsPerRound) {
+				es.sendActiveTaskNext();
+				counter+=1;
+			}
+		}
+	}
+	
+	@Scheduled(cron="0 0 1 * * *")
+	public void sendReminderMails() {
+		if(Boolean.parseBoolean(this.reminderEnabled)) {
+			sss.log("Start sending mail reminders");
+			for(InstanciaTasca instanciaTasca : its.getPastTasks()) {
+				for(Usuari u : us.getInstanceAsignedUsers(instanciaTasca.getInstancia().getIdInstancia())) {
+					Email email = new Email();
+					email.setUsusari(u);
+					email.setInstanciaTasca(instanciaTasca);
+					es.addEmail(email);
+				}
+			}
+		}
+	}
+	
+	@Scheduled(cron="0 0 1 * * *")
+	public void sendCalendarMails() throws MessagingException {
+		if(Boolean.parseBoolean(this.calendarEnabled)) {
+			Integer counter = 0;
+			Usuari u = this.us.findByUsername("system");
+			List<Calendari> events = this.cs.getNextEvents();
+			for(Calendari e : events) {
+				this.es.sendCalendarMail(u, e);
+				counter+=1;
+			}
+		}
+	}
+	
+	@Scheduled(cron="0 0 1 * * *")
+	public void closeExpiredTasks() {
+		if(Boolean.parseBoolean(this.expiredEnabled)) {
+			// to do in future
+		}
+	}
+
+}

+ 64 - 0
src/main/java/es/uv/saic/domain/SupervisionSearchParams.java

@@ -0,0 +1,64 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class SupervisionSearchParams implements Serializable{
+	
+	private static final long serialVersionUID = 1L;
+	private List<Integer> centres;
+	private List<Integer> cursos;
+	private List<Integer> titulacions;
+	private List<String> procediments;
+	private List<String> evidencies;
+	private String searchType;
+	
+	
+	public SupervisionSearchParams(List<Integer> centres, List<Integer> titulacions, List<Integer> cursos, 
+								   List<String> procediments, List<String> evidencies, String searchType) {
+		super();
+		this.centres = centres;
+		this.cursos = cursos;
+		this.titulacions = titulacions;
+		this.procediments = procediments;
+		this.evidencies = evidencies;
+		this.searchType = searchType;
+	}
+	public List<Integer> getCentres() {
+		return centres;
+	}
+	public void setCentres(List<Integer> centres) {
+		this.centres = centres;
+	}
+	public List<Integer> getCursos() {
+		return cursos;
+	}
+	public void setCursos(List<Integer> cursos) {
+		this.cursos = cursos;
+	}
+	public List<Integer> getTitulacions() {
+		return titulacions;
+	}
+	public void setTitulacions(List<Integer> titulacions) {
+		this.titulacions = titulacions;
+	}
+	public List<String> getProcediments() {
+		return procediments;
+	}
+	public void setProcediments(List<String> procediments) {
+		this.procediments = procediments;
+	}
+	public List<String> getEvidencies() {
+		return evidencies;
+	}
+	public void setEvidencies(List<String> evidencies) {
+		this.evidencies = evidencies;
+	}
+	public String getSearchType() {
+		return searchType;
+	}
+	public void setSearchType(String searchType) {
+		this.searchType = searchType;
+	}
+	
+}

+ 81 - 0
src/main/java/es/uv/saic/domain/SysStatus.java

@@ -0,0 +1,81 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.util.Date;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+
+@Entity
+@Table(name="sys_status")
+@NamedQuery(name="SysStatus.findAll", query="SELECT t FROM SysStatus t")
+public class SysStatus implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	@Column(name="id_status")
+	private Integer idStatus;
+	
+	@Column(name="timestamp")
+	private Timestamp timestamp;
+	
+	@Column(name="type")
+	private String type;
+	
+	@Column(name="msg")
+	private String msg;
+	
+	@Column(name="err")
+	private String err;
+
+	public Integer getIdStatus() {
+		return idStatus;
+	}
+
+	public void setIdStatus(Integer idStatus) {
+		this.idStatus = idStatus;
+	}
+
+	public Date getTimestamp() {
+		return timestamp;
+	}
+
+	public void setTimestamp(Timestamp timestamp) {
+		this.timestamp = timestamp;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public String getMsg() {
+		return msg;
+	}
+
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+	
+	public String getErr() {
+		return err;
+	}
+
+	public void setErr(String err) {
+		this.err = err;
+	}
+	
+	
+	
+	
+}

+ 15 - 0
src/main/java/es/uv/saic/domain/SysStatusRepository.java

@@ -0,0 +1,15 @@
+package es.uv.saic.domain;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface SysStatusRepository extends JpaRepository<SysStatus, Integer> {
+
+	@Query("SELECT i FROM SysStatus i WHERE i.type = ?1")
+	List<SysStatus> findByType(String type);
+	
+}

+ 256 - 0
src/main/java/es/uv/saic/domain/Tasca.java

@@ -0,0 +1,256 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+
+import jakarta.persistence.*;
+import java.util.Date;
+import java.util.List;
+
+
+/**
+ * The persistent class for the tasques database table.
+ * 
+ */
+@Entity
+@Table(name="tasques")
+@NamedQuery(name="Tasca.findAll", query="SELECT t FROM Tasca t")
+public class Tasca implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@Column(name="id_tasca")
+	private Integer idTasca;
+
+	@Column(name="codi_evidencia")
+	private String codiEvidencia;
+
+	@Temporal(TemporalType.DATE)
+	@Column(name="data_lim")
+	private Date dataLim;
+
+	@Column(name="descripcio_cas")
+	private String descripcioCas;
+
+	@Column(name="descripcio_val")
+	private String descripcioVal;
+
+	@Column(name="id_tasca_seg")
+	private Integer idTascaSeg;
+
+	@Column(name="id_tasca_seg2")
+	private Integer idTascaSeg2;
+
+	@Column(name="id_tascap")
+	private Integer idTascap;
+
+	@Column(name="nom_evidencia_cas")
+	private String nomEvidenciaCas;
+	
+	@Column(name="nom_evidencia_val")
+	private String nomEvidenciaVal;
+
+	@Column(name="titol_cas")
+	private String titolCas;
+
+	@Column(name="titol_val")
+	private String titolVal;
+	
+	@Column(name="opcions")
+	private String opcions;
+	
+	@Column(name="informe")
+	private Boolean informe;
+
+	//bi-directional many-to-one association to Proces
+	@ManyToOne
+	@JoinColumn(name="id_proces")
+	private Proces proces;
+
+	//bi-directional many-to-one association to Rol
+	@ManyToOne
+	@JoinColumn(name="id_rol")
+	private Rol rol;
+
+	//bi-directional many-to-one association to Tipus
+	@ManyToOne
+	@JoinColumn(name="tipus")
+	private Tipus tipus;
+
+	//bi-directional many-to-one association to InstanciaTasca
+	@OneToMany(mappedBy="tasca")
+	private List<InstanciaTasca> instancies;
+
+	public Tasca() {
+	}
+
+	public Integer getIdTasca() {
+		return this.idTasca;
+	}
+
+	public void setIdTasca(Integer idTasca) {
+		this.idTasca = idTasca;
+	}
+
+	public String getCodiEvidencia() {
+		return this.codiEvidencia;
+	}
+
+	public void setCodiEvidencia(String codiEvidencia) {
+		this.codiEvidencia = codiEvidencia;
+	}
+
+	public Date getDataLim() {
+		return this.dataLim;
+	}
+
+	public void setDataLim(Date dataLim) {
+		this.dataLim = dataLim;
+	}
+
+	public String getDescripcioCas() {
+		return this.descripcioCas;
+	}
+
+	public void setDescripcioCas(String descripcioCas) {
+		this.descripcioCas = descripcioCas;
+	}
+
+	public String getDescripcioVal() {
+		return this.descripcioVal;
+	}
+
+	public void setDescripcioVal(String descripcioVal) {
+		this.descripcioVal = descripcioVal;
+	}
+
+	public Integer getIdTascaSeg() {
+		return this.idTascaSeg;
+	}
+
+	public void setIdTascaSeg(Integer idTascaSeg) {
+		this.idTascaSeg = idTascaSeg;
+	}
+
+	public Integer getIdTascaSeg2() {
+		return this.idTascaSeg2;
+	}
+
+	public void setIdTascaSeg2(Integer idTascaSeg2) {
+		this.idTascaSeg2 = idTascaSeg2;
+	}
+
+	public Integer getIdTascap() {
+		return this.idTascap;
+	}
+
+	public void setIdTascap(Integer idTascap) {
+		this.idTascap = idTascap;
+	}
+
+	public String getNomEvidenciaCas() {
+		return this.nomEvidenciaCas;
+	}
+
+	public void setNomEvidenciaCas(String nomEvidenciaCas) {
+		this.nomEvidenciaCas = nomEvidenciaCas;
+	}
+	public String getNomEvidenciaVal() {
+		return this.nomEvidenciaVal;
+	}
+
+	public void setNomEvidenciaVal(String nomEvidenciaVal) {
+		this.nomEvidenciaVal = nomEvidenciaVal;
+	}
+	public String getTitolCas() {
+		return this.titolCas;
+	}
+
+	public void setTitolCas(String titolCas) {
+		this.titolCas = titolCas;
+	}
+
+	public String getTitolVal() {
+		return this.titolVal;
+	}
+
+	public void setTitolVal(String titolVal) {
+		this.titolVal = titolVal;
+	}
+
+	public Proces getProces() {
+		return this.proces;
+	}
+
+	public void setProces(Proces proces) {
+		this.proces = proces;
+	}
+
+	public Rol getRol() {
+		return this.rol;
+	}
+
+	public void setRol(Rol rol) {
+		this.rol = rol;
+	}
+
+	public Tipus getTipus() {
+		return this.tipus;
+	}
+
+	public void setTipus(Tipus tipus) {
+		this.tipus = tipus;
+	}
+
+	public List<InstanciaTasca> getInstancies() {
+		return this.instancies;
+	}
+
+	public void setInstancies(List<InstanciaTasca> instanciaTascas) {
+		this.instancies = instanciaTascas;
+	}
+
+	public InstanciaTasca addInstancia(InstanciaTasca instanciaTasca) {
+		this.getInstancies().add(instanciaTasca);
+		instanciaTasca.setTasca(this);
+
+		return instanciaTasca;
+	}
+
+	public InstanciaTasca removeInstancia(InstanciaTasca instanciaTasca) {
+		this.getInstancies().remove(instanciaTasca);
+		instanciaTasca.setTasca(null);
+
+		return instanciaTasca;
+	}
+	
+	public boolean isExpired() {
+		if(this.getDataLim() != null) {
+			if((new Date(this.getDataLim().getTime()+(1000 * 60 * 60 * 24))).before(new Date())) {
+				return true;
+			}
+			else {
+				return false;
+			}
+		}
+		else {
+			return false;
+		}
+	}
+	
+	public void setOpcions(String opcions) {
+		this.opcions = opcions;
+	}
+
+	public String getOpcions() {
+		return this.opcions;
+	}
+	
+	public void setInforme(Boolean informe) {
+		this.informe = informe;
+	}
+
+	public Boolean getInforme() {
+		return this.informe;
+	}
+
+}

+ 53 - 0
src/main/java/es/uv/saic/domain/TascaRepository.java

@@ -0,0 +1,53 @@
+package es.uv.saic.domain;
+
+import java.util.Date;
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+public interface TascaRepository extends JpaRepository<Tasca, Integer> {
+
+	@Query(value=("SELECT * FROM tasques WHERE id_proces = ?1 ORDER BY id_tascap ASC"), nativeQuery=true)
+	List<Tasca> findByProces(Integer idProces);
+	
+	@Query(value=("SELECT * FROM tasques WHERE id_proces = ?1 AND id_tascap = ?2"), nativeQuery=true)
+	Tasca findByProcesTascap(Integer idProces, Integer idTascap);
+	
+	@Query(value=("SELECT DISTINCT codi_evidencia AS codiEvidencia, nom_evidencia_cas AS nomEvidenciaCas, nom_evidencia_val AS nomEvidenciaVal FROM tasques"), nativeQuery=true)
+	List<EvidenciaBuscador> findAllEvidencies();
+	
+	@Query(value=("SELECT DISTINCT ta.codi_evidencia AS codiEvidencia, ta.nom_evidencia_cas AS nomEvidenciaCas, ta.nom_evidencia_val AS nomEvidenciaVal " + 
+			"FROM tasques ta, tasquesi ti, instancies ia, processos pr " + 
+			"WHERE ta.id_tasca = ti.id_tasca AND ti.id_instancia = ia.id_instancia AND ta.id_proces = pr.id_proces " + 
+			"AND ia.centre IN (?1) AND ia.titulacio IN (?2) AND pr.curs_avaluat IN (?3)"), nativeQuery=true)
+	List<EvidenciaBuscador> findEvidenciesByCentreTitulacioCurs(List<Integer> centres, List<Integer> titulacions, List<Integer> cursos);
+	
+	@Query(value=("SELECT DISTINCT codi_evidencia AS codiEvidencia, nom_evidencia_cas AS nomEvidenciaCas, "
+			+ "id_tascap AS idTascap, nom_evidencia_val AS nomEvidenciaVal FROM tasques "
+			+ "WHERE id_proces = ?1 AND codi_evidencia IS NOT NULL AND codi_evidencia <> ''"), nativeQuery=true)
+	List<EvidenciaBuscador> getEvidencesByProcedure(Integer idProcedure);
+	
+	@Query(value=("SELECT DISTINCT codi_evidencia AS codiEvidencia "
+			+ "FROM tasques "
+			+ "WHERE codi_evidencia IS NOT NULL AND codi_evidencia <> ''"), nativeQuery=true)
+	List<String> getAllAvailableEvidences();
+	
+	@Transactional
+    @Modifying(flushAutomatically = true, clearAutomatically = true)
+	@Query(value="INSERT INTO tasques VALUES(?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13)", nativeQuery=true)
+    Integer create(Integer idTasca, Integer idProces, Integer idTascap, String titolCas, String descripcioCas, String titolVal, 
+    		String descripcioVal, Date dataLim, Integer tipus, Integer idTascaSeg, Integer idTascaSeg2, Integer idRol, String codiEvidencia);
+	
+	public static interface EvidenciaBuscador {
+		String getCodiEvidencia();
+		String getNomEvidenciaVal();
+		String getNomEvidenciaCas();	
+		Integer getIdTascap();
+	}
+	
+}

+ 76 - 0
src/main/java/es/uv/saic/domain/TascaVersioTransfer.java

@@ -0,0 +1,76 @@
+package es.uv.saic.domain;
+
+import java.math.BigInteger;
+import java.util.Date;
+
+public class TascaVersioTransfer {
+
+	private BigInteger idInstanciaTasca;
+	private String usuariFet;
+	private Date dataFet;
+	private Integer version;
+	private String nomEvidenciaVal;
+	private String nomEvidenciaCas;
+	private String codiEvidencia; 
+	private String estat;
+	private Integer tipus;  
+	
+	public TascaVersioTransfer() {}
+
+	public BigInteger getIdInstanciaTasca() {
+		return idInstanciaTasca;
+	}
+	public void setIdInstanciaTasca(BigInteger idInstanciaTasca) {
+		this.idInstanciaTasca = idInstanciaTasca;
+	}
+	public String getUsuariFet() {
+		return usuariFet;
+	}
+	public void setUsuariFet(String usuariFet) {
+		this.usuariFet = usuariFet;
+	}
+	public Date getDataFet() {
+		return dataFet;
+	}
+	public void setDataFet(Date dataFet) {
+		this.dataFet = dataFet;
+	}
+	public Integer getVersion() {
+		return version;
+	}
+	public void setVersion(Integer version) {
+		this.version = version;
+	}
+	public String getNomEvidenciaVal() {
+		return nomEvidenciaVal;
+	}
+	public void setNomEvidenciaVal(String nomEvidenciaVal) {
+		this.nomEvidenciaVal = nomEvidenciaVal;
+	}
+	public String getNomEvidenciaCas() {
+		return nomEvidenciaCas;
+	}
+	public void setNomEvidenciaCas(String nomEvidenciaCas) {
+		this.nomEvidenciaCas = nomEvidenciaCas;
+	}
+	public String getCodiEvidencia() {
+		return codiEvidencia;
+	}
+	public void setCodiEvidencia(String codiEvidencia) {
+		this.codiEvidencia = codiEvidencia;
+	}
+	public String getEstat() {
+		return estat;
+	}
+	public void setEstat(String estat) {
+		this.estat = estat;
+	}
+	public Integer getTipus() {
+		return tipus;
+	}
+	public void setTipus(Integer tipus) {
+		this.tipus = tipus;
+	}
+	
+	
+}

+ 42 - 0
src/main/java/es/uv/saic/domain/Tipus.java

@@ -0,0 +1,42 @@
+package es.uv.saic.domain;
+
+
+import java.io.Serializable;
+import jakarta.persistence.*;
+
+
+/**
+ * The persistent class for the tipus database table.
+ * 
+ */
+@Entity
+@NamedQuery(name="Tipus.findAll", query="SELECT t FROM Tipus t")
+public class Tipus implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	private Integer tipus;
+
+	private String descripcio;
+
+
+	public Tipus() {
+	}
+
+	public Integer getTipus() {
+		return this.tipus;
+	}
+
+	public void setTipus(Integer tipus) {
+		this.tipus = tipus;
+	}
+
+	public String getDescripcio() {
+		return this.descripcio;
+	}
+
+	public void setDescripcio(String descripcio) {
+		this.descripcio = descripcio;
+	}
+
+}

+ 11 - 0
src/main/java/es/uv/saic/domain/TipusRepository.java

@@ -0,0 +1,11 @@
+package es.uv.saic.domain;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+//import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+
+@Repository
+public interface TipusRepository extends JpaRepository<Tipus, Integer> {
+
+}

+ 31 - 0
src/main/java/es/uv/saic/domain/TreeDTOAny.java

@@ -0,0 +1,31 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class TreeDTOAny implements Serializable  {
+	private static final long serialVersionUID = 1L;
+	
+	private String text;
+	private List<TreeDTODimensio> children;
+	
+	public TreeDTOAny() {}
+	
+	public TreeDTOAny(String text, List<TreeDTODimensio> children) {
+		this.text = text;
+		this.children = children;
+	}
+	
+	public String getText() {
+		return text;
+	}
+	public void setText(String text) {
+		this.text = text;
+	}
+	public List<TreeDTODimensio> getChildren() {
+		return children;
+	}
+	public void setChildren(List<TreeDTODimensio> children) {
+		this.children = children;
+	}
+}

+ 33 - 0
src/main/java/es/uv/saic/domain/TreeDTODimensio.java

@@ -0,0 +1,33 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class TreeDTODimensio implements Serializable  {
+	private static final long serialVersionUID = 1L;
+	
+	private String text;
+	private List<TreeDTOOrgan> children;
+	
+	public TreeDTODimensio() {}
+	
+	public TreeDTODimensio(String text, List<TreeDTOOrgan> children) {
+		this.text = text;
+		this.children = children;
+	}
+	
+	public String getText() {
+		return text;
+	}
+	public void setText(String text) {
+		this.text = text;
+	}
+	public List<TreeDTOOrgan> getChildren() {
+		return children;
+	}
+	public void setChildren(List<TreeDTOOrgan> children) {
+		this.children = children;
+	}
+
+	
+}

+ 149 - 0
src/main/java/es/uv/saic/domain/TreeDTOInstancia.java

@@ -0,0 +1,149 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+
+import org.springframework.context.i18n.LocaleContextHolder;
+
+public class TreeDTOInstancia implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	private BigInteger idInstancia;
+	private BigInteger idInstanciaTasca;
+	private Integer centre;
+	private String estat;
+	private Integer titulacio;
+	private String tlugar;
+	private Integer lugar;
+	private String nomProces;
+	private String descVal;
+	private String descCas;
+	private String ambit;
+	private String text;
+
+	public TreeDTOInstancia() {}
+	
+	public TreeDTOInstancia(Instancia i) {
+		String locale = LocaleContextHolder.getLocale().getLanguage();
+		this.idInstancia = i.getIdInstancia();
+		this.centre = i.getCentre();
+		this.estat = i.getEstat();
+		this.titulacio = i.getTitulacio();
+		this.lugar = i.getOrgan().getId().getLugar();
+		this.tlugar = i.getOrgan().getId().getTlugar();
+		this.nomProces = i.getProces().getNomProces();
+		this.descVal = i.getProces().getTitolVal();
+		this.descCas = i.getProces().getTitolCas();
+		this.ambit = i.getProces().getAmbit(); 
+		
+		String icon = "<span class=\"btn gantt-legend-done\" style=\"border-width:5px;border-radius:50%;width:20px;height:20px;margin-top:-2px\"></span>";
+		if(this.estat.equals("A")) {
+			icon = "<span class=\"btn gantt-legend-active\" style=\"border-width:5px;border-radius:50%;width:20px;height:20px;margin-top:-2px\"></span>";
+		}
+		else if(this.estat.equals("C")) {
+			icon = "<span class=\"btn gantt-legend-closed\" style=\"border-width:5px;border-radius:50%;width:20px;height:20px;margin-top:-2px\"></span>";
+		}
+		
+		this.text = icon+" <a target=\"_blank\" href=\"/procedure/"+i.getIdInstancia().toString()+"\">"+i.getProces().getNomProces() + " - " + (locale.equals("es") ? i.getProces().getTitolCas() : i.getProces().getTitolVal()) +"</a>";
+	}
+
+	public BigInteger getIdInstancia() {
+		return this.idInstancia;
+	}
+
+	public void setIdInstancia(BigInteger idInstancia) {
+		this.idInstancia = idInstancia;
+	}
+
+	public Integer getCentre() {
+		return this.centre;
+	}
+
+	public void setCentre(Integer centre) {
+		this.centre = centre;
+	}
+
+	public String getEstat() {
+		return this.estat;
+	}
+
+	public void setEstat(String estat) {
+		this.estat = estat;
+	}
+
+	public Integer getTitulacio() {
+		return this.titulacio;
+	}
+
+	public void setTitulacio(Integer titulacio) {
+		this.titulacio = titulacio;
+	}
+
+	public String getTlugar() {
+		return tlugar;
+	}
+
+	public void setTlugar(String tlugar) {
+		this.tlugar = tlugar;
+	}
+
+	public Integer getLugar() {
+		return lugar;
+	}
+
+	public void setLugar(Integer lugar) {
+		this.lugar = lugar;
+	}
+
+	public String getNomProces() {
+		return nomProces;
+	}
+
+	public void setNomProces(String nomProces) {
+		this.nomProces = nomProces;
+	}
+
+	public String getDescVal() {
+		return descVal;
+	}
+
+	public void setDescVal(String descVal) {
+		this.descVal = descVal;
+	}
+
+	public String getDescCas() {
+		return descCas;
+	}
+
+	public void setDescCas(String descCas) {
+		this.descCas = descCas;
+	}
+
+	public String getAmbit() {
+		return ambit;
+	}
+
+	public void setAmbit(String ambit) {
+		this.ambit = ambit;
+	}
+
+	public String getText() {
+		return text;
+	}
+
+	public void setText(String text) {
+		this.text = text;
+	}
+	
+	public BigInteger getIdInstanciaTasca() {
+		return idInstanciaTasca;
+	}
+
+	public void setIdInstanciaTasca(BigInteger idInstanciaTasca) {
+		this.idInstanciaTasca = idInstanciaTasca;
+	}
+	
+	
+
+
+}

+ 33 - 0
src/main/java/es/uv/saic/domain/TreeDTOOrgan.java

@@ -0,0 +1,33 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import java.util.List; 
+
+public class TreeDTOOrgan implements Serializable  {
+	private static final long serialVersionUID = 1L;
+	
+	private String text;
+	private List<TreeDTOInstancia> children;
+	
+	public TreeDTOOrgan() {}
+	
+	public TreeDTOOrgan(String text, List<TreeDTOInstancia> children) {
+		this.text = text;
+		this.children = children;
+	}
+	
+	public String getText() {
+		return text;
+	}
+	public void setText(String text) {
+		this.text = text;
+	}
+	public List<TreeDTOInstancia> getChildren() {
+		return children;
+	}
+	public void setChildren(List<TreeDTOInstancia> children) {
+		this.children = children;
+	}
+
+	
+}

+ 210 - 0
src/main/java/es/uv/saic/domain/Usuari.java

@@ -0,0 +1,210 @@
+package es.uv.saic.domain;
+
+import java.io.Serializable;
+import jakarta.persistence.*;
+
+import java.util.Date;
+import java.util.List;
+
+
+/**
+ * The persistent class for the usuaris database table.
+ * 
+ */
+@Entity
+@Table(name="usuaris")
+@NamedQuery(name="Usuari.findAll", query="SELECT u FROM Usuari u")
+public class Usuari implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	private String usuari;
+
+	private String clau;
+
+	private String cognoms;
+
+	private String email;
+
+	private Boolean ldap;
+
+	private String nom;
+	
+	@Temporal(TemporalType.TIMESTAMP)
+	@Column(name="data_ultim")
+	private Date dataUltim;
+	
+	private String locale;
+
+	//bi-directional many-to-one association to InstanciaTasca
+	@OneToMany(mappedBy="usuari")
+	private List<InstanciaTasca> instanciesTasques;
+
+	//bi-directional many-to-one association to UsuarisRol
+	@OneToMany(mappedBy="usuari")
+	private List<UsuarisRol> rols;
+	
+	@Transient
+	private boolean isGranted;
+	
+	@Transient
+	private boolean isAdmin;
+	
+	@Transient
+	private boolean isDataTest;
+
+	public Usuari() {
+	}
+
+	public String getUsuari() {
+		return this.usuari;
+	}
+
+	public void setUsuari(String usuari) {
+		this.usuari = usuari;
+	}
+
+	public String getClau() {
+		return this.clau;
+	}
+
+	public void setClau(String clau) {
+		this.clau = clau;
+	}
+
+	public String getCognoms() {
+		return this.cognoms;
+	}
+
+	public void setCognoms(String cognoms) {
+		this.cognoms = cognoms;
+	}
+
+	public String getEmail() {
+		return this.email;
+	}
+
+	public void setEmail(String email) {
+		this.email = email;
+	}
+
+	public Boolean getLdap() {
+		return this.ldap;
+	}
+
+	public void setLdap(Boolean ldap) {
+		this.ldap = ldap;
+	}
+
+	public String getNom() {
+		return this.nom;
+	}
+
+	public void setNom(String nom) {
+		this.nom = nom;
+	}
+	
+	public Date getDataUltim() {
+		return this.dataUltim;
+	}
+
+	public void setDataUltim(Date dataUltim) {
+		this.dataUltim = dataUltim;
+	}
+	
+	public String getLocale() {
+		return this.locale;
+	}
+	
+	public void setLocale(String locale) {
+		this.locale = locale;
+	}
+
+	public List<InstanciaTasca> getInstanciesTasques() {
+		return this.instanciesTasques;
+	}
+
+	public void setInstanciesTasques(List<InstanciaTasca> instanciaTascas) {
+		this.instanciesTasques = instanciaTascas;
+	}
+
+	public InstanciaTasca addInstanciaTasca(InstanciaTasca instanciaTasca) {
+		getInstanciesTasques().add(instanciaTasca);
+		instanciaTasca.setUsuari(this);
+
+		return instanciaTasca;
+	}
+
+	public InstanciaTasca removeInstanciaTasca(InstanciaTasca instanciaTasca) {
+		getInstanciesTasques().remove(instanciaTasca);
+		instanciaTasca.setUsuari(null);
+
+		return instanciaTasca;
+	}
+
+	public List<UsuarisRol> getUsuarisRols() {
+		return this.rols;
+	}
+
+	public void setUsuariRols(List<UsuarisRol> usuarisRols) {
+		this.rols = usuarisRols;
+	}
+
+	public UsuarisRol addRol(UsuarisRol usuarisRol) {
+		getUsuarisRols().add(usuarisRol);
+		usuarisRol.setUsuari(this);
+
+		return usuarisRol;
+	}
+
+	public UsuarisRol removeRol(UsuarisRol usuarisRol) {
+		getUsuarisRols().remove(usuarisRol);
+		usuarisRol.setUsuari(null);
+
+		return usuarisRol;
+	}
+	
+	public boolean isGranted() {
+		return this.isGranted;
+	}
+
+	public void setGranted(boolean isGranted) {
+		this.isGranted = isGranted;
+	}
+	public boolean isAdmin() {
+		return this.isAdmin;
+	}
+
+	public void setAdmin(boolean isAdmin) {
+		this.isAdmin = isAdmin;
+	}
+
+	public boolean isDataTest() {
+		return isDataTest;
+	}
+
+	public void setDataTest(boolean isDataTest) {
+		this.isDataTest = isDataTest;
+	}
+	
+	public boolean equals(Object other) {
+		if (this == other) {
+			return true;
+		}
+		if (!(other instanceof Usuari)) {
+			return false;
+		}
+		Usuari castOther = (Usuari)other;
+		return 
+			this.usuari.equals(castOther.usuari);
+	}
+
+	public int hashCode() {
+		final int prime = 31;
+		int hash = 17;
+		hash = hash * prime + this.usuari.hashCode();
+		
+		return hash;
+	}
+	
+}

+ 98 - 0
src/main/java/es/uv/saic/domain/UsuariRepository.java

@@ -0,0 +1,98 @@
+package es.uv.saic.domain;
+
+
+
+import java.math.BigInteger;
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+
+@Repository
+public interface UsuariRepository extends JpaRepository<Usuari, String> {
+	
+	@Query("SELECT i FROM Usuari i WHERE i.usuari = ?1")
+	Usuari findByUsername(String usuari);
+	
+	@Query(value=("(SELECT ur.tlugar AS tLugar, ur.lugar AS lugar, id_proces AS idProces , id_instancia AS instancia, id_tascai AS instanciaTasca, id_tascap AS tascaP, ur.id_rol AS rol \n"+ 
+			"FROM usuaris_rols ur \n"+
+			"INNER JOIN tasquesi ti ON ur.tlugar=ti.tlugar AND ur.lugar=ti.lugar \n"+
+			"WHERE ur.tlugar=ti.tlugar AND ur.id_rol=ti.id_rol AND vigent \n"+ 
+			"AND estat='A' AND usuari=?1) \n"+
+			"UNION \n"+
+			"(SELECT ur.tlugar AS tLugar, ur.lugar AS lugar, id_proces AS idProces , id_instancia AS instancia, id_tascai AS instanciaTasca, id_tascap AS tascaP, ur.id_rol AS rol \n"+
+			"FROM usuaris_rols ur, organs o, tasquesi ti \n"+
+			"WHERE ti.tlugar='T' AND ti.tlugar=o.tlugar AND ti.lugar=o.lugar AND o.tlugar2=ur.tlugar AND o.lugar2=ur.lugar \n"+
+			"AND ur.id_rol=ti.id_rol \n"+
+			"AND vigent \n"+
+			"AND estat='A' AND usuari=?1)"), nativeQuery=true)
+	List<TascaAsignada> findActiveInstanciaTasques(String usuari);
+	
+	@Query(value=("SELECT DISTINCT(ins.id_instancia) FROM instancies ins, usuaris_rols usr, tasques tas, tasquesi tasi WHERE ins.estat = 'A' " + 
+			"AND ((ins.tlugar = usr.tlugar AND ins.lugar = usr.lugar) OR (ins.centre = usr.lugar AND usr.tlugar = 'C')) " +
+			"AND tasi.id_instancia = ins.id_instancia " + 
+			"AND usr.vigent AND usr.usuari = ?1 AND tasi.id_tasca = tas.id_tasca AND tasi.estat = 'A' " + 
+			"AND tas.id_proces = ins.id_proces AND tas.id_rol = usr.id_rol ORDER BY ins.id_instancia ASC"), nativeQuery=true)
+	List<BigInteger> findActiveInstancies(String usuari);
+	
+	@Query(value=("SELECT DISTINCT(ins.id_instancia) FROM instancies ins, usuaris_rols usr, tasques tas, tasquesi tasi WHERE ins.estat = 'A'\n" + 
+			"AND usr.usuari = ?1 AND tasi.id_tasca = tas.id_tasca AND tasi.estat = 'A' AND tasi.id_instancia = ins.id_instancia\n" + 
+			"AND tas.id_proces = ins.id_proces AND tas.id_rol = usr.id_rol AND usr.vigent ORDER BY ins.id_instancia ASC"), nativeQuery=true)
+	List<BigInteger> findActiveInstanciesGranted(String usuari);
+	
+	@Query(value=("SELECT id_instancia FROM instancies WHERE lugar = ?1 AND tlugar = ?2"), nativeQuery=true)
+	List<BigInteger> findSupervisableProcessos(Integer lugar, String tlugar);
+	
+	@Query(value=("SELECT id_instancia FROM instancies WHERE centre = ?1"), nativeQuery=true)
+	List<BigInteger> findSupervisableProcessosResp(Integer centre);
+	
+	@Query(value=("SELECT id_instancia FROM instancies WHERE id_proces IN(SELECT id_proces FROM processos WHERE nom_proces IN(?1))"), nativeQuery=true)
+	List<BigInteger> findSupervisableProcessosSupervisor(List<String> procs);
+	
+	@Query(value=("SELECT DISTINCT(centre) FROM (SELECT o.lugar AS centre FROM usuaris_rols u " + 
+			 "LEFT JOIN organs o ON u.tlugar = o.tlugar AND u.lugar = o.lugar " + 
+			 "WHERE o.tlugar = 'C' AND u.usuari = ?1 AND u.vigent " + 
+			 "UNION " + 
+			 "SELECT lugar2 AS centre FROM usuaris_rols u " + 
+			 "LEFT JOIN organs o ON u.tlugar = o.tlugar AND u.lugar = o.lugar " + 
+			 "WHERE o.tlugar = 'T' AND u.usuari = ?1 AND u.vigent) a"), nativeQuery=true)
+	List<Integer> findSupervisableCentres(String usuari);
+	
+	@Query(value=("SELECT DISTINCT ins.centre FROM instancies ins "
+			+ "LEFT JOIN processos pr ON pr.id_proces = ins.id_proces "
+			+ "WHERE pr.nom_proces IN(?1)"), nativeQuery=true)
+	List<Integer> findSupervisableCentresSupervisor(List<String> procs);
+	
+	@Query(value="SELECT us.* FROM usuaris us, usuaris_rols usr, tasques tas, tasquesi tasi, instancies ins "
+			+ "WHERE us.usuari = usr.usuari AND tasi.id_tasca = tas.id_tasca AND tasi.estat = 'A' "
+			+ "AND ins.lugar = usr.lugar AND ins.tlugar = usr.tlugar AND ins.id_instancia = tasi.id_instancia AND ins.id_instancia = ?1 "
+			+ "AND usr.vigent AND tas.id_rol = usr.id_rol "
+			+ "UNION "
+			+ "SELECT us.* FROM usuaris us, usuaris_rols usr, tasques tas, tasquesi tasi, instancies ins "
+			+ "WHERE us.usuari = usr.usuari AND tasi.id_tasca = tas.id_tasca AND tasi.estat = 'A' "
+			+ "AND ins.centre = usr.lugar AND ins.id_instancia = tasi.id_instancia AND ins.id_instancia = ?1 "
+			+ "AND usr.vigent AND tas.id_rol = usr.id_rol "
+			+ "UNION "
+			+ "SELECT us.* FROM usuaris us, usuaris_rols usr, tasques tas, tasquesi tasi, instancies ins "
+			+ "WHERE us.usuari = usr.usuari AND tasi.id_tasca = tas.id_tasca AND tasi.estat = 'A' "
+			+ "AND usr.lugar = 0 AND usr.tlugar = 'U' AND ins.id_instancia = tasi.id_instancia AND ins.id_instancia = ?1 "
+			+ "AND usr.vigent AND tas.id_rol = usr.id_rol ", nativeQuery=true)
+	public List<Usuari> getInstanceAsignedUsers(BigInteger idInstancia);
+	
+	@Query(value=("SELECT * FROM usuaris WHERE usuari IN(SELECT DISTINCT usuari FROM usuaris_rols WHERE id_rol = ?1 "
+			+ "AND (lugar IN(?2) OR lugar IN (SELECT lugar FROM organs WHERE tlugar = 'T' AND lugar2 IN(?2))) AND vigent)"), nativeQuery=true)
+	List<Usuari> findByRolCentre(Integer idRol, List<Integer> centres);
+	
+	public static interface TascaAsignada {
+		String getTLugar();
+		String getLugar();
+		String getIdProces();
+		String getInstancia();
+		String getInstanciaTasca();
+		String getTascaP();
+		Object getRol();
+	}
+
+}

+ 128 - 0
src/main/java/es/uv/saic/domain/UsuarisRol.java

@@ -0,0 +1,128 @@
+package es.uv.saic.domain;
+
+
+import java.io.Serializable;
+import jakarta.persistence.*;
+import java.util.Date;
+
+
+/**
+ * The persistent class for the usuaris_rols database table.
+ * 
+ */
+@Entity
+@Table(name="usuaris_rols")
+@NamedQuery(name="UsuarisRol.findAll", query="SELECT u FROM UsuarisRol u")
+public class UsuarisRol implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@Column(name="id_usuari_rol")
+	private Integer idUsuariRol;
+
+	@Temporal(TemporalType.DATE)
+	private Date fin;
+
+	@Temporal(TemporalType.DATE)
+	private Date inici;
+
+	private Integer num;
+
+	private Integer supervisor;
+
+	private Boolean vigent;
+
+	//bi-directional many-to-one association to Organ
+	@ManyToOne
+	@JoinColumns({
+		@JoinColumn(name="lugar", referencedColumnName="lugar"),
+		@JoinColumn(name="tlugar", referencedColumnName="tlugar")
+		})
+	private Organ organ;
+
+	//bi-directional many-to-one association to Rol
+	@ManyToOne
+	@JoinColumn(name="id_rol")
+	private Rol rol;
+
+	//bi-directional many-to-one association to Usuari
+	@ManyToOne
+	@JoinColumn(name="usuari")
+	private Usuari usuari;
+
+	public UsuarisRol() {
+	}
+
+	public Integer getIdUsuariRol() {
+		return this.idUsuariRol;
+	}
+
+	public void setIdUsuariRol(Integer idUsuariRol) {
+		this.idUsuariRol = idUsuariRol;
+	}
+
+	public Date getFin() {
+		return this.fin;
+	}
+
+	public void setFin(Date fin) {
+		this.fin = fin;
+	}
+
+	public Date getInici() {
+		return this.inici;
+	}
+
+	public void setInici(Date inici) {
+		this.inici = inici;
+	}
+
+	public Integer getNum() {
+		return this.num;
+	}
+
+	public void setNum(Integer num) {
+		this.num = num;
+	}
+
+	public Integer getSupervisor() {
+		return this.supervisor;
+	}
+
+	public void setSupervisor(Integer supervisor) {
+		this.supervisor = supervisor;
+	}
+
+	public Boolean getVigent() {
+		return this.vigent;
+	}
+
+	public void setVigent(Boolean vigent) {
+		this.vigent = vigent;
+	}
+
+	public Organ getOrgan() {
+		return this.organ;
+	}
+
+	public void setOrgan(Organ organ) {
+		this.organ = organ;
+	}
+
+	public Rol getRol() {
+		return this.rol;
+	}
+
+	public void setRol(Rol rol) {
+		this.rol = rol;
+	}
+
+	public Usuari getUsuari() {
+		return this.usuari;
+	}
+
+	public void setUsuari(Usuari usuariBean) {
+		this.usuari = usuariBean;
+	}
+
+}

+ 64 - 0
src/main/java/es/uv/saic/domain/UsuarisRolRepository.java

@@ -0,0 +1,64 @@
+package es.uv.saic.domain;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+
+@Repository
+public interface UsuarisRolRepository extends JpaRepository<UsuarisRol, Long> {
+
+	@Query("SELECT i FROM UsuarisRol i WHERE i.usuari = ?1")
+	List<UsuarisRol> findByUsername(String usuari);
+	
+	@Query("SELECT i FROM UsuarisRol i WHERE i.usuari = ?1 AND i.vigent = TRUE")
+	List<UsuarisRol> findByUsernameActive(Usuari usuari);
+	
+	@Query("SELECT i FROM UsuarisRol i WHERE i.usuari = ?1 AND i.vigent = TRUE AND i.rol.nomRol = ?2")
+	UsuarisRol findByUsernameActiveRol(Usuari usuari, String Rol);
+	
+	@Query("SELECT i FROM UsuarisRol i WHERE i.usuari = ?1 AND i.vigent = TRUE AND i.rol.nomRol IN(?2)")
+	UsuarisRol findByUsernameActiveRoles(Usuari usuari, ArrayList<String> Rol);
+	
+	@Query(value=("SELECT * FROM usuaris_rols WHERE usuari = ?1 AND tlugar = ?2 AND lugar = ?3 AND vigent LIMIT 1"), nativeQuery=true)
+	UsuarisRol findActiveByUsuariTlugarLugar(String usuari, String tlugar, Integer lugar);
+	
+	//@Query("SELECT i FROM UsuarisRol i WHERE i.usuari = ?1 AND i.vigent = TRUE AND i.rol.ambit = ?2 LIMIT 1")
+	@Query(value=("SELECT ur.* "
+			+ "FROM usuaris_rols ur LEFT JOIN rols r ON ur.id_rol = r.id_rol "
+			+ "WHERE ur.usuari = ?1 AND r.ambit = ?2 AND ur.vigent LIMIT 1"), nativeQuery=true)
+	UsuarisRol findByUsernameActiveAmbit(String usuari, String ambit);
+	
+	@Query(value=("SELECT nom_proces FROM processos_rols WHERE id_rol IN(SELECT id_rol FROM rols WHERE nom_rol = ?1)"), nativeQuery=true)
+	List<String> findAssociatedProcs(String rol);
+
+	@Query(value=("SELECT * FROM usuaris_rols WHERE tlugar = 'C' AND lugar = ?1 AND vigent ORDER BY id_rol ASC"), nativeQuery=true)
+	List<UsuarisRol> findManagerByCentre(Integer centre);
+	
+	@Query(value=("SELECT * FROM usuaris_rols WHERE tlugar = 'T' AND lugar = ?1 AND vigent ORDER BY lugar"), nativeQuery=true)
+	List<UsuarisRol> findManagerByTitulacio(Integer titulacio);
+	
+	@Query(value=("SELECT * FROM usuaris_rols WHERE tlugar = 'C' AND lugar IN(?1) AND vigent ORDER BY id_rol ASC"), nativeQuery=true)
+	List<UsuarisRol> findManagerByCentres(List<Integer> centre);
+	
+	@Query(value=("SELECT * FROM usuaris_rols WHERE tlugar = 'T' AND lugar IN(?1) AND vigent ORDER BY lugar"), nativeQuery=true)
+	List<UsuarisRol> findManagerByTitulacions(List<Integer> titulacio);
+	
+	@Query(value=("SELECT * FROM usuaris_rols WHERE id_rol = ?1 AND usuari = ?2 AND lugar = ?3 AND tlugar = ?4"), nativeQuery=true)
+	UsuarisRol find(Integer idRol, String usuari, Integer lugar, String tlugar);
+	
+	@Query(value=("SELECT * FROM usuaris_rols WHERE id_rol = ?1 AND usuari = ?2 AND lugar = ?3 AND tlugar = ?4 AND vigent"), nativeQuery=true)
+	UsuarisRol findActive(Integer idRol, String usuari, Integer lugar, String tlugar);
+	
+	@Query(value=("SELECT * FROM usuaris_rols WHERE id_rol = ?1 AND usuari = ?2 AND lugar = ?3 AND tlugar = ?4 ORDER BY num DESC LIMIT 1"), nativeQuery=true)
+	UsuarisRol findLast(Integer idRol, String usuari, Integer lugar, String tlugar);
+	
+	@Query(value=("SELECT num FROM usuaris_rols WHERE id_rol = ?1 AND lugar = ?2 AND tlugar = ?3 ORDER BY num DESC LIMIT 1"), nativeQuery=true)
+	Integer findLastNum(Integer idRol, Integer lugar, String tlugar);
+	
+	
+}

+ 63 - 0
src/main/java/es/uv/saic/domain/Wiki.java

@@ -0,0 +1,63 @@
+package es.uv.saic.domain;
+
+import java.util.Date;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.NamedQuery;
+import jakarta.persistence.Table;
+
+@Entity
+@Table(name="wiki")
+@NamedQuery(name="Wiki.findAll", query="SELECT i FROM Wiki i")
+public class Wiki {
+	
+	@Id
+	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	@Column(name="id_wiki")
+	private Integer idWiki;
+	private Date data;
+	@Column(name="data_mod")
+	private Date dataMod;
+	private String text;
+	private String categoria;
+	
+	public Wiki() {}
+	
+	public Integer getIdWiki() {
+		return idWiki;
+	}
+	public void setIdWiki(Integer idWiki) {
+		this.idWiki = idWiki;
+	}
+	public Date getData() {
+		return data;
+	}
+	public void setData(Date data) {
+		this.data = data;
+	}
+	public Date getDataMod() {
+		return dataMod;
+	}
+	public void setDataMod(Date dataMod) {
+		this.dataMod = dataMod;
+	}
+	public String getText() {
+		return text;
+	}
+	public void setText(String text) {
+		this.text = text;
+	}
+	public String getCategoria() {
+		return categoria;
+	}
+	public void setCategoria(String categoria) {
+		this.categoria = categoria;
+	}
+	
+	
+	
+}

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません