public void applyRetentionPolicy(RetentionPolicy policy) { for (Entry<String, Content> e : contentItems.entrySet()) { Content content = e.getValue(); for (ObjectType section : ObjectType.getTypesForVersion(modelVersion)) { if (policy.shouldRetain(urlCache.get(e.getKey()), section)) { retainObjectsInSection(content, section); } } } }
/** * Localize all the model objects in the given content item * <p> * This is used when to ensure that all model objects appearing in the top-level * spec will retain their original names in the final spec. Model objects * appearing in other specs may have their names changed for disambiguation. */ public void localizeObjects(Content content) { for (ObjectType section : ObjectType.getTypesForVersion(modelVersion, Option.COMPONENT_OBJECTS)) { localizeObjectsInSection(content, section); } localizeObjectsInSection(content, ObjectType.PATH); }
private void markPositions(ObjectNode tree) { for (ObjectType sectionType : ObjectType.getTypesForVersion(modelVersion)) { JsonNode section = sectionType.getFromNode(tree, modelVersion); if (section != null) { markPositionsInSection(section); if (sectionType == ObjectType.PATH) { for (Entry<String, JsonNode> path : Util.iterable(section.fields())) { markPositionsInPath(path.getValue()); } } } } }
private void sort(ObjectNode tree) { for (ObjectType sectionType : ObjectType.getTypesForVersion(modelVersion)) { JsonNode section = sectionType.getFromNode(tree, modelVersion); if (!section.isMissingNode()) { sortSection(section); if (sectionType == ObjectType.PATH) { for (Entry<String, JsonNode> path : Util.iterable(section.fields())) { sortInPath(path.getValue()); } } } } }
private void reorderTree(JsonNode tree) { for (ObjectType sectionType : ObjectType.getTypesForVersion(modelVersion)) { JsonNode section = sectionType.getFromNode(tree, modelVersion); if (!section.isMissingNode()) { reorderPropertiesInObject((ObjectNode) section); if (sectionType == ObjectType.PATH) { for (Entry<String, JsonNode> path : Util.iterable(section.fields())) { reorderInPath((ObjectNode) path.getValue()); } } } } }