Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save cesarockstar1985/f3defb5507bf94f1196f746592413b9e to your computer and use it in GitHub Desktop.

Select an option

Save cesarockstar1985/f3defb5507bf94f1196f746592413b9e to your computer and use it in GitHub Desktop.
private boolean isHarbor(String pointOfDeliveryPlantNumber) {
DataSource dataSourceExternalDS1 = null;
Connection connectionExternalDS1 = null;
String unit_type = DEFAULT_JIRA_ACCOUNT_ID;
PreparedStatement ps = null;
ResultSet rs = null;
boolean ret = false;
try {
dataSourceExternalDS1 = (DataSource) appContext.getBean(DataBaseHelper.EXTERNAL_DS1);
connectionExternalDS1 = DataSourceUtils.getConnection(dataSourceExternalDS1);
StringBuilder sb = new StringBuilder();
//sb.append(" select unit_type from point_of_delivery where point_of_delivery_plant_number = ? limit 1 ");
// jvillalba: le quito el "point_of_delivery_" en el where clause
sb.append("select ut.description unit_type from point_of_delivery pod join unit_type ut on pod.unit_type = ut.id where pod.plant_number = '318' limit 1");
ps = connectionExternalDS1.prepareStatement(sb.toString());
ps.setString(1, pointOfDeliveryPlantNumber);
rs = ps.executeQuery();
while (rs.next()) {
unit_type = rs.getString("unit_type");
if (unit_type != null && !unit_type.isEmpty()) {
if (unit_type.contains("PUERTO")) {
ret = true;
}
}
}
} catch (Exception e) {
LOG.error("Error al determinar si el POD es un puerto o no", e);
} finally {
DataBaseHelper.closePreparedStatement(ps);
DataBaseHelper.closeResultSet(rs);
DataBaseHelper.releaseConnection(connectionExternalDS1, dataSourceExternalDS1);
}
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment