Builds the PlayerCharacter data model for the given CharID. @param id The CharID for which the data model should be built @return A Map of the data model for the PlayerCharacter identified by the given CharID
(CharID id)
| 148 | * given CharID |
| 149 | */ |
| 150 | public static Map<String, Object> buildDataModel(CharID id) |
| 151 | { |
| 152 | Map<String, Object> input = new HashMap<>(); |
| 153 | for (Object k1 : outModels.getKeySet()) |
| 154 | { |
| 155 | for (Object k2 : outModels.getSecondaryKeySet(k1)) |
| 156 | { |
| 157 | ModelFactory modelFactory = outModels.get(k1, k2); |
| 158 | TemplateModel model = modelFactory.generate(id); |
| 159 | String k1String = k1.toString(); |
| 160 | if ("".equals(k2.toString())) |
| 161 | { |
| 162 | input.put(k1String, model); |
| 163 | } |
| 164 | else |
| 165 | { |
| 166 | ensureMap(input, k1String); |
| 167 | @SuppressWarnings("unchecked") |
| 168 | Map<Object, Object> m = (Map<Object, Object>) input.get(k1String); |
| 169 | m.put(k2.toString(), model); |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | return input; |
| 174 | } |
| 175 | |
| 176 | private static void ensureMap(Map<String, Object> input, String k1String) |
| 177 | { |