Skip to content
Snippets Groups Projects
Commit f7b4a959 authored by Falucho's avatar Falucho
Browse files

Fix para deploy

parent f3c4d206
No related branches found
No related tags found
No related merge requests found
......@@ -8,8 +8,8 @@ import javax.persistence.*;
*/
@Entity
@NamedQueries({
@NamedQuery(name = "Periferico.findAll", query = "select c from Categoria c"),
@NamedQuery(name = "Periferico.findByName", query = "select c from Categoria c where c.name = :name")
@NamedQuery(name = "Categoria.findAll", query = "select c from Categoria c"),
@NamedQuery(name = "Categoria.findByName", query = "select c from Categoria c where c.name = :name")
})
public final class Categoria {
......
......@@ -7,9 +7,9 @@ import java.util.List;
@Entity
@NamedQueries({
@NamedQuery(name = "Periferico.findAll", query = "select p from Periferico p"),
@NamedQuery(name = "Periferico.findById", query = "select p from Periferico p where p.id = :id"),
@NamedQuery(name = "Periferico.findByCategoria", query = "select p from Periferico p where p.categorias.name = :name") //todo verificar consulta
@NamedQuery(name = "Periferico.findAll", query = "SELECT p FROM Periferico p"),
@NamedQuery(name = "Periferico.findById", query = "SELECT p FROM Periferico p WHERE p.id = :id"),
@NamedQuery(name = "Periferico.findByCategoria", query = "SELECT p FROM Periferico p INNER JOIN p.categories AS c WHERE c.name = :name")
})
public final class Periferico extends Mecanismo {
......
......@@ -10,13 +10,13 @@ public class TransicionEstado {
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(nullable = false)
@ManyToOne(optional = false)
private Estado state;
@Column(nullable = false)
@ManyToOne(optional = false)
private Usuario user;
@Column(nullable = false)
@ManyToOne(optional = false)
private Hecho fact;
@Column(nullable = false)
......
......@@ -15,7 +15,8 @@ public class VerificacionChecker {
@ManyToOne(optional = false)
private Hecho fact;
@Column(nullable = false)
@ManyToOne(optional = false)
private Calificacion score;
@Column(nullable = false)
......
......@@ -12,6 +12,7 @@
<!-- <jta-data-source>java:jboss/datasources/herokuDS</jta-data-source>-->
<properties>
<!-- Properties for Hibernate -->
<property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="false"/>
</properties>
......
......@@ -14,14 +14,14 @@
</datasource>
<!--https://data.heroku.com/datastores/30b15fdc-4667-493f-b244-cdfea47f071f#administration-->
<datasource jndi-name="java:jboss/datasources/herokuDS" pool-name="heroku" enabled="true" use-java-context="true">
<connection-url>jdbc:postgresql://ec2-23-23-92-204.compute-1.amazonaws.com:5432/dd1clqkconunk4</connection-url>
<driver>postgresql</driver>
<security>
<user-name>hqxefooowavbtm</user-name>
<password>fd34e142d8d9ae681fb227b74745c498c87f22a65da9681c9653b01af1375557</password>
</security>
</datasource>
<!-- <datasource jndi-name="java:jboss/datasources/herokuDS" pool-name="heroku" enabled="true" use-java-context="true">-->
<!-- <connection-url>jdbc:postgresql://ec2-23-23-92-204.compute-1.amazonaws.com:5432/dd1clqkconunk4</connection-url>-->
<!-- <driver>postgresql</driver>-->
<!-- <security>-->
<!-- <user-name>hqxefooowavbtm</user-name>-->
<!-- <password>fd34e142d8d9ae681fb227b74745c498c87f22a65da9681c9653b01af1375557</password>-->
<!-- </security>-->
<!-- </datasource>-->
</datasources>
......@@ -3,9 +3,7 @@ package uy.edu.fing.tse.central.business.common;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Path;
import java.io.InputStream;
import java.util.Map;
import java.util.Properties;
......@@ -51,20 +49,21 @@ public enum Propiedades {
for (Propiedades value : Propiedades.values()) {
System.setProperty(value.key, value.defaultValue);
}
//Cargo los valores del archivo
try {
final URL resource = Propiedades.class.getClassLoader().getResource("central.properties");
final Path of = Path.of(resource.toURI());
load(of.toFile());
} catch (URISyntaxException e) {
throw new RuntimeException("Error leyendo el archivo de propiedades", e);
}
//Cargo los valores del archivo de configuracion
final var inputStream = Propiedades.class.getClassLoader().getResourceAsStream("central.properties");
load(inputStream);
}
public static void load(final File propFile) {
try (FileInputStream is = new FileInputStream(propFile)) {
load(is);
} catch (IOException ex) {
throw new RuntimeException("Error leyendo el archivo de propiedades", ex);
}
}
public static void load(final InputStream is) {
try {
Properties p = new Properties();
p.load(is);
......
package uy.edu.fing.tse.central.business.mq;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.DefaultConsumer;
......@@ -8,8 +7,6 @@ import com.rabbitmq.client.Envelope;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uy.edu.fing.tse.central.business.BusinessLocal;
import uy.edu.fing.tse.dto.CheckMechanism;
import uy.edu.fing.tse.dto.Peripherical;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
......@@ -50,8 +47,12 @@ public class MessageConsumer {
String contentType = properties.getContentType();
long deliveryTag = envelope.getDeliveryTag();
final Peripherical peripherical = new ObjectMapper().readValue(body, Peripherical.class);
negocio.altaPeriferico(peripherical);
System.out.println("#####################################");
System.out.println(new String(body));
System.out.println("#####################################");
//final Peripherical peripherical = new ObjectMapper().readValue(body, Peripherical.class);
//negocio.altaPeriferico(peripherical);
channel.basicAck(deliveryTag, false);
}
......@@ -67,9 +68,12 @@ public class MessageConsumer {
String contentType = properties.getContentType();
long deliveryTag = envelope.getDeliveryTag();
System.out.println("#####################################");
System.out.println(new String(body));
System.out.println("#####################################");
final CheckMechanism cm = new ObjectMapper().readValue(body, CheckMechanism.class);
negocio.altaVerificacionMecanismo(cm);
//final CheckMechanism cm = new ObjectMapper().readValue(body, CheckMechanism.class);
// negocio.altaVerificacionMecanismo(cm);
channel.basicAck(deliveryTag, false);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment