comparison flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java @ 3555:b1912514e0f5

s/container.size() == 0/container.isEmpty()/ flys-artifacts/trunk@5149 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 28 Jul 2012 21:48:15 +0000
parents 0b9b2a0c4e64
children 8e713e9bb4d7
comparison
equal deleted inserted replaced
3554:9b356ed24411 3555:b1912514e0f5
72 String name, 72 String name,
73 String pattern, 73 String pattern,
74 String output, 74 String output,
75 String groupName) 75 String groupName)
76 { 76 {
77 logger.debug("Search theme for: " + name + " - pattern: " + pattern); 77 if (logger.isDebugEnabled()) {
78 logger.debug(
79 "Search theme for: " + name + " - pattern: " + pattern);
80 }
78 81
79 if (c == null || name == null) { 82 if (c == null || name == null) {
80 logger.warn("Cannot search for theme."); 83 logger.warn("Cannot search for theme.");
81 return null; 84 return null;
82 } 85 }
90 List<ThemeGroup> tgs = (List<ThemeGroup>) 93 List<ThemeGroup> tgs = (List<ThemeGroup>)
91 c.get(FLYSContext.THEMES); 94 c.get(FLYSContext.THEMES);
92 95
93 ThemeGroup group = null; 96 ThemeGroup group = null;
94 for (ThemeGroup tg: tgs) { 97 for (ThemeGroup tg: tgs) {
95 if(tg.getName().equals(groupName)) { 98 if (tg.getName().equals(groupName)) {
96 group = tg; 99 group = tg;
100 break;
97 } 101 }
98 } 102 }
99 103
100 if (group == null) { 104 if (group == null) {
101 return null; 105 return null;
103 107
104 Map<String, Theme> t = group.getThemes(); 108 Map<String, Theme> t = group.getThemes();
105 109
106 FLYSArtifact artifact = (FLYSArtifact) c.get(FLYSContext.ARTIFACT_KEY); 110 FLYSArtifact artifact = (FLYSArtifact) c.get(FLYSContext.ARTIFACT_KEY);
107 111
108 if (map == null || map.size() == 0 || t == null || t.size() == 0) { 112 if (map == null || map.isEmpty() || t == null || t.isEmpty()) {
109 logger.warn("No mappings or themes found. Cannot retrieve theme!"); 113 logger.warn("No mappings or themes found. Cannot retrieve theme!");
110 return null; 114 return null;
111 } 115 }
112 116
113 List<ThemeMapping> mapping = map.get(name); 117 List<ThemeMapping> mapping = map.get(name);

http://dive4elements.wald.intevation.org