git-svn-id: https://svn.coded.pt/svn/SIPRP@1063 bb69d46d-e84e-40c8-a05a-06db0d633741

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Frederico Palma 17 years ago
parent f0d448ce5e
commit 25046cbe9f

@ -86,19 +86,19 @@ public class SIPRPDataLoader implements CompanyDataLoader
Singleton.setInstance( SingletonConstants.WEB_DB_NAME, "siprp" ); Singleton.setInstance( SingletonConstants.WEB_DB_NAME, "siprp" );
Singleton.setInstance( SingletonConstants.WEB_DRIVER_NAME, "org.postgresql.Driver" ); Singleton.setInstance( SingletonConstants.WEB_DRIVER_NAME, "org.postgresql.Driver" );
// Singleton.setInstance( SingletonConstants.LOCAL_USER, "siprp" ); Singleton.setInstance( SingletonConstants.LOCAL_USER, "siprp" );
// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "rg2h-opksiprp" ); Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "rg2h-opksiprp" );
// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" );
// Singleton.setInstance( SingletonConstants.LOCAL_URL, "www.evolute.pt:5436" );
// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local_3" );
// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" );
//
Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" );
Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" );
Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" );
Singleton.setInstance( SingletonConstants.LOCAL_URL, "10.158.2.2:5432" ); Singleton.setInstance( SingletonConstants.LOCAL_URL, "www.evolute.pt:5436" );
Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" ); Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local_3" );
Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" );
//
// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" );
// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" );
// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" );
// Singleton.setInstance( SingletonConstants.LOCAL_URL, "10.158.2.2:5432" );
// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" );
// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" );
// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); // Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" );
// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); // Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" );

@ -24,6 +24,7 @@ import com.evolute.utils.sql.Select2;
public class RelatorioPrintDataProvider public class RelatorioPrintDataProvider
{ {
private static final Object LOCK = new Object(); private static final Object LOCK = new Object();
protected static final Object UNCONTROLLED = "Incontrolado";
protected static final Object CONTROLLED = "Controlado"; protected static final Object CONTROLLED = "Controlado";
protected static final Object INDETERMINATE = "Indeterminado"; protected static final Object INDETERMINATE = "Indeterminado";
private static RelatorioPrintDataProvider instance = null; private static RelatorioPrintDataProvider instance = null;
@ -375,9 +376,9 @@ public class RelatorioPrintDataProvider
new String[]{ "hs_relatorio_posto" }, new String[]{ "hs_relatorio_posto" },
new Integer[]{}, new Integer[]{},
new Expression[]{}, new Expression[]{},
new String[]{ "hs_relatorio_posto.id", "hs_relatorio_posto.description" }, new String[]{ "hs_relatorio_posto.id", "hs_relatorio_posto.description", "coalesce(hs_relatorio_posto.is_principal,'FALSE')" },
new Field( "hs_relatorio_posto.area_id" ).isEqual( areaId ), new Field( "hs_relatorio_posto.area_id" ).isEqual( areaId ),
new String[]{ "hs_relatorio_posto.id" }, new String[]{ "coalesce(hs_relatorio_posto.is_principal,'FALSE') DESC", "hs_relatorio_posto.id" },
null, null,
null, null,
null ); null );
@ -441,38 +442,71 @@ public class RelatorioPrintDataProvider
@Override @Override
public int compare(RiscoToPrint o1, RiscoToPrint o2) { public int compare(RiscoToPrint o1, RiscoToPrint o2) {
int comparevalue = 0; Integer o1Value = 1000;
if (o1.probabilidade != null && o1.severidade != null Integer o2Value = 1000;
&& o2.probabilidade != null && o2.severidade != null){ if( o1.probabilidade != null && o1.severidade != null )
Integer o1Value = o1.probabilidade*o1.severidade; {
Integer o2Value = o2.probabilidade*o2.severidade; o1Value = -o1.probabilidade*o1.severidade;
comparevalue = 0-o1Value.compareTo(o2Value); }
} else if (o1.valorQualitativo != null else if(o1.valorQualitativo.equals(UNCONTROLLED))
&& o1.valorQualitativo.length() > 0 {
&& o2.valorQualitativo != null o1Value = 100;
&& o2.valorQualitativo.length() > 0) { }
if(o1.valorQualitativo.equals(CONTROLLED)){ else if(o1.valorQualitativo.equals(CONTROLLED))
comparevalue = -1; {
}else if(o1.valorQualitativo.equals(INDETERMINATE)){ o1Value = 200;
comparevalue = 1; }
}else{ else if(o1.valorQualitativo.equals(INDETERMINATE))
if(o2.valorQualitativo.equals(CONTROLLED)){ {
comparevalue = 1; o1Value = 300;
}else{ }
comparevalue = -1; if( o2.probabilidade != null && o2.severidade != null )
} {
} o2Value = -o2.probabilidade*o2.severidade;
}else{ }
if(o1.valorQualitativo!=null){ else if(o2.valorQualitativo.equals(UNCONTROLLED))
comparevalue = 1; {
}else{ o2Value = 100;
comparevalue = -1; }
} else if(o2.valorQualitativo.equals(CONTROLLED))
{
o2Value = 200;
}
else if(o2.valorQualitativo.equals(INDETERMINATE))
{
o2Value = 300;
} }
return comparevalue; return o1Value.compareTo(o2Value);
// int comparevalue = 0;
// if (o1.probabilidade != null && o1.severidade != null
// && o2.probabilidade != null && o2.severidade != null){
// Integer o1Value = o1.probabilidade*o1.severidade;
// Integer o2Value = o2.probabilidade*o2.severidade;
// comparevalue = 0-o1Value.compareTo(o2Value);
// } else if (o1.valorQualitativo != null
// && o1.valorQualitativo.length() > 0
// && o2.valorQualitativo != null
// && o2.valorQualitativo.length() > 0) {
// if(o1.valorQualitativo.equals(CONTROLLED)){
// comparevalue = -1;
// }else if(o1.valorQualitativo.equals(INDETERMINATE)){
// comparevalue = 1;
// }else{
// if(o2.valorQualitativo.equals(CONTROLLED)){
// comparevalue = 1;
// }else{
// comparevalue = -1;
// }
// }
// }else{
// if(o1.valorQualitativo!=null){
// comparevalue = 1;
// }else{
// comparevalue = -1;
// }
// }
// return comparevalue;
} }
}); });
return riscos; return riscos;

Loading…
Cancel
Save