private void handleError(JdbcConnection connection, Exception e) throws DatabaseException, CustomChangeException { connection.rollback(); throw new CustomChangeException(e); } }
private void handleError(JdbcConnection connection, Exception e) throws DatabaseException, CustomChangeException { connection.rollback(); throw new CustomChangeException(e); }
private void handleError(JdbcConnection connection, Exception e) throws DatabaseException, CustomChangeException { connection.rollback(); throw new CustomChangeException(e); }
private void handleError(JdbcConnection connection, Exception e) throws DatabaseException, CustomChangeException { connection.rollback(); throw new CustomChangeException(e); }
private void handleError(JdbcConnection connection, Exception e) throws DatabaseException, CustomChangeException { connection.rollback(); throw new CustomChangeException(e); }
private List<DiscontinuedOrder> getDiscontinuedOrders(JdbcConnection connection) throws CustomChangeException, SQLException { List<DiscontinuedOrder> dcOrders = new ArrayList<>(); PreparedStatement statement = null; try { statement = connection.prepareStatement("select order_id, concept_id, patient_id, encounter_id, date_stopped, " + "discontinued_by, discontinued_reason, discontinued_reason_non_coded, order_type_id " + "from orders where discontinued = ?"); statement.setBoolean(1, true); ResultSet rs = statement.executeQuery(); while (rs.next()) { dcOrders.add(new DiscontinuedOrder(rs.getInt("order_id"), rs.getInt("concept_id"), rs.getInt("patient_id"), rs.getInt("encounter_id"), rs.getInt("discontinued_by"), rs.getInt("discontinued_reason"), rs .getString("discontinued_reason_non_coded"), rs.getDate("date_stopped"), rs .getInt("order_type_id"))); } } catch (SQLException | DatabaseException e) { throw new CustomChangeException(e); } finally { if (statement != null) { statement.close(); } } return dcOrders; }
throws CustomChangeException { if (trueConceptId == null || trueConceptId < 1 || falseConceptId == null || falseConceptId < 1) { throw new CustomChangeException("Can't create global properties for true/false concepts with invalid conceptIds"); throw new CustomChangeException("Unable to create global properties for concept ids defining boolean concepts", e);
throw new CustomChangeException("Unable to get int", e);
@Override public void execute(Database database) throws CustomChangeException { JdbcConnection connection = (JdbcConnection) database.getConnection(); DatabaseMetaData metadata; try { metadata = connection.getMetaData(); String[] types = { "TABLE" }; ResultSet rs = metadata.getTables(null, null, "%", types); while (rs.next()) { String tableName = rs.getString(3); connection.prepareStatement("ALTER TABLE " + tableName + " DISABLE TRIGGER ALL").execute(); } } catch (DatabaseException | SQLException ex) { throw new CustomChangeException("Error disabling trigger: " + ex); } }
@Override public void execute(Database database) throws CustomChangeException { JdbcConnection connection = (JdbcConnection) database.getConnection(); DatabaseMetaData metadata; try { metadata = connection.getMetaData(); String[] types = { "TABLE" }; ResultSet rs = metadata.getTables(null, null, "%", types); while (rs.next()) { String tableName = rs.getString(3); connection.prepareStatement("ALTER TABLE " + tableName + " ENABLE TRIGGER ALL").execute(); } } catch (DatabaseException | SQLException ex) { throw new CustomChangeException("Error enabling trigger: " + ex); } }
throw new CustomChangeException("Unable to change obs", e);
throw new CustomChangeException("Unable to move deleted HL7s from archive table to queue table", e);
throw new CustomChangeException("Failed to update secret answers: " + e);
@Override public void execute(Database database) throws CustomChangeException { JdbcConnection connection = (JdbcConnection) database.getConnection(); try { List<DiscontinuedOrder> discontinuedOrders = getDiscontinuedOrders(connection); createDiscontinueOrders(connection, discontinuedOrders); } catch (SQLException | DatabaseException e) { throw new CustomChangeException(e); } }
@Override public void execute(Database database) throws CustomChangeException { JdbcConnection connection = (JdbcConnection) database.getConnection(); try { List<List<Object>> usersAndProviders = getUsersAndProviders(connection); convertOrdererToProvider(connection, usersAndProviders); } catch (Exception e) { throw new CustomChangeException(e); } }
Integer conceptIdForFrequency = UpgradeUtil.getConceptIdForUnits(frequency); if (conceptIdForFrequency == null) { throw new CustomChangeException("No concept mapping found for frequency: " + frequency); throw new CustomChangeException("No order frequency found for concept " + conceptIdForFrequency);
@Override public void execute(Database database) throws CustomChangeException { JdbcConnection connection = (JdbcConnection) database.getConnection(); try { Set<String> uniqueFrequencies = DatabaseUtil.getUniqueNonNullColumnValues("frequency_text", "drug_order", String.class, connection.getUnderlyingConnection()); insertUniqueFrequencies(connection, uniqueFrequencies); } catch (Exception e) { throw new CustomChangeException(e); } }
@Override public void execute(Database database) throws CustomChangeException { JdbcConnection connection = (JdbcConnection) database.getConnection(); try { Set<String> uniqueFrequencies = DatabaseUtil.getUniqueNonNullColumnValues("frequency_text", "drug_order", String.class, connection.getUnderlyingConnection()); migrateFrequenciesToCodedValue(connection, uniqueFrequencies); } catch (Exception e) { throw new CustomChangeException(e); } }
@Override public void execute(Database database) throws CustomChangeException { JdbcConnection connection = (JdbcConnection) database.getConnection(); try { Set<String> uniqueUnits = DatabaseUtil.getUniqueNonNullColumnValues("units", "drug_order", String.class, connection.getUnderlyingConnection()); migrateUnitsToCodedValue(connection, uniqueUnits); } catch (Exception e) { throw new CustomChangeException(e); } }
Integer conceptIdForUnit = UpgradeUtil.getConceptIdForUnits(unit); if (conceptIdForUnit == null) { throw new CustomChangeException("No concept mapping found for unit: " + unit); dosingUnitsConceptSetUuid); if (!dosingUnitsconceptIds.contains(conceptIdForUnit)) { throw new CustomChangeException("Dosing unit '" + unit + "' is not among valid concepts defined in global property " + OpenmrsConstants.GP_DRUG_DOSING_UNITS_CONCEPT_UUID);