public static boolean belongsToCaseAugment(final CaseSchemaNode caseNode, final AugmentationIdentifier childToProcess) { for (final AugmentationSchemaNode augmentationSchema : caseNode.getAvailableAugmentations()) { final Set<QName> currentAugmentChildNodes = new HashSet<>(); for (final DataSchemaNode dataSchemaNode : augmentationSchema.getChildNodes()) { currentAugmentChildNodes.add(dataSchemaNode.getQName()); } if (childToProcess.getPossibleChildNames().equals(currentAugmentChildNodes)) { return true; } } return false; }
public static boolean belongsToCaseAugment(final CaseSchemaNode caseNode, final AugmentationIdentifier childToProcess) { for (final AugmentationSchemaNode augmentationSchema : caseNode.getAvailableAugmentations()) { final Set<QName> currentAugmentChildNodes = new HashSet<>(); for (final DataSchemaNode dataSchemaNode : augmentationSchema.getChildNodes()) { currentAugmentChildNodes.add(dataSchemaNode.getQName()); } if (childToProcess.getPossibleChildNames().equals(currentAugmentChildNodes)) { return true; } } return false; }
static CaseEnforcer forTree(final CaseSchemaNode schema, final DataTreeConfiguration treeConfig) { final TreeType type = treeConfig.getTreeType(); final Builder<NodeIdentifier, DataSchemaNode> childrenBuilder = ImmutableMap.builder(); final Builder<AugmentationIdentifier, AugmentationSchemaNode> augmentationsBuilder = ImmutableMap.builder(); if (SchemaAwareApplyOperation.belongsToTree(type, schema)) { for (final DataSchemaNode child : schema.getChildNodes()) { if (SchemaAwareApplyOperation.belongsToTree(type, child)) { childrenBuilder.put(NodeIdentifier.create(child.getQName()), child); } } for (final AugmentationSchemaNode augment : schema.getAvailableAugmentations()) { if (augment.getChildNodes().stream() .anyMatch(child -> SchemaAwareApplyOperation.belongsToTree(type, child))) { augmentationsBuilder.put(DataSchemaContextNode.augmentationIdentifierFrom(augment), augment); } } } final ImmutableMap<NodeIdentifier, DataSchemaNode> children = childrenBuilder.build(); if (children.isEmpty()) { return null; } final ImmutableMap<AugmentationIdentifier, AugmentationSchemaNode> augmentations = augmentationsBuilder.build(); final Optional<MandatoryLeafEnforcer> enforcer = MandatoryLeafEnforcer.forContainer(schema, treeConfig); return enforcer.isPresent() ? new EnforcingMandatory(children, augmentations, enforcer.get()) : new CaseEnforcer(children, augmentations); }
static CaseEnforcer forTree(final CaseSchemaNode schema, final DataTreeConfiguration treeConfig) { final TreeType type = treeConfig.getTreeType(); final Builder<NodeIdentifier, DataSchemaNode> childrenBuilder = ImmutableMap.builder(); final Builder<AugmentationIdentifier, AugmentationSchemaNode> augmentationsBuilder = ImmutableMap.builder(); if (SchemaAwareApplyOperation.belongsToTree(type, schema)) { for (final DataSchemaNode child : schema.getChildNodes()) { if (SchemaAwareApplyOperation.belongsToTree(type, child)) { childrenBuilder.put(NodeIdentifier.create(child.getQName()), child); } } for (final AugmentationSchemaNode augment : schema.getAvailableAugmentations()) { if (augment.getChildNodes().stream() .anyMatch(child -> SchemaAwareApplyOperation.belongsToTree(type, child))) { augmentationsBuilder.put(DataSchemaContextNode.augmentationIdentifierFrom(augment), augment); } } } final ImmutableMap<NodeIdentifier, DataSchemaNode> children = childrenBuilder.build(); return children.isEmpty() ? null : new CaseEnforcer(children, augmentationsBuilder.build(), MandatoryLeafEnforcer.forContainer(schema, treeConfig)); }