-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Agregando funcionalidades de requerimientos
- Loading branch information
1 parent
f6a9b3a
commit 1903f24
Showing
23 changed files
with
271 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
ENTREGA 3/src/EntidadesYEstablecimientos/Monitoreable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,22 @@ | ||
package EntidadesYEstablecimientos; | ||
|
||
public class Monitoreable { | ||
private String nombre; | ||
private Disponibilidad estado; | ||
private List<Incidente> incidentesActivos; | ||
private List<Incidente> incidentesInactivos; | ||
public void registrarIncidente(Incidente unIncidente){ | ||
incidentesActivos.add(unIncidente); | ||
} | ||
public void cerrar(Incidente unIncidente){ | ||
incidentesActivos.remove(unIncidente); | ||
incidentesInactivos.add(unIncidente); | ||
} | ||
public List<Incidente> getIncidentesAbiertos(){ | ||
return this.incidentesActivos; | ||
} | ||
|
||
public List<Incidente> getIncidentesInactivos(){ | ||
return this.incidentesInactivos; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
public class Comunidad { | ||
private List<Membresia> miembros; | ||
private List<Incidente> incidentesNotificables; | ||
|
||
public void alta(Membresia unMiembro){ | ||
//toDO | ||
} | ||
|
||
public void baja(Membresia unMiembro){ | ||
miembros.remove(unMiembro); | ||
} | ||
|
||
public void modificacion(){ | ||
// no hay suficiente informacion | ||
} | ||
|
||
public void sugerirRevision(){ | ||
//toDO con Hasura | ||
} | ||
|
||
public void notificarMiembros(){ | ||
// toDo no es requerimiento entrega3 | ||
} | ||
|
||
public void actualizarIncidentesNotificables(){ | ||
//toDO no es requerimiento entrega3 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
public enum Disponibilidad { | ||
ACTIVO, | ||
INACTIVO | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
public enum Estado { | ||
ABIERTO, | ||
CERRADO | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
public enum HoraNotificacion { | ||
//Arranca con H para que sea valido como identificador | ||
H00, H01, H02, H03, H04, H05, H06, H07, H08, H09, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21, H22, H23 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import java.time.LocalDateTime; | ||
public class Indicente { | ||
private Motivo descripcion; | ||
private LocalDateTime fechaInicio; | ||
private LocalDateTime fechaCierre; | ||
private Monitoreable monitoreable; | ||
private String observaciones; | ||
private Estado estado; | ||
private Integer genteAfectada; | ||
private UsuarioPersonal creador; | ||
public Incidente(Monitoreable unMonitoreable, UsuarioPersonal unUsuario){ | ||
this.monitoreable = unMonitoreable; | ||
this.creador = unUsuario; | ||
this.fechaInicio = LocalDateTime.now(); | ||
} | ||
public void notificarComunidades(){ | ||
//toDo no es requerimiento para la entrega3 | ||
//no se si es necesario que este en esta clase el metodo | ||
// deberia mandar el incidente para que las comunidades lo guarden en su lista | ||
//un metodo que llama al metodo del usuario para avisar a cada membresia para que notifique a su respectiva comunidad | ||
} | ||
public Estado getEstado(){ | ||
return this.estado; | ||
} | ||
|
||
public LocalDateTime getFechaInicio(){ | ||
return this.fechaInicio; | ||
} | ||
|
||
public LocalDateTime getFechaCierre(){ | ||
return this.fechaCierre; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
ENTREGA 3/src/PosibleClasesAgregadas/InformeIncidente.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
public class InformeIncidente { | ||
private Entidad entidadAsociada; | ||
public notificarEmpresaPrestadora(){ | ||
//toDO | ||
} | ||
public notificarOrganismoDeControl(){ | ||
//toDO | ||
} | ||
|
||
public Entidad getEntidadAsociada(){ | ||
return this.entidadAsociada; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public class Membresia { | ||
private UsuarioPersonal usuario; | ||
private Comunidad comunidad; | ||
private RolDePermiso rolDePermiso; | ||
private RolDeImpacto rolDeImpacto; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
public enum Motivo { | ||
EN_REPARACION, | ||
CLAUSURADO | ||
} |
61 changes: 61 additions & 0 deletions
61
ENTREGA 3/src/PosibleClasesAgregadas/RankingDePromedios.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import java.time.LocalDateTime; | ||
import java.time.temporal.ChronoUnit; | ||
import java.util.List; | ||
import java.util.Collections; | ||
import java.util.Comparator; | ||
|
||
public class RankingDePromedios extends TipoDeRanking{ | ||
@Override | ||
public List<InformeIncidente> generarRanking(List<InformeIncidente> listaInformes){ | ||
|
||
List<IncidenteInactivo> listaIncidentesInactivos = listaInformes.stream() | ||
.map(InformeIncidente::getEntidadAsociada) // Obtener la entidad asociada de cada informe | ||
.flatMap(entidad -> entidad.getMonitoreables().stream()) // Obtener todas las listas de monitoreables y combinarlas en una sola lista | ||
.flatMap(monitoreable -> monitoreable.getIncidentesInactivos().stream()) // Obtener todos los incidentes inactivos y combinarlos en una sola lista | ||
.collect(Collectors.toList()); // Recolectar en una lista | ||
// Lista con todos los incidentes inactivos asociado a cada una de las entidades | ||
|
||
// calculo del promedio de diferencia en minutos por entidad | ||
for (Entidad entidad : listaIncidentesInactivos) { | ||
List<IncidenteInactivo> incidentesInactivosEntidad = entidad.getIncidentesInactivos(); | ||
int totalDiferenciaEnMinutos = 0; | ||
|
||
for (IncidenteInactivo incidente : incidentesInactivosEntidad) { | ||
LocalDateTime fechaInicio = incidente.getFechaInicio(); | ||
LocalDateTime fechaCierre = incidente.getFechaCierre(); | ||
|
||
long diferenciaEnMinutos = fechaInicio.until(fechaCierre, ChronoUnit.MINUTES); | ||
totalDiferenciaEnMinutos += diferenciaEnMinutos; | ||
} | ||
|
||
double promedioDiferenciaEnMinutos = totalDiferenciaEnMinutos / (double) incidentesInactivosEntidad.size(); | ||
entidad.setPromedioCierreIncidentes(promedioDiferenciaEnMinutos); | ||
} //cada entidad tiene el promedio asociado | ||
|
||
// Ahora para ordenar la lista de informes según el promedio | ||
Collections.sort(listaInformes, new Comparator<InformeIncidente>() { | ||
@Override | ||
public int compare(InformeIncidente informe1, InformeIncidente informe2) { | ||
// Comparar los informes según el promedio | ||
double promedio1 = informe1.getEntidadAsociada().getPromedioCierreIncidentes(); | ||
double promedio2 = informe2.getEntidadAsociada().getPromedioCierreIncidentes(); | ||
return Double.compare(promedio2, promedio1); | ||
} | ||
}); | ||
|
||
return listaInformes; | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
||
// Ahora, listaInformes contiene los informes ordenados por su promedio de diferencia en minutos en orden descendente | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
public class RankingImpacto extends TipoDeRanking { | ||
public List<InformeIncidente> generarRanking(List<InformeIncidente> listaInformes){ | ||
//toDO no en entrega3 | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
ENTREGA 3/src/PosibleClasesAgregadas/RankingMayorCantIncidentes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
public class RankingMayorCantIncidentes extends TipoDeRanking { | ||
public List<InformeIncidente> generarRanking(List<InformeIncidente> listaInformes){ | ||
//toDO | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
public class RankingsIncidente { | ||
private List<InformeIncidente> informes; | ||
private TipoDeRanking tipoDeRanking; | ||
|
||
public void generarSegunCriterio(){ | ||
//void??? | ||
tipoDeRanking.generarRanking(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
public enum RolDeImpacto { | ||
AFECTADO, | ||
OBSERVADOR | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
public enum RolDePermiso { | ||
ADMINISTRADOR, | ||
ESTANDAR | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
public class TipoDeRanking { | ||
public void generarRanking(){ | ||
//void? | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import java.nio.charset.UnmappableCharacterException; | ||
|
||
public class UsuarioPersonal extends UsuarioGeneral { | ||
private List<Membresia> membresias; | ||
private Localizacion localizacionAsociada; | ||
private List<Monitoreable> serviciosDeInteres; | ||
private List<HoraNotificacion> horariosNotificacion; | ||
private List<EmpresaPrestadora> empresasDeInteres; | ||
|
||
public void modificar(Monitoreable unMonitoreable){ | ||
//completar | ||
} | ||
public void eliminar(Monitoreable unMonitoreable){ | ||
//elimina de la lista? | ||
} | ||
public void setLocalizacion(Localizacion unaLocalizacion){ | ||
localizacionAsociada = unaLocalizacion; | ||
} | ||
public void agregarServicioDeInteres(Monitoreable unMonitoreable){ | ||
serviciosDeInteres.add(unMonitoreable); | ||
} | ||
public void registrarIncidente(Monitoreable unMonitoreable, UsuarioPersonal unUsuario){ | ||
//void? | ||
//para mi el metodo va sin el parametro del UsuarioPersonal ya que es solo para mandarselo al incidente | ||
Incidente unIncidente = new Incidente(unMonitoreable, this); | ||
} | ||
} |