use of de.alpharogroup.db.resource.bundles.entities.PropertiesKeys in project bundle-app-ui by astrapi69.
the class OverviewResourceBundleAddEntryPanel method onAddEntry.
protected void onAddEntry(final ActionEvent e) {
final String key = txtKey.getText();
final String value = txtValue.getText();
BundleApplications bundleApplication = getModelObject().getBundleApplication();
final String baseName = getModelObject().getSelectedBundleName().getBaseName().getName();
final Locale locale = LocaleResolver.resolveLocale(getModelObject().getSelectedBundleName().getLocale().getLocale());
final PropertiesKeysService propertiesKeysService = SpringApplicationContext.getInstance().getPropertiesKeysService();
final ResourcebundlesService resourcebundlesService = SpringApplicationContext.getInstance().getResourcebundlesService();
final boolean update = true;
Resourcebundles resourcebundle = resourcebundlesService.getResourcebundle(bundleApplication, baseName, locale, key);
if (resourcebundle != null) {
if (update) {
resourcebundle.setValue(value);
}
} else {
final PropertiesKeys pkey = propertiesKeysService.getOrCreateNewPropertiesKeys(key);
resourcebundle = Resourcebundles.builder().bundleName(getModelObject().getSelectedBundleName()).key(pkey).value(value).build();
ResourceBundlesDomainObjectFactory.getInstance().newResourcebundles(getModelObject().getSelectedBundleName(), pkey, value);
}
resourcebundle = resourcebundlesService.merge(resourcebundle);
reloadTableModel();
MainFrame.getInstance().getModelObject().getSelectedBundleApplication().setSelectedResourcebundle(null);
txtKey.setText("");
txtValue.setText("");
revalidate();
}
Aggregations