Compare commits
42 Commits
docker
...
revert-4ae
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cec37b8edd | ||
|
|
ed1938f44a | ||
|
|
4aeec0c31b | ||
|
|
917e128d7e | ||
|
|
a65e7fb885 | ||
|
|
18f2524412 | ||
|
|
26c3ec6a33 | ||
|
|
b75199840e | ||
|
|
a8dd4f2674 | ||
|
|
06388f9449 | ||
|
|
f62f4df779 | ||
|
|
14f4ac42ac | ||
|
|
aee0f9deaf | ||
|
|
6a413357e5 | ||
|
|
45c9de6546 | ||
|
|
03f34d4a83 | ||
|
|
b6d68df139 | ||
|
|
b815680649 | ||
|
|
992fc3e25a | ||
|
|
ed78633291 | ||
|
|
c8a3f1e933 | ||
|
|
02ea97195f | ||
|
|
ebc33396c7 | ||
|
|
2dc7c9b8b7 | ||
|
|
83e3fb9867 | ||
|
|
a83b273955 | ||
|
|
310aae76ef | ||
|
|
06114b7e2f | ||
|
|
952417c6ce | ||
|
|
1dff9b09e8 | ||
|
|
aeb1d300a4 | ||
|
|
66a00616e5 | ||
|
|
318680d5c0 | ||
|
|
8482b660c1 | ||
|
|
e789cb57d2 | ||
|
|
ffe56f3c68 | ||
|
|
b2e55231ea | ||
|
|
1e3886cc54 | ||
|
|
492ddad057 | ||
|
|
7891777ecf | ||
|
|
01f0f5627f | ||
|
|
25a4896426 |
@@ -14,7 +14,7 @@ ci_build:
|
||||
script:
|
||||
- cd 1.sources/MyHealth
|
||||
- ant clean
|
||||
- ant all
|
||||
- ant ear
|
||||
|
||||
ci_test:
|
||||
stage: test
|
||||
@@ -25,10 +25,13 @@ ci_test:
|
||||
deploy_pre:
|
||||
stage: deploy
|
||||
script:
|
||||
- echo "Eliminamos archivo ear anterior..."
|
||||
- rm -f $JBOSS_HOME/standalone/deployments/MyHealth.*
|
||||
- echo "Despliegue al servidor de PRE"
|
||||
- cd 1.sources/MyHealth
|
||||
- ant deployear
|
||||
|
||||
|
||||
environment:
|
||||
name: pre
|
||||
url: https://localhost:8080/MyHealth
|
||||
@@ -38,6 +41,8 @@ deploy_pre:
|
||||
deploy_pro:
|
||||
stage: deploy
|
||||
script:
|
||||
- echo "Eliminamos archivo ear anterior..."
|
||||
- rm -f $JBOSS_HOME/standalone/deployments/MyHealth.*
|
||||
- echo "Despliegue al servidor de PRO"
|
||||
- cd 1.sources/MyHealth
|
||||
- ant deployear
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
||||
@@ -49,8 +49,17 @@
|
||||
<target name="compileEjb" depends="init">
|
||||
<copy file="${sourcesrc}/META-INF/persistence.xml" todir="${buildjar}/META-INF" />
|
||||
<copy file="${sourcesrc}/log4j.properties" todir="${buildjar}" />
|
||||
<javac encoding="${java.encoding}" srcdir="${sourcesrc}" destdir="${buildjar}" includes="ejb/**/*.java, jpa/**/*.java, TO/**/*.java, common/**/*.java" classpathref="jboss.classpath"
|
||||
includeantruntime="true" />
|
||||
<javac encoding="${java.encoding}" srcdir="${sourcesrc}" destdir="${buildjar}" includeantruntime="true" source="1.8" target="1.8">
|
||||
<classpath>
|
||||
<path refid="jboss.classpath" />
|
||||
</classpath>
|
||||
<include name="ejb/**/*.java" />
|
||||
<include name="jpa/**/*.java" />
|
||||
<include name="TO/**/*.java" />
|
||||
<include name="common/**/*.java" />
|
||||
<exclude name="managedbean/**/*.java" />
|
||||
</javac>
|
||||
<delete verbose="true" dir="${buildjar}/managedbean" />
|
||||
</target>
|
||||
|
||||
<!-- Update the EJB jar file and create if not exist -->
|
||||
@@ -63,11 +72,16 @@
|
||||
<copy todir="${buildwar}">
|
||||
<fileset dir="${docroot}" />
|
||||
</copy>
|
||||
<javac encoding="${java.encoding}" srcdir="${sourcesrc}" destdir="${buildwar}/WEB-INF/classes" includes="managedbean/**/*.java" includeantruntime="true">
|
||||
<javac encoding="${java.encoding}" srcdir="${sourcesrc}" destdir="${buildwar}/WEB-INF/classes" includeantruntime="true" source="1.8" target="1.8">
|
||||
<classpath>
|
||||
<path refid="jboss.classpath" />
|
||||
<path refid="lib.dir" />
|
||||
</classpath>
|
||||
<include name="managedbean/**/*.java" />
|
||||
<exclude name="ejb/**/*.java" />
|
||||
<exclude name="jpa/**/*.java" />
|
||||
<exclude name="TO/**/*.java" />
|
||||
<exclude name="common/**/*.java" />
|
||||
</javac>
|
||||
<delete verbose="true" dir="${buildwar}/WEB-INF/classes/ejb" />
|
||||
<delete verbose="true" dir="${buildwar}/WEB-INF/classes/jpa" />
|
||||
|
||||
@@ -2,4 +2,7 @@
|
||||
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd" version="2.3">
|
||||
|
||||
<factory>
|
||||
<exception-handler-factory>org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory</exception-handler-factory>
|
||||
</factory>
|
||||
</faces-config>
|
||||
|
||||
@@ -18,7 +18,10 @@
|
||||
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
|
||||
<context-param>
|
||||
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
|
||||
<param-value>client</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
|
||||
<param-value>.xhtml</param-value>
|
||||
@@ -27,8 +30,6 @@
|
||||
<param-name>primefaces.FONT_AWESOME</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
|
||||
|
||||
<context-param>
|
||||
<param-name>primefaces.THEME</param-name>
|
||||
<param-value>#{sessionPreferences.currentTheme}</param-value>
|
||||
@@ -42,36 +43,59 @@
|
||||
</servlet>
|
||||
|
||||
<!-- Map these files with JSF -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>Faces Servlet</servlet-name>
|
||||
<url-pattern>/faces/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>Faces Servlet</servlet-name>
|
||||
<url-pattern>*.jsf</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>Faces Servlet</servlet-name>
|
||||
<url-pattern>*.faces</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>Faces Servlet</servlet-name>
|
||||
<url-pattern>*.xhtml</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- Filters -->
|
||||
<filter>
|
||||
<filter-name>facesExceptionFilter</filter-name>
|
||||
<filter-class>org.omnifaces.filter.FacesExceptionFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<!-- Filter mappings -->
|
||||
<filter-mapping>
|
||||
<filter-name>facesExceptionFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<!-- Error pages mapping -->
|
||||
<error-page>
|
||||
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
|
||||
<location>/error.xhtml?type=expired</location>
|
||||
</error-page>
|
||||
<error-page>
|
||||
<exception-type>java.sql.SQLException</exception-type>
|
||||
<exception-type>org.hibernate.exception.GenericJDBCException</exception-type>
|
||||
<exception-type>java.net.ConnectException</exception-type>
|
||||
<exception-type>javax.persistence.PersistenceException</exception-type>
|
||||
<location>/error.xhtml?type=sql</location>
|
||||
</error-page>
|
||||
<error-page>
|
||||
<exception-type>javax.persistence.PersistenceException</exception-type>
|
||||
<location>/error.xhtml?type=runtime</location>
|
||||
</error-page>
|
||||
<error-page>
|
||||
<exception-type>java.net.ConnectException</exception-type>
|
||||
<location>/error.xhtml?type=sql</location>
|
||||
</error-page>
|
||||
<error-page>
|
||||
<error-code>500</error-code>
|
||||
<location>/error.xhtml</location>
|
||||
</error-page>
|
||||
<error-page>
|
||||
<error-code>401</error-code>
|
||||
<location>/error.xhtml?type=expired</location>
|
||||
</error-page>
|
||||
|
||||
<session-config>
|
||||
<session-timeout>30</session-timeout>
|
||||
|
||||
</session-config>
|
||||
|
||||
<!-- The Welcome File List -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>home.xhtml</welcome-file>
|
||||
<welcome-file>/home.xhtml</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
</web-app>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:p="http://primefaces.org/ui">
|
||||
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
|
||||
|
||||
<ui:composition template="./header.xhtml">
|
||||
<ui:define name="content">
|
||||
@@ -12,16 +12,23 @@
|
||||
<div class="ui-g-8 ui-md-8">
|
||||
<p:panel id="ErrorPanel">
|
||||
<f:facet name="header">
|
||||
<p:outputLabel value="Se ha producido un error de autorización" rendered="#{param.type == 'auth'}" />
|
||||
<p:outputLabel value="Se ha producido un error desconocido" rendered="#{param.type == null}" />
|
||||
<p:outputLabel rendered="#{param.type == 'sql'}" value="No se puede conectar con la base de datos" />
|
||||
<p:outputLabel rendered="#{param.type == 'auth'}" value="Se ha producido un error de autorización" />
|
||||
<p:outputLabel rendered="#{param.type == 'expired'}" value="Su sesión ha caducado" />
|
||||
<p:outputLabel rendered="#{param.type == 'runtime'}" value="Se producido un error en tiempo de ejecución" />
|
||||
<p:outputLabel rendered="#{param.type == '' or param.type == null}" value="Se ha producido un error desconocido" />
|
||||
</f:facet>
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-12">La acción que estaba realizando a causado un error inesperado en el sistema. A continuación podrá ver un descripción detallada del error para que
|
||||
pueda comunicarlo al equipo de soporte.</div>
|
||||
|
||||
<div class="ui-g-12" style="font-weight: bold;">
|
||||
<!-- <p:outputLabel value="No está autorizado a acceder a la página solicitada. Por favor, utilice el menú principal de la aplicación." rendered="#{param.type == 'auth'}" /> -->
|
||||
<!-- <p:outputLabel value="Se ha producido un error desconocido. Si vuelve a repetirse, por favor, contacte con el equipo de soporte." rendered="#{param.type == null}" /> -->
|
||||
<div class="ui-g-12">
|
||||
<p:outputLabel rendered="#{param.type == 'sql'}"
|
||||
value="No ha sido posible realizar una conexión con el servidor de base de datos subyante, o ha ocurrido un error grave cuando se intentaba realizar la conexión. Por favor contacte con el equipo de soporte." />
|
||||
<p:outputLabel rendered="#{param.type == 'auth'}"
|
||||
value="No está autorizado a ver la url consultada. Por favor, vaya a la página principal y utilice el menú de la aplicación para acceder las funcionalidades disponibles." />
|
||||
<p:outputLabel rendered="#{param.type == 'expired'}" value="Su sesión ha caducado. Por favor, incie sesión de nuevo en el sistema." />
|
||||
<p:outputLabel rendered="#{param.type == 'runtime'}"
|
||||
value="Se ha producido un error en el servidor durante la ejecución de la última acción. Por favor, intentelo de nuevo o contacte con el equipo de soporte." />
|
||||
<p:outputLabel rendered="#{param.type == '' or param.type == null}"
|
||||
value="La acción que estaba realizando a causado un error inesperado en el sistema. A continuación podrá ver un descripción detallada del error para que pueda comunicarlo al equipo de soporte." />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-12">
|
||||
|
||||
@@ -2,45 +2,35 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:p="http://primefaces.org/ui">
|
||||
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
|
||||
|
||||
<h:head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>MyHealth Online Services</title>
|
||||
<h:outputStylesheet name="primeicons/primeicons.css" library="primefaces" />
|
||||
<h:outputStylesheet library="css" name="estilos.css" />
|
||||
<h:outputScript library="js" name="common.js" />
|
||||
</h:head>
|
||||
<h:outputScript>
|
||||
function handleLoginRequest(xhr, status, args) {
|
||||
if(args.validationFailed || !args.loggedIn) {
|
||||
PF('dlgLogin').jq.effect("shake", {times:5}, 100);
|
||||
PF('btnLogin').enable();
|
||||
}
|
||||
else {
|
||||
PF('btnLogin').enable();
|
||||
PF('dlgLogin').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function startLogin() {
|
||||
PF('btnLogin').disable();
|
||||
// Si hay un error AJAX, lo más probable es que la sesión expirase, vamos a la página de error
|
||||
function onAjaxError() {
|
||||
window.location.href = "#{request.contextPath}/error.xhtml?type=expired";
|
||||
}
|
||||
</h:outputScript>
|
||||
<h:body>
|
||||
<p:growl id="messages" globalOnly="true" sticky="false" showDetail="true" life="15000" />
|
||||
<div id="layout">
|
||||
<div id="top" class="top">
|
||||
<p:growl id="messages" globalOnly="true" sticky="false" showDetail="true" life="15000" />
|
||||
<h:graphicImage library="images" name="logo-small.png" />
|
||||
</div>
|
||||
<hr />
|
||||
<div id="menuDiv">
|
||||
<p:ajaxStatus style="width:32px; height:32px; position:fixed; right:32px; bottom:32px">
|
||||
<div id="menuDiv" style="margin-bottom: 10px;">
|
||||
<p:ajaxStatus style="width:32px; height:32px; position:fixed; right:32px; bottom:32px" onerror="onAjaxError()">
|
||||
<f:facet name="start">
|
||||
<i id="loginSpin" class="pi pi-spin pi-spinner" style="font-size: 3em"></i>
|
||||
<i id="loginSpin" class="pi pi-spin pi-spinner" style="font-size: 3em" />
|
||||
</f:facet>
|
||||
|
||||
<f:facet name="complete">
|
||||
<h:outputText value="" />
|
||||
<f:facet name="error">
|
||||
<i class="pi pi-exclamation-triangle" style="font-size: 3em" />
|
||||
</f:facet>
|
||||
</p:ajaxStatus>
|
||||
|
||||
|
||||
@@ -2,34 +2,27 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:p="http://primefaces.org/ui">
|
||||
<f:metadata>
|
||||
<f:viewParam name="refresh" value="#{home.refresh}" />
|
||||
</f:metadata>
|
||||
|
||||
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
|
||||
<ui:composition template="./header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form>
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel header="Pagina principal">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel for="selectorTema" value="Cambio de tema" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<div class="ui-g-3 ui-md-3">
|
||||
<p:themeSwitcher id="selectorTema" style="width:300px" value="#{sessionPreferences.currentTheme}">
|
||||
<f:selectItem itemLabel="Seleccione un tema" itemValue="" noSelectionOption="true" />
|
||||
<f:selectItems value="#{home.themes}" var="theme" itemLabel="#{theme.displayName}" itemValue="#{theme.name}" />
|
||||
<p:ajax listener="#{sessionPreferences.updateCurrentTheme}" />
|
||||
</p:themeSwitcher>
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-1" />
|
||||
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
<div class="ui-g-4 ui-md-4 ">
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:commandButton value="Usar tema en este sesión" update="mesgs" action="#{sessionPreferences.updateCurrentTheme}" icon="pi pi-save" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
<div class="ui-g-5 ui-md-5" />
|
||||
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<div class="ui-inputgroup">
|
||||
|
||||
@@ -2,24 +2,7 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:p="http://primefaces.org/ui">
|
||||
|
||||
<h:head>
|
||||
<title>login</title>
|
||||
</h:head>
|
||||
<h:outputScript>
|
||||
<script type="text/javascript">
|
||||
function handleLoginRequest(xhr, status, args) {
|
||||
if(args.validationFailed || !args.loggedIn) {
|
||||
PF('dlg').jq.effect("shake", {times:5}, 100);
|
||||
}
|
||||
else {
|
||||
PF('dlg').hide();
|
||||
$('#loginLink').fadeOut();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</h:outputScript>
|
||||
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
|
||||
<ui:composition template="./header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<div class="ui-g-12 ui-g-nopad">
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
<div class="ui-g-2 ui-md-2 ">
|
||||
<p:commandButton validateClient="true" value="Guardar" update="TestForm" action="#{BeanName.actionMethod}" icon="pi pi-check" />
|
||||
<p:commandButton validateClient="true" value="Guardar" update="TestForm" action="#{PendingQuestions.saveData}" icon="pi pi-check" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
<h:form>
|
||||
<p:growl id="messages" />
|
||||
|
||||
<p:menubar>
|
||||
<p:submenu label="File" icon="pi pi-file">
|
||||
<p:submenu label="New" icon="pi pi-briefcase">
|
||||
<p:menuitem value="Project" url="#" />
|
||||
<p:menuitem value="Other" url="#" />
|
||||
</p:submenu>
|
||||
<p:menuitem value="Open" url="#" />
|
||||
<p:separator />
|
||||
<p:menuitem value="Quit" url="#" />
|
||||
</p:submenu>
|
||||
|
||||
<p:submenu label="Edit" icon="pi pi-pencil">
|
||||
<p:menuitem value="Undo" url="#" icon="pi pi-angle-double-left" />
|
||||
<p:menuitem value="Redo" url="#" icon="pi pi-angle-double-right" />
|
||||
</p:submenu>
|
||||
|
||||
<p:submenu label="Help" icon="pi pi-question">
|
||||
<p:menuitem value="Contents" url="#" />
|
||||
<p:submenu label="Search" icon="pi pi-search">
|
||||
<p:submenu label="Text">
|
||||
<p:menuitem value="Workspace" url="#" />
|
||||
</p:submenu>
|
||||
<p:menuitem value="File" url="#" />
|
||||
</p:submenu>
|
||||
</p:submenu>
|
||||
|
||||
<p:submenu label="Actions" icon="pi pi-cog">
|
||||
<p:submenu label="Ajax" icon="pi pi-refresh">
|
||||
<p:menuitem value="Save" action="#{menuView.save}" icon="pi pi-save"
|
||||
update="messages" />
|
||||
<p:menuitem value="Update" action="#{menuView.update}"
|
||||
icon="pi pi-refresh" update="messages" />
|
||||
</p:submenu>
|
||||
<p:submenu label="Non-Ajax" icon="pi pi-clone">
|
||||
<p:menuitem value="Delete" action="#{menuView.delete}"
|
||||
icon="pi pi-times" update="messages" ajax="false" />
|
||||
</p:submenu>
|
||||
</p:submenu>
|
||||
|
||||
<p:menuitem value="Quit" url="http://www.primefaces.org"
|
||||
icon="pi pi-times" />
|
||||
|
||||
<f:facet name="options">
|
||||
<p:inputText style="margin:1px 10px 1px 1px;" placeholder="Search" />
|
||||
<p:commandButton type="button" value="Logout" icon="pi pi-home" />
|
||||
</f:facet>
|
||||
</p:menubar>
|
||||
</h:form>
|
||||
@@ -7,7 +7,7 @@
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="frmChangeFD">
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="badProfile" rendered="#{not home.patient}">
|
||||
<div class="ui-g-3 ui-md-3" />
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
@@ -31,18 +31,18 @@
|
||||
<p:panel id="PanelPHC" header="Cambiar médico de familia asignado" rendered="#{home.patient}">
|
||||
<div class="ui-g ui-fluid">
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel value="Médico de familia actualmente asignado:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<div class="ui-g-4">
|
||||
<p:outputLabel id="lblCurrentCenter" style="font-weight: bold;" value="#{ChangeFD.currentFamilyDoctor.displayName}" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
<div class="ui-g-6" />
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel value="Nuevo médico de familia:" for="newFamilyDocAC" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<div class="ui-g-4">
|
||||
<p:autoComplete id="newFamilyDocAC" dropdown="true" required="true" value="#{ChangeFD.newFamilyDoctor}" completeMethod="#{ChangeFD.completeFamilyDoctor}" var="fd"
|
||||
itemLabel="#{fd.displayName}" itemValue="#{fd}" forceSelection="true" requiredMessage="Por favor, selecciona un médico de familia"
|
||||
placeholder="Seleccione su nuevo médico de familia o teclee para buscar...">
|
||||
@@ -58,7 +58,7 @@
|
||||
</p:column>
|
||||
</p:autoComplete>
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<div class="ui-g-6">
|
||||
<p:message for="newFamilyDocAC" />
|
||||
</div>
|
||||
|
||||
@@ -73,7 +73,6 @@
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="frmChangePHCC">
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="badProfile" rendered="#{not home.familyDoctor}">
|
||||
<div class="ui-g-3 ui-md-3" />
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
@@ -31,18 +31,18 @@
|
||||
<p:panel id="PanelPHC" header="Cambiar centro de antención primaria asignado" rendered="#{home.familyDoctor}">
|
||||
<div class="ui-g ui-fluid">
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel value="Centro de antención primaria actualmente asignado:" />
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel value="Centro de antención primaria actual:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<div class="ui-g-4">
|
||||
<p:outputLabel id="lblCurrentCenter" style="font-weight: bold;" value="#{ChangeCAP.currentCenter.displayName}" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
<div class="ui-g-6" />
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel value="Nuevo centro de atención primaria:" for="newCenter" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<div class="ui-g-4">
|
||||
<p:autoComplete id="newCenter" dropdown="true" required="true" value="#{ChangeCAP.newCenter}" completeMethod="#{ChangeCAP.completePrimaryHealCareCenter}" var="phc"
|
||||
itemLabel="#{phc.displayName}" itemValue="#{phc}" forceSelection="true" requiredMessage="Por favor, selecciona un nuevo centro de antención primaria"
|
||||
placeholder="Seleccione una CAP o teclee para buscar...">
|
||||
@@ -55,7 +55,7 @@
|
||||
</p:column>
|
||||
</p:autoComplete>
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<div class="ui-g-6">
|
||||
<p:message for="newCenter" />
|
||||
</div>
|
||||
|
||||
|
||||
@@ -44,26 +44,7 @@
|
||||
</h:form>
|
||||
|
||||
<h:form id="frmRegisterUser" rendered="#{not RegisterUser.registered}">
|
||||
<h:outputScript>
|
||||
function handleRequest(xhr, status, args) {
|
||||
var nif = PF('nifButton');
|
||||
if ( args.NIFisDupe == false ) {
|
||||
nif.jq.children(".ui-icon").removeClass("pi pi-times");
|
||||
nif.jq.removeClass('red-button');
|
||||
|
||||
nif.jq.children(".ui-icon").addClass("pi pi-check");
|
||||
nif.jq.addClass('green-button');
|
||||
}
|
||||
else if (nif.jq.hasClass('red-button') == false) {
|
||||
nif.jq.children(".ui-icon").removeClass("pi pi-check");
|
||||
nif.jq.removeClass('green-button');
|
||||
|
||||
nif.jq.children(".ui-icon").addClass("pi pi-times");
|
||||
nif.jq.addClass('red-button');
|
||||
}
|
||||
}
|
||||
</h:outputScript>
|
||||
<p:messages id="mesgs" globalOnly="true" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:growl id="mesgs" globalOnly="true" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="tipoUsuario" header="Especifique el tipo de usuario que desea registrarse">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
@@ -86,7 +67,7 @@
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<div class="ui-inputgroup">
|
||||
<p:inputText id="nif" value="#{RegisterUser.nif}" validator="nifValidator" maxlength="20" required="true" requiredMessage="Por favor, indque su NIF">
|
||||
<p:ajax event="blur" update="nifmsg" listener="#{RegisterUser.hadleNIFValueChange}" oncomplete="handleRequest(xhr, status, args)" />
|
||||
<p:ajax event="blur" update="nifmsg" listener="#{RegisterUser.hadleNIFValueChange}" oncomplete="handleNIFResponse(xhr, status, args)" />
|
||||
</p:inputText>
|
||||
<p:commandButton widgetVar="nifButton" icon="pi pi-times" styleClass="red-button" />
|
||||
</div>
|
||||
|
||||
@@ -7,26 +7,7 @@
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="frmUpdateProfile">
|
||||
<h:outputScript>
|
||||
function handleRequest(xhr, status, args) {
|
||||
var nif = PF('nifButton');
|
||||
if ( args.NIFisDupe == false ) {
|
||||
nif.jq.children(".ui-icon").removeClass("pi pi-times");
|
||||
nif.jq.removeClass('red-button');
|
||||
|
||||
nif.jq.children(".ui-icon").addClass("pi pi-check");
|
||||
nif.jq.addClass('green-button');
|
||||
}
|
||||
else if (nif.jq.hasClass('red-button') == false) {
|
||||
nif.jq.children(".ui-icon").removeClass("pi pi-check");
|
||||
nif.jq.removeClass('green-button');
|
||||
|
||||
nif.jq.children(".ui-icon").addClass("pi pi-times");
|
||||
nif.jq.addClass('red-button');
|
||||
}
|
||||
}
|
||||
</h:outputScript>
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
|
||||
<p:panel id="tipoUsuario" header="Tipo de usuario registrado">
|
||||
<div class="ui-g ui-fluid">
|
||||
@@ -61,7 +42,7 @@
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<div class="ui-inputgroup">
|
||||
<p:inputText id="nif" value="#{UpdateProfile.nif}" validator="nifValidator" maxlength="20" required="true" requiredMessage="Por favor, indque su NIF">
|
||||
<p:ajax event="blur" update="nifmsg" listener="#{UpdateProfile.hadleNIFValueChange}" oncomplete="handleRequest(xhr, status, args)" />
|
||||
<p:ajax event="blur" update="nifmsg" listener="#{UpdateProfile.hadleNIFValueChange}" oncomplete="handleNIFResponse(xhr, status, args)" />
|
||||
</p:inputText>
|
||||
<p:commandButton widgetVar="nifButton" icon="pi pi-check" styleClass="green-button" />
|
||||
</div>
|
||||
@@ -138,7 +119,7 @@
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:autoComplete id="selPHC" dropdown="true" value="#{UpdateProfile.primaryHealthCareCenter}" completeMethod="#{UpdateProfile.completePrimaryHealCareCenter}" var="phc"
|
||||
itemLabel="#{phc.displayName}" itemValue="#{phc}" forceSelection="true" requiredMessage="Por favor, selecciona un nuevo centro de antención primaria">
|
||||
itemLabel="#{phc.displayName}" itemValue="#{phc}" forceSelection="true" required="true" requiredMessage="Por favor, selecciona un nuevo centro de antención primaria">
|
||||
<o:converter converterId="omnifaces.ListConverter" list="#{UpdateProfile.phcList}" />
|
||||
<p:column headerText="Nombre">
|
||||
<h:outputText value="#{phc.name}" />
|
||||
@@ -159,7 +140,7 @@
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:autoComplete id="selMS" dropdown="true" value="#{UpdateProfile.medicalSpecialty}" completeMethod="#{UpdateProfile.completeMedicalSpecialty}" var="ms"
|
||||
itemLabel="#{ms.displayName}" itemValue="#{ms}" forceSelection="true" requiredMessage="Por favor, selecciona una especialidad médica">
|
||||
itemLabel="#{ms.displayName}" itemValue="#{ms}" forceSelection="true" required="true" requiredMessage="Por favor, selecciona una especialidad médica">
|
||||
<o:converter converterId="omnifaces.ListConverter" list="#{UpdateProfile.medicalSpecialtiesList}" />
|
||||
<p:column headerText="Nombre">
|
||||
<h:outputText value="#{ms.name}" />
|
||||
|
||||
@@ -11,6 +11,11 @@ BODY {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
ul.ui-menu-list {
|
||||
white-space: nowrap;
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
.green-button.ui-button.ui-state-default {
|
||||
background-color: #5cb85c;
|
||||
border-color: #5cb85c;
|
||||
|
||||
41
1.sources/MyHealth/docroot/resources/js/common.js
Normal file
41
1.sources/MyHealth/docroot/resources/js/common.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Funciones comunes JavaScript para el proyecto MyHealth
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
// Gestiona la ventana de login
|
||||
function handleLoginRequest(xhr, status, args) {
|
||||
if (args.validationFailed || !args.loggedIn) {
|
||||
PF('dlgLogin').jq.effect("shake", {
|
||||
times : 5
|
||||
}, 100);
|
||||
PF('btnLogin').enable();
|
||||
} else {
|
||||
PF('btnLogin').enable();
|
||||
PF('dlgLogin').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// Tras empezar la petición AJAX de login desabilita el botón para evitar doble login
|
||||
function startLogin() {
|
||||
PF('btnLogin').disable();
|
||||
}
|
||||
|
||||
// Valida si un NIF está duplicado.
|
||||
function handleNIFResponse(xhr, status, args) {
|
||||
var nif = PF('nifButton');
|
||||
if (args.NIFisDupe == false) {
|
||||
nif.jq.children(".ui-icon").removeClass("pi pi-times");
|
||||
nif.jq.removeClass('red-button');
|
||||
|
||||
nif.jq.children(".ui-icon").addClass("pi pi-check");
|
||||
nif.jq.addClass('green-button');
|
||||
} else if (nif.jq.hasClass('red-button') == false) {
|
||||
nif.jq.children(".ui-icon").removeClass("pi pi-check");
|
||||
nif.jq.removeClass('green-button');
|
||||
|
||||
nif.jq.children(".ui-icon").addClass("pi pi-times");
|
||||
nif.jq.addClass('red-button');
|
||||
}
|
||||
}
|
||||
@@ -7,21 +7,32 @@
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="frmManageSpecialties">
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="PanelMS" header="Página Gestión de Especialidades">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:autoComplete id="specialty" dropdown="true" required="true"
|
||||
value="#{SystemAdmin.medicalSpecialty}" completeMethod="#{SystemAdmin.completeMedicalSpecialty}" var="ms"
|
||||
placeholder="----- Selecciona una especialidad -----" itemLabel="#{ms.name}" itemValue="#{ms.name}" forceSelection="true">
|
||||
<o:converter converterId="omnifaces.ListConverter" list="#{RegisterUser.medicalSpecialtiesList}" />
|
||||
<p:column>
|
||||
<h:outputText value="#{ms.name}" />
|
||||
</p:column>
|
||||
</p:autoComplete>
|
||||
<p:outputLabel for="ms"/>
|
||||
<p:selectOneMenu id="ms" value="#{ManageSpecialities.medicalSpecialty}" converter="omnifaces.SelectItemsIndexConverter"
|
||||
effect="fold" editable="true" filter="true" filterMatchMode="startsWith"
|
||||
placeholder="- Selecciona una especialidad -">
|
||||
<f:selectItems value="#{ManageSpecialities.medicalSpecialtiesList}" var="ms" itemValue="#{ms}" itemLabel="#{ms.name}" />
|
||||
<f:ajax render="name description" />
|
||||
</p:selectOneMenu>
|
||||
</div>
|
||||
<div class="ui-g-1 ui-md-1" >
|
||||
<p:outputLabel value="Editar nombre" for="name"/>
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:inputText id="name" value="#{ManageSpecialities.medicalSpecialty.name}" readonly="false" required="true" requiredMessage="Es necesario un nombre" />
|
||||
</div>
|
||||
<div class="ui-g-1 ui-md-1">
|
||||
<p:outputLabel value="Editar descripción" for="description" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="specialty" />
|
||||
<p:inputText id="description" value="#{ManageSpecialities.medicalSpecialty.description}" readonly="false" required="true" requiredMessage="Es necesaria una descripción" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2 ">
|
||||
<p:commandButton validateClient="true" value="Guardar" update="mesgs" action="#{ManageSpecialities.saveData}" icon="pi pi-check" />
|
||||
</div>
|
||||
</div>
|
||||
</p:panel>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<application>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6">
|
||||
<application-name>MyHealth</application-name>
|
||||
<display-name>MyHealth</display-name>
|
||||
<module>
|
||||
<web>
|
||||
@@ -10,4 +13,3 @@
|
||||
<ejb>MyHealth.jar</ejb>
|
||||
</module>
|
||||
</application>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
*/
|
||||
@XmlRootElement(name = "medicalspeciality")
|
||||
@XmlRootElement(name = "medicalSpecialty")
|
||||
public class MedicalSpecialtyTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -4,8 +4,6 @@ import java.io.Serializable;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import jpa.FamilyDoctorJPA;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package common;
|
||||
|
||||
import java.text.Normalizer;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -16,4 +17,13 @@ public class Utils {
|
||||
// return stripAccents(input).toLowerCase();
|
||||
return input.toLowerCase();
|
||||
}
|
||||
|
||||
public static Throwable getExceptionRootCause(Throwable throwable) {
|
||||
Objects.requireNonNull(throwable);
|
||||
Throwable rootCause = throwable;
|
||||
while (rootCause.getCause() != null && rootCause.getCause() != rootCause) {
|
||||
rootCause = rootCause.getCause();
|
||||
}
|
||||
return rootCause;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package ejb.common;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Remote;
|
||||
@@ -10,9 +9,6 @@ import TO.MedicalSpecialtyTO;
|
||||
import TO.PatientTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
import TO.SpecialistDoctorTO;
|
||||
import jpa.FamilyDoctorJPA;
|
||||
import jpa.PatientJPA;
|
||||
import jpa.SpecialistDoctorJPA;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -278,8 +278,6 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
||||
* @return FamilyDoctorTO (Transfer Object del médico de familia al que se la ha cambiado el CAP).
|
||||
*/
|
||||
public FamilyDoctorTO changePrimaryHealthCareCenter(int professionalId, PrimaryHealthCareCenterTO newCenter) throws Exception {
|
||||
FamilyDoctorTO fdTO = null;
|
||||
|
||||
FamilyDoctorJPA fd = entman.find(FamilyDoctorJPA.class, professionalId);
|
||||
if (fd == null) {
|
||||
throw new Exception("No se encuentra en la base de datos ningún médico de familia con id: " + String.valueOf(professionalId));
|
||||
|
||||
@@ -7,6 +7,7 @@ import javax.persistence.PersistenceContext;
|
||||
|
||||
import TO.FamilyDoctorTO;
|
||||
import TO.LoggedUserTO;
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import TO.PatientTO;
|
||||
import TO.SpecialistDoctorTO;
|
||||
import common.Constants;
|
||||
@@ -14,6 +15,8 @@ import common.HashUtils;
|
||||
import common.UserType;
|
||||
import ejb.common.CommonFacadeLocal;
|
||||
import jpa.AdministratorJPA;
|
||||
import jpa.MedicalSpecialtyJPA;
|
||||
import jpa.PatientJPA;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -107,4 +110,20 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
|
||||
return usr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MedicalSpecialtyTO updateSpecialtyData(int id, String name, String description) throws Exception {
|
||||
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, id);
|
||||
|
||||
if (ms == null) {
|
||||
throw new Exception("No se pueden actualizar los datos de la especialidad porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(id));
|
||||
}
|
||||
|
||||
ms.setName(name);
|
||||
ms.setDescription(description);
|
||||
|
||||
entman.persist(ms);
|
||||
|
||||
return this.commonServices.getPOJOforMedicalSpecialtyJPA(ms);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import javax.ejb.Remote;
|
||||
|
||||
import TO.LoggedUserTO;
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import TO.PatientTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
|
||||
/**
|
||||
@@ -19,6 +20,7 @@ public interface SystemAdminFacadeRemote {
|
||||
* Definimos la interfaz remota
|
||||
*/
|
||||
|
||||
|
||||
public LoggedUserTO login(String id, String pwd);
|
||||
|
||||
public MedicalSpecialtyTO updateSpecialtyData(int id, String name, String description) throws Exception;
|
||||
}
|
||||
@@ -2,11 +2,9 @@
|
||||
package managedbean.common;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Dictionary;
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
@@ -18,10 +16,10 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.primefaces.model.menu.DefaultSeparator;
|
||||
import org.primefaces.model.menu.DefaultSubMenu;
|
||||
import org.omnifaces.util.Exceptions;
|
||||
|
||||
import common.UserType;
|
||||
import common.Utils;
|
||||
|
||||
@WebFilter(filterName = "AuthFilter", urlPatterns = { "*.xhtml" })
|
||||
public class AuthorizationFilter implements Filter {
|
||||
@@ -34,25 +32,47 @@ public class AuthorizationFilter implements Filter {
|
||||
|
||||
}
|
||||
|
||||
private boolean isAJAXRequest(HttpServletRequest request) {
|
||||
boolean check = false;
|
||||
String facesRequest = request.getHeader("Faces-Request");
|
||||
if (facesRequest != null && facesRequest.equals("partial/ajax")) {
|
||||
check = true;
|
||||
}
|
||||
return check;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
HttpServletRequest req = null;
|
||||
HttpServletResponse resp = null;
|
||||
HttpSession ses = null;
|
||||
try {
|
||||
|
||||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
HttpServletResponse resp = (HttpServletResponse) response;
|
||||
HttpSession ses = req.getSession(false);
|
||||
|
||||
req = (HttpServletRequest) request;
|
||||
String reqURI = req.getRequestURI();
|
||||
|
||||
// Para recursos publicos permitimos el acceso
|
||||
resp = (HttpServletResponse) response;
|
||||
ses = req.getSession(false);
|
||||
|
||||
// Para recursos publicos permitimos el acceso exista sesión o no.
|
||||
if (reqURI.indexOf("/login.xhtml") >= 0 || reqURI.indexOf("/profile/RegisterUser.xhtml") >= 0 || reqURI.indexOf("/home.xhtml") >= 0
|
||||
|| reqURI.indexOf("/error.xhtml") >= 0 || reqURI.indexOf("/public/") >= 0 || reqURI.contains("javax.faces.resource")) {
|
||||
chain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
// Si el usuario está logeado comprobamos si está autorizado a ver la página
|
||||
// solicitada.
|
||||
if (this.isAJAXRequest(req) == true) {
|
||||
chain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
// Sesión expirada
|
||||
if (req.isRequestedSessionIdValid() == false && req.getRequestedSessionId() != null) {
|
||||
resp.sendRedirect(req.getContextPath() + "/error.xhtml?type=expired");
|
||||
return;
|
||||
}
|
||||
|
||||
// Si el usuario está logeado comprobamos si está autorizado a ver la página solicitada.
|
||||
if (SessionUtils.isLogedIn(ses) == true) {
|
||||
UserType tipoUsuario = SessionUtils.getUserType(ses);
|
||||
boolean authorized = false;
|
||||
@@ -130,21 +150,29 @@ public class AuthorizationFilter implements Filter {
|
||||
chain.doFilter(request, response);
|
||||
return;
|
||||
} else {
|
||||
SessionUtils.addMessage(ses, FacesMessage.SEVERITY_ERROR, "No está autorizado a acceder a la página solicitada. Por favor, utilice el menú principal de la aplicación.", String.format("Se ha producido una expción de autorización, su usuario no está autorizado a acceder a la página: (%s).", reqURI));
|
||||
SessionUtils.addMessage(ses, FacesMessage.SEVERITY_ERROR,
|
||||
"No está autorizado a acceder a la página solicitada. Por favor, utilice el menú principal de la aplicación.",
|
||||
String.format("Se ha producido una expción de autorización, su usuario no está autorizado a acceder a la página: (%s).", reqURI));
|
||||
resp.sendRedirect(req.getContextPath() + "/error.xhtml?type=auth");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
resp.sendRedirect(req.getContextPath() + "/login.xhtml");
|
||||
resp.sendRedirect(req.getContextPath() + "/home.xhtml");
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
if (Exceptions.is(e, PersistenceException.class) == true) {
|
||||
if (ses != null)
|
||||
SessionUtils.addMessage(ses, FacesMessage.SEVERITY_ERROR, "Error al intentar acceder a la base de datos", Utils.getExceptionRootCause(e).getLocalizedMessage());
|
||||
|
||||
resp.sendRedirect(req.getContextPath() + "/error.xhtml?type=sql");
|
||||
} else
|
||||
resp.sendRedirect(req.getContextPath() + "/error.xhtml");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
System.out.println("Sessión destruida");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package managedbean.common;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.ejb.EJB;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.application.ViewExpiredException;
|
||||
import javax.faces.context.ExternalContext;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
@@ -121,6 +124,24 @@ public class ManagedBeanBase {
|
||||
}
|
||||
|
||||
protected void manageException(Exception ex) {
|
||||
String strType = "";
|
||||
|
||||
if (ex.getClass().equals(ViewExpiredException.class)) {
|
||||
// Sessión expired
|
||||
strType = "expired";
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Su sesión ha caducado", "Su sesión ha caducado, vuelva a logarse en el sistema.");
|
||||
} else {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Se ha producido un error inesperado", "Descripción del error: " + ex.getLocalizedMessage());
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
ExternalContext ctx = FacesContext.getCurrentInstance().getExternalContext();
|
||||
|
||||
ctx.redirect(ctx.getApplicationContextPath() + "/error.xhtml?type=" + strType);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ import java.io.Serializable;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.primefaces.model.menu.DefaultMenuItem;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package managedbean.common;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ThemeService {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ThemeService implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final String DEFAULT_THEME = "nova-light";
|
||||
public static final List<Theme> THEMES = new ArrayList<Theme>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
{
|
||||
int i = 1;
|
||||
add(new Theme(i++, "afterdark", "afterdark"));
|
||||
|
||||
@@ -70,6 +70,9 @@ public class ValidationUtils {
|
||||
public static boolean checkIfNifAlreadyRegistered(CommonFacadeRemote remoteSvc, UserType userType, String nif, Integer id) {
|
||||
boolean nifExists = false;
|
||||
|
||||
if (userType == null || remoteSvc == null)
|
||||
return nifExists;
|
||||
|
||||
switch (userType) {
|
||||
case ADMINISTRATOR:
|
||||
break;
|
||||
|
||||
@@ -12,8 +12,6 @@ import org.primefaces.model.LazyDataModel;
|
||||
import org.primefaces.model.SortOrder;
|
||||
|
||||
import TO.QuestionTO;
|
||||
import common.Constants;
|
||||
import ejb.medicalTest.MedicalTestFacadeRemote;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
|
||||
@@ -50,4 +48,8 @@ public class PendingQuestionsMBean extends ManagedBeanBase implements Serializab
|
||||
public LazyDataModel<QuestionTO> getLazyDataModelQuestionList() {
|
||||
return lazyDataModelQuestionList;
|
||||
}
|
||||
|
||||
public void saveData() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,12 +84,13 @@ public class ChangeFamilyDoctorMBean extends ManagedBeanBase implements Serializ
|
||||
int error = 0;
|
||||
|
||||
if (this.getNewFamilyDoctor() == null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nuevo médico de familia no seleccionado", "Por favor, especifique un nuevvo médico de familia.");
|
||||
this.addFacesMessage("frmChangeFD:newFamilyDocAC", FacesMessage.SEVERITY_WARN, "Nuevo médico de familia no seleccionado",
|
||||
"Por favor, especifique un nuevvo médico de familia.");
|
||||
error++;
|
||||
}
|
||||
|
||||
if (this.getCurrentFamilyDoctor() != null && this.getNewFamilyDoctor().getId() == this.getCurrentFamilyDoctor().getId()) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El médico de familia debe ser diferente",
|
||||
this.addFacesMessage("frmChangeFD:newFamilyDocAC", FacesMessage.SEVERITY_WARN, "El médico de familia debe ser diferente",
|
||||
"Por favor, seleccione un médico de familia diferente al que tiene actualmente asignado.");
|
||||
error++;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package managedbean.profile;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@@ -86,12 +85,12 @@ public class ChangePrimaryHealthCareCenterMBean extends ManagedBeanBase implemen
|
||||
int error = 0;
|
||||
|
||||
if (this.getNewCenter() == null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado", "Por favor, especifique un nuevvo centro de atención primaria.");
|
||||
this.addFacesMessage("frmChangePHCC:newCenter", FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado", "Por favor, especifique un nuevvo centro de atención primaria.");
|
||||
error++;
|
||||
}
|
||||
|
||||
if (this.getNewCenter().getName().equals(this.getCurrentCenter().getName())) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El centro de atención primeria debe ser diferente", "Por favor, seleccione un centro de atención primaria diferente al cual está actualmente asignado.");
|
||||
this.addFacesMessage("frmChangePHCC:newCenter", FacesMessage.SEVERITY_WARN, "El centro de atención primeria debe ser diferente", "Por favor, seleccione un centro de atención primaria diferente al cual está actualmente asignado.");
|
||||
error++;
|
||||
}
|
||||
|
||||
|
||||
@@ -198,11 +198,11 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
int error = 0;
|
||||
|
||||
if (this.isFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado", "Por favor, especifique un centro de atención primaria.");
|
||||
this.addFacesMessage("frmRegisterUser:selPHC", FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado", "Por favor, especifique un centro de atención primaria.");
|
||||
error++;
|
||||
}
|
||||
if (this.isSpecialistDoctor() && this.medicalSpecialty == null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Especialidad médica no seleccionada", "Por favor, especifique una especialidad médica.");
|
||||
this.addFacesMessage("frmRegisterUser:selMS", FacesMessage.SEVERITY_WARN, "Especialidad médica no seleccionada", "Por favor, especifique una especialidad médica.");
|
||||
error++;
|
||||
}
|
||||
if (ValidationUtils.isValid(nif) == false) {
|
||||
|
||||
@@ -257,6 +257,11 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
|
||||
public void saveData() {
|
||||
int error = 0;
|
||||
|
||||
// Si no hay tipo de usuario, es que algo raro ha pasado (sesión caducada?). salimos.
|
||||
if (this.userType == null)
|
||||
return;
|
||||
|
||||
boolean changePassword = (this.oldPassword != null && this.oldPassword.equals("") == false) || (this.password != null && this.password.equals("") == false);
|
||||
|
||||
if (this.isUserTypeFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
||||
|
||||
@@ -1,19 +1,12 @@
|
||||
package managedbean.systemAdmin;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.inject.Named;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.primefaces.PrimeFaces;
|
||||
|
||||
import TO.LoggedUserTO;
|
||||
import ejb.systemAdmin.SystemAdminFacadeRemote;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
package managedbean.systemAdmin;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.inject.Named;
|
||||
|
||||
import TO.LoggedUserTO;
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import common.Constants;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
|
||||
@Named("ManageSpecialities")
|
||||
@RequestScoped
|
||||
public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String description;
|
||||
private MedicalSpecialtyTO medicalSpecialty;
|
||||
private List<MedicalSpecialtyTO> medicalSpecialitiesList;
|
||||
|
||||
public ManageSpecialitiesMBean() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
if (this.medicalSpecialty == null) {
|
||||
this.medicalSpecialty = new MedicalSpecialtyTO();
|
||||
}
|
||||
// Recuperamos el usuario logeado actual
|
||||
LoggedUserTO usr = null;
|
||||
try {
|
||||
usr = SessionUtils.getloggedOnUser();
|
||||
|
||||
if (usr == null)
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida",
|
||||
"Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
||||
else {
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
}
|
||||
|
||||
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 getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
private void setSpecialtyData(MedicalSpecialtyTO ms) {
|
||||
this.id = ms.getId();
|
||||
this.name = ms.getName();
|
||||
this.description = ms.getDescription();
|
||||
}
|
||||
|
||||
public List<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
||||
return medicalSpecialitiesList;
|
||||
}
|
||||
|
||||
public MedicalSpecialtyTO getMedicalSpecialty() {
|
||||
return medicalSpecialty;
|
||||
}
|
||||
|
||||
public void setMedicalSpecialty(MedicalSpecialtyTO value) {
|
||||
this.medicalSpecialty = value;
|
||||
}
|
||||
|
||||
public void saveData() {
|
||||
int error = 0;
|
||||
|
||||
if (this.medicalSpecialty.getName() == null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nombre no relleno", "Por favor, escriba un nombre de especialidad.");
|
||||
error++;
|
||||
}
|
||||
if (this.medicalSpecialty.getDescription() == null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Descripción no rellena", "Por favor, escriba una descripción.");
|
||||
error++;
|
||||
}
|
||||
|
||||
if (error == 0) {
|
||||
try {
|
||||
MedicalSpecialtyTO ms = this.getRemoteManagerSystemAdmin().updateSpecialtyData(this.medicalSpecialty.getId(), this.medicalSpecialty.getName(), this.medicalSpecialty.getDescription());
|
||||
this.setSpecialtyData(ms);
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los datos se han guardado", "Los datos de la especialidad se han guardado correctamente.");
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package managedbean.systemAdmin;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.inject.Named;
|
||||
|
||||
import TO.LoggedUserTO;
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import common.Constants;
|
||||
import common.UserType;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
|
||||
@Named("SystemAdmin")
|
||||
@RequestScoped
|
||||
public class SystemAdminMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String lastUIQuery;
|
||||
private MedicalSpecialtyTO medicalSpecialty;
|
||||
private List<MedicalSpecialtyTO> medicalSpecialitiesList;
|
||||
|
||||
public SystemAdminMBean() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// Recuperamos el usuario logeado actual
|
||||
LoggedUserTO usr = null;
|
||||
this.lastUIQuery = "";
|
||||
|
||||
try {
|
||||
usr = SessionUtils.getloggedOnUser();
|
||||
|
||||
if (usr == null)
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida",
|
||||
"Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
||||
else {
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public List<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
||||
return medicalSpecialitiesList;
|
||||
}
|
||||
|
||||
public List<MedicalSpecialtyTO> completeMedicalSpecialty(String query) {
|
||||
if (query != null && query.equals(this.lastUIQuery) == false) {
|
||||
this.lastUIQuery = query;
|
||||
// Recuperamos las 200 primeras coincidencias
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
return this.medicalSpecialitiesList;
|
||||
}
|
||||
|
||||
public MedicalSpecialtyTO getMedicalSpecialty() {
|
||||
return medicalSpecialty;
|
||||
}
|
||||
|
||||
public void setMedicalSpecialty(MedicalSpecialtyTO value) {
|
||||
this.medicalSpecialty = value;
|
||||
}
|
||||
}
|
||||
@@ -14,12 +14,12 @@ import javax.faces.validator.ValidatorException;
|
||||
import org.primefaces.validate.ClientValidator;
|
||||
|
||||
@FacesValidator("emailValidator")
|
||||
public class EmailValidator implements Validator, ClientValidator {
|
||||
public class EmailValidator implements Validator<String>, ClientValidator {
|
||||
|
||||
private final static String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
|
||||
private final static Pattern EMAIL_COMPILED_PATTERN = Pattern.compile(EMAIL_PATTERN);
|
||||
|
||||
public void validate(FacesContext context, UIComponent comp, Object value) throws ValidatorException {
|
||||
public void validate(FacesContext context, UIComponent comp, String value) throws ValidatorException {
|
||||
String strValue = "";
|
||||
|
||||
if (value != null)
|
||||
|
||||
@@ -14,9 +14,9 @@ import org.primefaces.validate.ClientValidator;
|
||||
import managedbean.common.ValidationUtils;
|
||||
|
||||
@FacesValidator("nifValidator")
|
||||
public class NifValidator implements Validator, ClientValidator {
|
||||
public class NifValidator implements Validator<String>, ClientValidator {
|
||||
|
||||
public void validate(FacesContext context, UIComponent comp, Object value) throws ValidatorException {
|
||||
public void validate(FacesContext context, UIComponent comp, String value) throws ValidatorException {
|
||||
String strValue = "";
|
||||
|
||||
if (value != null)
|
||||
|
||||
@@ -71,7 +71,7 @@ INSERT INTO myhealth.specialistdoctor(professionalnumber, password, nif, surname
|
||||
INSERT INTO myhealth.patient(personalidentificationcode, password, nif, surname, email, name, familydoctorid) VALUES
|
||||
('PAT#100','912EC803B2CE49E4A541068D495AB570','97758900E','Singh Vila', 'Soledad@example.ecom','Soledad', 1)
|
||||
,('PAT#101','912EC803B2CE49E4A541068D495AB570','Z9518183Y','Jimenez Merino', 'Ainhoa@example.ecom','Ainhoa', 2)
|
||||
,('PAT#102','912EC803B2CE49E4A541068D495AB570','97758900E','Jesus Chen Barba', 'Abel@example.ecom','Abel', 3)
|
||||
,('PAT#102','912EC803B2CE49E4A541068D495AB570','49426296D','Jesus Chen Barba', 'Abel@example.ecom','Abel', 3)
|
||||
,('PAT#103','912EC803B2CE49E4A541068D495AB570','95014341F','Lorenzo Tapia Navas', 'Francisco@example.ecom','Francisco', 4)
|
||||
,('PAT#104','912EC803B2CE49E4A541068D495AB570','17873499S','Gimenez Gutierrez', 'Teodora@example.ecom','Teodora', 5)
|
||||
,('PAT#105','912EC803B2CE49E4A541068D495AB570','07320674G','Escobar Marquez', 'Jorge@example.ecom','Jorge', 6)
|
||||
@@ -81,29 +81,29 @@ INSERT INTO myhealth.patient(personalidentificationcode, password, nif, surname,
|
||||
,('PAT#109','912EC803B2CE49E4A541068D495AB570','53986482P','Carretero Ayala', 'Eduardo@example.ecom','Eduardo', 10);
|
||||
|
||||
INSERT INTO myhealth.question(title, message, status, response, patientid, familydoctorid) VALUES
|
||||
('titulo de la pregunta número 1', 'Doctor, tengo dolor en la articulación numero 1', 1, null, 1, 1)
|
||||
,('titulo de la pregunta número 2', 'Doctor, tengo dolor en la articulación numero 2', 1, null, 2, 1)
|
||||
,('titulo de la pregunta número 3', 'Doctor, tengo dolor en la articulación numero 3', 1, null, 3, 1)
|
||||
,('titulo de la pregunta número 4', 'Doctor, tengo dolor en la articulación numero 4', 1, null, 4, 1)
|
||||
,('titulo de la pregunta número 5', 'Doctor, tengo dolor en la articulación numero 5', 1, null, 5, 1)
|
||||
,('titulo de la pregunta número 6', 'Doctor, tengo dolor en la articulación numero 6', 1, null, 6, 1)
|
||||
,('titulo de la pregunta número 7', 'Doctor, tengo dolor en la articulación numero 7', 1, null, 7, 1)
|
||||
,('titulo de la pregunta número 8', 'Doctor, tengo dolor en la articulación numero 8', 1, null, 8, 1)
|
||||
,('titulo de la pregunta número 9', 'Doctor, tengo dolor en la articulación numero 9', 1, null, 9, 1)
|
||||
,('titulo de la pregunta número 10', 'Doctor, tengo dolor en la articulación numero 10', 1, null, 10, 1)
|
||||
,('titulo de la pregunta número 11', 'Doctor, tengo dolor en la articulación numero 11', 1, null, 1, 1)
|
||||
,('titulo de la pregunta número 12', 'Doctor, tengo dolor en la articulación numero 12', 1, null, 2, 1)
|
||||
,('titulo de la pregunta número 13', 'Doctor, tengo dolor en la articulación numero 13', 1, null, 3, 1)
|
||||
,('titulo de la pregunta número 14', 'Doctor, tengo dolor en la articulación numero 14', 1, null, 4, 1)
|
||||
,('titulo de la pregunta número 15', 'Doctor, tengo dolor en la articulación numero 15', 1, null, 5, 1)
|
||||
,('titulo de la pregunta número 16', 'Doctor, tengo dolor en la articulación numero 16', 1, null, 6, 1)
|
||||
,('titulo de la pregunta número 17', 'Doctor, tengo dolor en la articulación numero 17', 1, null, 7, 1)
|
||||
,('titulo de la pregunta número 18', 'Doctor, tengo dolor en la articulación numero 18', 1, null, 8, 1)
|
||||
,('titulo de la pregunta número 19', 'Doctor, tengo dolor en la articulación numero 19', 1, null, 9, 1)
|
||||
,('titulo de la pregunta número 20', 'Doctor, tengo dolor en la articulación numero 20', 1, null, 10, 1)
|
||||
,('titulo de la pregunta número 21', 'Doctor, tengo dolor en la articulación numero 21', 1, null, 8, 1)
|
||||
,('titulo de la pregunta número 22', 'Doctor, tengo dolor en la articulación numero 22', 1, null, 9, 1)
|
||||
,('titulo de la pregunta número 23', 'Doctor, tengo dolor en la articulación numero 23', 1, null, 10, 1);
|
||||
('titulo de la pregunta número 1', 'Doctor, tengo dolor en la articulación numero 1', 'PENDING', null, 1, 1)
|
||||
,('titulo de la pregunta número 2', 'Doctor, tengo dolor en la articulación numero 2', 'PENDING', null, 2, 1)
|
||||
,('titulo de la pregunta número 3', 'Doctor, tengo dolor en la articulación numero 3', 'PENDING', null, 3, 1)
|
||||
,('titulo de la pregunta número 4', 'Doctor, tengo dolor en la articulación numero 4', 'PENDING', null, 4, 1)
|
||||
,('titulo de la pregunta número 5', 'Doctor, tengo dolor en la articulación numero 5', 'PENDING', null, 5, 1)
|
||||
,('titulo de la pregunta número 6', 'Doctor, tengo dolor en la articulación numero 6', 'PENDING', null, 6, 1)
|
||||
,('titulo de la pregunta número 7', 'Doctor, tengo dolor en la articulación numero 7', 'PENDING', null, 7, 1)
|
||||
,('titulo de la pregunta número 8', 'Doctor, tengo dolor en la articulación numero 8', 'PENDING', null, 8, 1)
|
||||
,('titulo de la pregunta número 9', 'Doctor, tengo dolor en la articulación numero 9', 'PENDING', null, 9, 1)
|
||||
,('titulo de la pregunta número 10', 'Doctor, tengo dolor en la articulación numero 10', 'PENDING', null, 10, 1)
|
||||
,('titulo de la pregunta número 11', 'Doctor, tengo dolor en la articulación numero 11', 'PENDING', null, 1, 1)
|
||||
,('titulo de la pregunta número 12', 'Doctor, tengo dolor en la articulación numero 12', 'PENDING', null, 2, 1)
|
||||
,('titulo de la pregunta número 13', 'Doctor, tengo dolor en la articulación numero 13', 'PENDING', null, 3, 1)
|
||||
,('titulo de la pregunta número 14', 'Doctor, tengo dolor en la articulación numero 14', 'PENDING', null, 4, 1)
|
||||
,('titulo de la pregunta número 15', 'Doctor, tengo dolor en la articulación numero 15', 'PENDING', null, 5, 1)
|
||||
,('titulo de la pregunta número 16', 'Doctor, tengo dolor en la articulación numero 16', 'PENDING', null, 6, 1)
|
||||
,('titulo de la pregunta número 17', 'Doctor, tengo dolor en la articulación numero 17', 'PENDING', null, 7, 1)
|
||||
,('titulo de la pregunta número 18', 'Doctor, tengo dolor en la articulación numero 18', 'PENDING', null, 8, 1)
|
||||
,('titulo de la pregunta número 19', 'Doctor, tengo dolor en la articulación numero 19', 'PENDING', null, 9, 1)
|
||||
,('titulo de la pregunta número 20', 'Doctor, tengo dolor en la articulación numero 20', 'PENDING', null, 10, 1)
|
||||
,('titulo de la pregunta número 21', 'Doctor, tengo dolor en la articulación numero 21', 'PENDING', null, 8, 1)
|
||||
,('titulo de la pregunta número 22', 'Doctor, tengo dolor en la articulación numero 22', 'PENDING', null, 9, 1)
|
||||
,('titulo de la pregunta número 23', 'Doctor, tengo dolor en la articulación numero 23', 'PENDING', null, 10, 1);
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
**Página de inicio del proyecto My Health del Grupo 2**
|
||||
## Página de inicio del proyecto My Health del Grupo 2
|
||||
|
||||
|
||||
Organización de directorios:
|
||||
### Organización de directorios:
|
||||
* sources: Código fuente y proyecto eclipse
|
||||
* database: Scripts SQL para crear la estructura de base de datos y los datos de prueba
|
||||
* doc: Directorio para ubicar la documentación compartida.
|
||||
|
||||
### Instrucciones de despliegue e instalación
|
||||
Las instrucciones detalladas de despliegue y configuración están descritas en el documento [install.md](install.md)
|
||||
@@ -9,7 +9,8 @@ services:
|
||||
- POSTGRES_PASSWORD=PASSWORD
|
||||
- POSTGRES_DB=myhealth
|
||||
volumes:
|
||||
- ./2.database/01.CreateTables.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
- ./2.database/01.CreateTables.sql:/docker-entrypoint-initdb.d/01.CreateTables.sql
|
||||
- ./2.database/02.Datos_prueba.sql:/docker-entrypoint-initdb.d/02.Datos_prueba.sql
|
||||
wildfly:
|
||||
build: .
|
||||
ports:
|
||||
|
||||
34
install.md
Normal file
34
install.md
Normal file
@@ -0,0 +1,34 @@
|
||||
## Instrucciones de despliegue e instalación
|
||||
### 1. Crear esquema de base de datos y tablas:
|
||||
Se debe crear un esquema nuevo en PostgreSQL y conceder permisos al usuario USER. Esto puede realizarse ejecutando el script incluido con la solución llamado:
|
||||
* 01.CreateTables.sql
|
||||
|
||||
### 2. Inserción de datos iniciales:
|
||||
Se debe ejecutar el script, incluido con la solución, que crea la tabla e inserta los datos de prueba:
|
||||
* 02.Datos_prueba.sql
|
||||
|
||||
### 3. Creación del DataSource:
|
||||
Para este proyecto se utilizará el mismo datasource que para el caso práctico, si no está creado debe añadirse al fichero JBOSS_HOME\standalone\configuration\standalone.xlm.
|
||||
El usuario y contraseña de base de datos que se han utilizado en el datasource es USER con contraseña PASSWORD.
|
||||
|
||||
<datasource jta="false" jndi-name="java:jboss/postgresDS" pool-name="postgresDS"
|
||||
enabled="true" use-java-context="true" use-ccm="false" statistics-enabled="true">
|
||||
<connection-url>jdbc:postgresql://localhost:5432/postgres</connection-url>
|
||||
<driver-class>org.postgresql.Driver</driver-class>
|
||||
<driver>postgresql</driver>
|
||||
<security>
|
||||
<user-name>USER</user-name>
|
||||
<password>PASSWORD</password>
|
||||
</security>
|
||||
</datasource>
|
||||
|
||||
### 4. Ejecutar la compilación y despliegue del proyecto
|
||||
Acceder al directorio con el código fuente ([git-folder]/1.sources/MyHealth), y donde está ubicado el archivo de compilación de ant build.xml, ejecutar `ant` en este directorio, el proyecto debería compilarse y desplegarse automáticamente en el servidor JBOSS local.
|
||||
|
||||
## Instrucciones de despliegue alternativo con docker
|
||||
|
||||
### pre-requisitos:
|
||||
Instalar docker desktop
|
||||
|
||||
### Levantar ambiente con un solo comando:
|
||||
Abrimos la consola y nos posicionamos en el root del proyecto donde se encuentra el archivo `docker-compose.yml` y mediante la ejecución del comando `docker-compose up` levantaremos un contenedor de postgresql con el schema, tablas y permisos configurado y un contenedor con jboss/wildfly también configurado en el que compilaremos la ultima versión del producto y la desplegaremos.
|
||||
Reference in New Issue
Block a user