public void init() { catalogData = catalogReader.read(); for (Attribute attribute : catalogData.getAttributes()) { attributes.put(attribute.getName(), attribute); } }
private Map<String, Map<String, CatalogInfo>> initializeData(CatalogReader catalogReader) throws Exception { JsonFactory factory = new JsonFactory(); factory.enable(JsonParser.Feature.ALLOW_COMMENTS); ObjectMapper mapper = new ObjectMapper(factory); String catalog = catalogReader.readCatalog(); catalogData = mapper.readValue(catalog, CatalogData.class); if (catalogData.getAttributes() != null) { for (Attribute attr : catalogData.getAttributes()) { if (attr.isRequestContext()) { requestContextAttributes.put(attr.getName(), attr); } Map<String, Attribute> attrMap = attributeMap.get(attr.getCatalogId()); if (attrMap == null) { attrMap = new HashMap<>(); attributeMap.put(attr.getCatalogId(), attrMap); } attrMap.put(attr.getName(), attr); } } Map<String, Map<String, CatalogInfo>> map = new HashMap<>(); map.put(DEFAULT_CATALOG, new HashMap<>()); for (Event event : catalogData.getEvents()) { addEntry(map, event); } return map; }