public void init() { catalogData = catalogReader.read(); for (Attribute attribute : catalogData.getAttributes()) { attributes.put(attribute.getName(), attribute); } }
@Override public Map<String, Attribute> getAttributes(String eventName, String catalogId) { Event event = getEvent(eventName, catalogId); if (event == null) { logger.warn("The event named {} could not be found in catalog {}", eventName, catalogId); return null; } List<EventAttribute> eventAttributes = event.getAttributes() == null ? emptyList() : event.getAttributes(); Map<String, Attribute> attributes = new HashMap<>(eventAttributes.size()); for (EventAttribute eventAttribute : eventAttributes) { Attribute attr = getAttribute(eventAttribute.getName(), event.getCatalogId()); if (attr != null) { attributes.put(attr.getName(), attr); } } return attributes; }
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; }
if ((!attr.isRequestContext() && (attr.isRequired()) || (eventAttribute.isRequired() != null && eventAttribute.isRequired()))) { String name = attr.getName(); if (!attributes.containsKey(name)) { if (missingAttributes.length() > 0) {
for (Attribute attribute : attributes.values()) { if (attribute.isRequestContext()) { String name = attribute.getName(); if (name.startsWith(REQCTX)) { name = name.substring(REQCTX.length()); continue; String name = attribute.getName(); reqCtx.append(KEY).append(entry.getKey()).append("\""); Attribute attrib = entry.getValue(); String name = attrib.getName(); if (name.startsWith(REQCTX)) { name = name.substring(REQCTX.length());
public AttributeModel convert(Attribute attribute) { LOGGER.traceEntry(attribute.getName()); AttributeModel model; if (attribute.getId() != null) { model = new AttributeModel(); model.setName(attribute.getName()); model.setAliases(attribute.getAliases()); model.setDescription(attribute.getDescription());