resourcebundle and session constants
This commit is contained in:
35
src/de/geofroggerfx/application/SessionConstants.java
Normal file
35
src/de/geofroggerfx/application/SessionConstants.java
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Andreas Billmann <abi@geofroggerfx.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package de.geofroggerfx.application;
|
||||
|
||||
/**
|
||||
* @author Andreas Billmann
|
||||
*/
|
||||
public class SessionConstants {
|
||||
public static final String CURRENT_CACHE = "current-cache";
|
||||
public static final String CACHE_LIST = "cache-list";
|
||||
public static final String CACHE_LISTS = "cache-lists";
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package de.geofroggerfx.fx.cachedetails;
|
||||
|
||||
import de.geofroggerfx.application.SessionConstants;
|
||||
import de.geofroggerfx.application.SessionContext;
|
||||
import de.geofroggerfx.application.SessionContextListener;
|
||||
import de.geofroggerfx.fx.components.MapPaneWrapper;
|
||||
@@ -56,6 +57,9 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import static de.geofroggerfx.application.SessionConstants.CACHE_LISTS;
|
||||
import static de.geofroggerfx.application.SessionConstants.CURRENT_CACHE;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
*
|
||||
@@ -137,7 +141,7 @@ public class CacheDetailsController implements Initializable, SessionContextList
|
||||
|
||||
@Override
|
||||
public void sessionContextChanged() {
|
||||
Cache currentCache = (Cache) sessionContext.getData("current-cache");
|
||||
Cache currentCache = (Cache) sessionContext.getData(CURRENT_CACHE);
|
||||
if (currentCache != null) {
|
||||
fillForm(currentCache);
|
||||
fadeIn();
|
||||
@@ -154,13 +158,13 @@ public class CacheDetailsController implements Initializable, SessionContextList
|
||||
|
||||
|
||||
private void setSessionListener() {
|
||||
sessionContext.addListener("current-cache", this);
|
||||
sessionContext.addListener("cache-lists", () -> Platform.runLater(this::refreshCacheListMenu));
|
||||
sessionContext.addListener(CURRENT_CACHE, this);
|
||||
sessionContext.addListener(CACHE_LISTS, () -> Platform.runLater(this::refreshCacheListMenu));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void refreshCacheListMenu() {
|
||||
List<CacheList> cacheLists = (List<CacheList>) sessionContext.getData("cache-lists");
|
||||
List<CacheList> cacheLists = (List<CacheList>) sessionContext.getData(CACHE_LISTS);
|
||||
addToListMenuButton.getItems().clear();
|
||||
cacheLists.stream().forEach(this::addToListMenuItem);
|
||||
}
|
||||
@@ -173,7 +177,7 @@ public class CacheDetailsController implements Initializable, SessionContextList
|
||||
}
|
||||
|
||||
private void addCacheAction(CacheList cacheList) {
|
||||
Cache currentCache = (Cache) sessionContext.getData("current-cache");
|
||||
Cache currentCache = (Cache) sessionContext.getData(CURRENT_CACHE);
|
||||
cacheList.addCache(currentCache);
|
||||
cacheService.storeCacheList(cacheList);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package de.geofroggerfx.fx.cachelist;
|
||||
|
||||
import de.geofroggerfx.application.SessionConstants;
|
||||
import de.geofroggerfx.application.SessionContext;
|
||||
import de.geofroggerfx.fx.components.CacheListCell;
|
||||
import de.geofroggerfx.fx.components.IconManager;
|
||||
@@ -48,6 +49,7 @@ import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import static de.geofroggerfx.application.SessionConstants.*;
|
||||
import static de.geofroggerfx.fx.utils.JavaFXUtils.addClasses;
|
||||
import static de.geofroggerfx.service.CacheSortField.*;
|
||||
|
||||
@@ -60,6 +62,8 @@ public class CacheListController implements Initializable {
|
||||
|
||||
private static final String CACHE_LIST_ACTION_ICONS = "cache-list-action-icons";
|
||||
|
||||
private ResourceBundle resourceBundle;
|
||||
|
||||
@Inject
|
||||
private SessionContext sessionContext;
|
||||
|
||||
@@ -89,16 +93,18 @@ public class CacheListController implements Initializable {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
this.resourceBundle = rb;
|
||||
|
||||
setSessionListener();
|
||||
setCellFactory();
|
||||
|
||||
cacheListView.getSelectionModel().selectedItemProperty().addListener(
|
||||
(ChangeListener<Cache>) (ObservableValue<? extends Cache> ov, Cache oldValue, Cache newValue) ->
|
||||
sessionContext.setData("current-cache", newValue)
|
||||
sessionContext.setData(CURRENT_CACHE, newValue)
|
||||
);
|
||||
|
||||
initCacheListComboBox();
|
||||
initListMenuButton(rb);
|
||||
initListMenuButton();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -109,22 +115,22 @@ public class CacheListController implements Initializable {
|
||||
}
|
||||
|
||||
private void setSessionListener() {
|
||||
sessionContext.addListener("cache-list", () -> Platform.runLater(this::resetCacheList));
|
||||
sessionContext.addListener("cache-lists", () -> Platform.runLater(this::refreshCacheListComboAndSelectFirst));
|
||||
sessionContext.addListener(CACHE_LIST, () -> Platform.runLater(this::resetCacheList));
|
||||
sessionContext.addListener(CACHE_LISTS, () -> Platform.runLater(this::refreshCacheListComboAndSelectFirst));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void resetCacheList() {
|
||||
List<Cache> caches = (List<Cache>) sessionContext.getData("cache-list");
|
||||
List<Cache> caches = (List<Cache>) sessionContext.getData(CACHE_LIST);
|
||||
cacheNumber.setText(" " + caches.size());
|
||||
cacheListView.getItems().setAll(caches);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void refreshCacheListComboAndSelectFirst() {
|
||||
List<CacheList> cacheLists = (List<CacheList>) sessionContext.getData("cache-lists");
|
||||
List<CacheList> cacheLists = (List<CacheList>) sessionContext.getData(CACHE_LISTS);
|
||||
cacheListComboBox.getItems().clear();
|
||||
cacheListComboBox.getItems().add("All caches");
|
||||
cacheListComboBox.getItems().add(resourceBundle.getString("all.caches"));
|
||||
cacheListComboBox.getItems().addAll(cacheLists);
|
||||
cacheListComboBox.getSelectionModel().selectFirst();
|
||||
}
|
||||
@@ -139,42 +145,42 @@ public class CacheListController implements Initializable {
|
||||
|
||||
private void cacheListSelectAction(Object selectedItem) {
|
||||
if (selectedItem != null) {
|
||||
if (selectedItem.equals("All caches")) {
|
||||
if (selectedItem.equals(resourceBundle.getString("all.caches"))) {
|
||||
loadAllCaches();
|
||||
} else{
|
||||
CacheList cacheList = (CacheList)selectedItem;
|
||||
sessionContext.setData("cache-list", cacheList.getCaches());
|
||||
sessionContext.setData(CACHE_LIST, cacheList.getCaches());
|
||||
}
|
||||
} else {
|
||||
cacheListComboBox.getSelectionModel().selectFirst();
|
||||
}
|
||||
}
|
||||
|
||||
private void initListMenuButton(final ResourceBundle rb) {
|
||||
private void initListMenuButton() {
|
||||
addClasses(menuIcon, CACHE_LIST_ACTION_ICONS);
|
||||
menuIcon.setGraphic(new ImageView(IconManager.getIcon("iconmonstr-menu-icon.png", IconManager.IconSize.SMALL)));
|
||||
menuIcon.getItems().addAll(createSortMenu(rb));
|
||||
menuIcon.getItems().addAll(createSortMenu());
|
||||
menuIcon.minHeightProperty().bind(cacheListComboBox.heightProperty());
|
||||
menuIcon.prefHeightProperty().bind(cacheListComboBox.heightProperty());
|
||||
menuIcon.maxHeightProperty().bind(cacheListComboBox.heightProperty());
|
||||
}
|
||||
|
||||
private Menu createSortMenu(final ResourceBundle rb) {
|
||||
Menu sortMenu = new Menu(rb.getString("menu.title.sort"));
|
||||
currentSortingButton = createSortButton(rb, NAME);
|
||||
private Menu createSortMenu() {
|
||||
Menu sortMenu = new Menu(resourceBundle.getString("menu.title.sort"));
|
||||
currentSortingButton = createSortButton(NAME);
|
||||
currentSortingButton.setSelected(true);
|
||||
sortMenu.getItems().addAll(
|
||||
currentSortingButton,
|
||||
createSortButton(rb, TYPE),
|
||||
createSortButton(rb, DIFFICULTY),
|
||||
createSortButton(rb, TERRAIN),
|
||||
createSortButton(rb, OWNER),
|
||||
createSortButton(rb, PLACEDBY));
|
||||
createSortButton(TYPE),
|
||||
createSortButton(DIFFICULTY),
|
||||
createSortButton(TERRAIN),
|
||||
createSortButton(OWNER),
|
||||
createSortButton(PLACEDBY));
|
||||
return sortMenu;
|
||||
}
|
||||
|
||||
private SortingMenuItem createSortButton(final ResourceBundle rb, final CacheSortField field) {
|
||||
SortingMenuItem button = new SortingMenuItem(rb.getString("sort.cache."+field.getFieldName()), field);
|
||||
private SortingMenuItem createSortButton(final CacheSortField field) {
|
||||
SortingMenuItem button = new SortingMenuItem(resourceBundle.getString("sort.cache."+field.getFieldName()), field);
|
||||
button.setOnAction(actionEvent -> {
|
||||
|
||||
// if there was another button selected, change the selection
|
||||
@@ -190,8 +196,7 @@ public class CacheListController implements Initializable {
|
||||
}
|
||||
|
||||
private void loadAllCaches() {
|
||||
sessionContext.setData("cache-list", cacheService.getAllCaches(currentSortingButton.getField(), currentSortingButton.getSortDirection()));
|
||||
sessionContext.setData(CACHE_LIST, cacheService.getAllCaches(currentSortingButton.getField(), currentSortingButton.getSortDirection()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
package de.geofroggerfx.fx.geofrogger;
|
||||
|
||||
import de.geofroggerfx.application.ProgressEvent;
|
||||
import de.geofroggerfx.application.SessionConstants;
|
||||
import de.geofroggerfx.application.SessionContext;
|
||||
import de.geofroggerfx.gpx.GPXReader;
|
||||
import de.geofroggerfx.model.Cache;
|
||||
@@ -58,8 +59,11 @@ import java.util.ResourceBundle;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static de.geofroggerfx.application.SessionConstants.CACHE_LIST;
|
||||
import static de.geofroggerfx.application.SessionConstants.CACHE_LISTS;
|
||||
import static de.geofroggerfx.service.CacheSortField.NAME;
|
||||
import static de.geofroggerfx.service.SortDirection.ASC;
|
||||
import static java.util.logging.Level.SEVERE;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
@@ -69,7 +73,7 @@ import static de.geofroggerfx.service.SortDirection.ASC;
|
||||
public class GeofroggerController implements Initializable {
|
||||
|
||||
private static final String LICENSE = "/*\n" +
|
||||
" * Copyright (c) 2013, Andreas Billmann <abi@geofroggerfx.de>\n" +
|
||||
" * Copyright (c) 2013-2014, Andreas Billmann <abi@geofroggerfx.de>\n" +
|
||||
" * All rights reserved.\n" +
|
||||
" *\n" +
|
||||
" * Redistribution and use in source and binary forms, with or without\n" +
|
||||
@@ -97,7 +101,7 @@ public class GeofroggerController implements Initializable {
|
||||
private static final String MASTHEAD_TEXT = "GeoFroggerFX by Andreas Billmann <abi@geofroggerfx.de>";
|
||||
private static final String ABOUT_TEXT = "Used libs:\n"
|
||||
+ "\t- JFXtras 8.0 r1\n"
|
||||
+ "\t- ControlsFX 8.0.2 developer preview 1\n"
|
||||
+ "\t- ControlsFX 8.0.6\n"
|
||||
+ "\t- jdom 2.x\n"
|
||||
+ "\t- H2 1.3.173\n"
|
||||
+ "\t- Icons by http://iconmonstr.com/\n";
|
||||
@@ -107,6 +111,7 @@ public class GeofroggerController implements Initializable {
|
||||
private final LoadCachesFromFileService loadService = new LoadCachesFromFileService();
|
||||
private final LoadCachesFromDatabaseService loadFromDBService = new LoadCachesFromDatabaseService();
|
||||
private final LoadCacheListsFromDatabaseService loadListsFromDBService = new LoadCacheListsFromDatabaseService();
|
||||
private ResourceBundle resourceBundle;
|
||||
|
||||
@Inject
|
||||
private GPXReader gpxReader;
|
||||
@@ -142,6 +147,8 @@ public class GeofroggerController implements Initializable {
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
resourceBundle = rb;
|
||||
|
||||
List<Plugin> plugins = pluginService.getAllPlugins();
|
||||
for (Plugin plugin: plugins) {
|
||||
MenuItem menuItem = new MenuItem(plugin.getName()+" ("+plugin.getVersion()+")");
|
||||
@@ -171,7 +178,7 @@ public class GeofroggerController implements Initializable {
|
||||
|
||||
@FXML
|
||||
public void showAboutDialog(ActionEvent actionEvent) {
|
||||
Dialog dialog = new Dialog(null, "About");
|
||||
Dialog dialog = new Dialog(null, resourceBundle.getString("dialog.title.about"));
|
||||
dialog.setMasthead(MASTHEAD_TEXT);
|
||||
dialog.setContent(ABOUT_TEXT);
|
||||
dialog.setExpandableContent(new TextArea(LICENSE));
|
||||
@@ -189,34 +196,36 @@ public class GeofroggerController implements Initializable {
|
||||
public void newList(ActionEvent actionEvent) {
|
||||
final Optional<String> listNameOption = Dialogs.
|
||||
create().
|
||||
title("New list").
|
||||
message("List name").
|
||||
title(resourceBundle.getString("dialog.title.new_list")).
|
||||
message(resourceBundle.getString("dialog.label.listname")).
|
||||
showTextInput();
|
||||
if (hasValue(listNameOption)) {
|
||||
final String listName = listNameOption.get().trim();
|
||||
if (cacheService.doesCacheListNameExist(listName)) {
|
||||
Dialogs.create().message("List does already exist!").showError();
|
||||
Dialogs.
|
||||
create().
|
||||
message(resourceBundle.getString("dialog.msg.list.does.exist")).
|
||||
showError();
|
||||
} else {
|
||||
CacheList list = new CacheList();
|
||||
list.setName(listName);
|
||||
cacheService.storeCacheList(list);
|
||||
sessionContext.setData("cache-lists", cacheService.getAllCacheLists());
|
||||
setCacheListInContext();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
public void deleteList(ActionEvent actionEvent) {
|
||||
final Optional<CacheList> listOption = Dialogs.
|
||||
create().
|
||||
title("Delete list").
|
||||
message("List name").
|
||||
title("dialog.title.delete_list").
|
||||
message("dialog.label.listname").
|
||||
showChoices(cacheService.getAllCacheLists());
|
||||
|
||||
if (listOption.isPresent()) {
|
||||
cacheService.deleteCacheList(listOption.get());
|
||||
sessionContext.setData("cache-lists", cacheService.getAllCacheLists());
|
||||
setCacheListInContext();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,6 +234,10 @@ public class GeofroggerController implements Initializable {
|
||||
Platform.exit();
|
||||
}
|
||||
|
||||
private void setCacheListInContext() {
|
||||
sessionContext.setData(CACHE_LISTS, cacheService.getAllCacheLists());
|
||||
}
|
||||
|
||||
private void updateStatus(String text, double progressValue) {
|
||||
Platform.runLater(() -> {
|
||||
leftStatus.setText(text);
|
||||
@@ -243,9 +256,9 @@ public class GeofroggerController implements Initializable {
|
||||
return new Task() {
|
||||
@Override
|
||||
protected Void call() throws Exception {
|
||||
updateStatus("Load cache lists from database.", ProgressIndicator.INDETERMINATE_PROGRESS);
|
||||
sessionContext.setData("cache-lists", cacheService.getAllCacheLists());
|
||||
updateStatus("All cache lists loaded.", 0);
|
||||
updateStatus(resourceBundle.getString("status.load.all.caches.from.db"), ProgressIndicator.INDETERMINATE_PROGRESS);
|
||||
sessionContext.setData(CACHE_LISTS, cacheService.getAllCacheLists());
|
||||
updateStatus(resourceBundle.getString("status.all.cache.lists.loaded"), 0);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -261,9 +274,9 @@ public class GeofroggerController implements Initializable {
|
||||
return new Task() {
|
||||
@Override
|
||||
protected Void call() throws Exception {
|
||||
updateStatus("Load caches from database.", ProgressIndicator.INDETERMINATE_PROGRESS);
|
||||
sessionContext.setData("cache-list", cacheService.getAllCaches(NAME, ASC));
|
||||
updateStatus("All caches loaded.", 0);
|
||||
updateStatus(resourceBundle.getString("status.load.caches.from.db"), ProgressIndicator.INDETERMINATE_PROGRESS);
|
||||
sessionContext.setData(CACHE_LIST, cacheService.getAllCaches(NAME, ASC));
|
||||
updateStatus(resourceBundle.getString("status.all.caches.loaded"), 0);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -296,16 +309,16 @@ public class GeofroggerController implements Initializable {
|
||||
final List<Cache> cacheList = gpxReader.load(file.get().getAbsolutePath());
|
||||
if (cacheList != null && !cacheList.isEmpty()) {
|
||||
|
||||
updateStatus("Store caches in database", ProgressIndicator.INDETERMINATE_PROGRESS);
|
||||
updateStatus(resourceBundle.getString("status.store.all.caches"), ProgressIndicator.INDETERMINATE_PROGRESS);
|
||||
cacheService.storeCaches(cacheList);
|
||||
updateStatus("All caches are stored in database", 0);
|
||||
updateStatus(resourceBundle.getString("status.all.caches.stored"), 0);
|
||||
|
||||
updateStatus("Load caches from database.", ProgressIndicator.INDETERMINATE_PROGRESS);
|
||||
sessionContext.setData("cache-list", cacheService.getAllCaches(NAME, ASC));
|
||||
updateStatus("All caches loaded.", 0);
|
||||
updateStatus(resourceBundle.getString("status.load.caches.from.db"), ProgressIndicator.INDETERMINATE_PROGRESS);
|
||||
sessionContext.setData(CACHE_LIST, cacheService.getAllCaches(NAME, ASC));
|
||||
updateStatus(resourceBundle.getString("status.all.caches.loaded"), 0);
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(GeofroggerController.class.getName()).log(Level.SEVERE, null, ex);
|
||||
Logger.getLogger(GeofroggerController.class.getName()).log(SEVERE, null, ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -35,3 +35,18 @@ sort.cache.difficulty = Schwierigkeitsgrad
|
||||
sort.cache.terrain = Gel\u00E4nde
|
||||
sort.cache.placedBy = Platziert von
|
||||
sort.cache.owner = Betreut von
|
||||
|
||||
dialog.title.about = Über
|
||||
dialog.title.new_list = Neue Liste
|
||||
dialog.label.listname = Name der Liste:
|
||||
dialog.msg.list.does.exist = Diese Liste existiert schon!
|
||||
dialog.title.delete_list = Liste löschen
|
||||
|
||||
all.caches = Alle Caches
|
||||
|
||||
status.load.all.caches.from.db = Lade alle Caches von der Datenbank.
|
||||
status.all.cache.lists.loaded = Alle Listen geladen.
|
||||
status.load.caches.from.db = Lade Caches von der Datenbank.
|
||||
status.all.caches.loaded = Alle Caches geladen.
|
||||
status.store.all.caches = Speichere Caches in Datenbank.
|
||||
status.all.caches.stored = Alle Caches in der Datenbank gespeichert.
|
||||
@@ -36,3 +36,18 @@ sort.cache.difficulty = Difficulty
|
||||
sort.cache.terrain = Terrain
|
||||
sort.cache.placedBy = Placed by
|
||||
sort.cache.owner = Owner
|
||||
|
||||
dialog.title.about = About
|
||||
dialog.title.new_list = New list
|
||||
dialog.label.listname = Name of list:
|
||||
dialog.msg.list.does.exist = List does already exist!
|
||||
dialog.title.delete_list = Delete list
|
||||
|
||||
all.caches = All caches
|
||||
|
||||
status.load.all.caches.from.db = Load cache lists from database.
|
||||
status.all.cache.lists.loaded = All cache lists loaded.
|
||||
status.load.caches.from.db = Load caches from database.
|
||||
status.all.caches.loaded = All caches loaded.
|
||||
status.store.all.caches = Store caches in database.
|
||||
status.all.caches.stored = All caches are stored in database.
|
||||
@@ -170,7 +170,7 @@ public class CacheServiceImpl implements CacheService {
|
||||
EntityManager em = dbService.getEntityManager();
|
||||
try {
|
||||
em.getTransaction().begin();
|
||||
em.persist(list);
|
||||
em.merge(list);
|
||||
em.getTransaction().commit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user