public ContentManager(Integer modelVersion) { this.modelVersion = modelVersion; this.localizer = new ContentLocalizer(modelVersion); }
public Optional<LocalContent> getAndRemoveRetainedModelObject() { return localizer.getAndRemoveRetainedModelObject(); }
private Set<LocalContent> collectSecuritySchemeObjects(Set<String> securitySchemeNames) { return securitySchemeNames.stream() // .map(name -> localizer.getLocalContent("/components/securitySchemes", name)) // .filter(Objects::nonNull) // .collect(Collectors.toSet()); }
public JsonNode getLocalizedRefNode(Reference ref) { Optional<JsonNode> node = getModelObject(ref); if (node.isPresent()) { localizer.register(ref, node.get()); return localizer.getLocalizedRefNode(ref); } else { return ref.getBadRefNode(); } }
public Reference getLocalizedRef(Reference ref) { Optional<JsonNode> node = getModelObject(ref); if (node.isPresent()) { localizer.register(ref, node.get()); return localizer.getLocalizedRef(ref); } else { return ref.getBadRef(); } }
/** * Register the given object tree under the given reference, and select a name * for a local copy of that object if it ends up in the constructed spec. */ public LocalContent register(Reference ref, JsonNode node) { if (!localContentItems.containsKey(ref)) { register(new LocalContent(ref, node)); } return localContentItems.get(ref); }
public JsonNode getLocalizedRefNode(Reference ref) { return getLocalizedRef(ref).getRefNode(); }
public void retainImplicitlyReferencedObjects() { for (LocalContent item : localizer.getLocalContentItems()) { if (item.isRetained()) { if (item.getSectionType() == ObjectType.PATH && item.isRetained()) { getRequiredSecuritySchemesFromPath(item).forEach(LocalContent::retain); } } else if (item.getSectionType() == ObjectType.SECURITY_SCHEME) { item.retain(); } } }
public void localizeObjectsInSection(Content content, ObjectType section) { for (String objectName : content.getObjectNames(section)) { Reference ref = content.getObjectReference(section, objectName); JsonNode obj = content.getObject(section, objectName).get(); localizer.register(ref, obj); } }
private void retainObjectsInSection(Content content, ObjectType section) { for (String objectName : content.getObjectNames(section)) { Reference ref = content.getObjectReference(section, objectName); JsonNode obj = content.getObject(section, objectName).get(); localizer.register(ref, obj).retain(); } }