Peter Centgraf pushed to branch master at cms-community / hippo-cms-l10n-tooling


Commits:
a7808e73 by Peter Centgraf at 2018-01-29T17:35:45+01:00
CMS-11027 Refactor to match API cleanup in HCM-242

- - - - -
3461e7f6 by Peter Centgraf at 2018-02-08T11:53:07+01:00
CMS-11027 Update copyright year

- - - - -
1680ff09 by Peter Centgraf at 2018-02-08T18:09:28+01:00
CMS-11027 reintegrate feature/CMS-11027

- - - - -


2 changed files:

- tooling/src/main/java/org/onehippo/cms/l10n/RepositoryResourceBundle.java
- 
tooling/src/main/java/org/onehippo/cms/l10n/RepositoryResourceBundleLoader.java


Changes:

=====================================
tooling/src/main/java/org/onehippo/cms/l10n/RepositoryResourceBundle.java
=====================================
--- a/tooling/src/main/java/org/onehippo/cms/l10n/RepositoryResourceBundle.java
+++ b/tooling/src/main/java/org/onehippo/cms/l10n/RepositoryResourceBundle.java
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2017 Hippo B.V. (http://www.onehippo.com)
+ *  Copyright 2017-2018 Hippo B.V. (http://www.onehippo.com)
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -226,16 +226,18 @@ public class RepositoryResourceBundle extends 
ResourceBundle {
 
             final ModuleImpl module = loadBundleModule(file);
 
-            final List<DefinitionNodeImpl> definitions = 
module.getConfigSources().iterator().next().getDefinitions().stream().filter(d 
-> d instanceof ConfigDefinitionImpl).map(d -> ((ConfigDefinitionImpl) 
d).getNode()).filter(n -> 
n.getPath().startsWith("/hippo:configuration")).collect(Collectors.toList());
+            final List<DefinitionNodeImpl> definitions = 
module.getConfigSources().iterator().next()
+                    .getDefinitions().stream().filter(d -> d instanceof 
ConfigDefinitionImpl)
+                    .map(d -> ((ConfigDefinitionImpl) d).getNode())
+                    .filter(n -> 
n.getPath().startsWith("/hippo:configuration"))
+                    .collect(Collectors.toList());
             for (DefinitionNodeImpl node : definitions) {
                 if (node.getPath().equals(bundlePath)) {
                     final DefinitionNodeImpl localeNode = node.getNode(locale);
                     if (localeNode != null) {
-                        Map<String, DefinitionPropertyImpl> properties = 
localeNode.getProperties();
-                        for (String propName : properties.keySet()) {
-                            DefinitionPropertyImpl value = 
properties.get(propName);
-                            if (!propName.equals(JCR_PRIMARY_TYPE)) {
-                                entries.put(propName, 
value.getValue().getString());
+                        for (DefinitionPropertyImpl property : 
localeNode.getProperties()) {
+                            if (!property.getName().equals(JCR_PRIMARY_TYPE)) {
+                                entries.put(property.getName(), 
property.getValue().getString());
                             }
                         }
                         return;


=====================================
tooling/src/main/java/org/onehippo/cms/l10n/RepositoryResourceBundleLoader.java
=====================================
--- 
a/tooling/src/main/java/org/onehippo/cms/l10n/RepositoryResourceBundleLoader.java
+++ 
b/tooling/src/main/java/org/onehippo/cms/l10n/RepositoryResourceBundleLoader.java
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2017 Hippo B.V. (http://www.onehippo.com)
+ *  Copyright 2017-2018 Hippo B.V. (http://www.onehippo.com)
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -107,17 +107,17 @@ class RepositoryResourceBundleLoader extends 
ResourceBundleLoader {
         final Map<String, String> entries = new HashMap<>();
 
         if (node.getNodes().size() > 0) {
-            for (Map.Entry<String, DefinitionNodeImpl> nodeEntry : 
node.getNodes().entrySet()) {
-                path.push(nodeEntry.getKey());
-                collectResourceBundles(nodeEntry.getValue(), fileName, 
locales, path, bundles);
+            for (DefinitionNodeImpl childNode : node.getNodes()) {
+                path.push(childNode.getName());
+                collectResourceBundles(childNode, fileName, locales, path, 
bundles);
                 path.pop();
             }
         }
 
         if (node.getProperties().size() > 0) {
-            for (Map.Entry<String, DefinitionPropertyImpl> propertyEntry : 
node.getProperties().entrySet()) {
-                if (!propertyEntry.getKey().equals(JCR_PRIMARY_TYPE)) {
-                    entries.put(propertyEntry.getKey(), 
propertyEntry.getValue().getValue().getString());
+            for (DefinitionPropertyImpl property : node.getProperties()) {
+                if (!property.getName().equals(JCR_PRIMARY_TYPE)) {
+                    entries.put(property.getName(), 
property.getValue().getString());
                 }
             }
         }



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-cms-l10n-tooling/compare/0aa458c1477c2fe62c1d499160ddbd1b4b66a061...1680ff09e453a26ff76a8c1697efb9a9905c98c0

---
View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-cms-l10n-tooling/compare/0aa458c1477c2fe62c1d499160ddbd1b4b66a061...1680ff09e453a26ff76a8c1697efb9a9905c98c0
You're receiving this email because of your account on code.onehippo.org.
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to