@Override public void serializeAsField(Object pojo, JsonGenerator jgen, SerializerProvider provider, PropertyWriter writer) throws Exception { if (writer.getName().equals("catalogId") && DEFAULT_CATALOG.equals(((Event)pojo).getCatalogId())) { return; } super.serializeAsField(pojo, jgen, provider, writer); } }
@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; }
protected void addEntry(Map<String, Map<String, CatalogInfo>> map, Event event) { CatalogInfo info = new CatalogInfo(); info.event = event; String catalogId = event.getCatalogId(); if (catalogId != null && catalogId.length() > 0 && !map.containsKey(catalogId)) { map.put(catalogId, new HashMap<>()); for (EventAttribute eventAttribute : event.getAttributes()) { String name = eventAttribute.getName(); Attribute attribute = getAttribute(name, event.getCatalogId()); if (attribute != null) { info.attributes.put(name, attribute);
Attribute attr = catalogManager.getAttribute(eventAttribute.getName(), event.getCatalogId()); if ((!attr.isRequestContext() && (attr.isRequired()) || (eventAttribute.isRequired() != null && eventAttribute.isRequired()))) { Map<String, Attribute> attributeMap = catalogManager.getAttributes(eventName, event.getCatalogId()); for (String name : attributes.keySet()) { if (!attributeMap.containsKey(name) && !name.equals("completionStatus")) { throw new ConstraintValidationException(errors.toString()); List<String> attributeNames = catalogManager.getAttributeNames(eventName, event.getCatalogId()); StringBuilder buf = new StringBuilder(); for (String attribute : attributes.keySet()) { List<String> reqCtxAttrs = catalogManager.getRequiredContextAttributes(eventName, event.getCatalogId()); if (reqCtxAttrs != null && !reqCtxAttrs.isEmpty()) { StringBuilder sb = new StringBuilder();
model = new EventModel(); model.setCatalogId(event.getCatalogId()); model.setName(event.getName()); model.setAliases(event.getAliases()); eventAttributeModel.setRequired(eventAttribute != null ? eventAttribute.isRequired() : null); } else { Optional<AttributeModel> optional = getAttribute(event.getCatalogId(), eventAttribute.getName()); if (optional.isPresent()) { eventAttributeModel = new EventAttributeModel();