Browse Source

He tenido que quitar las entidades, porque no podia ejecutar, tengo que mejorar el index para que quede mas para abajo.

master
Cristobal Bernal Mayordomo 2 years ago
parent
commit
fdf286909e
7 changed files with 12 additions and 441 deletions
  1. +2
    -0
      pom.xml
  2. +10
    -0
      src/main/java/com/cristobalbernal/foro/controlador/Controlador.java
  3. +0
    -24
      src/main/java/com/cristobalbernal/foro/controlador/controlador.java
  4. +0
    -64
      src/main/java/com/cristobalbernal/foro/entidades/CategoriaForoEntity.java
  5. +0
    -105
      src/main/java/com/cristobalbernal/foro/entidades/ForoEntity.java
  6. +0
    -105
      src/main/java/com/cristobalbernal/foro/entidades/RespuestasEntity.java
  7. +0
    -143
      src/main/java/com/cristobalbernal/foro/entidades/UsersEntity.java

+ 2
- 0
pom.xml View File

@ -60,6 +60,8 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>


+ 10
- 0
src/main/java/com/cristobalbernal/foro/controlador/Controlador.java View File

@ -0,0 +1,10 @@
package com.cristobalbernal.foro.controlador;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class Controlador {
}

+ 0
- 24
src/main/java/com/cristobalbernal/foro/controlador/controlador.java View File

@ -1,24 +0,0 @@
package com.cristobalbernal.foro.controlador;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import java.net.MalformedURLException;
import java.net.URL;
@Controller
public class controlador {
@GetMapping({"/","","home","/inicio","/index"})
public String welcome(Model model) throws MalformedURLException {
final String currentURL = ServletUriComponentsBuilder.fromCurrentContextPath().build().toUriString();
URL requestURL = new URL(currentURL);
model.addAttribute("mensaje","Ramoncin");
String dominio = requestURL.getHost();
int x = dominio.indexOf(".");
int y = dominio.indexOf(".");
String conDominio = dominio.substring(0,x);
model.addAttribute("dominio",conDominio);
return "index";
}
}

+ 0
- 64
src/main/java/com/cristobalbernal/foro/entidades/CategoriaForoEntity.java View File

@ -1,64 +0,0 @@
package com.cristobalbernal.foro.entidades;
import jakarta.persistence.*;
@Entity
@Table(name = "categoria_foro", schema = "foro", catalog = "")
public class CategoriaForoEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@Column(name = "id", nullable = false)
private int id;
@Basic
@Column(name = "name", nullable = true, length = 45)
private String name;
@Basic
@Column(name = "descripcion", nullable = true, length = 45)
private String descripcion;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CategoriaForoEntity that = (CategoriaForoEntity) o;
if (id != that.id) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (descripcion != null ? !descripcion.equals(that.descripcion) : that.descripcion != null) return false;
return true;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (descripcion != null ? descripcion.hashCode() : 0);
return result;
}
}

+ 0
- 105
src/main/java/com/cristobalbernal/foro/entidades/ForoEntity.java View File

@ -1,105 +0,0 @@
package com.cristobalbernal.foro.entidades;
import jakarta.persistence.*;
import java.sql.Timestamp;
@Entity
@Table(name = "foro", schema = "foro", catalog = "")
public class ForoEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@Column(name = "id", nullable = false)
private int id;
@Basic
@Column(name = "titulo", nullable = true, length = 150)
private String titulo;
@Basic
@Column(name = "descripcion", nullable = true, length = 150)
private String descripcion;
@Basic
@Column(name = "fechaYHora", nullable = true)
private Timestamp fechaYHora;
@Basic
@Column(name = "imagen_id", nullable = false)
private int imagenId;
@Basic
@Column(name = "categoria_foro_id", nullable = false)
private int categoriaForoId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitulo() {
return titulo;
}
public void setTitulo(String titulo) {
this.titulo = titulo;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public Timestamp getFechaYHora() {
return fechaYHora;
}
public void setFechaYHora(Timestamp fechaYHora) {
this.fechaYHora = fechaYHora;
}
public int getImagenId() {
return imagenId;
}
public void setImagenId(int imagenId) {
this.imagenId = imagenId;
}
public int getCategoriaForoId() {
return categoriaForoId;
}
public void setCategoriaForoId(int categoriaForoId) {
this.categoriaForoId = categoriaForoId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ForoEntity that = (ForoEntity) o;
if (id != that.id) return false;
if (imagenId != that.imagenId) return false;
if (categoriaForoId != that.categoriaForoId) return false;
if (titulo != null ? !titulo.equals(that.titulo) : that.titulo != null) return false;
if (descripcion != null ? !descripcion.equals(that.descripcion) : that.descripcion != null) return false;
if (fechaYHora != null ? !fechaYHora.equals(that.fechaYHora) : that.fechaYHora != null) return false;
return true;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + (titulo != null ? titulo.hashCode() : 0);
result = 31 * result + (descripcion != null ? descripcion.hashCode() : 0);
result = 31 * result + (fechaYHora != null ? fechaYHora.hashCode() : 0);
result = 31 * result + imagenId;
result = 31 * result + categoriaForoId;
return result;
}
}

