Commit d257abb6 authored by HerreraVE's avatar HerreraVE

backend

parents
HELP.md
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
/out/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
spring.datasource.url=jdbc:mysql://localhost:3306/swalumniapp
spring.datasource.username=root
spring.datasource.password=lerick09
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
\ No newline at end of file
plugins {
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
group = 'com.HelpDesk'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web'
runtimeOnly 'mysql:mysql-connector-java'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
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
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
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
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
pluginManagement {
repositories {
gradlePluginPortal()
}
}
rootProject.name = 'HelpDesk'
package com.HelpDesk.HelpDesk;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class HelpDeskApplication {
public static void main(String[] args) {
SpringApplication.run(HelpDeskApplication.class, args);
}
}
package com.HelpDesk.HelpDesk.controllers;
import java.io.IOException;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.HelpDesk.HelpDesk.dao.CrugeUserRepository;
import com.HelpDesk.HelpDesk.model.CrugeUser;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import constants.ConstantesHelpDesk;
@CrossOrigin(origins = { ConstantesHelpDesk.DOMAINS_1 })
@RestController
public class CrugeUserController {
@Autowired
private CrugeUserRepository crugeUserRepository;
private ObjectMapper mapper;
/* metodo editar y guardar */
@SuppressWarnings("rawtypes")
@RequestMapping(value = "/saveOrUpdateCrugeUser", method = RequestMethod.POST)
public ResponseEntity saveOrUpdateCrugeUser(@RequestBody String crugeUserJson)
throws JsonParseException, JsonMappingException, IOException {
CrugeUser crugeUser = new CrugeUser();
this.mapper = new ObjectMapper();
try {
crugeUser = this.mapper.readValue(crugeUserJson, CrugeUser.class);
System.out.println(crugeUser);
if (!this.validate(crugeUser)) {
System.out.println("if");
return new ResponseEntity(HttpStatus.NOT_ACCEPTABLE);
}
this.crugeUserRepository.save(crugeUser);
System.out.println("save");
return new ResponseEntity(HttpStatus.OK);
} catch (Exception e) {
System.out.println(e);
return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@RequestMapping(value = "/getCrugeUser", method = RequestMethod.GET)
/* metodo buscar */
public List<CrugeUser> getCrugeUser() {
return (List<CrugeUser>) this.crugeUserRepository.findAll();
}
/* metodo buscar por cedula */
@RequestMapping(value = "/getCrugeUser/Cedula/{cedula}", method = RequestMethod.GET)
public Optional<CrugeUser> cedula(String cedula) {
return (Optional<CrugeUser>) this.crugeUserRepository.findByCedula(cedula);
}
/* metodo buscar por correoEspe */
@RequestMapping(value = "/getCrugeUser/CorreoEspe/{correoEspe}", method = RequestMethod.GET)
public Optional<CrugeUser> correoespe(String correoEspe) {
return (Optional<CrugeUser>) this.crugeUserRepository.findByCorreoEspe(correoEspe);
}
@RequestMapping(value = "/deleteCrugeUser", method = RequestMethod.POST)
public void deleteCrugeUser(@RequestBody String crugeUserJson) throws Exception {
this.mapper = new ObjectMapper();
CrugeUser crugeUser = this.mapper.readValue(crugeUserJson, CrugeUser.class);
if (crugeUser.getId() == 0L) {
throw new Exception("El Id esta nulo");
}
this.crugeUserRepository.delete(crugeUser);
}
private boolean validate(CrugeUser crugeUser) {
boolean isValid = true;
return isValid;
}
}
package com.HelpDesk.HelpDesk.controllers;
import java.io.IOException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.HelpDesk.HelpDesk.dao.EstudianteRepository;
import com.HelpDesk.HelpDesk.model.Estudiante;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import constants.ConstantesHelpDesk;
@CrossOrigin(origins = { ConstantesHelpDesk.DOMAINS_1 })
@RestController
public class EstudianteController {
@Autowired
private EstudianteRepository estudianteRepository;
private ObjectMapper mapper;
/* metodo editar y guardar */
@SuppressWarnings("rawtypes")
@RequestMapping(value = "/saveOrUpdateEstudiante", method = RequestMethod.POST)
public ResponseEntity saveOrUpdateEstudiante(@RequestBody String estudianteJson)
throws JsonParseException, JsonMappingException, IOException {
Estudiante estudiante = new Estudiante();
this.mapper = new ObjectMapper();
try {
estudiante = this.mapper.readValue(estudianteJson, Estudiante.class);
System.out.println(estudiante);
if (!this.validate(estudiante)) {
System.out.println("if");
return new ResponseEntity(HttpStatus.NOT_ACCEPTABLE);
}
this.estudianteRepository.save(estudiante);
System.out.println("save");
return new ResponseEntity(HttpStatus.OK);
} catch (Exception e) {
System.out.println(e);
return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@RequestMapping(value = "/getEstudiante", method = RequestMethod.GET)
/* metodo buscar */
public List<Estudiante> getEstudiante() {
return (List<Estudiante>) this.estudianteRepository.findAll();
}
@RequestMapping(value = "/deleteEstudiante", method = RequestMethod.POST)
public void deleteUser(@RequestBody String estudianteJson) throws Exception {
this.mapper = new ObjectMapper();
Estudiante estudiante = this.mapper.readValue(estudianteJson, Estudiante.class);
if (estudiante.getId() == 0L) {
throw new Exception("El Id esta nulo");
}
this.estudianteRepository.delete(estudiante);
}
private boolean validate(Estudiante estudiante) {
boolean isValid = true;
return isValid;
}
}
\ No newline at end of file
package com.HelpDesk.HelpDesk.controllers;
import java.io.IOException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.HelpDesk.HelpDesk.dao.GeneroRepository;
import com.HelpDesk.HelpDesk.model.Genero;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import constants.ConstantesHelpDesk;
@CrossOrigin(origins = { ConstantesHelpDesk.DOMAINS_1 })
@RestController
public class GeneroController {
@Autowired
private GeneroRepository generoRepository;
private ObjectMapper mapper;
/* metodo editar y guardar */
@SuppressWarnings("rawtypes")
@RequestMapping(value = "/saveOrUpdateGenero", method = RequestMethod.POST)
public ResponseEntity saveOrUpdateGenero(@RequestBody String generoJson)
throws JsonParseException, JsonMappingException, IOException {
Genero genero = new Genero();
this.mapper = new ObjectMapper();
try {
genero = this.mapper.readValue(generoJson, Genero.class);
System.out.println(genero);
if (!this.validate(genero)) {
System.out.println("if");
return new ResponseEntity(HttpStatus.NOT_ACCEPTABLE);
}
this.generoRepository.save(genero);
System.out.println("save");
return new ResponseEntity(HttpStatus.OK);
} catch (Exception e) {
System.out.println(e);
return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@RequestMapping(value = "/getGenero", method = RequestMethod.GET)
/* metodo buscar */
public List<Genero> getGenero() {
return (List<Genero>) this.generoRepository.findAll();
}
@RequestMapping(value = "/deleteGenero", method = RequestMethod.POST)
public void deleteUser(@RequestBody String generoJson) throws Exception {
this.mapper = new ObjectMapper();
Genero genero = this.mapper.readValue(generoJson, Genero.class);
if (genero.getId() == 0L) {
throw new Exception("El Id esta nulo");
}
this.generoRepository.delete(genero);
}
private boolean validate(Genero genero) {
boolean isValid = true;
return isValid;
}
}
\ No newline at end of file
package com.HelpDesk.HelpDesk.controllers;
import java.io.IOException;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.HelpDesk.HelpDesk.dao.PersonaRepository;
import com.HelpDesk.HelpDesk.model.Persona;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import constants.ConstantesHelpDesk;
@CrossOrigin(origins = { ConstantesHelpDesk.DOMAINS_1 })
@RestController
public class PersonaController {
@Autowired
protected PersonaRepository personaRepository;
private ObjectMapper mapper;
/* metodo editar y guardar */
@SuppressWarnings("rawtypes")
@RequestMapping(value = "/saveOrUpdatePersona", method = RequestMethod.POST)
public ResponseEntity saveOrUpdatePersona(@RequestBody String personaJson)
throws JsonParseException, JsonMappingException, IOException {
Persona persona = new Persona();
this.mapper = new ObjectMapper();
try {
persona = this.mapper.readValue(personaJson, Persona.class);
System.out.println(persona);
if (!this.validate(persona)) {
System.out.println("if");
return new ResponseEntity(HttpStatus.NOT_ACCEPTABLE);
}
this.personaRepository.save(persona);
System.out.println("save");
return new ResponseEntity(HttpStatus.OK);
} catch (Exception e) {
System.out.println(e);
return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
/* metodo buscar todas las personas */
@RequestMapping(value = "/getPersonas", method = RequestMethod.GET)
public List<Persona> getPersona() {
return (List<Persona>) this.personaRepository.findAll();
}
/* metodo buscar por cedula */
@RequestMapping(value = "/getPersonas/Cedula/{cedula}", method = RequestMethod.GET)
public Optional<Persona> cedula(String cedula) {
return (Optional<Persona>) this.personaRepository.findByCedula(cedula);
}
/* metodo buscar por celular */
@RequestMapping(value = "/getPersonas/Celular/{celular}", method = RequestMethod.GET)
public Optional<Persona> celular(String celular) {
return (Optional<Persona>) this.personaRepository.findByCelular(celular);
}
/* metodo buscar por apellido */
@RequestMapping(value = "/getPersonas/Apellido/{apellido}", method = RequestMethod.GET)
public Optional<Persona> apellido(String apellido) {
return (Optional<Persona>) this.personaRepository.findByApellido(apellido);
}
/* metodo buscar por nombre */
@RequestMapping(value = "/getPersonas/Nombre/{nombre}", method = RequestMethod.GET)
public Optional<Persona> nombre(String nombre) {
return (Optional<Persona>) this.personaRepository.findByNombre(nombre);
}
/* metodo buscar por direccion */
@RequestMapping(value = "/getPersonas/Direccion/{direccion}", method = RequestMethod.GET)
public Optional<Persona> direccion(String direccion) {
return (Optional<Persona>) this.personaRepository.findByDireccion(direccion);
}
/* metodo buscar por telefono */
@RequestMapping(value = "/getPersonas/Telefono/{telefono}", method = RequestMethod.GET)
public Optional<Persona> telefono(String telefono) {
return (Optional<Persona>) this.personaRepository.findByTelefono(telefono);
}
/* metodo buscar por CorreoPersonal */
@RequestMapping(value = "/getPersonas/CorreoPersonal/{correoPersonal}", method = RequestMethod.GET)
public Optional<Persona> correopersonal(String correoPersonal) {
return (Optional<Persona>) this.personaRepository.findByCorreoPersonal(correoPersonal);
}
/* metodo buscar por CorreoEspe */
@RequestMapping(value = "/getPersonas/CorreoEspe/{correoEspe}", method = RequestMethod.GET)
public Optional<Persona> correoespe(String correoEspe) {
return (Optional<Persona>) this.personaRepository.findByCorreoEspe(correoEspe);
}
/* metodo buscar por Id */
@RequestMapping(value = "/getPersonas/Id/{id}", method = RequestMethod.GET)
public Optional<Persona> Id(long id) {
return (Optional<Persona>) this.personaRepository.findById(id);
}
@RequestMapping(value = "/deletePersonas", method = RequestMethod.POST)
public void deletePersona(@RequestBody String personaJson) throws Exception {
System.out.print("aqui");
System.out.print(personaJson);
this.mapper = new ObjectMapper();
Persona persona = this.mapper.readValue(personaJson, Persona.class);
if (persona.getId() == 0L) {
throw new Exception("El Id esta nulo");
}
this.personaRepository.delete(persona);
}
private boolean validate(Persona persona) {
boolean isValid = true;
return isValid;
}
}
\ No newline at end of file
package com.HelpDesk.HelpDesk.dao;
import java.util.Optional;
import org.springframework.data.repository.CrudRepository;
import com.HelpDesk.HelpDesk.model.CrugeUser;
public interface CrugeUserRepository extends CrudRepository<CrugeUser, Long>{
public Optional<CrugeUser> findById (long id);
public Optional<CrugeUser> findByCedula (String cedula);
public Optional<CrugeUser> findByCorreoEspe (String correoEspe);
public Optional<CrugeUser> findByPassword (String password);
}
package com.HelpDesk.HelpDesk.dao;
import org.springframework.data.repository.CrudRepository;
import com.HelpDesk.HelpDesk.model.Estudiante;
public interface EstudianteRepository extends CrudRepository<Estudiante, Long> {
@SuppressWarnings("unchecked")
Estudiante save (Estudiante gestionEstudiante);
}
package com.HelpDesk.HelpDesk.dao;
import org.springframework.data.repository.CrudRepository;
import com.HelpDesk.HelpDesk.model.Genero;
public interface GeneroRepository extends CrudRepository<Genero , Long> {
@SuppressWarnings("unchecked")
Genero save (Genero gestionGenero);
}
package com.HelpDesk.HelpDesk.dao;
import org.springframework.data.repository.CrudRepository;
import com.HelpDesk.HelpDesk.model.Persona;
import java.util.Optional;
public interface PersonaRepository extends CrudRepository<Persona, Long>{
public Optional<Persona> findByCedula(String cedula);
public Optional<Persona> findByCelular(String celular);
public Optional<Persona> findByApellido(String apellidod);
public Optional<Persona> findByNombre (String nombre);
public Optional<Persona> findByDireccion (String direccion);
public Optional<Persona> findByTelefono (String telefono);
public Optional<Persona> findByCorreoPersonal (String correoPersonal);
public Optional<Persona> findByCorreoEspe (String correoEspe);
public Optional<Persona> findById (long id);
}
package com.HelpDesk.HelpDesk.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "cruge_user")
public class CrugeUser {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "iduser")
private Long id;
@Column(name = "username")
public String cedula;
@Column(name = "email")
public String correoEspe;
@Column(name = "password")
public String password;
@Column(name = "state")
public Integer estado;
@Column(name = "totalsessioncounter")
public Integer totalsessioncounter;
@Column(name = "currentsessioncounter")
public String currentsessioncounter;
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return the cedula
*/
public String getCedula() {
return cedula;
}
/**
* @param cedula the cedula to set
*/
public void setCedula(String cedula) {
this.cedula = cedula;
}
/**
* @return the correoEspe
*/
public String getCorreoEspe() {
return correoEspe;
}
/**
* @param correoEspe the correoEspe to set
*/
public void setCorreoEspe(String correoEspe) {
this.correoEspe = correoEspe;
}
/**
* @return the password
*/
public String getPassword() {
return password;
}
/**
* @param password the password to set
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return the estado
*/
public Integer getEstado() {
return estado;
}
/**
* @param estado the estado to set
*/
public void setEstado(Integer estado) {
this.estado = estado;
}
/**
* @return the totalsessioncounter
*/
public Integer getTotalsessioncounter() {
return totalsessioncounter;
}
/**
* @param totalsessioncounter the totalsessioncounter to set
*/
public void setTotalsessioncounter(Integer totalsessioncounter) {
this.totalsessioncounter = totalsessioncounter;
}
/**
* @return the currentsessioncounter
*/
public String getCurrentsessioncounter() {
return currentsessioncounter;
}
/**
* @param currentsessioncounter the currentsessioncounter to set
*/
public void setCurrentsessioncounter(String currentsessioncounter) {
this.currentsessioncounter = currentsessioncounter;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "CrugeUser [id=" + id + ", cedula=" + cedula + ", correoEspe=" + correoEspe + ", password=" + password
+ ", estado=" + estado + ", totalsessioncounter=" + totalsessioncounter + ", currentsessioncounter="
+ currentsessioncounter + "]";
}
}
package com.HelpDesk.HelpDesk.model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "tipo_estudiante")
public class Estudiante implements Serializable{
/**
*
*/
private static final long serialVersionUID = 2328952476335064820L;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="TIE_CODIGO")
private Long id;
@Column(name = "TIE_NOMBRE")
public String nombre;
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return the nombre
*/
public String getNombre() {
return nombre;
}
/**
* @param nombre the nombre to set
*/
public void setNombre(String nombre) {
this.nombre = nombre;
}
}
package com.HelpDesk.HelpDesk.model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "genero")
public class Genero implements Serializable{
/**
*
*/
private static final long serialVersionUID = 2328952476335064820L;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="GEN_CODIGO")
private Long id;
@Column(name = "GEN_NOMBRE")
public String nombre;
@Column(name = "GEN_BANNER")
public String inicialGenero;
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return the nombre
*/
public String getNombre() {
return nombre;
}
/**
* @param nombre the nombre to set
*/
public void setNombre(String nombre) {
this.nombre = nombre;
}
/**
* @return the inicialGenero
*/
public String getInicialGenero() {
return inicialGenero;
}
/**
* @param inicialGenero the inicialGenero to set
*/
public void setInicialGenero(String inicialGenero) {
this.inicialGenero = inicialGenero;
}
}
package com.HelpDesk.HelpDesk.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name = "persona")
public class Persona {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "PER_CODIGO")
private Long id;
@Column(name = "PER_CEDULA")
public String cedula;
@Column(name = "PER_APELLIDO")
public String apellido;
@Column(name = "PER_NOMBRE")
public String nombre;
@Column(name = "PER_DIRECCION")
public String direccion;
@Column(name = "PER_CELULAR")
public String celular;
@Column(name = "PER_TELEFONO")
public String telefono;
@Column(name = "PER_CORREO")
public String correoPersonal;
@Column(name = "PER_PASSWORD")
public String password;
@Column(name = "PER_CORREOA")
public String correoEspe;
@Column(name = "ETN_CODIGO")
public String etniaCodigo;
@ManyToOne
@JoinColumn(name = "GEN_CODIGO")
private Genero genero;
@ManyToOne
@JoinColumn(name = "TIE_CODIGO")
private Estudiante estudiante;
/**
* @return the estudiante
*/
public Estudiante getEstudiante() {
return estudiante;
}
/**
* @param estudiante the estudiante to set
*/
public void setEstudiante(Estudiante estudiante) {
this.estudiante = estudiante;
}
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return the cedula
*/
public String getCedula() {
return cedula;
}
/**
* @param cedula the cedula to set
*/
public void setCedula(String cedula) {
this.cedula = cedula;
}
/**
* @return the apellido
*/
public String getApellido() {
return apellido;
}
/**
* @param apellido the apellido to set
*/
public void setApellido(String apellido) {
this.apellido = apellido;
}
/**
* @return the nombre
*/
public String getNombre() {
return nombre;
}
/**
* @param nombre the nombre to set
*/
public void setNombre(String nombre) {
this.nombre = nombre;
}
/**
* @return the direccion
*/
public String getDireccion() {
return direccion;
}
/**
* @param direccion the direccion to set
*/
public void setDireccion(String direccion) {
this.direccion = direccion;
}
/**
* @return the celular
*/
public String getCelular() {
return celular;
}
/**
* @param celular the celular to set
*/
public void setCelular(String celular) {
this.celular = celular;
}
/**
* @return the telefono
*/
public String getTelefono() {
return telefono;
}
/**
* @param telefono the telefono to set
*/
public void setTelefono(String telefono) {
this.telefono = telefono;
}
/**
* @return the correoPersonal
*/
public String getCorreoPersonal() {
return correoPersonal;
}
/**
* @param correoPersonal the correoPersonal to set
*/
public void setCorreoPersonal(String correoPersonal) {
this.correoPersonal = correoPersonal;
}
/**
* @return the password
*/
public String getPassword() {
return password;
}
/**
* @param password the password to set
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return the correoEspe
*/
public String getCorreoEspe() {
return correoEspe;
}
/**
* @param correoEspe the correoEspe to set
*/
public void setCorreoEspe(String correoEspe) {
this.correoEspe = correoEspe;
}
/**
* @return the etniaCodigo
*/
public String getEtniaCodigo() {
return etniaCodigo;
}
/**
* @param etniaCodigo the etniaCodigo to set
*/
public void setEtniaCodigo(String etniaCodigo) {
this.etniaCodigo = etniaCodigo;
}
/**
* @return the genero
*/
public Genero getGenero() {
return genero;
}
/**
* @param genero the genero to set
*/
public void setGenero(Genero genero) {
this.genero = genero;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Persona [id=" + id + ", cedula=" + cedula + ", apellido=" + apellido + ", nombre=" + nombre
+ ", direccion=" + direccion + ", celular=" + celular + ", telefono=" + telefono + ", correoPersonal="
+ correoPersonal + ", password=" + password + ", correoEspe=" + correoEspe + ", etniaCodigo="
+ etniaCodigo + ", genero=" + genero + ", estudiante=" + estudiante + "]";
}
}
package constants;
public class ConstantesHelpDesk {
public static final String DOMAINS_1 = "http://localhost:4200";
}
spring.datasource.url=jdbc:mysql://localhost:3306/swalumniapp
spring.datasource.username=root
spring.datasource.password=lerick09
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
\ No newline at end of file
package com.HelpDesk.HelpDesk;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class HelpDeskApplicationTests {
@Test
public void contextLoads() {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment