Skip to content

Instantly share code, notes, and snippets.

@gastonprieto
Last active June 2, 2016 13:01
Show Gist options
  • Save gastonprieto/7a2825575c0bb61acf8b7ae616d13032 to your computer and use it in GitHub Desktop.
Save gastonprieto/7a2825575c0bb61acf8b7ae616d13032 to your computer and use it in GitHub Desktop.
gestion_incidentes_ugly
public class Incidente {
private String tag;
private String sector;
}
public class PersonaViolenta extends Incidente {
private Persona persona;
private String sector;
}
public class PrincipioIncendio extends Incidente {
}
public interface GestorIncidentes {
public void registrar(Incidente incidente) ;
}
public class GestionDeIncidentesImpl implements GestorIncidentes {
private List<Incidente> incidentes;
private BlackList = new BlackList();
private Biper = new Biper();
private boolean integracionBlackList;
private boolean integracionBiper;
private boolean integracionBomberos;
private boolean integracionPrevencion;
public void registrar(Incidente incidente) {
this.incidentes.add(incidente);
if (incidente.getClass().equals(PersonaViolenta.class)) {
PersonaViolenta invidenteViolento = (PersonaViolenta) incidente;
if (integracionBlackList) {
blackList.registrar(incidenteViolenta.getPersona().getDni());
}
if (integracionBiper) {
biper.call(incidenteViolento.getSector(), "Incidente Violento");
}
}
if (incidente.getClass().equals(PrincipioIncendio.class) {
if (integracionBomberos) {
//.....
}
if (integracionPrevencion) {
//.....
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment