fixes bug#21427
qua:junia dev:wallace git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@105403 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
efcc11fd14
commit
69742dc180
|
@ -10,6 +10,7 @@ import java.util.List;
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.flywaydb.core.Flyway;
|
import org.flywaydb.core.Flyway;
|
||||||
import org.quartz.JobDetail;
|
import org.quartz.JobDetail;
|
||||||
|
@ -138,16 +139,57 @@ public class MyAppInit implements org.zkoss.zk.ui.util.WebAppInit {
|
||||||
ApplicationProperties.getInstance().singletonImage();
|
ApplicationProperties.getInstance().singletonImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Se nenhuma das constantes abaixo estiver configurada, o serviço de geração é iniciado.
|
||||||
|
*
|
||||||
|
* SERVIDOR_GENERACION_CORRIDA_EXCLUSIVO : Tem o IP aonde será liberado a geração de corrida. Somente nesse IP
|
||||||
|
*
|
||||||
|
* SERVIDOR_EXCEPCION_GENERACION_CORRIDA: Tem o IP aonde não será gerado a corrida. Somente esse IP
|
||||||
|
*
|
||||||
|
* * @return
|
||||||
|
*/
|
||||||
private boolean ipBloqueadoGeracaoServico() {
|
private boolean ipBloqueadoGeracaoServico() {
|
||||||
|
|
||||||
|
Constante constanteServidorExclusivo= getConstanteService().buscarPorNomeConstante("SERVIDOR_GENERACION_CORRIDA_EXCLUSIVO");
|
||||||
Constante constanteServidorException = getConstanteService().buscarPorNomeConstante("SERVIDOR_EXCEPCION_GENERACION_CORRIDA");
|
Constante constanteServidorException = getConstanteService().buscarPorNomeConstante("SERVIDOR_EXCEPCION_GENERACION_CORRIDA");
|
||||||
String ipConstante = constanteServidorException == null ? "" : constanteServidorException.getValorconstante();
|
|
||||||
|
|
||||||
log.info(" IP Constante: " + ipConstante);
|
String ipConstanteExcepcion = constanteServidorException == null ? "" : constanteServidorException.getValorconstante();
|
||||||
|
String ipConstanteExclusivo = constanteServidorExclusivo == null ? "" : constanteServidorExclusivo.getValorconstante();
|
||||||
|
|
||||||
if (ipConstante.equals("")) {
|
|
||||||
|
log.info(" IP Constante Excepcion: " + ipConstanteExcepcion);
|
||||||
|
log.info(" IP Constante Exclusivo: " + ipConstanteExclusivo);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(ipConstanteExclusivo) && StringUtils.isBlank(ipConstanteExcepcion)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<String> lsIps = getListIp();
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(ipConstanteExclusivo)){
|
||||||
|
if (lsIps.contains(ipConstanteExclusivo)) {
|
||||||
|
log.info(" IP não bloqueado. Liberado exclusivamente. ");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(ipConstanteExcepcion)){
|
||||||
|
if (lsIps.contains(ipConstanteExcepcion)) {
|
||||||
|
log.info(" IP bloqueado. Bloqueado por excecao. ");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getListIp() {
|
||||||
List<String> lsIps = new ArrayList<String>();
|
List<String> lsIps = new ArrayList<String>();
|
||||||
|
|
||||||
String ipExternalAWS = IPValidatorUtileria.getIpExternalAWS();
|
String ipExternalAWS = IPValidatorUtileria.getIpExternalAWS();
|
||||||
|
@ -159,16 +201,7 @@ public class MyAppInit implements org.zkoss.zk.ui.util.WebAppInit {
|
||||||
|
|
||||||
if (ipExternalAWS!=null){lsIps.add(ipExternalAWS);}
|
if (ipExternalAWS!=null){lsIps.add(ipExternalAWS);}
|
||||||
if (ip!=null){lsIps.add(ip);}
|
if (ip!=null){lsIps.add(ip);}
|
||||||
|
return lsIps;
|
||||||
|
|
||||||
if (lsIps.contains(ipConstante)) {
|
|
||||||
log.info(" IP bloqueado");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer[] horaExecucion(String nombConstante) {
|
private Integer[] horaExecucion(String nombConstante) {
|
||||||
|
|
Loading…
Reference in New Issue