+ 0
- 105
src/main/java/com/cristobalbernal/foro/entidades/RespuestasEntity.java View File

@ -1,105 +0,0 @@
package com.cristobalbernal.foro.entidades;
import jakarta.persistence.*;
import java.sql.Timestamp;
@Entity
@Table(name = "respuestas", schema = "foro", catalog = "")
public class RespuestasEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@Column(name = "id", nullable = false)
private int id;
@Basic
@Column(name = "Post", nullable = true, length = 45)
private String post;
@Basic
@Column(name = "fechaYHora", nullable = true)
private Timestamp fechaYHora;
@Basic
@Column(name = "Respuestas_id", nullable = false)
private int respuestasId;
@Basic
@Column(name = "users_id", nullable = false)
private int usersId;
@Basic
@Column(name = "Foro_id", nullable = false)
private int foroId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getPost() {
return post;
}
public void setPost(String post) {
this.post = post;
}
public Timestamp getFechaYHora() {
return fechaYHora;
}
public void setFechaYHora(Timestamp fechaYHora) {
this.fechaYHora = fechaYHora;
}
public int getRespuestasId() {
return respuestasId;
}
public void setRespuestasId(int respuestasId) {
this.respuestasId = respuestasId;
}
public int getUsersId() {
return usersId;
}
public void setUsersId(int usersId) {
this.usersId = usersId;
}
public int getForoId() {
return foroId;
}
public void setForoId(int foroId) {
this.foroId = foroId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RespuestasEntity that = (RespuestasEntity) o;
if (id != that.id) return false;
if (respuestasId != that.respuestasId) return false;
if (usersId != that.usersId) return false;
if (foroId != that.foroId) return false;
if (post != null ? !post.equals(that.post) : that.post != null) return false;
if (fechaYHora != null ? !fechaYHora.equals(that.fechaYHora) : that.fechaYHora != null) return false;
return true;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + (post != null ? post.hashCode() : 0);
result = 31 * result + (fechaYHora != null ? fechaYHora.hashCode() : 0);
result = 31 * result + respuestasId;
result = 31 * result + usersId;
result = 31 * result + foroId;
return result;
}
}

+ 0
- 143
src/main/java/com/cristobalbernal/foro/entidades/UsersEntity.java View File

@ -1,143 +0,0 @@
package com.cristobalbernal.foro.entidades;
import jakarta.persistence.*;
@Entity
@Table(name = "users", schema = "foro", catalog = "")
public class UsersEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@Column(name = "id", nullable = false)
private int id;
@Basic
@Column(name = "name", nullable = true, length = 45)
private String name;
@Basic
@Column(name = "firstname", nullable = true, length = 45)
private String firstname;
@Basic
@Column(name = "secondname", nullable = true, length = 45)
private String secondname;
@Basic
@Column(name = "password", nullable = true, length = 45)
private String password;
@Basic
@Column(name = "email", nullable = true, length = 45)
private String email;
@Basic
@Column(name = "username", nullable = true, length = 45)
private String username;
@Basic
@Column(name = "urlImgen", nullable = true, length = 150)
private String urlImgen;
@Basic
@Column(name = "tipoPrivilegios", nullable = true)
private Byte tipoPrivilegios;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getSecondname() {
return secondname;
}
public void setSecondname(String secondname) {
this.secondname = secondname;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getUrlImgen() {
return urlImgen;
}
public void setUrlImgen(String urlImgen) {
this.urlImgen = urlImgen;
}
public Byte getTipoPrivilegios() {
return tipoPrivilegios;
}
public void setTipoPrivilegios(Byte tipoPrivilegios) {
this.tipoPrivilegios = tipoPrivilegios;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UsersEntity that = (UsersEntity) o;
if (id != that.id) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (firstname != null ? !firstname.equals(that.firstname) : that.firstname != null) return false;
if (secondname != null ? !secondname.equals(that.secondname) : that.secondname != null) return false;
if (password != null ? !password.equals(that.password) : that.password != null) return false;
if (email != null ? !email.equals(that.email) : that.email != null) return false;
if (username != null ? !username.equals(that.username) : that.username != null) return false;
if (urlImgen != null ? !urlImgen.equals(that.urlImgen) : that.urlImgen != null) return false;
if (tipoPrivilegios != null ? !tipoPrivilegios.equals(that.tipoPrivilegios) : that.tipoPrivilegios != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (firstname != null ? firstname.hashCode() : 0);
result = 31 * result + (secondname != null ? secondname.hashCode() : 0);
result = 31 * result + (password != null ? password.hashCode() : 0);
result = 31 * result + (email != null ? email.hashCode() : 0);
result = 31 * result + (username != null ? username.hashCode() : 0);
result = 31 * result + (urlImgen != null ? urlImgen.hashCode() : 0);
result = 31 * result + (tipoPrivilegios != null ? tipoPrivilegios.hashCode() : 0);
return result;
}
}

Loading…
Cancel
Save