Skip to content

Commit

Permalink
Merge pull request #152 from cleydyr/issue-133-139
Browse files Browse the repository at this point in the history
[133] [139] registre update
  • Loading branch information
cleydyr authored Sep 16, 2019
2 parents 1283395 + ccc35c4 commit c359c6d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
package biblivre.update.v6_0_0;
package biblivre.update.v6_0_0$1_0_0$alpha;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Component;

import biblivre.core.translations.Translations;
import biblivre.core.utils.Constants;
import biblivre.update.UpdateService;

@Component
public class Update implements UpdateService {

public void doUpdateScopedBySchema(Connection connection) throws SQLException {
public void doUpdate(Connection connection) throws SQLException {
_addTranslations(connection);
}

@Override
public String getVersion() {
return "6.0.0-1.0.0-alpha";
}

private void _addTranslations(Connection connection) throws SQLException {
for (Map.Entry<String, Map<String, String>> entry: _TRANSLATIONS.entrySet()) {
for (Map.Entry<String, String> entry2: entry.getValue().entrySet()) {
String key = entry.getKey();
Expand All @@ -23,25 +28,27 @@ public void doUpdateScopedBySchema(Connection connection) throws SQLException {

String translation = entry2.getValue();

Translations.addSingleTranslation(
connection.getSchema(), language, key, translation,
Constants.ADMIN_LOGGED_USER_ID);
Translations.addSingleTranslation(language, key, translation);
}
}
}

@Override
public String getVersion() {
return "6.0.0";
}

@SuppressWarnings({ "unchecked", "rawtypes", "serial" })
private Map<String, Map<String, String>> _TRANSLATIONS = new HashMap() {{
put("cataloging.reservation.error.limit_exceeded", new HashMap() {{
put("en-US", "The selected reader surpassed the limit of authorized loans");
put("es", "El lector seleccionado excedió el límite de reservas permitidas");
put("pt-BR", "O leitor selecionado ultrapassou o limite de reservas permitidas");
}});

put("cataloging.import.error.file_upload_error", new HashMap() {{
put("en-US", "Couldn't upload file. Please contact the administrator to analyze this" +
"problem.");
put("es", "No ha sido posible subir el archivo. Por favor, contacta el administrador " +
"del sistema para analizar este problema.");
put("pt-BR", "Não foi possível fazer upload do arquivo. Por favor, contacte o " +
"administrador do sistema para anlizar este problema.");
}});
}};

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ biblivre.update.v4_1_11a.Update
biblivre.update.v5_0_0.Update
biblivre.update.v5_0_1.Update
biblivre.update.v5_0_1b.Update
biblivre.update.v5_0_4c.Update
biblivre.update.v5_0_4c.Update
biblivre.update.v6_0_0$1_0_0$alpha.Update

0 comments on commit c359c6d

Please sign in to comment.