├── .gitattributes ├── .gitignore ├── .metadata ├── .log ├── .mylyn │ └── repositories.xml.zip ├── .plugins │ ├── org.eclipse.core.resources │ │ ├── .projects │ │ │ └── .org.eclipse.egit.core.cmp │ │ │ │ └── .location │ │ ├── .root │ │ │ └── .indexes │ │ │ │ └── properties.index │ │ └── .safetable │ │ │ └── org.eclipse.core.resources │ ├── org.eclipse.core.runtime │ │ └── .settings │ │ │ ├── Docker.prefs │ │ │ ├── org.eclipse.core.resources.prefs │ │ │ ├── org.eclipse.debug.ui.prefs │ │ │ ├── org.eclipse.egit.core.prefs │ │ │ ├── org.eclipse.jdt.core.prefs │ │ │ ├── org.eclipse.jdt.debug.ui.prefs │ │ │ ├── org.eclipse.jdt.junit.prefs │ │ │ ├── org.eclipse.jdt.launching.prefs │ │ │ ├── org.eclipse.jdt.ui.prefs │ │ │ ├── org.eclipse.jsch.core.prefs │ │ │ ├── org.eclipse.jst.j2ee.webservice.ui.prefs │ │ │ ├── org.eclipse.m2e.apt.prefs │ │ │ ├── org.eclipse.mylyn.context.core.prefs │ │ │ ├── org.eclipse.mylyn.monitor.ui.prefs │ │ │ ├── org.eclipse.mylyn.tasks.ui.prefs │ │ │ ├── org.eclipse.pde.api.tools.prefs │ │ │ ├── org.eclipse.ui.navigator.prefs │ │ │ ├── org.eclipse.ui.prefs │ │ │ ├── org.eclipse.ui.workbench.prefs │ │ │ ├── org.eclipse.urischeme.prefs │ │ │ ├── org.eclipse.wst.jsdt.ui.prefs │ │ │ ├── org.eclipse.wst.ws.service.policy.prefs │ │ │ ├── org.springframework.ide.eclipse.imports.prefs │ │ │ └── org.springsource.ide.eclipse.commons.ui.prefs │ ├── org.eclipse.debug.core │ │ └── .launches │ │ │ └── Clase01.launch │ ├── org.eclipse.debug.ui │ │ └── launchConfigurationHistory.xml │ ├── org.eclipse.e4.workbench │ │ └── workbench.xmi │ ├── org.eclipse.egit.core │ │ └── .org.eclipse.egit.core.cmp │ │ │ ├── .project │ │ │ └── .settings │ │ │ └── org.eclipse.core.resources.prefs │ ├── org.eclipse.jdt.core │ │ ├── 1865797976.index │ │ ├── externalLibsTimeStamps │ │ ├── javaLikeNames.txt │ │ ├── savedIndexNames.txt │ │ └── variablesAndContainers.dat │ ├── org.eclipse.jdt.launching │ │ ├── .install.xml │ │ └── libraryInfos.xml │ ├── org.eclipse.ltk.core.refactoring │ │ └── .refactorings │ │ │ └── .workspace │ │ │ └── 2024 │ │ │ └── 9 │ │ │ └── 39 │ │ │ ├── refactorings.history │ │ │ └── refactorings.index │ ├── org.eclipse.m2e.core │ │ ├── workspaceState.ser │ │ └── workspacestate.properties │ ├── org.eclipse.m2e.logback │ │ ├── 0.log │ │ └── logback.2.2.1.20231030-1438.xml │ ├── org.eclipse.oomph.setup │ │ └── workspace.setup │ ├── org.eclipse.tm.terminal.view.ui │ │ └── .executables │ │ │ └── data.properties │ ├── org.eclipse.ui.intro │ │ └── introstate │ ├── org.eclipse.ui.workbench │ │ └── workingsets.xml │ ├── org.eclipse.wildwebdeveloper.xml │ │ └── system-catalog.xml │ ├── org.eclipse.wst.jsdt.core │ │ ├── externalLibsTimeStamps │ │ ├── libraries │ │ │ ├── baseBrowserLibrary.js │ │ │ ├── browserWindow.js │ │ │ ├── dom5.js │ │ │ ├── system.js │ │ │ └── xhr.js │ │ └── variablesAndContainers.dat │ └── org.eclipse.wst.sse.core │ │ └── task-tags.properties └── version.ini ├── .mvn └── wrapper │ └── maven-wrapper.properties ├── LICENCE ├── README.md ├── afterclass-01 └── pom.xml ├── clase-00 ├── .classpath ├── .project ├── .settings │ ├── org.eclipse.jdt.apt.core.prefs │ ├── org.eclipse.jdt.core.prefs │ └── org.eclipse.m2e.core.prefs ├── pom.xml ├── src │ └── main │ │ └── java │ │ └── com │ │ └── coderhouse │ │ └── Clase01.java └── target │ └── classes │ ├── META-INF │ ├── MANIFEST.MF │ └── maven │ │ └── com.coderhouse │ │ └── clase-01 │ │ ├── pom.properties │ │ └── pom.xml │ └── com │ └── coderhouse │ └── Clase01.class ├── clase-01 ├── .classpath ├── .gitignore ├── .project ├── .settings │ ├── org.eclipse.jdt.apt.core.prefs │ ├── org.eclipse.jdt.core.prefs │ └── org.eclipse.m2e.core.prefs ├── pom.xml └── src │ └── main │ └── java │ ├── com │ └── coderhouse │ │ └── inicio │ │ └── Clase01.java │ └── ejercicios │ └── ejercicios.md ├── clase-02 ├── .classpath ├── .project ├── .settings │ ├── org.eclipse.jdt.apt.core.prefs │ ├── org.eclipse.jdt.core.prefs │ └── org.eclipse.m2e.core.prefs ├── pom.xml ├── src │ └── main │ │ └── java │ │ ├── com │ │ └── coderhouse │ │ │ └── Clase02.java │ │ └── ejercicios │ │ └── ejercicios.md └── target │ └── classes │ ├── META-INF │ ├── MANIFEST.MF │ └── maven │ │ └── com.coderhouse │ │ └── clase-02 │ │ ├── pom.properties │ │ └── pom.xml │ ├── com │ └── coderhouse │ │ └── Clase02.class │ └── ejercicios │ └── ejercicios.md ├── clase-03 ├── .classpath ├── .project ├── .settings │ ├── org.eclipse.jdt.apt.core.prefs │ ├── org.eclipse.jdt.core.prefs │ └── org.eclipse.m2e.core.prefs ├── pom.xml ├── src │ └── main │ │ ├── ejercicios │ │ └── ejercicios_clase03.md │ │ └── java │ │ └── com │ │ └── coderhouse │ │ └── Clase03.java └── target │ └── classes │ ├── META-INF │ ├── MANIFEST.MF │ └── maven │ │ └── com.coderhouse │ │ └── clase-03 │ │ ├── pom.properties │ │ └── pom.xml │ └── com │ └── coderhouse │ └── Clase03.class ├── clase-04 ├── .classpath ├── .project ├── .settings │ ├── org.eclipse.jdt.apt.core.prefs │ ├── org.eclipse.jdt.core.prefs │ └── org.eclipse.m2e.core.prefs ├── pom.xml ├── src │ └── main │ │ └── java │ │ ├── com │ │ └── coderhouse │ │ │ ├── Clase01.java │ │ │ └── objetos │ │ │ └── Perro.java │ │ └── ejercicios │ │ └── ejercicios.md └── target │ └── classes │ ├── META-INF │ ├── MANIFEST.MF │ └── maven │ │ └── com.coderhouse │ │ └── clase-04 │ │ ├── pom.properties │ │ └── pom.xml │ ├── com │ └── coderhouse │ │ ├── Clase01.class │ │ └── objetos │ │ └── Perro.class │ └── ejercicios │ └── ejercicios.md ├── clase-05 ├── pom.xml └── src │ └── main │ └── java │ ├── Main.java │ ├── com │ └── coderhouse │ │ ├── banco │ │ ├── CajaDeAhorro.java │ │ ├── Cuenta.java │ │ ├── CuentaCorriente.java │ │ └── Persona.java │ │ └── herencia │ │ ├── Animal.java │ │ ├── Gato.java │ │ └── Perro.java │ ├── ejercicios │ └── ejercicios.md │ └── teoria │ └── teoria.md ├── clase-06 ├── pom.xml └── src │ └── main │ └── java │ ├── com │ └── coderhouse │ │ ├── Main.java │ │ ├── abstractas │ │ └── Vehiculo.java │ │ ├── entidades │ │ ├── AnimalTerreste.java │ │ ├── Auto.java │ │ ├── Ave.java │ │ ├── Perro.java │ │ └── Personas.java │ │ ├── interfaces │ │ ├── AccionesInterface.java │ │ ├── CRUDInterface.java │ │ └── SerVivoInterface.java │ │ └── sobrecarga │ │ └── Impresora.java │ └── ejercicios │ └── ejercicios.md ├── clase-07 ├── pom.xml └── src │ └── main │ └── resources │ ├── ejercicios-sql.docx │ ├── querys.sql │ ├── querys_after.sql │ ├── querys_relaciones.sql │ └── querys_sql.sql ├── clase-08 ├── .gitattributes ├── .gitignore ├── .mvn │ └── wrapper │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── coderhouse │ │ ├── Clase08Application.java │ │ ├── dao │ │ └── DaoFactory.java │ │ ├── modelos │ │ ├── Alumno.java │ │ └── Curso.java │ │ └── models │ │ ├── Pasaporte.java │ │ └── Persona.java │ └── resources │ ├── application.properties │ └── resumen.md ├── clase-09 ├── .gitattributes ├── .gitignore ├── .mvn │ └── wrapper │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── coderhouse │ │ ├── Clase09Application.java │ │ ├── dao │ │ └── DaoFactory.java │ │ └── modelos │ │ ├── Alumno.java │ │ ├── Categoria.java │ │ └── Curso.java │ ├── querys.sql │ └── resources │ ├── application.properties │ └── resumen.md ├── clase-10 ├── .gitattributes ├── .gitignore ├── .mvn │ └── wrapper │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── coderhouse │ │ │ ├── Clase10Application.java │ │ │ ├── controllers │ │ │ ├── AlumnoController.java │ │ │ ├── CategoriaController.java │ │ │ └── CursoController.java │ │ │ ├── models │ │ │ ├── Alumno.java │ │ │ ├── Categoria.java │ │ │ └── Curso.java │ │ │ └── repositories │ │ │ ├── AlumnoRepository.java │ │ │ ├── CategoriaRepository.java │ │ │ └── CursosRepository.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── coderhouse │ └── Clase10ApplicationTests.java ├── clase-11 ├── .gitattributes ├── .gitignore ├── .mvn │ └── wrapper │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── coderhouse │ │ ├── Clase11Application.java │ │ ├── controllers │ │ ├── AlumnoController.java │ │ ├── CategoriaController.java │ │ └── CursoController.java │ │ ├── models │ │ ├── Alumno.java │ │ ├── Categoria.java │ │ └── Curso.java │ │ ├── repositories │ │ ├── AlumnoRepository.java │ │ ├── CategoriaRepository.java │ │ └── CursosRepository.java │ │ └── services │ │ ├── AlumnoService.java │ │ ├── CategoriaService.java │ │ └── CursoService.java │ └── resources │ └── application.properties ├── clase-12 ├── .gitattributes ├── .gitignore ├── .mvn │ └── wrapper │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── coderhouse │ │ ├── Clase12Application.java │ │ ├── apis │ │ └── UserRestApi.java │ │ ├── controllers │ │ ├── AlumnoController.java │ │ ├── CategoriaController.java │ │ ├── CursoController.java │ │ └── UserController.java │ │ ├── dtos │ │ ├── AsignacionCategoriaDTO.java │ │ └── InscripcionDTO.java │ │ ├── interfaces │ │ └── UserRestInterface.java │ │ ├── models │ │ ├── Alumno.java │ │ ├── Categoria.java │ │ ├── Curso.java │ │ └── User.java │ │ ├── repositories │ │ ├── AlumnoRepository.java │ │ ├── CategoriaRepository.java │ │ └── CursosRepository.java │ │ └── services │ │ ├── AlumnoService.java │ │ ├── CategoriaService.java │ │ ├── CursoService.java │ │ └── UserService.java │ └── resources │ └── application.properties ├── clase-13 ├── .gitattributes ├── .gitignore ├── .mvn │ └── wrapper │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── coderhouse │ │ ├── Clase13Application.java │ │ ├── apis │ │ └── UserRestApi.java │ │ ├── controller │ │ └── UserController.java │ │ ├── interfaces │ │ └── UserRestInterface.java │ │ ├── models │ │ └── User.java │ │ └── services │ │ └── UserService.java │ └── resources │ ├── application.properties │ └── resumen.md ├── clase-14 ├── .gitattributes ├── .gitignore ├── .mvn │ └── wrapper │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── coderhouse │ │ ├── Clase14Application.java │ │ ├── apis │ │ └── UserRestApi.java │ │ ├── config │ │ └── OpenApiConfig.java │ │ ├── controllers │ │ ├── AlumnoController.java │ │ ├── CategoriaController.java │ │ ├── CursoController.java │ │ └── UserController.java │ │ ├── dtos │ │ ├── AsignacionCategoriaDTO.java │ │ └── InscripcionDTO.java │ │ ├── interfaces │ │ ├── DAOInterface.java │ │ └── UserRestInterface.java │ │ ├── models │ │ ├── Alumno.java │ │ ├── Categoria.java │ │ ├── Curso.java │ │ └── User.java │ │ ├── repositories │ │ ├── AlumnoRepository.java │ │ ├── CategoriaRepository.java │ │ └── CursosRepository.java │ │ └── services │ │ ├── AlumnoService.java │ │ ├── CategoriaService.java │ │ ├── CursoService.java │ │ └── UserService.java │ └── resources │ ├── application.properties │ └── colecciones │ ├── Alumnos.postman_collection.json │ ├── Categorias.postman_collection.json │ ├── Cursos.postman_collection.json │ ├── Time API.postman_collection.json │ └── Users API.postman_collection.json ├── clase-15 ├── .gitattributes ├── .gitignore ├── .mvn │ └── wrapper │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── coderhouse │ │ ├── Clase15Application.java │ │ ├── apis │ │ └── UserRestApi.java │ │ ├── config │ │ └── OpenApiConfig.java │ │ ├── controllers │ │ ├── AlumnoController.java │ │ ├── CategoriaController.java │ │ ├── CursoController.java │ │ ├── FechaController.java │ │ └── UserController.java │ │ ├── dtos │ │ ├── AsignacionCategoriaDTO.java │ │ ├── InscripcionDTO.java │ │ └── TimeResponseDTO.java │ │ ├── interfaces │ │ ├── DAOInterface.java │ │ └── UserRestInterface.java │ │ ├── models │ │ ├── Alumno.java │ │ ├── Categoria.java │ │ ├── Curso.java │ │ └── User.java │ │ ├── repositories │ │ ├── AlumnoRepository.java │ │ ├── CategoriaRepository.java │ │ └── CursosRepository.java │ │ └── services │ │ ├── AlumnoService.java │ │ ├── CategoriaService.java │ │ ├── CursoService.java │ │ ├── FechaService.java │ │ └── UserService.java │ └── resources │ ├── application.properties │ ├── colecciones │ ├── Alumnos.postman_collection.json │ ├── Categorias.postman_collection.json │ ├── Cursos.postman_collection.json │ ├── Time API.postman_collection.json │ └── Users API.postman_collection.json │ └── teoria.md ├── final-proyect ├── 001.png ├── 002.png ├── 003.png ├── 004.png ├── 005.png └── 006.png ├── mvnw.cmd ├── pom.xml └── ventas-online-modelo-final ├── .gitignore ├── .mvn └── wrapper │ ├── MavenWrapperDownloader.java │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── .vs ├── VSWorkspaceState.json └── ventas-online │ └── v16 │ └── .suo ├── Notas.txt ├── mvnw ├── mvnw.cmd ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── coder │ │ └── house │ │ └── ventas │ │ └── online │ │ └── ventasonline │ │ ├── GFG.java │ │ ├── VentasOnlineApplication.java │ │ ├── controller │ │ ├── ClienteController.java │ │ ├── ComprobanteController.java │ │ └── ProductoController.java │ │ ├── entidad │ │ ├── Cliente.java │ │ ├── Comprobante.java │ │ ├── ComprobanteDTO.java │ │ ├── Linea.java │ │ ├── LineaDTO.java │ │ ├── Producto.java │ │ └── WorldClock.java │ │ ├── repository │ │ ├── ClienteRepository.java │ │ ├── ComprobanteRepository.java │ │ └── ProductoRepository.java │ │ └── service │ │ ├── ClienteService.java │ │ ├── ComprobanteService.java │ │ └── ProductoService.java ├── postman │ └── CoderHouse.postman_collection.json ├── resources │ └── application.properties └── sql │ └── create.sql └── test └── java └── com └── coder └── house └── ventas └── online └── ventasonline └── VentasOnlineApplicationTests.java /.gitattributes: -------------------------------------------------------------------------------- 1 | /mvnw text eol=lf 2 | *.cmd text eol=crlf 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.metadata/ 2 | HELP.md 3 | target/ 4 | !.mvn/wrapper/maven-wrapper.jar 5 | !**/src/main/**/target/ 6 | !**/src/test/**/target/ 7 | 8 | ### STS ### 9 | .apt_generated 10 | .classpath 11 | .factorypath 12 | .project 13 | .settings 14 | .springBeans 15 | .sts4-cache 16 | 17 | ### IntelliJ IDEA ### 18 | .idea 19 | *.iws 20 | *.iml 21 | *.ipr 22 | 23 | ### NetBeans ### 24 | /nbproject/private/ 25 | /nbbuild/ 26 | /dist/ 27 | /nbdist/ 28 | /.nb-gradle/ 29 | build/ 30 | !**/src/main/**/build/ 31 | !**/src/test/**/build/ 32 | .metadata 33 | languageServers-log 34 | 35 | ### VS Code ### 36 | .vscode/ 37 | 38 | ### Servers 39 | Servers 40 | /Servers 41 | */Servers 42 | 43 | */logs/ 44 | /logs/ 45 | logs/ 46 | 47 | Dockerfile 48 | /Dockerfile 49 | */Dockerfile* 50 | fly.toml 51 | /fly.toml 52 | */*.toml* -------------------------------------------------------------------------------- /.metadata/.mylyn/repositories.xml.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/.metadata/.mylyn/repositories.xml.zip -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.location: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.location -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index: -------------------------------------------------------------------------------- 1 | /org.eclipse.core.resourcescontentCacheState2contentCacheTimestamp@15b919290330d2470b6d4c924c20cfc5a9df7374d41e3a22066b73fbe2374ef7org.eclipse.jdt.corestateVersionNumber38org.eclipse.jst.jsp.core+org.eclipse.jst.jsp.core.taglib.TaglibIndexCLEANorg.eclipse.wst.jsdt.corestateVersionNumber21 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/Docker.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | runTargets-v2= 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding=UTF-8 3 | version=1 4 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.debug.ui.Color=191,25,59 3 | org.eclipse.debug.ui.MemoryHistoryKnownColor=235,235,235 4 | org.eclipse.debug.ui.MemoryHistoryUnknownColor=176,176,176 5 | org.eclipse.debug.ui.PREF_CHANGED_VALUE_BACKGROUND=127,68,97 6 | org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=\r\n\r\n 7 | org.eclipse.debug.ui.cancel_launch_with_compile_errors=always 8 | org.eclipse.debug.ui.changedDebugElement=255,128,128 9 | org.eclipse.debug.ui.consoleBackground=23,23,23 10 | org.eclipse.debug.ui.errorColor=0,255,0 11 | org.eclipse.debug.ui.inColor=208,208,208 12 | org.eclipse.debug.ui.outColor=208,208,208 13 | overriddenByCSS=,org.eclipse.debug.ui.Color,org.eclipse.debug.ui.MemoryHistoryKnownColor,org.eclipse.debug.ui.MemoryHistoryUnknownColor,org.eclipse.debug.ui.PREF_CHANGED_VALUE_BACKGROUND,org.eclipse.debug.ui.changedDebugElement,org.eclipse.debug.ui.consoleBackground,org.eclipse.debug.ui.errorColor,org.eclipse.debug.ui.inColor,org.eclipse.debug.ui.outColor, 14 | preferredTargets=default,org.eclipse.lsp4e.debug.toggleBreakpointTarget\:default|org.eclipse.lsp4e.debug.toggleBreakpointTarget\:org.eclipse.lsp4e.debug.toggleBreakpointTarget| 15 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.egit.core.prefs: -------------------------------------------------------------------------------- 1 | GitRepositoriesView.GitDirectories=E\:\\java_59570\\.git; 2 | GitRepositoriesView.GitDirectories.relative=.git; 3 | core_autoIgnoreDerivedResources=false 4 | eclipse.preferences.version=1 5 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.classpathVariable.M2_REPO=C\:/Users/addis/.m2/repository 3 | org.eclipse.jdt.core.codeComplete.visibilityCheck=enabled 4 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 5 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=21 6 | org.eclipse.jdt.core.compiler.compliance=21 7 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 8 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 9 | org.eclipse.jdt.core.compiler.release=enabled 10 | org.eclipse.jdt.core.compiler.source=21 11 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.debug.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.debug.ui.prompt_unable_to_install_breakpoint=false 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.junit.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.junit.content_assist_favorite_static_members_migrated=true 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.launching.PREF_VM_XML=\r\n\r\n \r\n \r\n \r\n \r\n\r\n 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jsch.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jsch.core.hasChangedDefaultWin32SshHome=true 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jst.j2ee.webservice.ui.prefs: -------------------------------------------------------------------------------- 1 | areThereWebServices=false 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.m2e.apt.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.m2e.apt.mode=jdt_apt 3 | org.springframework.ide.eclipse.boot.customised=true 4 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.context.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | mylyn.attention.migrated=true 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.monitor.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.mylyn.monitor.activity.tracking.enabled.checked=true 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.tasks.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | migrated.task.repositories.secure.store=true 3 | org.eclipse.mylyn.tasks.ui.filters.nonmatching=true 4 | org.eclipse.mylyn.tasks.ui.filters.nonmatching.encouraged=true 5 | org.eclipse.mylyn.tasks.ui.welcome.message=true 6 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.pde.api.tools.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | knownEEFragments= 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.navigator.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.ui.navigator.ProjectExplorer.filterActivation=\:org.eclipse.jdt.java.ui.filters.HidePackageDeclaration\:org.eclipse.jdt.java.ui.filters.HideOutputFolder\:org.eclipse.buildship.ui.navigator.filter.gradle.subProject\:org.eclipse.ui.navigator.resources.nested.HideTopLevelProjectIfNested\:org.eclipse.buildship.ui.navigator.filter.gradle.buildfolder\:org.eclipse.jdt.java.ui.filters.HideEmptyInnerPackages\:org.eclipse.jst.j2ee.navigator.ui.filters.jetemitters\:org.eclipse.jdt.java.ui.filters.HideInnerClassFiles\:org.eclipse.ui.navigator.resources.filters.startsWithDot\:org.eclipse.jdt.java.ui.filters.HideEmptyLibraryContainers\:org.eclipse.jdt.java.ui.filters.HideImportDeclaration\:org.eclipse.jdt.java.ui.filters.HideSyntheticMembers\:org.eclipse.mylyn.tasks.ui.navigator.filters.tasks\:org.eclipse.ui.navigator.resources.nested.HideFolderWhenProjectIsShownAsNested\: 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | showIntro=false 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.urischeme.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | processedSchemes=,eclipse+mpc,eclipse+command 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.wst.ws.service.policy.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.wst.ws.service.policy.ui.servicepols.wsiprofilecomp.wsiap.defaultProtocol=http\://schemas.xmlsoap.org/wsdl/soap/ 3 | org.eclipse.wst.ws.service.policy.ui.servicepols.wsiprofilecomp.wsissbp.defaultProtocol=http\://schemas.xmlsoap.org/wsdl/soap/ 4 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.springframework.ide.eclipse.imports.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.springframework.ide.eclipse.imports.importStaticsInstanceScope=true 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.springsource.ide.eclipse.commons.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | egit.pref.fixed.core_autoIgnoreDerivedResources=true 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.debug.core/.launches/Clase01.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.egit.core/.org.eclipse.egit.core.cmp/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | .org.eclipse.egit.core.cmp 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.egit.core/.org.eclipse.egit.core.cmp/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/1865797976.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/.metadata/.plugins/org.eclipse.jdt.core/1865797976.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/.metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/javaLikeNames.txt: -------------------------------------------------------------------------------- 1 | java -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.launching/.install.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.launching/libraryInfos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/.workspace/2024/9/39/refactorings.history: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/.workspace/2024/9/39/refactorings.index: -------------------------------------------------------------------------------- 1 | 1727220674054 Delete resource 'clase-01' 2 | 1727372929218 Delete resource 'clase-02' 3 | 1727375781051 Delete resource 'clase-02' 4 | 1727390810551 Rename resource 'clase-01' 5 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.m2e.core/workspaceState.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/.metadata/.plugins/org.eclipse.m2e.core/workspaceState.ser -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.m2e.logback/logback.2.2.1.20231030-1438.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %date [%thread] %-5level %logger{35} - %msg%n 5 | 6 | 7 | ${org.eclipse.m2e.log.console.threshold:-OFF} 8 | 9 | 10 | 11 | 12 | ${org.eclipse.m2e.log.dir}/0.log 13 | 14 | ${org.eclipse.m2e.log.dir}/%i.log 15 | 1 16 | 10 17 | 18 | 19 | 10MB 20 | 21 | 22 | %date [%thread] %-5level %logger{35} - %msg%n 23 | 24 | 25 | 26 | 27 | 28 | WARN 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.oomph.setup/workspace.setup: -------------------------------------------------------------------------------- 1 | 2 | 7 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.tm.terminal.view.ui/.executables/data.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 24 20:33:24 ART 2024 2 | 0.Args=--login -i 3 | 0.Icon=C\:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico 4 | 0.Name=Git Bash 5 | 0.Path=C\:\\Program Files\\Git\\bin\\sh.exe 6 | 0.Translate=true 7 | 1.Args=--distribution Ubuntu 8 | 1.Name=Ubuntu (WSL) 9 | 1.Path=C\:\\WINDOWS\\System32\\wsl.exe 10 | 1.Translate=true 11 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.ui.intro/introstate: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.wst.jsdt.core/externalLibsTimeStamps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/.metadata/.plugins/org.eclipse.wst.jsdt.core/externalLibsTimeStamps -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.wst.jsdt.core/variablesAndContainers.dat: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.wst.sse.core/task-tags.properties: -------------------------------------------------------------------------------- 1 | # 2 | #Wed Nov 20 16:52:47 GMT-03:00 2024 3 | task-tag-projects-already-scanned=clase-09,afterclass-01,clase-07,clase-08,clase-05,clase-06,clase-03,clase-14,clase-04,clase-15,clase-01,clase-12,clase-02,clase-13,clase-10,clase-00,clase-11 4 | -------------------------------------------------------------------------------- /.metadata/version.ini: -------------------------------------------------------------------------------- 1 | #Wed Nov 20 16:52:27 GMT-03:00 2024 2 | org.eclipse.core.runtime=2 3 | org.eclipse.platform=4.33.0.v20240903-0240 4 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip 20 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Alejandro Daniel Di Stefano 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /afterclass-01/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.coderhouse 4 | afterclass-01 5 | 0.0.1-SNAPSHOT 6 | -------------------------------------------------------------------------------- /clase-00/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | clase-00 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | 25 | 1727820244417 26 | 27 | 30 28 | 29 | org.eclipse.core.resources.regexFilterMatcher 30 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /clase-00/.settings/org.eclipse.jdt.apt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.apt.aptEnabled=false 3 | -------------------------------------------------------------------------------- /clase-00/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 3 | org.eclipse.jdt.core.compiler.compliance=11 4 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 5 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 6 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore 7 | org.eclipse.jdt.core.compiler.processAnnotations=disabled 8 | org.eclipse.jdt.core.compiler.release=disabled 9 | org.eclipse.jdt.core.compiler.source=11 10 | -------------------------------------------------------------------------------- /clase-00/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /clase-00/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.coderhouse 6 | clase-01 7 | 0.0.1-SNAPSHOT 8 | clase-01 9 | 10 | 11 11 | 11 12 | 13 | -------------------------------------------------------------------------------- /clase-00/src/main/java/com/coderhouse/Clase01.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse; 2 | 3 | public class Clase01 { 4 | 5 | public static void main(String[] args) { 6 | System.out.println("Hello World.!!"); 7 | System.out.println("Coderhouse | Comision #59570"); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /clase-00/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Build-Jdk-Spec: 23 3 | Created-By: Maven Integration for Eclipse 4 | 5 | -------------------------------------------------------------------------------- /clase-00/target/classes/META-INF/maven/com.coderhouse/clase-01/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Nov 14 19:03:32 GMT-03:00 2024 3 | artifactId=clase-01 4 | groupId=com.coderhouse 5 | m2e.projectLocation=E\:\\java_59570\\clase-00 6 | m2e.projectName=clase-00 7 | version=0.0.1-SNAPSHOT 8 | -------------------------------------------------------------------------------- /clase-00/target/classes/META-INF/maven/com.coderhouse/clase-01/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.coderhouse 6 | clase-01 7 | 0.0.1-SNAPSHOT 8 | clase-01 9 | 10 | 11 11 | 11 12 | 13 | -------------------------------------------------------------------------------- /clase-00/target/classes/com/coderhouse/Clase01.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/clase-00/target/classes/com/coderhouse/Clase01.class -------------------------------------------------------------------------------- /clase-01/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | -------------------------------------------------------------------------------- /clase-01/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | clase-01 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | 25 | 1727820244399 26 | 27 | 30 28 | 29 | org.eclipse.core.resources.regexFilterMatcher 30 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /clase-01/.settings/org.eclipse.jdt.apt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.apt.aptEnabled=false 3 | -------------------------------------------------------------------------------- /clase-01/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=21 3 | org.eclipse.jdt.core.compiler.compliance=21 4 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 5 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 6 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore 7 | org.eclipse.jdt.core.compiler.processAnnotations=disabled 8 | org.eclipse.jdt.core.compiler.release=disabled 9 | org.eclipse.jdt.core.compiler.source=21 10 | -------------------------------------------------------------------------------- /clase-01/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /clase-01/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.coderhouse 4 | clase-01 5 | 0.0.1-SNAPSHOT 6 | 7 | 21 8 | 21 9 | 10 | -------------------------------------------------------------------------------- /clase-01/src/main/java/com/coderhouse/inicio/Clase01.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.inicio; 2 | 3 | public class Clase01 { 4 | 5 | public static void main(String[] args) { 6 | // Declaracion de variables 7 | 8 | /*int variableA = 1000; 9 | 10 | byte variableB = 12; 11 | 12 | /*var numero = 1; 13 | numero = 10;*/ 14 | 15 | /*String numeroA = "Hola"; 16 | 17 | char letra = '@'; 18 | String letraA = "b"; 19 | 20 | String letraB = "dfsfsd"; 21 | 22 | //System.out.println("El resultado es: " + (variableA + variableB)); 23 | 24 | System.out.println(variableA);*/ 25 | /* 26 | float numero1 = 10f; 27 | float numero2 = 12f; 28 | float resultado; 29 | 30 | // Calculadora 31 | 32 | resultado = numero1 / numero2; 33 | 34 | System.out.println("El resultado es: " + resultado); 35 | */ 36 | 37 | // Incrementos 38 | int contador = 1; 39 | 40 | System.out.println(contador); 41 | contador = contador + 1; 42 | System.out.println(contador); 43 | contador = contador + 1; 44 | System.out.println(contador); 45 | contador--; 46 | System.out.println(contador); 47 | contador--; 48 | System.out.println(contador); 49 | 50 | // contador == contador; Con esto comparo el valor de dos variables 51 | // contador === contador; Con esto comparo el valor y el tipo de dos variables 52 | 53 | 54 | 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /clase-02/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | clase-02 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | 25 | 1727827797983 26 | 27 | 30 28 | 29 | org.eclipse.core.resources.regexFilterMatcher 30 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /clase-02/.settings/org.eclipse.jdt.apt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.apt.aptEnabled=false 3 | -------------------------------------------------------------------------------- /clase-02/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=21 3 | org.eclipse.jdt.core.compiler.compliance=21 4 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 5 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 6 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore 7 | org.eclipse.jdt.core.compiler.processAnnotations=disabled 8 | org.eclipse.jdt.core.compiler.release=disabled 9 | org.eclipse.jdt.core.compiler.source=21 10 | -------------------------------------------------------------------------------- /clase-02/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /clase-02/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.coderhouse 6 | clase-02 7 | 0.0.1-SNAPSHOT 8 | 9 | 21 10 | 21 11 | 12 | -------------------------------------------------------------------------------- /clase-02/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Build-Jdk-Spec: 23 3 | Created-By: Maven Integration for Eclipse 4 | 5 | -------------------------------------------------------------------------------- /clase-02/target/classes/META-INF/maven/com.coderhouse/clase-02/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Wed Nov 20 16:56:07 GMT-03:00 2024 3 | artifactId=clase-02 4 | groupId=com.coderhouse 5 | m2e.projectLocation=E\:\\java_59570\\clase-02 6 | m2e.projectName=clase-02 7 | version=0.0.1-SNAPSHOT 8 | -------------------------------------------------------------------------------- /clase-02/target/classes/META-INF/maven/com.coderhouse/clase-02/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.coderhouse 6 | clase-02 7 | 0.0.1-SNAPSHOT 8 | 9 | 21 10 | 21 11 | 12 | -------------------------------------------------------------------------------- /clase-02/target/classes/com/coderhouse/Clase02.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/clase-02/target/classes/com/coderhouse/Clase02.class -------------------------------------------------------------------------------- /clase-03/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | clase-03 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | 25 | 1728433005520 26 | 27 | 30 28 | 29 | org.eclipse.core.resources.regexFilterMatcher 30 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /clase-03/.settings/org.eclipse.jdt.apt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.apt.aptEnabled=false 3 | -------------------------------------------------------------------------------- /clase-03/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 3 | org.eclipse.jdt.core.compiler.compliance=1.8 4 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 5 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 6 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore 7 | org.eclipse.jdt.core.compiler.processAnnotations=disabled 8 | org.eclipse.jdt.core.compiler.release=disabled 9 | org.eclipse.jdt.core.compiler.source=1.8 10 | -------------------------------------------------------------------------------- /clase-03/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /clase-03/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.coderhouse 4 | clase-03 5 | 0.0.1-SNAPSHOT 6 | -------------------------------------------------------------------------------- /clase-03/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Build-Jdk-Spec: 23 3 | Created-By: Maven Integration for Eclipse 4 | 5 | -------------------------------------------------------------------------------- /clase-03/target/classes/META-INF/maven/com.coderhouse/clase-03/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Nov 14 19:03:32 GMT-03:00 2024 3 | artifactId=clase-03 4 | groupId=com.coderhouse 5 | m2e.projectLocation=E\:\\java_59570\\clase-03 6 | m2e.projectName=clase-03 7 | version=0.0.1-SNAPSHOT 8 | -------------------------------------------------------------------------------- /clase-03/target/classes/META-INF/maven/com.coderhouse/clase-03/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.coderhouse 4 | clase-03 5 | 0.0.1-SNAPSHOT 6 | -------------------------------------------------------------------------------- /clase-03/target/classes/com/coderhouse/Clase03.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/clase-03/target/classes/com/coderhouse/Clase03.class -------------------------------------------------------------------------------- /clase-04/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | clase-04 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | 25 | 1728433005533 26 | 27 | 30 28 | 29 | org.eclipse.core.resources.regexFilterMatcher 30 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /clase-04/.settings/org.eclipse.jdt.apt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.apt.aptEnabled=false 3 | -------------------------------------------------------------------------------- /clase-04/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 3 | org.eclipse.jdt.core.compiler.compliance=1.8 4 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 5 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 6 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore 7 | org.eclipse.jdt.core.compiler.processAnnotations=disabled 8 | org.eclipse.jdt.core.compiler.release=disabled 9 | org.eclipse.jdt.core.compiler.source=1.8 10 | -------------------------------------------------------------------------------- /clase-04/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /clase-04/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.coderhouse 4 | clase-04 5 | 0.0.1-SNAPSHOT 6 | -------------------------------------------------------------------------------- /clase-04/src/main/java/com/coderhouse/Clase01.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse; 2 | 3 | import com.coderhouse.objetos.Perro; 4 | 5 | public class Clase01 { 6 | 7 | public static void main(String[] args) throws Exception { 8 | /* 9 | Perro primerPerro = new Perro(); 10 | 11 | primerPerro.nombre = "Firulay"; 12 | primerPerro.color = "Marron"; 13 | primerPerro.edad = 3; 14 | primerPerro.raza = "Caniche"; 15 | primerPerro.tamanio = "Chico"; 16 | 17 | primerPerro.setNombre("Firulay"); 18 | primerPerro.setColor("Marron"); 19 | 20 | primerPerro.ladrar(); 21 | primerPerro.caminar(); 22 | */ 23 | 24 | /* 25 | String[] nombres = new String[] { 26 | "Lorena", 27 | "Alejandro", 28 | "Tristan", 29 | "Luis", 30 | "Valentin", 31 | "Angel" 32 | }; 33 | 34 | imprimirListaDeNombres(nombres); 35 | 36 | sumarNumeros(5, 66); 37 | */ 38 | 39 | Perro primerPerro = new Perro(); 40 | 41 | try { 42 | 43 | 44 | primerPerro.setNombre("Firulay"); 45 | primerPerro.setColor("Marron"); 46 | primerPerro.setRaza("Caniche"); 47 | primerPerro.setTamanio("Chico"); 48 | primerPerro.setEdad(10); 49 | 50 | //System.out.println("Perro: " + primerPerro); 51 | 52 | } catch (Exception e) { 53 | e.printStackTrace(); 54 | } 55 | 56 | /* 57 | private static void imprimirListaDeNombres(String[] nombresDePersonas) { 58 | for (String nombre : nombresDePersonas) { 59 | System.out.println("Nombre: " + nombre); 60 | } 61 | } 62 | 63 | private static void sumarNumeros(int numeroA, int numeroB) { 64 | System.out.println("La suma entre " + numeroA + " y " + numeroB + " es de: " + (numeroA + numeroB)); 65 | }; 66 | */ 67 | double radio = 4d; 68 | 69 | System.out.println("El area del Circulo con radio\n " + radio + " es igual a: " 70 | + calcularAreaDeUnCurculo(radio)); 71 | 72 | 73 | } 74 | static final double PI; 75 | static final double PO; 76 | static {PI = 3.141592653589793237; PO = 4.32;}; 77 | 78 | private static double calcularAreaDeUnCurculo(double radio) { 79 | return PI * Math.pow(radio, 2); 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /clase-04/src/main/java/com/coderhouse/objetos/Perro.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.objetos; 2 | 3 | public class Perro { 4 | 5 | private static final int EDAD_MAXIMA = 15; // Constante 6 | 7 | // Atributos o Variables de Clase 8 | private String nombre; 9 | private String raza; 10 | private String color; 11 | private String tamanio; 12 | private int edad; 13 | 14 | String mensajeDeError = "El Perro no vive mas de " + EDAD_MAXIMA + " Años de Edad"; 15 | 16 | // Metodos 17 | public void ladrar() { 18 | System.out.println(getNombre() + " está ladrando.!"); 19 | } 20 | 21 | public void caminar() { 22 | System.out.println(getNombre() + " está caminando.!"); 23 | } 24 | 25 | // Getters and Setter 26 | 27 | public String getNombre() { 28 | return this.nombre; 29 | } 30 | 31 | public void setNombre(String nombre) { 32 | this.nombre = nombre; 33 | } 34 | 35 | public String getRaza() { 36 | return this.raza; 37 | } 38 | 39 | public void setRaza(String raza) { 40 | this.raza = raza; 41 | } 42 | 43 | public String getColor() { 44 | return this.color; 45 | } 46 | 47 | public void setColor(String color) { 48 | this.color = color; 49 | } 50 | 51 | public String getTamanio() { 52 | return this.tamanio; 53 | } 54 | 55 | public void setTamanio(String tamanio) { 56 | this.tamanio = tamanio; 57 | } 58 | 59 | public int getEdad() { 60 | return this.edad; 61 | } 62 | 63 | 64 | public void setEdad(int edad) throws Exception { // Arroja una Excepcion 65 | if (edad > EDAD_MAXIMA) { 66 | throw new Exception(mensajeDeError); 67 | } else { 68 | this.edad = edad; 69 | } 70 | 71 | } 72 | 73 | @Override 74 | public String toString() { 75 | return "Perro [nombre=" + nombre + ", raza=" + raza + ", color=" + color + ", tamanio=" + tamanio + ", edad=" 76 | + edad + "\n" + mensajeDeError; 77 | } 78 | 79 | 80 | } 81 | -------------------------------------------------------------------------------- /clase-04/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Build-Jdk-Spec: 23 3 | Created-By: Maven Integration for Eclipse 4 | 5 | -------------------------------------------------------------------------------- /clase-04/target/classes/META-INF/maven/com.coderhouse/clase-04/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Nov 14 19:03:32 GMT-03:00 2024 3 | artifactId=clase-04 4 | groupId=com.coderhouse 5 | m2e.projectLocation=E\:\\java_59570\\clase-04 6 | m2e.projectName=clase-04 7 | version=0.0.1-SNAPSHOT 8 | -------------------------------------------------------------------------------- /clase-04/target/classes/META-INF/maven/com.coderhouse/clase-04/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.coderhouse 4 | clase-04 5 | 0.0.1-SNAPSHOT 6 | -------------------------------------------------------------------------------- /clase-04/target/classes/com/coderhouse/Clase01.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/clase-04/target/classes/com/coderhouse/Clase01.class -------------------------------------------------------------------------------- /clase-04/target/classes/com/coderhouse/objetos/Perro.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/clase-04/target/classes/com/coderhouse/objetos/Perro.class -------------------------------------------------------------------------------- /clase-05/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.coderhouse 4 | clase-05 5 | 0.0.1-SNAPSHOT 6 | -------------------------------------------------------------------------------- /clase-05/src/main/java/com/coderhouse/banco/CajaDeAhorro.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.banco; 2 | 3 | public class CajaDeAhorro extends Cuenta { 4 | 5 | @Override 6 | public void abrirCuenta() { 7 | System.out.println(getTitular() + " abrio una Caja de Ahorro Simple"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /clase-05/src/main/java/com/coderhouse/banco/Cuenta.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.banco; 2 | 3 | public class Cuenta { 4 | 5 | private int numero; 6 | private double saldo; 7 | private Persona titular; 8 | 9 | 10 | public void abrirCuenta() { 11 | System.out.println(getTitular() + " abrio una Cuenta"); 12 | } 13 | 14 | public void verSaldo(){ 15 | System.out.println("El saldo de la cuenta es: " + getSaldo()); 16 | } 17 | 18 | public void transferir() { 19 | System.out.println(getTitular() + " hizo una transferencia"); 20 | } 21 | 22 | public int getNumero() { 23 | return this.numero; 24 | } 25 | 26 | public void setNumero(int numero) { 27 | this.numero = numero; 28 | } 29 | 30 | public double getSaldo() { 31 | return this.saldo; 32 | } 33 | 34 | public void setSaldo(double saldo) { 35 | this.saldo = saldo; 36 | } 37 | 38 | public Persona getTitular() { 39 | return this.titular; 40 | } 41 | 42 | public void setTitular(Persona titular) { 43 | this.titular = titular; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return "Cuenta [numero=" + numero + ", saldo=" + saldo + ", titular=" + titular + "]"; 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /clase-05/src/main/java/com/coderhouse/banco/CuentaCorriente.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.banco; 2 | 3 | public class CuentaCorriente extends Cuenta { 4 | 5 | @Override 6 | public void abrirCuenta() { 7 | System.out.println(getTitular() + " abrio una Cuenta Corriente"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /clase-05/src/main/java/com/coderhouse/banco/Persona.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.banco; 2 | 3 | public class Persona { 4 | 5 | private String titular; 6 | private int dni; 7 | 8 | 9 | public String getTitular() { 10 | return this.titular; 11 | } 12 | public void setTitular(String titular) { 13 | this.titular = titular; 14 | } 15 | public int getDni() { 16 | return this.dni; 17 | } 18 | public void setDni(int dni) { 19 | this.dni = dni; 20 | } 21 | @Override 22 | public String toString() { 23 | return "Persona [titular=" + titular + ", dni=" + dni + "]"; 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /clase-05/src/main/java/com/coderhouse/herencia/Animal.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.herencia; 2 | 3 | import java.util.Objects; 4 | 5 | public class Animal { 6 | 7 | private String nombre; 8 | private String raza; 9 | private int edad; 10 | private boolean mamifero; 11 | private String alimentacion; 12 | 13 | public void caminar() { 14 | System.out.println(getNombre() + " esta Caminando.!"); 15 | } 16 | 17 | public void comer() { 18 | System.out.println(getNombre() + " esta Comiendo.!"); 19 | } 20 | 21 | public void hacerSonido() { 22 | System.out.println(getNombre() + " esta haciendo un Sonido.!"); 23 | } 24 | 25 | public String getNombre() { 26 | return this.nombre; 27 | } 28 | 29 | public void setNombre(String nombre) { 30 | this.nombre = nombre; 31 | } 32 | 33 | public String getRaza() { 34 | return this.raza; 35 | } 36 | 37 | public void setRaza(String raza) { 38 | this.raza = raza; 39 | } 40 | 41 | public int getEdad() { 42 | return this.edad; 43 | } 44 | 45 | public void setEdad(int edad) { 46 | this.edad = edad; 47 | } 48 | 49 | public boolean isMamifero() { 50 | return this.mamifero; 51 | } 52 | 53 | public void setMamifero(boolean mamifero) { 54 | this.mamifero = mamifero; 55 | } 56 | 57 | public String getAlimentacion() { 58 | return this.alimentacion; 59 | } 60 | 61 | public void setAlimentacion(String alimentacion) { 62 | this.alimentacion = alimentacion; 63 | } 64 | 65 | @Override 66 | public String toString() { 67 | return "Animal [nombre=" + nombre + ", raza=" + raza + ", edad=" + edad + ", mamifero=" + mamifero 68 | + ", alimentacion=" + alimentacion + "]"; 69 | } 70 | 71 | @Override 72 | public int hashCode() { 73 | return Objects.hash(nombre); 74 | } 75 | 76 | @Override 77 | public boolean equals(Object obj) { 78 | if (this == obj) 79 | return true; 80 | if (obj == null) 81 | return false; 82 | if (getClass() != obj.getClass()) 83 | return false; 84 | Animal other = (Animal) obj; 85 | return Objects.equals(nombre, other.nombre); 86 | } 87 | 88 | 89 | 90 | 91 | 92 | } 93 | -------------------------------------------------------------------------------- /clase-05/src/main/java/com/coderhouse/herencia/Gato.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.herencia; 2 | 3 | public class Gato extends Animal { 4 | 5 | @Override 6 | public void hacerSonido() { 7 | System.out.println(getNombre() + " está Mauyando.!!"); 8 | } 9 | 10 | public void dormir() { 11 | System.out.println(getNombre() + " está Durmiendo.!!"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /clase-05/src/main/java/com/coderhouse/herencia/Perro.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.herencia; 2 | 3 | public class Perro extends Animal { 4 | 5 | @Override 6 | public void hacerSonido() { 7 | System.out.println(getNombre() + " está Ladrando.!!"); 8 | } 9 | 10 | public void saltar() { 11 | System.out.println(getNombre() + " está Saltando.!!"); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /clase-06/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.coderhouse 4 | clase-06 5 | 0.0.1-SNAPSHOT 6 | -------------------------------------------------------------------------------- /clase-06/src/main/java/com/coderhouse/Main.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse; 2 | 3 | import com.coderhouse.sobrecarga.Impresora; 4 | 5 | //import com.coderhouse.abstractas.Vehiculo; 6 | //import com.coderhouse.entidades.AnimalTerreste; 7 | //import com.coderhouse.entidades.Auto; 8 | //import com.coderhouse.entidades.Perro; 9 | //import com.coderhouse.interfaces.SerVivoInterface; 10 | 11 | public class Main { 12 | 13 | public static void main(String[] args) { 14 | 15 | // Perro miPerro = new Perro(); 16 | // 17 | // 18 | // miPerro.setNombre("Firulay"); 19 | // miPerro.setEdad(5); 20 | // 21 | // System.out.println(miPerro); 22 | // 23 | // miPerro.amigable(); 24 | // miPerro.comer(); 25 | // miPerro.emitirSonido(); 26 | // miPerro.moverse(); 27 | // 28 | // System.out.println("La ubicacion de " + miPerro.getNombre() + 29 | // " esta en el " + SerVivoInterface.UBICACION); 30 | // 31 | // String ubicacion = AnimalTerreste.UBICACION; 32 | // 33 | // Auto miAuto = new Auto(); 34 | // 35 | // miAuto.apagar(); 36 | // miAuto.enciender(); 37 | // miAuto.mover(); 38 | // miAuto.setRuedas(4); 39 | // miAuto.mostrarCantidadDeRuedas(); 40 | 41 | Impresora miImpresora = new Impresora(); 42 | 43 | miImpresora.imprimir(10); 44 | 45 | miImpresora.imprimir(10, 20); 46 | 47 | miImpresora.imprimir("Texto para Imprimir"); 48 | 49 | int[] enteros = {1 , 2 , 3 , 4}; 50 | miImpresora.imprimir(enteros); 51 | 52 | miImpresora.imprimir("Texto para Imprimir", "Hola gente"); 53 | 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /clase-06/src/main/java/com/coderhouse/abstractas/Vehiculo.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.abstractas; 2 | 3 | public abstract class Vehiculo { 4 | 5 | protected String marca; 6 | protected String modelo; 7 | protected String color; 8 | protected Integer ruedas; 9 | 10 | protected abstract void enciender(); 11 | 12 | protected abstract void apagar(); 13 | 14 | protected abstract void mover(); 15 | 16 | public void mostrarCantidadDeRuedas() { 17 | System.out.println("Mi Auto tiene " + getRuedas() + " Ruedas"); 18 | } 19 | 20 | public String getMarca() { 21 | return this.marca; 22 | } 23 | 24 | public void setMarca(String marca) { 25 | this.marca = marca; 26 | } 27 | 28 | public String getModelo() { 29 | return this.modelo; 30 | } 31 | 32 | public void setModelo(String modelo) { 33 | this.modelo = modelo; 34 | } 35 | 36 | public String getColor() { 37 | return this.color; 38 | } 39 | 40 | public void setColor(String color) { 41 | this.color = color; 42 | } 43 | 44 | public Integer getRuedas() { 45 | return this.ruedas; 46 | } 47 | 48 | public void setRuedas(Integer ruedas) { 49 | this.ruedas = ruedas; 50 | } 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /clase-06/src/main/java/com/coderhouse/entidades/AnimalTerreste.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.entidades; 2 | 3 | import com.coderhouse.interfaces.AccionesInterface; 4 | import com.coderhouse.interfaces.SerVivoInterface; 5 | 6 | public class AnimalTerreste implements SerVivoInterface, AccionesInterface{ 7 | 8 | private boolean vivo; 9 | 10 | private String nombre; 11 | 12 | private String raza; 13 | 14 | private Integer edad; 15 | 16 | public void emitirSonido() {} 17 | 18 | public void moverse() {} 19 | 20 | public void comer() {} 21 | 22 | public boolean isVivo() { 23 | return this.vivo; 24 | } 25 | 26 | public void setVivo(boolean vivo) { 27 | this.vivo = vivo; 28 | } 29 | 30 | public String getNombre() { 31 | return this.nombre; 32 | } 33 | 34 | public void setNombre(String nombre) { 35 | this.nombre = nombre; 36 | } 37 | 38 | public String getRaza() { 39 | return this.raza; 40 | } 41 | 42 | public void setRaza(String raza) { 43 | this.raza = raza; 44 | } 45 | 46 | public Integer getEdad() { 47 | return this.edad; 48 | } 49 | 50 | public void setEdad(Integer edad) { 51 | this.edad = edad; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return "Animal [vivo=" + this.vivo + ", nombre=" + this.nombre + ", raza=" + this.raza 57 | + ", edad=" + this.edad + "]"; 58 | } 59 | 60 | @Override 61 | public boolean estaVivo() { 62 | // TODO Auto-generated method stub 63 | return true; 64 | } 65 | 66 | @Override 67 | public void dormir() { 68 | // TODO Auto-generated method stub 69 | 70 | } 71 | 72 | @Override 73 | public void respirar() { 74 | // TODO Auto-generated method stub 75 | 76 | } 77 | 78 | @Override 79 | public void jugar() { 80 | // TODO Auto-generated method stub 81 | 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /clase-06/src/main/java/com/coderhouse/entidades/Auto.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.entidades; 2 | 3 | import com.coderhouse.abstractas.Vehiculo; 4 | 5 | public class Auto extends Vehiculo { 6 | 7 | @Override 8 | public void enciender() { 9 | System.out.println("El auto enciende"); 10 | 11 | } 12 | 13 | @Override 14 | public void apagar() { 15 | System.out.println("El auto se apaga"); 16 | 17 | } 18 | 19 | @Override 20 | public void mover() { 21 | System.out.println("El auto se mueve"); 22 | 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /clase-06/src/main/java/com/coderhouse/entidades/Ave.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.entidades; 2 | 3 | import com.coderhouse.interfaces.SerVivoInterface; 4 | 5 | public class Ave implements SerVivoInterface{ 6 | 7 | @Override 8 | public void emitirSonido() { 9 | // TODO Auto-generated method stub 10 | 11 | } 12 | 13 | @Override 14 | public void moverse() { 15 | // TODO Auto-generated method stub 16 | 17 | } 18 | 19 | @Override 20 | public void comer() { 21 | // TODO Auto-generated method stub 22 | 23 | } 24 | 25 | @Override 26 | public boolean estaVivo() { 27 | // TODO Auto-generated method stub 28 | return true; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /clase-06/src/main/java/com/coderhouse/entidades/Perro.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.entidades; 2 | 3 | public class Perro extends AnimalTerreste { 4 | 5 | @Override 6 | public void emitirSonido() { 7 | System.out.println(getNombre() + " esta ladrando"); 8 | } 9 | 10 | @Override 11 | public void moverse() { 12 | System.out.println(getNombre() + " camino"); 13 | } 14 | 15 | @Override 16 | public void comer() { 17 | System.out.println(getNombre() + " comio"); 18 | } 19 | 20 | public boolean amigable() { 21 | return true; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /clase-06/src/main/java/com/coderhouse/entidades/Personas.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.entidades; 2 | 3 | import com.coderhouse.interfaces.AccionesInterface; 4 | import com.coderhouse.interfaces.SerVivoInterface; 5 | 6 | public class Personas implements SerVivoInterface, AccionesInterface{ 7 | 8 | @Override 9 | public void emitirSonido() {} 10 | 11 | @Override 12 | public void moverse() {} 13 | 14 | @Override 15 | public void comer() {} 16 | 17 | @Override 18 | public boolean estaVivo() { 19 | return true; 20 | } 21 | 22 | @Override 23 | public void dormir() { 24 | // TODO Auto-generated method stub 25 | 26 | } 27 | 28 | @Override 29 | public void respirar() { 30 | // TODO Auto-generated method stub 31 | 32 | } 33 | 34 | @Override 35 | public void jugar() { 36 | // TODO Auto-generated method stub 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /clase-06/src/main/java/com/coderhouse/interfaces/AccionesInterface.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.interfaces; 2 | 3 | public interface AccionesInterface { 4 | 5 | void dormir(); 6 | 7 | void respirar(); 8 | 9 | void jugar(); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /clase-06/src/main/java/com/coderhouse/interfaces/CRUDInterface.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.interfaces; 2 | 3 | public interface CRUDInterface { 4 | 5 | void create(); 6 | 7 | void read(); 8 | 9 | void update(); 10 | 11 | void delete(); 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /clase-06/src/main/java/com/coderhouse/interfaces/SerVivoInterface.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.interfaces; 2 | 3 | public interface SerVivoInterface { 4 | 5 | String UBICACION = "Planeta Tierra"; 6 | 7 | // Motodos Abstractos 8 | void emitirSonido(); 9 | 10 | void moverse(); 11 | 12 | void comer(); 13 | 14 | boolean estaVivo(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /clase-06/src/main/java/com/coderhouse/sobrecarga/Impresora.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.sobrecarga; 2 | 3 | public class Impresora { 4 | 5 | 6 | // Sobrecarga de Metodos 7 | public void imprimir(int numero) { 8 | System.out.println("Imprimiendo el numero " + numero); 9 | } 10 | 11 | public void imprimir(int numeroA, int numeroB) { 12 | System.out.println("Imprimiendo los numeros " + numeroA + " y el numero " + numeroB ); 13 | } 14 | 15 | public void imprimir(String texto) { 16 | System.out.println("Imprimiendo el texto " + texto); 17 | } 18 | 19 | public void imprimir(String textoA, String textoB) { 20 | System.out.println("Imprimiendo el texto " + textoA + " Imprimiendo el texto " + textoB ); 21 | } 22 | 23 | public void imprimir(int[] numeros) { 24 | System.out.println("Imprimiendo el Array de Numeros: "); 25 | for (int numero : numeros) { 26 | System.out.println(numero + "\n"); 27 | } 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /clase-07/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.coderhouse 4 | clase-07 5 | 0.0.1-SNAPSHOT 6 | -------------------------------------------------------------------------------- /clase-07/src/main/resources/ejercicios-sql.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/clase-07/src/main/resources/ejercicios-sql.docx -------------------------------------------------------------------------------- /clase-08/.gitattributes: -------------------------------------------------------------------------------- 1 | /mvnw text eol=lf 2 | *.cmd text eol=crlf 3 | -------------------------------------------------------------------------------- /clase-08/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /clase-08/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip 20 | -------------------------------------------------------------------------------- /clase-08/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 3.3.4 9 | 10 | 11 | com.coderhouse 12 | clase-08 13 | v1.0.0 14 | clase-08 15 | Mi Premer App en Spring Boot 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 21 31 | 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-starter-data-jdbc 36 | 37 | 38 | org.springframework.boot 39 | spring-boot-starter-data-jpa 40 | 41 | 42 | 43 | com.mysql 44 | mysql-connector-j 45 | runtime 46 | 47 | 48 | org.springframework.boot 49 | spring-boot-starter-test 50 | test 51 | 52 | 53 | org.hibernate 54 | hibernate-core 55 | 6.4.4.Final 56 | 57 | 58 | 59 | 60 | 61 | 62 | org.springframework.boot 63 | spring-boot-maven-plugin 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /clase-08/src/main/java/com/coderhouse/Clase08Application.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.boot.CommandLineRunner; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | 8 | import com.coderhouse.dao.DaoFactory; 9 | import com.coderhouse.modelos.Alumno; 10 | import com.coderhouse.modelos.Curso; 11 | 12 | @SpringBootApplication 13 | public class Clase08Application implements CommandLineRunner { 14 | 15 | @Autowired 16 | private DaoFactory dao; 17 | 18 | public static void main(String[] args) { 19 | SpringApplication.run(Clase08Application.class, args); 20 | } 21 | 22 | @Override 23 | public void run(String... args) throws Exception { 24 | try { 25 | Curso curso1 = new Curso("HTML"); 26 | Curso curso2 = new Curso("CSS"); 27 | Curso curso3 = new Curso("Java"); 28 | 29 | Alumno alumno1 = new Alumno("Alejandro", "Di Stefano", 22555666, "L2255566"); 30 | Alumno alumno2 = new Alumno("Agustin", "Barraza", 33555666, "L33555666"); 31 | Alumno alumno3 = new Alumno("Bruno", "Lezama", 44555666, "L44555666"); 32 | 33 | dao.createAlumno(alumno1); 34 | dao.createAlumno(alumno2); 35 | dao.createAlumno(alumno3); 36 | 37 | dao.createCurso(curso1); 38 | dao.createCurso(curso2); 39 | dao.createCurso(curso3); 40 | 41 | } catch (Exception e) { 42 | e.printStackTrace(System.err); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /clase-08/src/main/java/com/coderhouse/dao/DaoFactory.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.dao; 2 | 3 | import org.springframework.stereotype.Service; 4 | 5 | import com.coderhouse.modelos.Alumno; 6 | import com.coderhouse.modelos.Curso; 7 | 8 | import jakarta.persistence.EntityManager; 9 | import jakarta.persistence.PersistenceContext; 10 | import jakarta.transaction.Transactional; 11 | 12 | @Service 13 | public class DaoFactory { 14 | 15 | @PersistenceContext 16 | private EntityManager em; 17 | 18 | @Transactional 19 | public void createAlumno(Alumno alumno) { 20 | em.persist(alumno); 21 | } 22 | 23 | @Transactional 24 | public void createCurso(Curso curso) { 25 | em.persist(curso); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /clase-08/src/main/java/com/coderhouse/modelos/Curso.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.modelos; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import jakarta.persistence.Column; 7 | import jakarta.persistence.Entity; 8 | import jakarta.persistence.FetchType; 9 | import jakarta.persistence.GeneratedValue; 10 | import jakarta.persistence.GenerationType; 11 | import jakarta.persistence.Id; 12 | import jakarta.persistence.JoinColumn; 13 | import jakarta.persistence.JoinTable; 14 | import jakarta.persistence.ManyToMany; 15 | import jakarta.persistence.Table; 16 | 17 | 18 | @Entity 19 | @Table(name = "Cursos") 20 | public class Curso { 21 | 22 | @Id // Primary Key 23 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 24 | private Long id; 25 | 26 | @Column(nullable = false) 27 | private String nombre; 28 | 29 | @ManyToMany(fetch = FetchType.EAGER) 30 | @JoinTable(name = "curso_alumno", joinColumns = @JoinColumn(name = "curso_id"), inverseJoinColumns = @JoinColumn(name = "alumno_id")) 31 | private List alumnos = new ArrayList<>(); 32 | 33 | public Curso() { 34 | super(); 35 | } 36 | 37 | public Curso(String nombre) { 38 | super(); 39 | this.nombre = nombre; 40 | } 41 | 42 | public Long getId() { 43 | return id; 44 | } 45 | 46 | public void setId(Long id) { 47 | this.id = id; 48 | } 49 | 50 | public String getNombre() { 51 | return nombre; 52 | } 53 | 54 | public void setNombre(String nombre) { 55 | this.nombre = nombre; 56 | } 57 | 58 | public List getAlumnos() { 59 | return alumnos; 60 | } 61 | 62 | public void setAlumnos(List alumnos) { 63 | this.alumnos = alumnos; 64 | } 65 | 66 | @Override 67 | public String toString() { 68 | return "Curso [id=" + id + ", nombre=" + nombre + ", alumnos=" + alumnos + "]"; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /clase-08/src/main/java/com/coderhouse/models/Pasaporte.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.GeneratedValue; 6 | import jakarta.persistence.GenerationType; 7 | import jakarta.persistence.Id; 8 | import jakarta.persistence.OneToOne; 9 | 10 | //@Entity 11 | public class Pasaporte { 12 | 13 | @Id 14 | @GeneratedValue(strategy = GenerationType.IDENTITY) 15 | private Long id; 16 | @Column(name = "numero") 17 | private String numero; 18 | 19 | @OneToOne(mappedBy = "pasaporte") 20 | private Persona persona; 21 | 22 | public Long getId() { 23 | return id; 24 | } 25 | 26 | public void setId(Long id) { 27 | this.id = id; 28 | } 29 | 30 | public String getNumero() { 31 | return numero; 32 | } 33 | 34 | public void setNumero(String numero) { 35 | this.numero = numero; 36 | } 37 | 38 | public Persona getPersona() { 39 | return persona; 40 | } 41 | 42 | public void setPersona(Persona persona) { 43 | this.persona = persona; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return "Pasaporte [id=" + id + ", numero=" + numero + ", persona=" + persona + "]"; 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /clase-08/src/main/java/com/coderhouse/models/Persona.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import jakarta.persistence.CascadeType; 4 | import jakarta.persistence.Column; 5 | import jakarta.persistence.Entity; 6 | import jakarta.persistence.GeneratedValue; 7 | import jakarta.persistence.GenerationType; 8 | import jakarta.persistence.Id; 9 | import jakarta.persistence.JoinColumn; 10 | import jakarta.persistence.OneToOne; 11 | 12 | //@Entity 13 | public class Persona { 14 | @Id // Primary Key 15 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 16 | private Long id; 17 | 18 | @Column(name = "nombre") 19 | private String nombre; 20 | 21 | @OneToOne(cascade = CascadeType.ALL) 22 | @JoinColumn(name = "pasaporte_id", referencedColumnName = "id") 23 | private Pasaporte pasaporte; 24 | 25 | public Long getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Long id) { 30 | this.id = id; 31 | } 32 | 33 | public String getNombre() { 34 | return nombre; 35 | } 36 | 37 | public void setNombre(String nombre) { 38 | this.nombre = nombre; 39 | } 40 | 41 | public Pasaporte getPasaporte() { 42 | return pasaporte; 43 | } 44 | 45 | public void setPasaporte(Pasaporte pasaporte) { 46 | this.pasaporte = pasaporte; 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | return "Persona [id=" + id + ", nombre=" + nombre + ", pasaporte=" + pasaporte + "]"; 52 | } 53 | 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /clase-08/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=clase-08 2 | 3 | spring.jpa.properties.hibernate.format_sql=true 4 | spring.jpa.hibernate.ddl-auto=update 5 | spring.jpa.show-sql=true 6 | 7 | spring.datasource.url=jdbc:mysql://localhost:3306/coderhouse 8 | spring.datasource.username=root 9 | spring.datasource.password=Alejandro -------------------------------------------------------------------------------- /clase-09/.gitattributes: -------------------------------------------------------------------------------- 1 | /mvnw text eol=lf 2 | *.cmd text eol=crlf 3 | -------------------------------------------------------------------------------- /clase-09/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /clase-09/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip 20 | -------------------------------------------------------------------------------- /clase-09/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 3.3.4 9 | 10 | 11 | com.coderhouse 12 | clase-09 13 | v1.0.0 14 | clase-09 15 | Mi Premer App en Spring Boot 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 21 31 | 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-starter-data-jdbc 36 | 37 | 38 | org.springframework.boot 39 | spring-boot-starter-data-jpa 40 | 41 | 42 | 43 | com.mysql 44 | mysql-connector-j 45 | runtime 46 | 47 | 48 | org.springframework.boot 49 | spring-boot-starter-test 50 | test 51 | 52 | 53 | org.hibernate 54 | hibernate-core 55 | 6.4.4.Final 56 | 57 | 58 | 59 | 60 | 61 | 62 | org.springframework.boot 63 | spring-boot-maven-plugin 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /clase-09/src/main/java/com/coderhouse/modelos/Categoria.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.modelos; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import jakarta.persistence.Column; 7 | import jakarta.persistence.Entity; 8 | import jakarta.persistence.FetchType; 9 | import jakarta.persistence.GeneratedValue; 10 | import jakarta.persistence.GenerationType; 11 | import jakarta.persistence.Id; 12 | import jakarta.persistence.OneToMany; 13 | import jakarta.persistence.Table; 14 | 15 | @Entity 16 | @Table(name = "Categorias") 17 | public class Categoria { 18 | 19 | @Id // Primary Key 20 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 21 | private Long id; 22 | 23 | @Column(nullable = false) 24 | private String nombre; 25 | 26 | @OneToMany(mappedBy = "categoria", fetch = FetchType.EAGER) 27 | private List cursos = new ArrayList<>(); 28 | 29 | public Categoria() { 30 | super(); 31 | } 32 | 33 | public Categoria(String nombre) { 34 | super(); 35 | this.nombre = nombre; 36 | } 37 | 38 | public Long getId() { 39 | return id; 40 | } 41 | 42 | public void setId(Long id) { 43 | this.id = id; 44 | } 45 | 46 | public String getNombre() { 47 | return nombre; 48 | } 49 | 50 | public void setNombre(String nombre) { 51 | this.nombre = nombre; 52 | } 53 | 54 | public List getCursos() { 55 | return cursos; 56 | } 57 | 58 | public void setCursos(List cursos) { 59 | this.cursos = cursos; 60 | } 61 | 62 | @Override 63 | public String toString() { 64 | return "Categoria [id=" + id + ", nombre=" + nombre + "]"; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /clase-09/src/main/java/com/coderhouse/modelos/Curso.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.modelos; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import jakarta.persistence.Column; 7 | import jakarta.persistence.Entity; 8 | import jakarta.persistence.FetchType; 9 | import jakarta.persistence.GeneratedValue; 10 | import jakarta.persistence.GenerationType; 11 | import jakarta.persistence.Id; 12 | import jakarta.persistence.JoinColumn; 13 | import jakarta.persistence.JoinTable; 14 | import jakarta.persistence.ManyToMany; 15 | import jakarta.persistence.ManyToOne; 16 | import jakarta.persistence.Table; 17 | 18 | @Entity 19 | @Table(name = "Cursos") 20 | public class Curso { 21 | 22 | @Id // Primary Key 23 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 24 | private Long id; 25 | 26 | @Column(nullable = false) 27 | private String nombre; 28 | 29 | @ManyToMany(fetch = FetchType.EAGER) 30 | @JoinTable( 31 | name = "curso_alumno", 32 | joinColumns = @JoinColumn(name = "curso_id"), 33 | inverseJoinColumns = @JoinColumn( 34 | name = "alumno_id")) 35 | private List alumnos = new ArrayList<>(); 36 | 37 | @ManyToOne(fetch = FetchType.EAGER) 38 | private Categoria categoria; 39 | 40 | public Curso() { 41 | super(); 42 | } 43 | 44 | public Curso(String nombre, Categoria categoria) { 45 | super(); 46 | this.nombre = nombre; 47 | this.categoria = categoria; 48 | } 49 | 50 | public Long getId() { 51 | return id; 52 | } 53 | 54 | public void setId(Long id) { 55 | this.id = id; 56 | } 57 | 58 | public String getNombre() { 59 | return nombre; 60 | } 61 | 62 | public void setNombre(String nombre) { 63 | this.nombre = nombre; 64 | } 65 | 66 | public List getAlumnos() { 67 | return alumnos; 68 | } 69 | 70 | public void setAlumnos(List alumnos) { 71 | this.alumnos = alumnos; 72 | } 73 | 74 | public Categoria getCategoria() { 75 | return categoria; 76 | } 77 | 78 | public void setCategoria(Categoria categoria) { 79 | this.categoria = categoria; 80 | } 81 | 82 | @Override 83 | public String toString() { 84 | return "Curso [id=" + id + ", nombre=" + nombre + ", categoria=" + categoria + "]"; 85 | } 86 | 87 | 88 | 89 | } 90 | -------------------------------------------------------------------------------- /clase-09/src/main/querys.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE IF NOT EXISTS coderhouse; 2 | USE coderhouse; 3 | 4 | 5 | select * from alumnos; 6 | select * from cursos; 7 | select * from categorias; 8 | select * from curso_alumno; 9 | -------------------------------------------------------------------------------- /clase-09/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=clase-09 2 | 3 | spring.jpa.properties.hibernate.format_sql=true 4 | spring.jpa.hibernate.ddl-auto=update 5 | spring.jpa.show-sql=false 6 | 7 | spring.datasource.url=jdbc:mysql://localhost:3306/coderhouse 8 | spring.datasource.username=root 9 | spring.datasource.password=Alejandro -------------------------------------------------------------------------------- /clase-10/.gitattributes: -------------------------------------------------------------------------------- 1 | /mvnw text eol=lf 2 | *.cmd text eol=crlf 3 | -------------------------------------------------------------------------------- /clase-10/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /clase-10/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip 20 | -------------------------------------------------------------------------------- /clase-10/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 3.3.5 9 | 10 | 11 | com.coderhouse 12 | clase-10 13 | v1.0.0 14 | clase-10 15 | Mi Premer App en Spring Boot 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 21 31 | 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-starter-data-jdbc 36 | 37 | 38 | org.springframework.boot 39 | spring-boot-starter-data-jpa 40 | 41 | 42 | org.springframework.boot 43 | spring-boot-starter-web 44 | 45 | 46 | 47 | com.mysql 48 | mysql-connector-j 49 | runtime 50 | 51 | 52 | org.springframework.boot 53 | spring-boot-starter-test 54 | test 55 | 56 | 57 | 58 | 59 | 60 | 61 | org.springframework.boot 62 | spring-boot-maven-plugin 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /clase-10/src/main/java/com/coderhouse/Clase10Application.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Clase10Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Clase10Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /clase-10/src/main/java/com/coderhouse/controllers/AlumnoController.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.controllers; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.http.ResponseEntity; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.PathVariable; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import com.coderhouse.models.Alumno; 15 | import com.coderhouse.repositories.AlumnoRepository; 16 | 17 | @RestController 18 | @RequestMapping("/api/alumnos") 19 | public class AlumnoController { 20 | 21 | @Autowired 22 | private AlumnoRepository alumnoRepository; 23 | 24 | @GetMapping 25 | public List getAllAlumnos() { 26 | return alumnoRepository.findAll(); 27 | } 28 | 29 | @GetMapping("/{id}") 30 | public ResponseEntity getAlumnoById(@PathVariable Long id) { 31 | if (alumnoRepository.existsById(id)) { 32 | Alumno alumno = alumnoRepository.findById(id).get(); 33 | return ResponseEntity.ok(alumno); 34 | } else { 35 | return ResponseEntity.notFound().build(); 36 | } 37 | 38 | } 39 | 40 | @PostMapping 41 | public Alumno createAlumno(@RequestBody Alumno alumno) { 42 | return alumnoRepository.save(alumno); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /clase-10/src/main/java/com/coderhouse/controllers/CategoriaController.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.controllers; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.http.ResponseEntity; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.PathVariable; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import com.coderhouse.models.Categoria; 15 | import com.coderhouse.repositories.CategoriaRepository; 16 | 17 | @RestController 18 | @RequestMapping("/api/categorias") 19 | public class CategoriaController { 20 | 21 | @Autowired 22 | private CategoriaRepository categoriaRepository; 23 | 24 | @GetMapping 25 | public List getAllCategorias() { 26 | return categoriaRepository.findAll(); 27 | } 28 | 29 | @GetMapping("/{id}") 30 | public ResponseEntity getCategoriaById(@PathVariable Long id) { 31 | if (categoriaRepository.existsById(id)) { 32 | Categoria categoria = categoriaRepository.findById(id).get(); 33 | return ResponseEntity.ok(categoria); 34 | } else { 35 | return ResponseEntity.notFound().build(); 36 | } 37 | 38 | } 39 | 40 | @PostMapping 41 | public Categoria createCategoria(@RequestBody Categoria categoria) { 42 | return categoriaRepository.save(categoria); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /clase-10/src/main/java/com/coderhouse/controllers/CursoController.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.controllers; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.http.ResponseEntity; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.PathVariable; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import com.coderhouse.models.Curso; 15 | import com.coderhouse.repositories.CursosRepository; 16 | 17 | @RestController 18 | @RequestMapping("/api/cursos") 19 | public class CursoController { 20 | 21 | @Autowired 22 | private CursosRepository cursosRepository; 23 | 24 | @GetMapping 25 | public List getAllCursos() { 26 | return cursosRepository.findAll(); 27 | 28 | } 29 | 30 | @GetMapping("/{id}") 31 | public ResponseEntity getCursoById(@PathVariable Long id) { 32 | if (cursosRepository.existsById(id)) { 33 | Curso curso = cursosRepository.findById(id).get(); 34 | return ResponseEntity.ok(curso); 35 | } else { 36 | return ResponseEntity.notFound().build(); 37 | } 38 | } 39 | 40 | @PostMapping 41 | public Curso createCurso(@RequestBody Curso curso) { 42 | return cursosRepository.save(curso); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /clase-10/src/main/java/com/coderhouse/models/Categoria.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import jakarta.persistence.Column; 7 | import jakarta.persistence.Entity; 8 | import jakarta.persistence.FetchType; 9 | import jakarta.persistence.GeneratedValue; 10 | import jakarta.persistence.GenerationType; 11 | import jakarta.persistence.Id; 12 | import jakarta.persistence.OneToMany; 13 | import jakarta.persistence.Table; 14 | 15 | @Entity 16 | @Table(name = "Categorias") 17 | public class Categoria { 18 | 19 | @Id // Primary Key 20 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 21 | private Long id; 22 | 23 | @Column(nullable = false) 24 | private String nombre; 25 | 26 | @OneToMany(mappedBy = "categoria", fetch = FetchType.EAGER) 27 | private List cursos = new ArrayList<>(); 28 | 29 | public Categoria() { 30 | super(); 31 | } 32 | 33 | public Categoria(String nombre) { 34 | super(); 35 | this.nombre = nombre; 36 | } 37 | 38 | public Long getId() { 39 | return id; 40 | } 41 | 42 | public void setId(Long id) { 43 | this.id = id; 44 | } 45 | 46 | public String getNombre() { 47 | return nombre; 48 | } 49 | 50 | public void setNombre(String nombre) { 51 | this.nombre = nombre; 52 | } 53 | 54 | public List getCursos() { 55 | return cursos; 56 | } 57 | 58 | public void setCursos(List cursos) { 59 | this.cursos = cursos; 60 | } 61 | 62 | @Override 63 | public String toString() { 64 | return "Categoria [id=" + id + ", nombre=" + nombre + "]"; 65 | } 66 | 67 | } -------------------------------------------------------------------------------- /clase-10/src/main/java/com/coderhouse/models/Curso.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import jakarta.persistence.Column; 7 | import jakarta.persistence.Entity; 8 | import jakarta.persistence.FetchType; 9 | import jakarta.persistence.GeneratedValue; 10 | import jakarta.persistence.GenerationType; 11 | import jakarta.persistence.Id; 12 | import jakarta.persistence.JoinColumn; 13 | import jakarta.persistence.JoinTable; 14 | import jakarta.persistence.ManyToMany; 15 | import jakarta.persistence.ManyToOne; 16 | import jakarta.persistence.Table; 17 | 18 | @Entity 19 | @Table(name = "Cursos") 20 | public class Curso { 21 | 22 | @Id // Primary Key 23 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 24 | private Long id; 25 | 26 | @Column(nullable = false) 27 | private String nombre; 28 | 29 | @ManyToMany(fetch = FetchType.EAGER) 30 | @JoinTable( 31 | name = "curso_alumno", 32 | joinColumns = @JoinColumn(name = "curso_id"), 33 | inverseJoinColumns = @JoinColumn( 34 | name = "alumno_id")) 35 | private List alumnos = new ArrayList<>(); 36 | 37 | @ManyToOne(fetch = FetchType.EAGER) 38 | private Categoria categoria; 39 | 40 | public Curso() { 41 | super(); 42 | } 43 | 44 | public Curso(String nombre, Categoria categoria) { 45 | super(); 46 | this.nombre = nombre; 47 | this.categoria = categoria; 48 | } 49 | 50 | public Long getId() { 51 | return id; 52 | } 53 | 54 | public void setId(Long id) { 55 | this.id = id; 56 | } 57 | 58 | public String getNombre() { 59 | return nombre; 60 | } 61 | 62 | public void setNombre(String nombre) { 63 | this.nombre = nombre; 64 | } 65 | 66 | public List getAlumnos() { 67 | return alumnos; 68 | } 69 | 70 | public void setAlumnos(List alumnos) { 71 | this.alumnos = alumnos; 72 | } 73 | 74 | public Categoria getCategoria() { 75 | return categoria; 76 | } 77 | 78 | public void setCategoria(Categoria categoria) { 79 | this.categoria = categoria; 80 | } 81 | 82 | @Override 83 | public String toString() { 84 | return "Curso [id=" + id + ", nombre=" + nombre + ", categoria=" + categoria + "]"; 85 | } 86 | 87 | 88 | 89 | } -------------------------------------------------------------------------------- /clase-10/src/main/java/com/coderhouse/repositories/AlumnoRepository.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.repositories; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import com.coderhouse.models.Alumno; 5 | 6 | public interface AlumnoRepository extends JpaRepository {} -------------------------------------------------------------------------------- /clase-10/src/main/java/com/coderhouse/repositories/CategoriaRepository.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.repositories; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import com.coderhouse.models.Categoria; 6 | 7 | public interface CategoriaRepository extends JpaRepository {} -------------------------------------------------------------------------------- /clase-10/src/main/java/com/coderhouse/repositories/CursosRepository.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.repositories; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import com.coderhouse.models.Curso; 6 | 7 | public interface CursosRepository extends JpaRepository {} -------------------------------------------------------------------------------- /clase-10/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=clase-10 2 | 3 | spring.jpa.properties.hibernate.format_sql=true 4 | spring.jpa.hibernate.ddl-auto=update 5 | spring.jpa.show-sql=false 6 | 7 | spring.datasource.url=jdbc:mysql://localhost:3306/coderhouse 8 | spring.datasource.username=root 9 | spring.datasource.password=Alejandro -------------------------------------------------------------------------------- /clase-10/src/test/java/com/coderhouse/Clase10ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class Clase10ApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /clase-11/.gitattributes: -------------------------------------------------------------------------------- 1 | /mvnw text eol=lf 2 | *.cmd text eol=crlf 3 | -------------------------------------------------------------------------------- /clase-11/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /clase-11/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip 20 | -------------------------------------------------------------------------------- /clase-11/src/main/java/com/coderhouse/Clase11Application.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Clase11Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Clase11Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /clase-11/src/main/java/com/coderhouse/models/Categoria.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.fasterxml.jackson.annotation.JsonIgnore; 7 | 8 | import jakarta.persistence.Column; 9 | import jakarta.persistence.Entity; 10 | import jakarta.persistence.FetchType; 11 | import jakarta.persistence.GeneratedValue; 12 | import jakarta.persistence.GenerationType; 13 | import jakarta.persistence.Id; 14 | import jakarta.persistence.OneToMany; 15 | import jakarta.persistence.Table; 16 | 17 | @Entity 18 | @Table(name = "Categorias") 19 | public class Categoria { 20 | 21 | @Id // Primary Key 22 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 23 | private Long id; 24 | 25 | @Column(nullable = false) 26 | private String nombre; 27 | 28 | @OneToMany(mappedBy = "categoria", fetch = FetchType.EAGER) 29 | @JsonIgnore 30 | private List cursos = new ArrayList<>(); 31 | 32 | public Categoria() { 33 | super(); 34 | } 35 | 36 | public Categoria(String nombre) { 37 | super(); 38 | this.nombre = nombre; 39 | } 40 | 41 | public Long getId() { 42 | return id; 43 | } 44 | 45 | public void setId(Long id) { 46 | this.id = id; 47 | } 48 | 49 | public String getNombre() { 50 | return nombre; 51 | } 52 | 53 | public void setNombre(String nombre) { 54 | this.nombre = nombre; 55 | } 56 | 57 | public List getCursos() { 58 | return cursos; 59 | } 60 | 61 | public void setCursos(List cursos) { 62 | this.cursos = cursos; 63 | } 64 | 65 | @Override 66 | public String toString() { 67 | return "Categoria [id=" + id + ", nombre=" + nombre + "]"; 68 | } 69 | 70 | } -------------------------------------------------------------------------------- /clase-11/src/main/java/com/coderhouse/models/Curso.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.fasterxml.jackson.annotation.JsonIgnore; 7 | 8 | import jakarta.persistence.Column; 9 | import jakarta.persistence.Entity; 10 | import jakarta.persistence.FetchType; 11 | import jakarta.persistence.GeneratedValue; 12 | import jakarta.persistence.GenerationType; 13 | import jakarta.persistence.Id; 14 | import jakarta.persistence.JoinColumn; 15 | import jakarta.persistence.JoinTable; 16 | import jakarta.persistence.ManyToMany; 17 | import jakarta.persistence.ManyToOne; 18 | import jakarta.persistence.Table; 19 | 20 | @Entity 21 | @Table(name = "Cursos") 22 | public class Curso { 23 | 24 | @Id // Primary Key 25 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 26 | private Long id; 27 | 28 | @Column(nullable = false) 29 | private String nombre; 30 | 31 | @ManyToMany(fetch = FetchType.EAGER) 32 | @JoinTable( 33 | name = "curso_alumno", 34 | joinColumns = @JoinColumn(name = "curso_id"), 35 | inverseJoinColumns = @JoinColumn( 36 | name = "alumno_id")) 37 | @JsonIgnore 38 | private List alumnos = new ArrayList<>(); 39 | 40 | @ManyToOne(fetch = FetchType.EAGER) 41 | private Categoria categoria; 42 | 43 | public Curso() { 44 | super(); 45 | } 46 | 47 | public Curso(String nombre, Categoria categoria) { 48 | super(); 49 | this.nombre = nombre; 50 | this.categoria = categoria; 51 | } 52 | 53 | public Long getId() { 54 | return id; 55 | } 56 | 57 | public void setId(Long id) { 58 | this.id = id; 59 | } 60 | 61 | public String getNombre() { 62 | return nombre; 63 | } 64 | 65 | public void setNombre(String nombre) { 66 | this.nombre = nombre; 67 | } 68 | 69 | public List getAlumnos() { 70 | return alumnos; 71 | } 72 | 73 | public void setAlumnos(List alumnos) { 74 | this.alumnos = alumnos; 75 | } 76 | 77 | public Categoria getCategoria() { 78 | return categoria; 79 | } 80 | 81 | public void setCategoria(Categoria categoria) { 82 | this.categoria = categoria; 83 | } 84 | 85 | @Override 86 | public String toString() { 87 | return "Curso [id=" + id + ", nombre=" + nombre + ", categoria=" + categoria + "]"; 88 | } 89 | 90 | 91 | 92 | } -------------------------------------------------------------------------------- /clase-11/src/main/java/com/coderhouse/repositories/AlumnoRepository.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.repositories; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import com.coderhouse.models.Alumno; 5 | 6 | public interface AlumnoRepository extends JpaRepository {} -------------------------------------------------------------------------------- /clase-11/src/main/java/com/coderhouse/repositories/CategoriaRepository.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.repositories; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import com.coderhouse.models.Categoria; 6 | 7 | public interface CategoriaRepository extends JpaRepository {} -------------------------------------------------------------------------------- /clase-11/src/main/java/com/coderhouse/repositories/CursosRepository.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.repositories; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import com.coderhouse.models.Curso; 6 | 7 | public interface CursosRepository extends JpaRepository {} -------------------------------------------------------------------------------- /clase-11/src/main/java/com/coderhouse/services/AlumnoService.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.services; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.coderhouse.models.Alumno; 9 | import com.coderhouse.repositories.AlumnoRepository; 10 | 11 | import jakarta.transaction.Transactional; 12 | 13 | @Service 14 | public class AlumnoService { 15 | 16 | @Autowired 17 | private AlumnoRepository alumnoRepository; 18 | 19 | 20 | public List getAllAlumnos() { 21 | return alumnoRepository.findAll(); 22 | } 23 | 24 | public Alumno findById(Long id) { 25 | return alumnoRepository.findById(id).orElseThrow(() -> new IllegalArgumentException("Alumno no encontrado")); 26 | } 27 | 28 | @Transactional 29 | public Alumno saveAlumno(Alumno alumno) { 30 | return alumnoRepository.save(alumno); 31 | } 32 | 33 | @Transactional 34 | public Alumno updateAlumno(Long id, Alumno alumnoDetails) { 35 | Alumno alumno = alumnoRepository.findById(id) 36 | .orElseThrow(() -> new IllegalArgumentException("Alumno no encontrado")); 37 | 38 | alumno.setNombre(alumnoDetails.getNombre()); 39 | alumno.setApellido(alumnoDetails.getApellido()); 40 | 41 | if (alumnoDetails.getDni() != 0) { 42 | alumno.setDni(alumnoDetails.getDni()); 43 | } 44 | 45 | if (alumnoDetails.getLegajo() != null && !alumnoDetails.getLegajo().isEmpty()) { 46 | alumno.setLegajo(alumnoDetails.getLegajo()); 47 | } 48 | 49 | return alumnoRepository.save(alumno); 50 | } 51 | 52 | public void deleteAlumno(Long id) { 53 | if (!alumnoRepository.existsById(id)) { 54 | throw new IllegalArgumentException("Alumno no encontrado"); 55 | } 56 | alumnoRepository.deleteById(id); 57 | 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /clase-11/src/main/java/com/coderhouse/services/CategoriaService.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.services; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.coderhouse.models.Categoria; 9 | import com.coderhouse.repositories.CategoriaRepository; 10 | 11 | import jakarta.transaction.Transactional; 12 | 13 | @Service 14 | public class CategoriaService { 15 | 16 | @Autowired 17 | private CategoriaRepository categoriaRepository; 18 | 19 | public List findAll() { 20 | return categoriaRepository.findAll(); 21 | } 22 | 23 | public Categoria getCategoriaById(Long id) { 24 | return categoriaRepository.findById(id) 25 | .orElseThrow(() -> new IllegalArgumentException("Categoria no encontrado")); 26 | 27 | } 28 | 29 | public boolean existsById(Long id) { 30 | return categoriaRepository.existsById(id); 31 | } 32 | 33 | @Transactional 34 | public Categoria createCategoria(Categoria categoria) { 35 | return categoriaRepository.save(categoria); 36 | } 37 | 38 | @Transactional 39 | public Categoria updateCategoria(Long id, Categoria categoraDetails) { 40 | Categoria categoria = categoriaRepository.findById(id) 41 | .orElseThrow(() -> new IllegalArgumentException("Categoria no fue encontrada")); 42 | categoria.setNombre(categoraDetails.getNombre()); 43 | return categoriaRepository.save(categoria); 44 | 45 | } 46 | 47 | public void deleteById(Long id) { 48 | categoriaRepository.deleteById(id); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /clase-11/src/main/java/com/coderhouse/services/CursoService.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.services; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.coderhouse.models.Curso; 9 | import com.coderhouse.repositories.CursosRepository; 10 | 11 | import jakarta.transaction.Transactional; 12 | 13 | @Service 14 | public class CursoService { 15 | 16 | @Autowired 17 | private CursosRepository cursoRepository; 18 | 19 | public List getAllCursos() { 20 | return cursoRepository.findAll(); 21 | } 22 | 23 | public Curso getCursoById(Long id) { 24 | return cursoRepository.findById(id).orElseThrow(() -> new IllegalArgumentException("Curso no encontrado")); 25 | 26 | } 27 | 28 | @Transactional 29 | public Curso createCurso(Curso curso) { 30 | return cursoRepository.save(curso); 31 | } 32 | 33 | @Transactional 34 | public Curso updateCurso(Long id, Curso cursoDetails) { 35 | Curso curso = cursoRepository.findById(id) 36 | .orElseThrow(() -> new IllegalArgumentException("Curso no encontrado")); 37 | curso.setNombre(cursoDetails.getNombre()); 38 | return cursoRepository.save(curso); 39 | 40 | } 41 | 42 | public void deleteCurso(Long id) { 43 | if (cursoRepository.existsById(id)) { 44 | cursoRepository.deleteById(id); 45 | } else { 46 | throw new IllegalArgumentException("Curso no encontrado"); 47 | } 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /clase-11/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=clase-11 2 | 3 | spring.jpa.properties.hibernate.format_sql=true 4 | spring.jpa.hibernate.ddl-auto=update 5 | spring.jpa.show-sql=false 6 | 7 | spring.datasource.url=jdbc:mysql://localhost:3306/coderhouse 8 | spring.datasource.username=root 9 | spring.datasource.password=Alejandro -------------------------------------------------------------------------------- /clase-12/.gitattributes: -------------------------------------------------------------------------------- 1 | /mvnw text eol=lf 2 | *.cmd text eol=crlf 3 | -------------------------------------------------------------------------------- /clase-12/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /clase-12/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip 20 | -------------------------------------------------------------------------------- /clase-12/src/main/java/com/coderhouse/Clase12Application.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.web.client.RestTemplate; 7 | 8 | @SpringBootApplication 9 | public class Clase12Application { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(Clase12Application.class, args); 13 | } 14 | 15 | @Bean 16 | RestTemplate restTemplate() { 17 | return new RestTemplate(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /clase-12/src/main/java/com/coderhouse/apis/UserRestApi.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.apis; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.http.HttpMethod; 7 | import org.springframework.stereotype.Component; 8 | import org.springframework.web.client.RestTemplate; 9 | 10 | import com.coderhouse.interfaces.UserRestInterface; 11 | import com.coderhouse.models.User; 12 | 13 | @Component 14 | public class UserRestApi implements UserRestInterface { 15 | 16 | private final String BASE_URL = "https://672d3b52fd8979715641d1ff.mockapi.io/users"; 17 | 18 | @Autowired 19 | private RestTemplate restTemplate; 20 | 21 | @Override 22 | public List getAllUsers() { 23 | try { 24 | @SuppressWarnings("unchecked") 25 | List users = restTemplate 26 | .exchange(BASE_URL, HttpMethod.GET, null, List.class).getBody(); 27 | return users; 28 | 29 | } catch (Exception e) { 30 | throw new RuntimeException("Error al obtener los Usuarios: " + e.getMessage(), e); 31 | } 32 | 33 | } 34 | 35 | @Override 36 | public User getUserById(String id) { 37 | try { 38 | String url = BASE_URL + "/" + id; 39 | return restTemplate.getForObject(url, User.class); 40 | } catch (Exception e) { 41 | throw new RuntimeException("Error al obtener el Usuario: " + e.getMessage(), e); 42 | 43 | } 44 | } 45 | 46 | @Override 47 | public User addUser(User user) { 48 | try { 49 | return restTemplate.postForObject(BASE_URL, user, User.class); 50 | } catch (Exception e) { 51 | throw new RuntimeException("Error al Agregar el Usuario: " + e.getMessage(), e); 52 | 53 | } 54 | } 55 | 56 | @Override 57 | public User updateUser(User user) { 58 | try { 59 | String url = BASE_URL + "/" + user.getId(); 60 | restTemplate.put(url, user); 61 | return user; 62 | } catch (Exception e) { 63 | throw new RuntimeException("Error al Modificar el Usuario: " + e.getMessage(), e); 64 | 65 | } 66 | } 67 | 68 | @Override 69 | public void deleteUser(String id) { 70 | try { 71 | String url = BASE_URL + "/" + id; 72 | restTemplate.delete(url); 73 | } catch (Exception e) { 74 | throw new RuntimeException("Error al eliminar el Usuario: " + e.getMessage(), e); 75 | 76 | } 77 | 78 | } 79 | 80 | } -------------------------------------------------------------------------------- /clase-12/src/main/java/com/coderhouse/dtos/AsignacionCategoriaDTO.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.dtos; 2 | 3 | public class AsignacionCategoriaDTO { 4 | 5 | private Long categoriaId; 6 | private Long cursoId; 7 | public Long getCategoriaId() { 8 | return categoriaId; 9 | } 10 | public void setCategoriaId(Long categoriaId) { 11 | this.categoriaId = categoriaId; 12 | } 13 | public Long getCursoId() { 14 | return cursoId; 15 | } 16 | public void setCursoId(Long cursoId) { 17 | this.cursoId = cursoId; 18 | } 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /clase-12/src/main/java/com/coderhouse/dtos/InscripcionDTO.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.dtos; 2 | 3 | import java.util.List; 4 | 5 | public class InscripcionDTO { 6 | 7 | private Long alumnoId; 8 | private List cursoIds; 9 | 10 | public Long getAlumnoId() { 11 | return alumnoId; 12 | } 13 | 14 | public void setAlumnoId(Long alumnoId) { 15 | this.alumnoId = alumnoId; 16 | } 17 | 18 | public List getCursoIds() { 19 | return cursoIds; 20 | } 21 | 22 | public void setCursoIds(List cursoIds) { 23 | this.cursoIds = cursoIds; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /clase-12/src/main/java/com/coderhouse/interfaces/UserRestInterface.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.interfaces; 2 | 3 | import java.util.List; 4 | 5 | import com.coderhouse.models.User; 6 | 7 | public interface UserRestInterface { 8 | 9 | public List getAllUsers(); 10 | 11 | public User getUserById(String id); 12 | 13 | public User addUser(User user); 14 | 15 | public User updateUser(User user); 16 | 17 | public void deleteUser(String id); 18 | 19 | } -------------------------------------------------------------------------------- /clase-12/src/main/java/com/coderhouse/models/Alumno.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import java.time.LocalDateTime; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | import jakarta.persistence.Column; 8 | import jakarta.persistence.Entity; 9 | import jakarta.persistence.FetchType; 10 | import jakarta.persistence.GeneratedValue; 11 | import jakarta.persistence.GenerationType; 12 | import jakarta.persistence.Id; 13 | import jakarta.persistence.ManyToMany; 14 | import jakarta.persistence.Table; 15 | import lombok.AllArgsConstructor; 16 | import lombok.Getter; 17 | import lombok.NoArgsConstructor; 18 | import lombok.Setter; 19 | import lombok.ToString; 20 | 21 | @Getter 22 | @Setter 23 | @NoArgsConstructor 24 | @AllArgsConstructor 25 | @ToString 26 | @Entity 27 | @Table(name = "Alumnos") 28 | public class Alumno { 29 | 30 | @Id // Primary Key 31 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 32 | private Long id; 33 | private String nombre; 34 | private String apellido; 35 | 36 | @Column(unique = true, nullable = false) 37 | private int dni; 38 | 39 | @Column(unique = true, nullable = false) 40 | private String legajo; 41 | 42 | @ManyToMany(mappedBy = "alumnos", fetch = FetchType.EAGER) 43 | private List cursos = new ArrayList<>(); 44 | 45 | private LocalDateTime createdAt = LocalDateTime.now(); 46 | } -------------------------------------------------------------------------------- /clase-12/src/main/java/com/coderhouse/models/Categoria.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.fasterxml.jackson.annotation.JsonIgnore; 7 | 8 | import jakarta.persistence.Column; 9 | import jakarta.persistence.Entity; 10 | import jakarta.persistence.FetchType; 11 | import jakarta.persistence.GeneratedValue; 12 | import jakarta.persistence.GenerationType; 13 | import jakarta.persistence.Id; 14 | import jakarta.persistence.OneToMany; 15 | import jakarta.persistence.Table; 16 | import lombok.AllArgsConstructor; 17 | import lombok.Getter; 18 | import lombok.NoArgsConstructor; 19 | import lombok.Setter; 20 | import lombok.ToString; 21 | 22 | @Getter 23 | @Setter 24 | @NoArgsConstructor 25 | @AllArgsConstructor 26 | @ToString 27 | @Entity 28 | @Table(name = "Categorias") 29 | public class Categoria { 30 | 31 | @Id // Primary Key 32 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 33 | private Long id; 34 | 35 | @Column(nullable = false) 36 | private String nombre; 37 | 38 | @OneToMany(mappedBy = "categoria", fetch = FetchType.EAGER) 39 | @JsonIgnore 40 | private List cursos = new ArrayList<>(); 41 | 42 | } -------------------------------------------------------------------------------- /clase-12/src/main/java/com/coderhouse/models/Curso.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.fasterxml.jackson.annotation.JsonIgnore; 7 | 8 | import jakarta.persistence.Column; 9 | import jakarta.persistence.Entity; 10 | import jakarta.persistence.FetchType; 11 | import jakarta.persistence.GeneratedValue; 12 | import jakarta.persistence.GenerationType; 13 | import jakarta.persistence.Id; 14 | import jakarta.persistence.JoinColumn; 15 | import jakarta.persistence.JoinTable; 16 | import jakarta.persistence.ManyToMany; 17 | import jakarta.persistence.ManyToOne; 18 | import jakarta.persistence.Table; 19 | import lombok.AllArgsConstructor; 20 | import lombok.Getter; 21 | import lombok.NoArgsConstructor; 22 | import lombok.Setter; 23 | import lombok.ToString; 24 | 25 | @Getter 26 | @Setter 27 | @NoArgsConstructor 28 | @AllArgsConstructor 29 | @ToString 30 | @Entity 31 | @Table(name = "Cursos") 32 | public class Curso { 33 | 34 | @Id // Primary Key 35 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 36 | private Long id; 37 | 38 | @Column(nullable = false) 39 | private String nombre; 40 | 41 | @ManyToMany(fetch = FetchType.EAGER) 42 | @JoinTable( 43 | name = "curso_alumno", 44 | joinColumns = @JoinColumn( 45 | name = "curso_id"), 46 | inverseJoinColumns = @JoinColumn( 47 | name = "alumno_id" 48 | ) 49 | ) 50 | @JsonIgnore 51 | private List alumnos = new ArrayList<>(); 52 | 53 | @ManyToOne(fetch = FetchType.EAGER) 54 | private Categoria categoria; 55 | 56 | } -------------------------------------------------------------------------------- /clase-12/src/main/java/com/coderhouse/models/User.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | 9 | @Getter 10 | @Setter 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | @ToString 14 | public class User { 15 | 16 | private String id; 17 | private String nombre; 18 | private String apellido; 19 | private String email; 20 | private String creado; 21 | 22 | 23 | } -------------------------------------------------------------------------------- /clase-12/src/main/java/com/coderhouse/repositories/AlumnoRepository.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.repositories; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import com.coderhouse.models.Alumno; 5 | 6 | public interface AlumnoRepository extends JpaRepository {} -------------------------------------------------------------------------------- /clase-12/src/main/java/com/coderhouse/repositories/CategoriaRepository.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.repositories; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import com.coderhouse.models.Categoria; 6 | 7 | public interface CategoriaRepository extends JpaRepository {} -------------------------------------------------------------------------------- /clase-12/src/main/java/com/coderhouse/repositories/CursosRepository.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.repositories; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import com.coderhouse.models.Curso; 6 | 7 | public interface CursosRepository extends JpaRepository {} -------------------------------------------------------------------------------- /clase-12/src/main/java/com/coderhouse/services/CategoriaService.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.services; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.coderhouse.models.Categoria; 9 | import com.coderhouse.repositories.CategoriaRepository; 10 | 11 | import jakarta.transaction.Transactional; 12 | 13 | @Service 14 | public class CategoriaService { 15 | 16 | @Autowired 17 | private CategoriaRepository categoriaRepository; 18 | 19 | public List findAll() { 20 | return categoriaRepository.findAll(); 21 | } 22 | 23 | public Categoria getCategoriaById(Long id) { 24 | return categoriaRepository.findById(id) 25 | .orElseThrow(() -> new IllegalArgumentException("Categoria no encontrado")); 26 | 27 | } 28 | 29 | public boolean existsById(Long id) { 30 | return categoriaRepository.existsById(id); 31 | } 32 | 33 | @Transactional 34 | public Categoria createCategoria(Categoria categoria) { 35 | return categoriaRepository.save(categoria); 36 | } 37 | 38 | @Transactional 39 | public Categoria updateCategoria(Long id, Categoria categoraDetails) { 40 | Categoria categoria = categoriaRepository.findById(id) 41 | .orElseThrow(() -> new IllegalArgumentException("Categoria no fue encontrada")); 42 | categoria.setNombre(categoraDetails.getNombre()); 43 | return categoriaRepository.save(categoria); 44 | 45 | } 46 | 47 | public void deleteById(Long id) { 48 | categoriaRepository.deleteById(id); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /clase-12/src/main/java/com/coderhouse/services/CursoService.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.services; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.coderhouse.models.Categoria; 9 | import com.coderhouse.models.Curso; 10 | import com.coderhouse.repositories.CategoriaRepository; 11 | import com.coderhouse.repositories.CursosRepository; 12 | 13 | import jakarta.transaction.Transactional; 14 | 15 | @Service 16 | public class CursoService { 17 | 18 | @Autowired 19 | private CursosRepository cursoRepository; 20 | 21 | @Autowired 22 | private CategoriaRepository categoriaRepository; 23 | 24 | public List getAllCursos() { 25 | return cursoRepository.findAll(); 26 | } 27 | 28 | public Curso getCursoById(Long id) { 29 | return cursoRepository.findById(id).orElseThrow(() -> new IllegalArgumentException("Curso no encontrado")); 30 | 31 | } 32 | 33 | @Transactional 34 | public Curso createCurso(Curso curso) { 35 | return cursoRepository.save(curso); 36 | } 37 | 38 | @Transactional 39 | public Curso updateCurso(Long id, Curso cursoDetails) { 40 | Curso curso = cursoRepository.findById(id) 41 | .orElseThrow(() -> new IllegalArgumentException("Curso no encontrado")); 42 | curso.setNombre(cursoDetails.getNombre()); 43 | return cursoRepository.save(curso); 44 | 45 | } 46 | 47 | public void deleteCurso(Long id) { 48 | if (cursoRepository.existsById(id)) { 49 | cursoRepository.deleteById(id); 50 | } else { 51 | throw new IllegalArgumentException("Curso no encontrado"); 52 | } 53 | } 54 | 55 | @Transactional 56 | public Curso asignarCategoriaACurso(Long cursoId, Long categoriaId) { 57 | Categoria categoria = categoriaRepository.findById(categoriaId) 58 | .orElseThrow(() -> new IllegalArgumentException("Categoria no encontrada")); 59 | 60 | Curso curso = cursoRepository.findById(cursoId) 61 | .orElseThrow(() -> new IllegalArgumentException("Curso no encontrada")); 62 | 63 | curso.setCategoria(categoria); 64 | return cursoRepository.save(curso); 65 | 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /clase-12/src/main/java/com/coderhouse/services/UserService.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.services; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.coderhouse.apis.UserRestApi; 9 | import com.coderhouse.interfaces.UserRestInterface; 10 | import com.coderhouse.models.User; 11 | 12 | @Service 13 | public class UserService implements UserRestInterface{ 14 | 15 | @Autowired 16 | private UserRestApi userRestApi; 17 | 18 | @Override 19 | public List getAllUsers() { 20 | return userRestApi.getAllUsers(); 21 | } 22 | 23 | @Override 24 | public User getUserById(String id) { 25 | return userRestApi.getUserById(id); 26 | } 27 | 28 | @Override 29 | public User addUser(User user) { 30 | return userRestApi.addUser(user); 31 | } 32 | 33 | @Override 34 | public User updateUser(User user) { 35 | return userRestApi.updateUser(user); 36 | } 37 | 38 | @Override 39 | public void deleteUser(String id) { 40 | userRestApi.deleteUser(id); 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /clase-12/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=clase-12 2 | 3 | spring.jpa.properties.hibernate.format_sql=true 4 | spring.jpa.hibernate.ddl-auto=update 5 | spring.jpa.show-sql=false 6 | 7 | spring.datasource.url=jdbc:mysql://localhost:3306/coderhouse 8 | spring.datasource.username=root 9 | spring.datasource.password=Alejandro -------------------------------------------------------------------------------- /clase-13/.gitattributes: -------------------------------------------------------------------------------- 1 | /mvnw text eol=lf 2 | *.cmd text eol=crlf 3 | -------------------------------------------------------------------------------- /clase-13/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /clase-13/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip 20 | -------------------------------------------------------------------------------- /clase-13/src/main/java/com/coderhouse/Clase13Application.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.web.client.RestTemplate; 7 | 8 | @SpringBootApplication 9 | public class Clase13Application { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(Clase13Application.class, args); 13 | } 14 | 15 | @Bean 16 | RestTemplate restTemplate() { 17 | return new RestTemplate(); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /clase-13/src/main/java/com/coderhouse/interfaces/UserRestInterface.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.interfaces; 2 | 3 | import java.util.List; 4 | 5 | import com.coderhouse.models.User; 6 | 7 | public interface UserRestInterface { 8 | 9 | public List getAllUsers(); 10 | 11 | public User getUserById(String id); 12 | 13 | public User addUser(User user); 14 | 15 | public User updateUser(User user); 16 | 17 | public void deleteUser(String id); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /clase-13/src/main/java/com/coderhouse/models/User.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | 9 | @Getter 10 | @Setter 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | @ToString 14 | public class User { 15 | 16 | private String id; 17 | private String nombre; 18 | private String apellido; 19 | private String email; 20 | private String creado; 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /clase-13/src/main/java/com/coderhouse/services/UserService.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.services; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.coderhouse.apis.UserRestApi; 9 | import com.coderhouse.interfaces.UserRestInterface; 10 | import com.coderhouse.models.User; 11 | 12 | @Service 13 | public class UserService implements UserRestInterface{ 14 | 15 | @Autowired 16 | private UserRestApi userRestApi; 17 | 18 | @Override 19 | public List getAllUsers() { 20 | return userRestApi.getAllUsers(); 21 | } 22 | 23 | @Override 24 | public User getUserById(String id) { 25 | return userRestApi.getUserById(id); 26 | } 27 | 28 | @Override 29 | public User addUser(User user) { 30 | return userRestApi.addUser(user); 31 | } 32 | 33 | @Override 34 | public User updateUser(User user) { 35 | return userRestApi.updateUser(user); 36 | } 37 | 38 | @Override 39 | public void deleteUser(String id) { 40 | userRestApi.deleteUser(id); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /clase-13/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=clase-13 2 | spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration 3 | -------------------------------------------------------------------------------- /clase-14/.gitattributes: -------------------------------------------------------------------------------- 1 | /mvnw text eol=lf 2 | *.cmd text eol=crlf 3 | -------------------------------------------------------------------------------- /clase-14/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /clase-14/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip 20 | -------------------------------------------------------------------------------- /clase-14/src/main/java/com/coderhouse/Clase14Application.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.web.client.RestTemplate; 7 | 8 | @SpringBootApplication 9 | public class Clase14Application { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(Clase14Application.class, args); 13 | } 14 | 15 | @Bean 16 | RestTemplate restTemplate() { 17 | return new RestTemplate(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /clase-14/src/main/java/com/coderhouse/config/OpenApiConfig.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.config; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | import io.swagger.v3.oas.models.OpenAPI; 9 | import io.swagger.v3.oas.models.info.Contact; 10 | import io.swagger.v3.oas.models.info.Info; 11 | import io.swagger.v3.oas.models.info.License; 12 | import io.swagger.v3.oas.models.servers.Server; 13 | 14 | @Configuration 15 | public class OpenApiConfig { 16 | 17 | //http://localhost:8080/swagger-ui.html# 18 | //http://localhost:8080/swagger-ui/ 19 | 20 | @Bean 21 | OpenAPI customOpenAPI () { 22 | return new OpenAPI() 23 | .info(new Info() 24 | .title("API REST Full | Java | CoderHouse") 25 | .version("3.0.0") 26 | .description("La API REST proporciona endpoints para administrar alumnos y " 27 | + "cursos en una plataforma educativa. Permite realizar operaciones " 28 | + "CRUD (Crear, Leer, Actualizar, Eliminar) tanto para alumnos como " 29 | + "para cursos. Los endpoints permiten listar, agregar, mostrar, " 30 | + "editar y eliminar alumnos y cursos. La API está documentada utilizando " 31 | + "Swagger, lo que facilita la comprensión de los endpoints y su uso.") 32 | .contact(new Contact() 33 | .name("Alejandro Di Stefano") 34 | .email("alejandro@mimail.com") 35 | .url("https://coderhouse.com.ar")) 36 | .license(new License() 37 | .name("Licencia") 38 | .url("https://github.com/Drako01/java-59570?tab=MIT-1-ov-file")) 39 | ) 40 | .servers(List.of(new Server() 41 | .url("http://localhost:8080") 42 | .description("Servidor Local"))); 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /clase-14/src/main/java/com/coderhouse/dtos/AsignacionCategoriaDTO.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.dtos; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | @Getter 8 | @Setter 9 | @Schema(description = "Modelo de Asignacion de Categorias DTO") 10 | public class AsignacionCategoriaDTO { 11 | 12 | @Schema(description = "Categoria ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 13 | private Long categoriaId; 14 | @Schema(description = "Curso ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 15 | private Long cursoId; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /clase-14/src/main/java/com/coderhouse/dtos/InscripcionDTO.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.dtos; 2 | 3 | import java.util.List; 4 | 5 | import io.swagger.v3.oas.annotations.media.Schema; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | 9 | @Getter 10 | @Setter 11 | @Schema(description = "Modelo de Inscripción de Alumnos DTO") 12 | public class InscripcionDTO { 13 | @Schema(description = "Alumno ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 14 | private Long alumnoId; 15 | @Schema(description = "Curso ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 16 | private List cursoIds; 17 | } 18 | -------------------------------------------------------------------------------- /clase-14/src/main/java/com/coderhouse/interfaces/DAOInterface.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.interfaces; 2 | 3 | import java.util.List; 4 | 5 | public interface DAOInterface { 6 | 7 | T save(T object); 8 | 9 | T getById(Integer id); 10 | 11 | List getAll(); 12 | 13 | T update(Integer id, T object) throws Exception; 14 | 15 | void delete(Integer id); 16 | 17 | } -------------------------------------------------------------------------------- /clase-14/src/main/java/com/coderhouse/interfaces/UserRestInterface.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.interfaces; 2 | 3 | import java.util.List; 4 | 5 | import com.coderhouse.models.User; 6 | 7 | public interface UserRestInterface { 8 | 9 | public List getAllUsers(); 10 | 11 | public User getUserById(String id); 12 | 13 | public User addUser(User user); 14 | 15 | public User updateUser(User user); 16 | 17 | public void deleteUser(String id); 18 | 19 | } -------------------------------------------------------------------------------- /clase-14/src/main/java/com/coderhouse/models/Alumno.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import java.time.LocalDateTime; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | import jakarta.persistence.Column; 9 | import jakarta.persistence.Entity; 10 | import jakarta.persistence.FetchType; 11 | import jakarta.persistence.GeneratedValue; 12 | import jakarta.persistence.GenerationType; 13 | import jakarta.persistence.Id; 14 | import jakarta.persistence.ManyToMany; 15 | import jakarta.persistence.Table; 16 | import lombok.AllArgsConstructor; 17 | import lombok.Getter; 18 | import lombok.NoArgsConstructor; 19 | import lombok.Setter; 20 | import lombok.ToString; 21 | 22 | @Getter 23 | @Setter 24 | @NoArgsConstructor 25 | @AllArgsConstructor 26 | @ToString 27 | @Schema(description = "Modelo de Alumno") 28 | @Entity 29 | @Table(name = "Alumnos") 30 | public class Alumno { 31 | 32 | @Schema(description = "ID del Alumno", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 33 | @Id // Primary Key 34 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 35 | private Long id; 36 | 37 | @Schema(description = "Nombre del Alumno", requiredMode = Schema.RequiredMode.REQUIRED, example = "Alejandro") 38 | private String nombre; 39 | 40 | @Schema(description = "Apellido del Alumno", requiredMode = Schema.RequiredMode.REQUIRED, example = "Di Stefano") 41 | private String apellido; 42 | 43 | @Schema(description = "DNI del Alumno", requiredMode = Schema.RequiredMode.REQUIRED, example = "22333666") 44 | @Column(unique = true, nullable = false) 45 | private int dni; 46 | 47 | @Schema(description = "Legajo del Alumno", requiredMode = Schema.RequiredMode.REQUIRED, example = "L22333666") 48 | @Column(unique = true, nullable = false) 49 | private String legajo; 50 | 51 | @Schema(description = "Lista de Cursos en los que se Anotó el Alumno") 52 | @ManyToMany(mappedBy = "alumnos", fetch = FetchType.EAGER) 53 | private List cursos = new ArrayList<>(); 54 | 55 | @Schema(description = "Fecha de Alta del Alumno", example = "2024/11/12") 56 | private LocalDateTime createdAt = LocalDateTime.now(); 57 | } -------------------------------------------------------------------------------- /clase-14/src/main/java/com/coderhouse/models/Categoria.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.fasterxml.jackson.annotation.JsonIgnore; 7 | 8 | import io.swagger.v3.oas.annotations.media.Schema; 9 | import jakarta.persistence.Column; 10 | import jakarta.persistence.Entity; 11 | import jakarta.persistence.FetchType; 12 | import jakarta.persistence.GeneratedValue; 13 | import jakarta.persistence.GenerationType; 14 | import jakarta.persistence.Id; 15 | import jakarta.persistence.OneToMany; 16 | import jakarta.persistence.Table; 17 | import lombok.AllArgsConstructor; 18 | import lombok.Getter; 19 | import lombok.NoArgsConstructor; 20 | import lombok.Setter; 21 | import lombok.ToString; 22 | 23 | @Getter 24 | @Setter 25 | @NoArgsConstructor 26 | @AllArgsConstructor 27 | @ToString 28 | @Schema(description = "Modelo de Categorias") 29 | @Entity 30 | @Table(name = "Categorias") 31 | public class Categoria { 32 | 33 | @Schema(description = "ID de la Categoria", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 34 | @Id // Primary Key 35 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 36 | private Long id; 37 | 38 | @Schema(description = "Nombre de la Categoria", requiredMode = Schema.RequiredMode.REQUIRED, example = "Programación") 39 | @Column(nullable = false) 40 | private String nombre; 41 | 42 | @OneToMany(mappedBy = "categoria", fetch = FetchType.EAGER) 43 | @JsonIgnore 44 | private List cursos = new ArrayList<>(); 45 | 46 | } -------------------------------------------------------------------------------- /clase-14/src/main/java/com/coderhouse/models/Curso.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.fasterxml.jackson.annotation.JsonIgnore; 7 | 8 | import io.swagger.v3.oas.annotations.media.Schema; 9 | import jakarta.persistence.Column; 10 | import jakarta.persistence.Entity; 11 | import jakarta.persistence.FetchType; 12 | import jakarta.persistence.GeneratedValue; 13 | import jakarta.persistence.GenerationType; 14 | import jakarta.persistence.Id; 15 | import jakarta.persistence.JoinColumn; 16 | import jakarta.persistence.JoinTable; 17 | import jakarta.persistence.ManyToMany; 18 | import jakarta.persistence.ManyToOne; 19 | import jakarta.persistence.Table; 20 | import lombok.AllArgsConstructor; 21 | import lombok.Getter; 22 | import lombok.NoArgsConstructor; 23 | import lombok.Setter; 24 | import lombok.ToString; 25 | 26 | @Getter 27 | @Setter 28 | @NoArgsConstructor 29 | @AllArgsConstructor 30 | @ToString 31 | @Schema(description = "Modelo de Cursos") 32 | @Entity 33 | @Table(name = "Cursos") 34 | public class Curso { 35 | 36 | @Schema(description = "ID del Cursos", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 37 | @Id // Primary Key 38 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 39 | private Long id; 40 | 41 | @Schema(description = "Nombre del Cursos", requiredMode = Schema.RequiredMode.REQUIRED, example = "Java") 42 | @Column(nullable = false) 43 | private String nombre; 44 | 45 | @ManyToMany(fetch = FetchType.EAGER) 46 | @JoinTable( 47 | name = "curso_alumno", 48 | joinColumns = @JoinColumn( 49 | name = "curso_id"), 50 | inverseJoinColumns = @JoinColumn( 51 | name = "alumno_id" 52 | ) 53 | ) 54 | @JsonIgnore 55 | private List alumnos = new ArrayList<>(); 56 | 57 | @Schema(description = "Categoria del Cursos", requiredMode = Schema.RequiredMode.REQUIRED) 58 | @ManyToOne(fetch = FetchType.EAGER) 59 | private Categoria categoria; 60 | 61 | } -------------------------------------------------------------------------------- /clase-14/src/main/java/com/coderhouse/models/User.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Getter; 6 | import lombok.NoArgsConstructor; 7 | import lombok.Setter; 8 | import lombok.ToString; 9 | 10 | @Getter 11 | @Setter 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | @ToString 15 | public class User { 16 | @Schema(description = "ID del User", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 17 | private String id; 18 | @Schema(description = "Nombre del User", requiredMode = Schema.RequiredMode.REQUIRED, example = "Usuario") 19 | private String nombre; 20 | @Schema(description = "Apellido del User", requiredMode = Schema.RequiredMode.REQUIRED, example = "Test API") 21 | private String apellido; 22 | @Schema(description = "Email del User", requiredMode = Schema.RequiredMode.REQUIRED, example = "usuario@test.com") 23 | private String email; 24 | @Schema(description = "Fecha de Alta del User", requiredMode = Schema.RequiredMode.AUTO) 25 | private String creado; 26 | 27 | 28 | } -------------------------------------------------------------------------------- /clase-14/src/main/java/com/coderhouse/repositories/AlumnoRepository.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.repositories; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import com.coderhouse.models.Alumno; 5 | 6 | public interface AlumnoRepository extends JpaRepository {} -------------------------------------------------------------------------------- /clase-14/src/main/java/com/coderhouse/repositories/CategoriaRepository.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.repositories; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import com.coderhouse.models.Categoria; 6 | 7 | public interface CategoriaRepository extends JpaRepository {} -------------------------------------------------------------------------------- /clase-14/src/main/java/com/coderhouse/repositories/CursosRepository.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.repositories; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import com.coderhouse.models.Curso; 6 | 7 | public interface CursosRepository extends JpaRepository {} -------------------------------------------------------------------------------- /clase-14/src/main/java/com/coderhouse/services/CategoriaService.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.services; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.coderhouse.models.Categoria; 9 | import com.coderhouse.repositories.CategoriaRepository; 10 | 11 | import jakarta.transaction.Transactional; 12 | 13 | @Service 14 | public class CategoriaService { 15 | 16 | @Autowired 17 | private CategoriaRepository categoriaRepository; 18 | 19 | public List findAll() { 20 | return categoriaRepository.findAll(); 21 | } 22 | 23 | public Categoria getCategoriaById(Long id) { 24 | return categoriaRepository.findById(id) 25 | .orElseThrow(() -> new IllegalArgumentException("Categoria no encontrado")); 26 | 27 | } 28 | 29 | public boolean existsById(Long id) { 30 | return categoriaRepository.existsById(id); 31 | } 32 | 33 | @Transactional 34 | public Categoria createCategoria(Categoria categoria) { 35 | return categoriaRepository.save(categoria); 36 | } 37 | 38 | @Transactional 39 | public Categoria updateCategoria(Long id, Categoria categoraDetails) { 40 | Categoria categoria = categoriaRepository.findById(id) 41 | .orElseThrow(() -> new IllegalArgumentException("Categoria no fue encontrada")); 42 | categoria.setNombre(categoraDetails.getNombre()); 43 | return categoriaRepository.save(categoria); 44 | 45 | } 46 | 47 | public void deleteById(Long id) { 48 | categoriaRepository.deleteById(id); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /clase-14/src/main/java/com/coderhouse/services/CursoService.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.services; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.coderhouse.models.Categoria; 9 | import com.coderhouse.models.Curso; 10 | import com.coderhouse.repositories.CategoriaRepository; 11 | import com.coderhouse.repositories.CursosRepository; 12 | 13 | import jakarta.transaction.Transactional; 14 | 15 | @Service 16 | public class CursoService { 17 | 18 | @Autowired 19 | private CursosRepository cursoRepository; 20 | 21 | @Autowired 22 | private CategoriaRepository categoriaRepository; 23 | 24 | public List getAllCursos() { 25 | return cursoRepository.findAll(); 26 | } 27 | 28 | public Curso getCursoById(Long id) { 29 | return cursoRepository.findById(id).orElseThrow(() -> new IllegalArgumentException("Curso no encontrado")); 30 | 31 | } 32 | 33 | @Transactional 34 | public Curso createCurso(Curso curso) { 35 | return cursoRepository.save(curso); 36 | } 37 | 38 | @Transactional 39 | public Curso updateCurso(Long id, Curso cursoDetails) { 40 | Curso curso = cursoRepository.findById(id) 41 | .orElseThrow(() -> new IllegalArgumentException("Curso no encontrado")); 42 | curso.setNombre(cursoDetails.getNombre()); 43 | return cursoRepository.save(curso); 44 | 45 | } 46 | 47 | public void deleteCurso(Long id) { 48 | if (cursoRepository.existsById(id)) { 49 | cursoRepository.deleteById(id); 50 | } else { 51 | throw new IllegalArgumentException("Curso no encontrado"); 52 | } 53 | } 54 | 55 | @Transactional 56 | public Curso asignarCategoriaACurso(Long cursoId, Long categoriaId) { 57 | Categoria categoria = categoriaRepository.findById(categoriaId) 58 | .orElseThrow(() -> new IllegalArgumentException("Categoria no encontrada")); 59 | 60 | Curso curso = cursoRepository.findById(cursoId) 61 | .orElseThrow(() -> new IllegalArgumentException("Curso no encontrada")); 62 | 63 | curso.setCategoria(categoria); 64 | return cursoRepository.save(curso); 65 | 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /clase-14/src/main/java/com/coderhouse/services/UserService.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.services; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.coderhouse.apis.UserRestApi; 9 | import com.coderhouse.interfaces.UserRestInterface; 10 | import com.coderhouse.models.User; 11 | 12 | @Service 13 | public class UserService implements UserRestInterface{ 14 | 15 | @Autowired 16 | private UserRestApi userRestApi; 17 | 18 | @Override 19 | public List getAllUsers() { 20 | return userRestApi.getAllUsers(); 21 | } 22 | 23 | @Override 24 | public User getUserById(String id) { 25 | return userRestApi.getUserById(id); 26 | } 27 | 28 | @Override 29 | public User addUser(User user) { 30 | return userRestApi.addUser(user); 31 | } 32 | 33 | @Override 34 | public User updateUser(User user) { 35 | return userRestApi.updateUser(user); 36 | } 37 | 38 | @Override 39 | public void deleteUser(String id) { 40 | userRestApi.deleteUser(id); 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /clase-14/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=clase-14 2 | 3 | spring.jpa.properties.hibernate.format_sql=true 4 | spring.jpa.hibernate.ddl-auto=update 5 | spring.jpa.show-sql=false 6 | 7 | spring.datasource.url=jdbc:mysql://localhost:3306/coderhouse 8 | spring.datasource.username=root 9 | spring.datasource.password=Alejandro -------------------------------------------------------------------------------- /clase-14/src/main/resources/colecciones/Time API.postman_collection.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "34f8a47c-aef1-45a2-9da2-d3bab8319b5c", 4 | "name": "Time API", 5 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", 6 | "_exporter_id": "26925227", 7 | "_collection_link": "https://armotusitio.postman.co/workspace/Java---CoderHouse~c21e6086-a9e2-4ed0-938d-38d87b78ce2e/collection/26925227-34f8a47c-aef1-45a2-9da2-d3bab8319b5c?action=share&source=collection_link&creator=26925227" 8 | }, 9 | "item": [ 10 | { 11 | "name": "Obtener la Fecha Actual desde una API Externa", 12 | "request": { 13 | "method": "GET", 14 | "header": [], 15 | "url": { 16 | "raw": "http://localhost:8080/api/fecha", 17 | "protocol": "http", 18 | "host": [ 19 | "localhost" 20 | ], 21 | "port": "8080", 22 | "path": [ 23 | "api", 24 | "fecha" 25 | ] 26 | } 27 | }, 28 | "response": [] 29 | } 30 | ] 31 | } -------------------------------------------------------------------------------- /clase-15/.gitattributes: -------------------------------------------------------------------------------- 1 | /mvnw text eol=lf 2 | *.cmd text eol=crlf 3 | -------------------------------------------------------------------------------- /clase-15/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /clase-15/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip 20 | -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/Clase15Application.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.web.client.RestTemplate; 7 | 8 | @SpringBootApplication 9 | public class Clase15Application { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(Clase15Application.class, args); 13 | } 14 | 15 | @Bean 16 | RestTemplate restTemplate() { 17 | return new RestTemplate(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/config/OpenApiConfig.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.config; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | import io.swagger.v3.oas.models.OpenAPI; 9 | import io.swagger.v3.oas.models.info.Contact; 10 | import io.swagger.v3.oas.models.info.Info; 11 | import io.swagger.v3.oas.models.info.License; 12 | import io.swagger.v3.oas.models.servers.Server; 13 | 14 | @Configuration 15 | public class OpenApiConfig { 16 | 17 | //http://localhost:8080/swagger-ui.html# 18 | //http://localhost:8080/swagger-ui/ 19 | 20 | @Bean 21 | OpenAPI customOpenAPI () { 22 | return new OpenAPI() 23 | .info(new Info() 24 | .title("API REST Full | Java | CoderHouse") 25 | .version("3.0.0") 26 | .description("La API REST proporciona endpoints para administrar alumnos y " 27 | + "cursos en una plataforma educativa. Permite realizar operaciones " 28 | + "CRUD (Crear, Leer, Actualizar, Eliminar) tanto para alumnos como " 29 | + "para cursos. Los endpoints permiten listar, agregar, mostrar, " 30 | + "editar y eliminar alumnos y cursos. La API está documentada utilizando " 31 | + "Swagger, lo que facilita la comprensión de los endpoints y su uso.") 32 | .contact(new Contact() 33 | .name("Alejandro Di Stefano") 34 | .email("alejandro@mimail.com") 35 | .url("https://coderhouse.com.ar")) 36 | .license(new License() 37 | .name("Licencia") 38 | .url("https://github.com/Drako01/java-59570?tab=MIT-1-ov-file")) 39 | ) 40 | .servers(List.of(new Server() 41 | .url("http://localhost:8080") 42 | .description("Servidor Local"))); 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/controllers/FechaController.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.controllers; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.http.HttpStatus; 5 | import org.springframework.http.ResponseEntity; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | import com.coderhouse.dtos.TimeResponseDTO; 11 | import com.coderhouse.services.FechaService; 12 | 13 | @RestController 14 | @RequestMapping("/api/fecha") 15 | public class FechaController { 16 | 17 | @Autowired 18 | private FechaService fechaService; 19 | 20 | private int contadorDeInvocaciones = 0; 21 | private String ultimaFechaMostrada = "N/A"; 22 | 23 | @GetMapping 24 | public ResponseEntity obtenerFechaActual() { 25 | contadorDeInvocaciones++; 26 | 27 | TimeResponseDTO fechaActual = fechaService.obtenerFechaActual(); 28 | if (fechaActual == null) { 29 | return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE) 30 | .body("Error al obtener la fecha Actual desde la API Externa"); 31 | } 32 | String mensaje = String.format( 33 | "Fecha Actual: %s %s %d, %d\nHora: %s\nNúmero de invocaciones: %d\nÚltima fecha mostrada: %s", 34 | fechaActual.getDayOfWeek(), 35 | fechaActual.getMonth(), 36 | fechaActual.getDay(), 37 | fechaActual.getYear(), 38 | fechaActual.getTime(), 39 | contadorDeInvocaciones, 40 | ultimaFechaMostrada); 41 | 42 | 43 | ultimaFechaMostrada = String.format("%s %s %d, %d %s", 44 | fechaActual.getDayOfWeek(), 45 | fechaActual.getMonth(), 46 | fechaActual.getDay(), 47 | fechaActual.getYear(), 48 | fechaActual.getTime()); 49 | 50 | return ResponseEntity.ok(mensaje); 51 | 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/dtos/AsignacionCategoriaDTO.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.dtos; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | @Getter 8 | @Setter 9 | @Schema(description = "Modelo de Asignacion de Categorias DTO") 10 | public class AsignacionCategoriaDTO { 11 | 12 | @Schema(description = "Categoria ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 13 | private Long categoriaId; 14 | @Schema(description = "Curso ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 15 | private Long cursoId; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/dtos/InscripcionDTO.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.dtos; 2 | 3 | import java.util.List; 4 | 5 | import io.swagger.v3.oas.annotations.media.Schema; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | 9 | @Getter 10 | @Setter 11 | @Schema(description = "Modelo de Inscripción de Alumnos DTO") 12 | public class InscripcionDTO { 13 | @Schema(description = "Alumno ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 14 | private Long alumnoId; 15 | @Schema(description = "Curso ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 16 | private List cursoIds; 17 | } 18 | -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/dtos/TimeResponseDTO.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.dtos; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class TimeResponseDTO { 7 | 8 | private int year; 9 | private int month; 10 | private int day; 11 | private int hour; 12 | private int minute; 13 | private int second; 14 | private int milliSeconds; 15 | private String dateTime; 16 | private String date; 17 | private String time; 18 | private String timeZone; 19 | private String dayOfWeek; 20 | private boolean dstActive; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/interfaces/DAOInterface.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.interfaces; 2 | 3 | import java.util.List; 4 | 5 | public interface DAOInterface { 6 | 7 | T save(T object); 8 | 9 | T getById(Integer id); 10 | 11 | List getAll(); 12 | 13 | T update(Integer id, T object) throws Exception; 14 | 15 | void delete(Integer id); 16 | 17 | } -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/interfaces/UserRestInterface.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.interfaces; 2 | 3 | import java.util.List; 4 | 5 | import com.coderhouse.models.User; 6 | 7 | public interface UserRestInterface { 8 | 9 | public List getAllUsers(); 10 | 11 | public User getUserById(String id); 12 | 13 | public User addUser(User user); 14 | 15 | public User updateUser(User user); 16 | 17 | public void deleteUser(String id); 18 | 19 | } -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/models/Alumno.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import java.time.LocalDateTime; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | import jakarta.persistence.Column; 9 | import jakarta.persistence.Entity; 10 | import jakarta.persistence.FetchType; 11 | import jakarta.persistence.GeneratedValue; 12 | import jakarta.persistence.GenerationType; 13 | import jakarta.persistence.Id; 14 | import jakarta.persistence.ManyToMany; 15 | import jakarta.persistence.Table; 16 | import lombok.AllArgsConstructor; 17 | import lombok.Getter; 18 | import lombok.NoArgsConstructor; 19 | import lombok.Setter; 20 | import lombok.ToString; 21 | 22 | @Getter 23 | @Setter 24 | @NoArgsConstructor 25 | @AllArgsConstructor 26 | @ToString 27 | @Schema(description = "Modelo de Alumno") 28 | @Entity 29 | @Table(name = "Alumnos") 30 | public class Alumno { 31 | 32 | @Schema(description = "ID del Alumno", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 33 | @Id // Primary Key 34 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 35 | private Long id; 36 | 37 | @Schema(description = "Nombre del Alumno", requiredMode = Schema.RequiredMode.REQUIRED, example = "Alejandro") 38 | private String nombre; 39 | 40 | @Schema(description = "Apellido del Alumno", requiredMode = Schema.RequiredMode.REQUIRED, example = "Di Stefano") 41 | private String apellido; 42 | 43 | @Schema(description = "DNI del Alumno", requiredMode = Schema.RequiredMode.REQUIRED, example = "22333666") 44 | @Column(unique = true, nullable = false) 45 | private int dni; 46 | 47 | @Schema(description = "Legajo del Alumno", requiredMode = Schema.RequiredMode.REQUIRED, example = "L22333666") 48 | @Column(unique = true, nullable = false) 49 | private String legajo; 50 | 51 | @Schema(description = "Lista de Cursos en los que se Anotó el Alumno") 52 | @ManyToMany(mappedBy = "alumnos", fetch = FetchType.EAGER) 53 | private List cursos = new ArrayList<>(); 54 | 55 | @Schema(description = "Fecha de Alta del Alumno", example = "2024/11/12") 56 | private LocalDateTime createdAt = LocalDateTime.now(); 57 | } -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/models/Categoria.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.fasterxml.jackson.annotation.JsonIgnore; 7 | 8 | import io.swagger.v3.oas.annotations.media.Schema; 9 | import jakarta.persistence.Column; 10 | import jakarta.persistence.Entity; 11 | import jakarta.persistence.FetchType; 12 | import jakarta.persistence.GeneratedValue; 13 | import jakarta.persistence.GenerationType; 14 | import jakarta.persistence.Id; 15 | import jakarta.persistence.OneToMany; 16 | import jakarta.persistence.Table; 17 | import lombok.AllArgsConstructor; 18 | import lombok.Getter; 19 | import lombok.NoArgsConstructor; 20 | import lombok.Setter; 21 | import lombok.ToString; 22 | 23 | @Getter 24 | @Setter 25 | @NoArgsConstructor 26 | @AllArgsConstructor 27 | @ToString 28 | @Schema(description = "Modelo de Categorias") 29 | @Entity 30 | @Table(name = "Categorias") 31 | public class Categoria { 32 | 33 | @Schema(description = "ID de la Categoria", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 34 | @Id // Primary Key 35 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 36 | private Long id; 37 | 38 | @Schema(description = "Nombre de la Categoria", requiredMode = Schema.RequiredMode.REQUIRED, example = "Programación") 39 | @Column(nullable = false) 40 | private String nombre; 41 | 42 | @OneToMany(mappedBy = "categoria", fetch = FetchType.EAGER) 43 | @JsonIgnore 44 | private List cursos = new ArrayList<>(); 45 | 46 | } -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/models/Curso.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.fasterxml.jackson.annotation.JsonIgnore; 7 | 8 | import io.swagger.v3.oas.annotations.media.Schema; 9 | import jakarta.persistence.Column; 10 | import jakarta.persistence.Entity; 11 | import jakarta.persistence.FetchType; 12 | import jakarta.persistence.GeneratedValue; 13 | import jakarta.persistence.GenerationType; 14 | import jakarta.persistence.Id; 15 | import jakarta.persistence.JoinColumn; 16 | import jakarta.persistence.JoinTable; 17 | import jakarta.persistence.ManyToMany; 18 | import jakarta.persistence.ManyToOne; 19 | import jakarta.persistence.Table; 20 | import lombok.AllArgsConstructor; 21 | import lombok.Getter; 22 | import lombok.NoArgsConstructor; 23 | import lombok.Setter; 24 | import lombok.ToString; 25 | 26 | @Getter 27 | @Setter 28 | @NoArgsConstructor 29 | @AllArgsConstructor 30 | @ToString 31 | @Schema(description = "Modelo de Cursos") 32 | @Entity 33 | @Table(name = "Cursos") 34 | public class Curso { 35 | 36 | @Schema(description = "ID del Cursos", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 37 | @Id // Primary Key 38 | @GeneratedValue(strategy = GenerationType.IDENTITY) // AutoIncremental 39 | private Long id; 40 | 41 | @Schema(description = "Nombre del Cursos", requiredMode = Schema.RequiredMode.REQUIRED, example = "Java") 42 | @Column(nullable = false) 43 | private String nombre; 44 | 45 | @ManyToMany(fetch = FetchType.EAGER) 46 | @JoinTable( 47 | name = "curso_alumno", 48 | joinColumns = @JoinColumn( 49 | name = "curso_id"), 50 | inverseJoinColumns = @JoinColumn( 51 | name = "alumno_id" 52 | ) 53 | ) 54 | @JsonIgnore 55 | private List alumnos = new ArrayList<>(); 56 | 57 | @Schema(description = "Categoria del Cursos", requiredMode = Schema.RequiredMode.REQUIRED) 58 | @ManyToOne(fetch = FetchType.EAGER) 59 | private Categoria categoria; 60 | 61 | } -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/models/User.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.models; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Getter; 6 | import lombok.NoArgsConstructor; 7 | import lombok.Setter; 8 | import lombok.ToString; 9 | 10 | @Getter 11 | @Setter 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | @ToString 15 | public class User { 16 | @Schema(description = "ID del User", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 17 | private String id; 18 | @Schema(description = "Nombre del User", requiredMode = Schema.RequiredMode.REQUIRED, example = "Usuario") 19 | private String nombre; 20 | @Schema(description = "Apellido del User", requiredMode = Schema.RequiredMode.REQUIRED, example = "Test API") 21 | private String apellido; 22 | @Schema(description = "Email del User", requiredMode = Schema.RequiredMode.REQUIRED, example = "usuario@test.com") 23 | private String email; 24 | @Schema(description = "Fecha de Alta del User", requiredMode = Schema.RequiredMode.AUTO) 25 | private String creado; 26 | 27 | 28 | } -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/repositories/AlumnoRepository.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.repositories; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import com.coderhouse.models.Alumno; 5 | 6 | public interface AlumnoRepository extends JpaRepository {} -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/repositories/CategoriaRepository.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.repositories; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import com.coderhouse.models.Categoria; 6 | 7 | public interface CategoriaRepository extends JpaRepository {} -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/repositories/CursosRepository.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.repositories; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import com.coderhouse.models.Curso; 6 | 7 | public interface CursosRepository extends JpaRepository {} -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/services/CategoriaService.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.services; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.coderhouse.models.Categoria; 9 | import com.coderhouse.repositories.CategoriaRepository; 10 | 11 | import jakarta.transaction.Transactional; 12 | 13 | @Service 14 | public class CategoriaService { 15 | 16 | @Autowired 17 | private CategoriaRepository categoriaRepository; 18 | 19 | public List findAll() { 20 | return categoriaRepository.findAll(); 21 | } 22 | 23 | public Categoria getCategoriaById(Long id) { 24 | return categoriaRepository.findById(id) 25 | .orElseThrow(() -> new IllegalArgumentException("Categoria no encontrado")); 26 | 27 | } 28 | 29 | public boolean existsById(Long id) { 30 | return categoriaRepository.existsById(id); 31 | } 32 | 33 | @Transactional 34 | public Categoria createCategoria(Categoria categoria) { 35 | return categoriaRepository.save(categoria); 36 | } 37 | 38 | @Transactional 39 | public Categoria updateCategoria(Long id, Categoria categoraDetails) { 40 | Categoria categoria = categoriaRepository.findById(id) 41 | .orElseThrow(() -> new IllegalArgumentException("Categoria no fue encontrada")); 42 | categoria.setNombre(categoraDetails.getNombre()); 43 | return categoriaRepository.save(categoria); 44 | 45 | } 46 | 47 | public void deleteById(Long id) { 48 | categoriaRepository.deleteById(id); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/services/CursoService.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.services; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.coderhouse.models.Categoria; 9 | import com.coderhouse.models.Curso; 10 | import com.coderhouse.repositories.CategoriaRepository; 11 | import com.coderhouse.repositories.CursosRepository; 12 | 13 | import jakarta.transaction.Transactional; 14 | 15 | @Service 16 | public class CursoService { 17 | 18 | @Autowired 19 | private CursosRepository cursoRepository; 20 | 21 | @Autowired 22 | private CategoriaRepository categoriaRepository; 23 | 24 | public List getAllCursos() { 25 | return cursoRepository.findAll(); 26 | } 27 | 28 | public Curso getCursoById(Long id) { 29 | return cursoRepository.findById(id).orElseThrow(() -> new IllegalArgumentException("Curso no encontrado")); 30 | 31 | } 32 | 33 | @Transactional 34 | public Curso createCurso(Curso curso) { 35 | return cursoRepository.save(curso); 36 | } 37 | 38 | @Transactional 39 | public Curso updateCurso(Long id, Curso cursoDetails) { 40 | Curso curso = cursoRepository.findById(id) 41 | .orElseThrow(() -> new IllegalArgumentException("Curso no encontrado")); 42 | curso.setNombre(cursoDetails.getNombre()); 43 | return cursoRepository.save(curso); 44 | 45 | } 46 | 47 | public void deleteCurso(Long id) { 48 | if (cursoRepository.existsById(id)) { 49 | cursoRepository.deleteById(id); 50 | } else { 51 | throw new IllegalArgumentException("Curso no encontrado"); 52 | } 53 | } 54 | 55 | @Transactional 56 | public Curso asignarCategoriaACurso(Long cursoId, Long categoriaId) { 57 | Categoria categoria = categoriaRepository.findById(categoriaId) 58 | .orElseThrow(() -> new IllegalArgumentException("Categoria no encontrada")); 59 | 60 | Curso curso = cursoRepository.findById(cursoId) 61 | .orElseThrow(() -> new IllegalArgumentException("Curso no encontrada")); 62 | 63 | curso.setCategoria(categoria); 64 | return cursoRepository.save(curso); 65 | 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/services/FechaService.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.services; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import org.springframework.web.client.RestClientException; 6 | import org.springframework.web.client.RestTemplate; 7 | 8 | import com.coderhouse.dtos.TimeResponseDTO; 9 | 10 | @Service 11 | public class FechaService { 12 | 13 | @Autowired 14 | private RestTemplate restTemplate; 15 | 16 | public TimeResponseDTO obtenerFechaActual() { 17 | try { 18 | final String URL = "https://timeapi.io/api/Time/current/zone?timeZone=America/Argentina/Buenos_Aires"; 19 | return restTemplate.getForObject(URL, TimeResponseDTO.class); 20 | }catch(RestClientException error) { 21 | System.err.println("Error, No se pudo conectar a la API Externa: " + error.getMessage()); 22 | return null; 23 | } 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /clase-15/src/main/java/com/coderhouse/services/UserService.java: -------------------------------------------------------------------------------- 1 | package com.coderhouse.services; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.coderhouse.apis.UserRestApi; 9 | import com.coderhouse.interfaces.UserRestInterface; 10 | import com.coderhouse.models.User; 11 | 12 | @Service 13 | public class UserService implements UserRestInterface{ 14 | 15 | @Autowired 16 | private UserRestApi userRestApi; 17 | 18 | @Override 19 | public List getAllUsers() { 20 | return userRestApi.getAllUsers(); 21 | } 22 | 23 | @Override 24 | public User getUserById(String id) { 25 | return userRestApi.getUserById(id); 26 | } 27 | 28 | @Override 29 | public User addUser(User user) { 30 | return userRestApi.addUser(user); 31 | } 32 | 33 | @Override 34 | public User updateUser(User user) { 35 | return userRestApi.updateUser(user); 36 | } 37 | 38 | @Override 39 | public void deleteUser(String id) { 40 | userRestApi.deleteUser(id); 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /clase-15/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=clase-15 2 | 3 | spring.jpa.properties.hibernate.format_sql=true 4 | spring.jpa.hibernate.ddl-auto=update 5 | spring.jpa.show-sql=false 6 | 7 | spring.datasource.url=jdbc:mysql://localhost:3306/coderhouse 8 | spring.datasource.username=root 9 | spring.datasource.password=Alejandro -------------------------------------------------------------------------------- /clase-15/src/main/resources/colecciones/Time API.postman_collection.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "34f8a47c-aef1-45a2-9da2-d3bab8319b5c", 4 | "name": "Time API", 5 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", 6 | "_exporter_id": "26925227", 7 | "_collection_link": "https://armotusitio.postman.co/workspace/Java---CoderHouse~c21e6086-a9e2-4ed0-938d-38d87b78ce2e/collection/26925227-34f8a47c-aef1-45a2-9da2-d3bab8319b5c?action=share&source=collection_link&creator=26925227" 8 | }, 9 | "item": [ 10 | { 11 | "name": "Obtener la Fecha Actual desde una API Externa", 12 | "request": { 13 | "method": "GET", 14 | "header": [], 15 | "url": { 16 | "raw": "http://localhost:8080/api/fecha", 17 | "protocol": "http", 18 | "host": [ 19 | "localhost" 20 | ], 21 | "port": "8080", 22 | "path": [ 23 | "api", 24 | "fecha" 25 | ] 26 | } 27 | }, 28 | "response": [] 29 | } 30 | ] 31 | } -------------------------------------------------------------------------------- /clase-15/src/main/resources/teoria.md: -------------------------------------------------------------------------------- 1 | 2 | ### ¿Qué es `String.format`? 3 | 4 | La función `String.format` nos permite crear cadenas de texto de manera flexible, insertando variables en un texto base. 5 | En este caso, queremos construir un mensaje que incluya la fecha, la hora y el número de invocaciones. 6 | 7 | ### Desglose del Formato del Mensaje 8 | 9 | En la primera parte, dentro de `String.format`, escribimos la estructura del mensaje como plantilla: 10 | 11 | - `"Fecha Actual: %s %s %d, %d\nHora: %s\nNúmero de invocaciones: %d"` 12 | 13 | Los símbolos `%` seguidos de una letra (`%s`, `%d`) representan "espacios reservados" donde se colocarán las variables. 14 | 15 | ### Explicación de Cada Símbolo 16 | 17 | - `%s`: Espacio reservado para una **cadena de texto** (String). 18 | - `%d`: Espacio reservado para un **número entero** (int). 19 | 20 | ### Plantilla del Mensaje Desglosada 21 | 22 | La plantilla es: 23 | 24 | 1. `"Fecha Actual: %s %s %d, %d"` – Primera línea del mensaje: 25 | - `%s`: Será reemplazado por el **día de la semana** (`fechaActual.getDayOfWeek()`), por ejemplo, "Thursday". 26 | - `%s`: Será reemplazado por el **mes** (`fechaActual.getMonth()`), como "11". 27 | - `%d`: Será reemplazado por el **día del mes** (`fechaActual.getDay()`), como "14". 28 | - `%d`: Será reemplazado por el **año** (`fechaActual.getYear()`), como "2024". 29 | 30 | Resultado ejemplo: `"Fecha Actual: Thursday 11 14, 2024"` 31 | 32 | 2. `"\nHora: %s"` – Segunda línea del mensaje: 33 | - `%s`: Será reemplazado por la **hora** (`fechaActual.getTime()`), por ejemplo, "13:13". 34 | 35 | Resultado ejemplo: `"Hora: 13:13"` 36 | 37 | 3. `"\nNúmero de invocaciones: %d"` – Tercera línea del mensaje: 38 | - `%d`: Será reemplazado por el **contador de invocaciones** (`invocacionesCount`), como "1". 39 | 40 | Resultado ejemplo: `"Número de invocaciones: 1"` 41 | 42 | ### Resultado Final de Ejemplo 43 | 44 | Si los datos fueran: 45 | - Día de la semana: "Thursday" 46 | - Mes: "11" 47 | - Día: "14" 48 | - Año: "2024" 49 | - Hora: "13:13" 50 | - Número de invocaciones: "1" 51 | 52 | El resultado final sería: 53 | 54 | ``` 55 | Fecha Actual: Thursday 11 14, 2024 56 | Hora: 13:13 57 | Número de invocaciones: 1 58 | ``` 59 | -------------------------------------------------------------------------------- /final-proyect/001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/final-proyect/001.png -------------------------------------------------------------------------------- /final-proyect/002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/final-proyect/002.png -------------------------------------------------------------------------------- /final-proyect/003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/final-proyect/003.png -------------------------------------------------------------------------------- /final-proyect/004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/final-proyect/004.png -------------------------------------------------------------------------------- /final-proyect/005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/final-proyect/005.png -------------------------------------------------------------------------------- /final-proyect/006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/final-proyect/006.png -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 3.3.4 9 | 10 | 11 | com.coderhouse 12 | clase-08-web 13 | 0.0.1-SNAPSHOT 14 | clase-08-web 15 | Demo project for Spring Boot 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 21 31 | 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-starter-data-jdbc 36 | 37 | 38 | org.springframework.boot 39 | spring-boot-starter-data-jpa 40 | 41 | 42 | 43 | com.mysql 44 | mysql-connector-j 45 | runtime 46 | 47 | 48 | org.springframework.boot 49 | spring-boot-starter-test 50 | test 51 | 52 | 53 | 54 | 55 | 56 | 57 | org.springframework.boot 58 | spring-boot-maven-plugin 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /ventas-online-modelo-final/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | /.vs/slnx.sqlite 35 | -------------------------------------------------------------------------------- /ventas-online-modelo-final/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/ventas-online-modelo-final/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /ventas-online-modelo-final/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /ventas-online-modelo-final/.vs/VSWorkspaceState.json: -------------------------------------------------------------------------------- 1 | { 2 | "ExpandedNodes": [ 3 | "" 4 | ], 5 | "PreviewInSolutionExplorer": false 6 | } -------------------------------------------------------------------------------- /ventas-online-modelo-final/.vs/ventas-online/v16/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Drako01/java-59570/b49e0cdd12857968cdfd747cce01150a91866fe6/ventas-online-modelo-final/.vs/ventas-online/v16/.suo -------------------------------------------------------------------------------- /ventas-online-modelo-final/Notas.txt: -------------------------------------------------------------------------------- 1 | #docker run -d --name postgres -e POSTGRES_PASSWORD=postgres -e PGDATA=/var/lib/postgresql/data/pgdata -v postgres:/var/lib/postgresql/data postgres 2 | 3 | #https://www.pgadmin.org/download/pgadmin-4-windows/ 4 | 5 | docker run -d -p 33060:3306 --name mysql-db -e MYSQL_ROOT_PASSWORD=123456 -v mysql:/var/lib/mysql mysql -------------------------------------------------------------------------------- /ventas-online-modelo-final/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.6.1 9 | 10 | 11 | com.coder.house.ventas.online 12 | ventas-online 13 | 0.0.1-SNAPSHOT 14 | ventas-online 15 | Demo project for Spring Boot 16 | 17 | 11 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-data-jpa 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-starter-web 27 | 28 | 29 | 30 | mysql 31 | mysql-connector-java 32 | runtime 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-starter-test 37 | test 38 | 39 | 40 | 41 | 42 | 43 | 44 | org.springframework.boot 45 | spring-boot-maven-plugin 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/main/java/com/coder/house/ventas/online/ventasonline/GFG.java: -------------------------------------------------------------------------------- 1 | package com.coder.house.ventas.online.ventasonline; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class GFG { 6 | public static void main(String[] args) 7 | { 8 | // BigDecimal object to store the result 9 | BigDecimal sum; 10 | 11 | // For user input 12 | // Use Scanner or BufferedReader 13 | 14 | // Two objects of String created 15 | // Holds the values to calculate the sum 16 | String input1 17 | = "0.0"; 18 | String input2 19 | = "4256456484464684864864"; 20 | 21 | // Convert the string input to BigDecimal 22 | BigDecimal a 23 | = new BigDecimal(input1); 24 | BigDecimal b 25 | = new BigDecimal(input2); 26 | 27 | // Using add() method 28 | sum = a.add(b); 29 | 30 | // Display the result in BigDecimal 31 | System.out.println("The sum of\n" 32 | + a + " \nand\n" + b + " " 33 | + "\nis\n" + sum + "\n"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/main/java/com/coder/house/ventas/online/ventasonline/VentasOnlineApplication.java: -------------------------------------------------------------------------------- 1 | package com.coder.house.ventas.online.ventasonline; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.web.client.RestTemplateBuilder; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.web.client.RestTemplate; 8 | 9 | @SpringBootApplication 10 | public class VentasOnlineApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(VentasOnlineApplication.class, args); 14 | } 15 | 16 | @Bean 17 | public RestTemplate restTemplate(RestTemplateBuilder builder) { 18 | return builder.build(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/main/java/com/coder/house/ventas/online/ventasonline/controller/ClienteController.java: -------------------------------------------------------------------------------- 1 | package com.coder.house.ventas.online.ventasonline.controller; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.PostMapping; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | import com.coder.house.ventas.online.ventasonline.entidad.Cliente; 14 | import com.coder.house.ventas.online.ventasonline.service.ClienteService; 15 | 16 | @RestController 17 | @RequestMapping("/cliente") 18 | public class ClienteController { 19 | 20 | @Autowired 21 | private ClienteService clienteService; 22 | 23 | @GetMapping 24 | public List findAll() { 25 | return this.clienteService.findAll(); 26 | } 27 | 28 | // Single item 29 | 30 | @GetMapping("/{id}") 31 | public Cliente one(@PathVariable Integer id) { 32 | 33 | return this.clienteService.findById(id); 34 | } 35 | 36 | @PostMapping 37 | public Cliente newEntity(@RequestBody Cliente cliente) { 38 | return this.clienteService.save(cliente); 39 | } 40 | } -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/main/java/com/coder/house/ventas/online/ventasonline/controller/ComprobanteController.java: -------------------------------------------------------------------------------- 1 | package com.coder.house.ventas.online.ventasonline.controller; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.PostMapping; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | import com.coder.house.ventas.online.ventasonline.entidad.Comprobante; 14 | import com.coder.house.ventas.online.ventasonline.entidad.ComprobanteDTO; 15 | import com.coder.house.ventas.online.ventasonline.service.ComprobanteService; 16 | 17 | @RestController 18 | @RequestMapping("/comprobante") 19 | public class ComprobanteController { 20 | 21 | @Autowired 22 | private ComprobanteService comprobanteService; 23 | 24 | @GetMapping 25 | public List findAll() { 26 | return this.comprobanteService.findAll(); 27 | } 28 | 29 | // Single item 30 | 31 | @GetMapping("/{id}") 32 | public ComprobanteDTO one(@PathVariable Integer id) { 33 | 34 | return this.comprobanteService.findById(id); 35 | } 36 | 37 | @PostMapping 38 | public ComprobanteDTO newEntity(@RequestBody Comprobante comprobante) { 39 | return this.comprobanteService.save(comprobante); 40 | } 41 | } -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/main/java/com/coder/house/ventas/online/ventasonline/controller/ProductoController.java: -------------------------------------------------------------------------------- 1 | package com.coder.house.ventas.online.ventasonline.controller; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.PostMapping; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | import com.coder.house.ventas.online.ventasonline.entidad.Producto; 14 | import com.coder.house.ventas.online.ventasonline.service.ProductoService; 15 | 16 | @RestController 17 | @RequestMapping("/producto") 18 | public class ProductoController { 19 | 20 | @Autowired 21 | private ProductoService productoService; 22 | 23 | @GetMapping 24 | public List findAll() { 25 | return this.productoService.findAll(); 26 | } 27 | 28 | // Single item 29 | 30 | @GetMapping("/{id}") 31 | public Producto one(@PathVariable Integer id) { 32 | 33 | return this.productoService.findById(id); 34 | } 35 | 36 | @PostMapping 37 | public Producto newEntity(@RequestBody Producto producto) { 38 | return this.productoService.save(producto); 39 | } 40 | } -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/main/java/com/coder/house/ventas/online/ventasonline/entidad/Cliente.java: -------------------------------------------------------------------------------- 1 | package com.coder.house.ventas.online.ventasonline.entidad; 2 | 3 | import java.io.Serializable; 4 | 5 | import javax.persistence.Entity; 6 | import javax.persistence.GeneratedValue; 7 | import javax.persistence.GenerationType; 8 | import javax.persistence.Id; 9 | import javax.persistence.NamedQuery; 10 | import javax.persistence.Table; 11 | 12 | 13 | /** 14 | * The persistent class for the cliente database table. 15 | * 16 | */ 17 | @Entity 18 | @Table(name="cliente") 19 | @NamedQuery(name="Cliente.findAll", query="SELECT c FROM Cliente c") 20 | public class Cliente implements Serializable { 21 | private static final long serialVersionUID = 1L; 22 | 23 | @Id 24 | @GeneratedValue(strategy=GenerationType.IDENTITY) 25 | private Integer clienteid; 26 | 27 | private String apellido; 28 | 29 | private Integer dni; 30 | 31 | private String nombre; 32 | 33 | public Cliente() { 34 | } 35 | 36 | public Integer getClienteid() { 37 | return this.clienteid; 38 | } 39 | 40 | public void setClienteid(Integer clienteid) { 41 | this.clienteid = clienteid; 42 | } 43 | 44 | public String getApellido() { 45 | return this.apellido; 46 | } 47 | 48 | public void setApellido(String apellido) { 49 | this.apellido = apellido; 50 | } 51 | 52 | public Integer getDni() { 53 | return this.dni; 54 | } 55 | 56 | public void setDni(Integer dni) { 57 | this.dni = dni; 58 | } 59 | 60 | public String getNombre() { 61 | return this.nombre; 62 | } 63 | 64 | public void setNombre(String nombre) { 65 | this.nombre = nombre; 66 | } 67 | 68 | @Override 69 | public String toString() { 70 | StringBuilder builder = new StringBuilder(); 71 | builder.append("Cliente ["); 72 | if (clienteid != null) 73 | builder.append("clienteid=").append(clienteid).append(", "); 74 | if (dni != null) 75 | builder.append("dni=").append(dni); 76 | builder.append("]"); 77 | return builder.toString(); 78 | } 79 | 80 | } -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/main/java/com/coder/house/ventas/online/ventasonline/entidad/ComprobanteDTO.java: -------------------------------------------------------------------------------- 1 | package com.coder.house.ventas.online.ventasonline.entidad; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.Date; 5 | import java.util.Set; 6 | 7 | public class ComprobanteDTO { 8 | 9 | private Integer comprobanteid; 10 | 11 | private Integer cantidad; 12 | 13 | private Date fecha; 14 | 15 | private BigDecimal total; 16 | 17 | private Cliente cliente; 18 | 19 | private Set lineas; 20 | 21 | public Integer getComprobanteid() { 22 | return comprobanteid; 23 | } 24 | 25 | public void setComprobanteid(Integer comprobanteid) { 26 | this.comprobanteid = comprobanteid; 27 | } 28 | 29 | public Integer getCantidad() { 30 | return cantidad; 31 | } 32 | 33 | public void setCantidad(Integer cantidad) { 34 | this.cantidad = cantidad; 35 | } 36 | 37 | public Date getFecha() { 38 | return fecha; 39 | } 40 | 41 | public void setFecha(Date fecha) { 42 | this.fecha = fecha; 43 | } 44 | 45 | public BigDecimal getTotal() { 46 | return total; 47 | } 48 | 49 | public void setTotal(BigDecimal total) { 50 | this.total = total; 51 | } 52 | 53 | public Cliente getCliente() { 54 | return cliente; 55 | } 56 | 57 | public void setCliente(Cliente cliente) { 58 | this.cliente = cliente; 59 | } 60 | 61 | public Set getLineas() { 62 | return lineas; 63 | } 64 | 65 | public void setLineas(Set lineas) { 66 | this.lineas = lineas; 67 | } 68 | 69 | 70 | 71 | } 72 | -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/main/java/com/coder/house/ventas/online/ventasonline/entidad/LineaDTO.java: -------------------------------------------------------------------------------- 1 | package com.coder.house.ventas.online.ventasonline.entidad; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class LineaDTO { 6 | 7 | private Integer lineaid; 8 | 9 | private Integer cantidad; 10 | 11 | private String descripcion; 12 | 13 | private BigDecimal precio; 14 | 15 | public Integer getLineaid() { 16 | return lineaid; 17 | } 18 | 19 | public void setLineaid(Integer lineaid) { 20 | this.lineaid = lineaid; 21 | } 22 | 23 | public Integer getCantidad() { 24 | return cantidad; 25 | } 26 | 27 | public void setCantidad(Integer cantidad) { 28 | this.cantidad = cantidad; 29 | } 30 | 31 | public String getDescripcion() { 32 | return descripcion; 33 | } 34 | 35 | public void setDescripcion(String descripcion) { 36 | this.descripcion = descripcion; 37 | } 38 | 39 | public BigDecimal getPrecio() { 40 | return precio; 41 | } 42 | 43 | public void setPrecio(BigDecimal precio) { 44 | this.precio = precio; 45 | } 46 | 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/main/java/com/coder/house/ventas/online/ventasonline/entidad/WorldClock.java: -------------------------------------------------------------------------------- 1 | package com.coder.house.ventas.online.ventasonline.entidad; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | 5 | @JsonIgnoreProperties(ignoreUnknown = true) 6 | public class WorldClock { 7 | 8 | //private String $id; 9 | private String currentDateTime; 10 | private String utcOffset; 11 | private Boolean isDayLightSavingsTime; 12 | private String dayOfTheWeek; 13 | private String timeZoneName; 14 | private Long currentFileTime; 15 | private String ordinalDate; 16 | private String serviceResponse; 17 | public String getCurrentDateTime() { 18 | return currentDateTime; 19 | } 20 | public void setCurrentDateTime(String currentDateTime) { 21 | this.currentDateTime = currentDateTime; 22 | } 23 | public String getUtcOffset() { 24 | return utcOffset; 25 | } 26 | public void setUtcOffset(String utcOffset) { 27 | this.utcOffset = utcOffset; 28 | } 29 | public Boolean getIsDayLightSavingsTime() { 30 | return isDayLightSavingsTime; 31 | } 32 | public void setIsDayLightSavingsTime(Boolean isDayLightSavingsTime) { 33 | this.isDayLightSavingsTime = isDayLightSavingsTime; 34 | } 35 | public String getDayOfTheWeek() { 36 | return dayOfTheWeek; 37 | } 38 | public void setDayOfTheWeek(String dayOfTheWeek) { 39 | this.dayOfTheWeek = dayOfTheWeek; 40 | } 41 | public String getTimeZoneName() { 42 | return timeZoneName; 43 | } 44 | public void setTimeZoneName(String timeZoneName) { 45 | this.timeZoneName = timeZoneName; 46 | } 47 | public Long getCurrentFileTime() { 48 | return currentFileTime; 49 | } 50 | public void setCurrentFileTime(Long currentFileTime) { 51 | this.currentFileTime = currentFileTime; 52 | } 53 | public String getOrdinalDate() { 54 | return ordinalDate; 55 | } 56 | public void setOrdinalDate(String ordinalDate) { 57 | this.ordinalDate = ordinalDate; 58 | } 59 | public String getServiceResponse() { 60 | return serviceResponse; 61 | } 62 | public void setServiceResponse(String serviceResponse) { 63 | this.serviceResponse = serviceResponse; 64 | } 65 | 66 | 67 | } 68 | -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/main/java/com/coder/house/ventas/online/ventasonline/repository/ClienteRepository.java: -------------------------------------------------------------------------------- 1 | package com.coder.house.ventas.online.ventasonline.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.coder.house.ventas.online.ventasonline.entidad.Cliente; 7 | 8 | @Repository 9 | public interface ClienteRepository extends JpaRepository { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/main/java/com/coder/house/ventas/online/ventasonline/repository/ComprobanteRepository.java: -------------------------------------------------------------------------------- 1 | package com.coder.house.ventas.online.ventasonline.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import com.coder.house.ventas.online.ventasonline.entidad.Comprobante; 6 | 7 | public interface ComprobanteRepository extends JpaRepository { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/main/java/com/coder/house/ventas/online/ventasonline/repository/ProductoRepository.java: -------------------------------------------------------------------------------- 1 | package com.coder.house.ventas.online.ventasonline.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import com.coder.house.ventas.online.ventasonline.entidad.Producto; 6 | 7 | public interface ProductoRepository extends JpaRepository { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/main/java/com/coder/house/ventas/online/ventasonline/service/ClienteService.java: -------------------------------------------------------------------------------- 1 | package com.coder.house.ventas.online.ventasonline.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.coder.house.ventas.online.ventasonline.entidad.Cliente; 9 | import com.coder.house.ventas.online.ventasonline.repository.ClienteRepository; 10 | 11 | @Service 12 | public class ClienteService { 13 | 14 | @Autowired 15 | private ClienteRepository clienteRepository; 16 | 17 | public List findAll() { 18 | return this.clienteRepository.findAll(); 19 | } 20 | 21 | public Cliente save(Cliente cliente) { 22 | return this.clienteRepository.save(cliente); 23 | } 24 | 25 | public Cliente findById(Integer id) { 26 | 27 | var opCliente = this.clienteRepository.findById(id); 28 | if (opCliente.isPresent()) { 29 | return opCliente.get(); 30 | } else { 31 | return new Cliente(); 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/main/java/com/coder/house/ventas/online/ventasonline/service/ProductoService.java: -------------------------------------------------------------------------------- 1 | package com.coder.house.ventas.online.ventasonline.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.coder.house.ventas.online.ventasonline.entidad.Producto; 9 | import com.coder.house.ventas.online.ventasonline.repository.ProductoRepository; 10 | 11 | @Service 12 | public class ProductoService { 13 | 14 | @Autowired 15 | private ProductoRepository productoRepository; 16 | 17 | public List findAll() { 18 | return this.productoRepository.findAll(); 19 | } 20 | 21 | public Producto save(Producto cliente) { 22 | return this.productoRepository.save(cliente); 23 | } 24 | 25 | public Producto findById(Integer id) { 26 | 27 | var opCliente = this.productoRepository.findById(id); 28 | if (opCliente.isPresent()) { 29 | return opCliente.get(); 30 | } else { 31 | return new Producto(); 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.jpa.hibernate.ddl-auto=update 2 | spring.jpa.properties.hibernate.show_sql=true 3 | spring.jpa.properties.hibernate.use_sql_comments=true 4 | spring.jpa.properties.hibernate.format_sql=true 5 | spring.datasource.url=jdbc:mysql://localhost:3306/ventas 6 | spring.datasource.username=root 7 | spring.datasource.password=Alejandro 8 | spring.datasource.driver-class-name =com.mysql.jdbc.Driver -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/main/sql/create.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE ventas; 2 | 3 | CREATE TABLE ventas.cliente ( 4 | clienteid int NOT NULL AUTO_INCREMENT, 5 | dni int NOT NULL, 6 | nombre varchar(255) NOT NULL, 7 | apellido varchar(255), 8 | PRIMARY KEY (clienteid) 9 | ); 10 | 11 | CREATE TABLE ventas.producto ( 12 | productoid int NOT NULL AUTO_INCREMENT, 13 | codigo int NOT NULL, 14 | descripcion varchar(255) NOT NULL, 15 | cantidad int, 16 | precio FLOAT(5, 2), 17 | PRIMARY KEY (productoid) 18 | ); 19 | 20 | CREATE TABLE ventas.comprobante ( 21 | comprobanteid int NOT NULL AUTO_INCREMENT, 22 | fecha datetime, 23 | cantidad int, 24 | total FLOAT(5, 2), 25 | clienteid int, 26 | PRIMARY KEY (comprobanteid), 27 | CONSTRAINT FK_cliente FOREIGN KEY (clienteid) 28 | REFERENCES cliente(clienteid) 29 | ); 30 | 31 | CREATE TABLE ventas.linea ( 32 | lineaid int NOT NULL AUTO_INCREMENT, 33 | descripcion varchar(255) NOT NULL, 34 | cantidad int, 35 | precio FLOAT(5, 2), 36 | comprobanteid int NOT NULL, 37 | productoid int NOT NULL, 38 | PRIMARY KEY (lineaid), 39 | CONSTRAINT FK_comprobante FOREIGN KEY (comprobanteid) 40 | REFERENCES comprobante(comprobanteid), 41 | CONSTRAINT FK_producto FOREIGN KEY (productoid) 42 | REFERENCES producto(productoid) 43 | ); -------------------------------------------------------------------------------- /ventas-online-modelo-final/src/test/java/com/coder/house/ventas/online/ventasonline/VentasOnlineApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.coder.house.ventas.online.ventasonline; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class VentasOnlineApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | --------------------------------------------------------------------------------