private static boolean isFromAugment(final DataNodeContainer schema, final DataSchemaNode childSchema) { if (!(schema instanceof AugmentationTarget)) { return false; } for (final AugmentationSchemaNode augmentation : ((AugmentationTarget) schema).getAvailableAugmentations()) { if (augmentation.getDataChildByName(childSchema.getQName()) != null) { return true; } } return false; }
private static boolean isFromAugment(final DataNodeContainer schema, final DataSchemaNode childSchema) { if (!(schema instanceof AugmentationTarget)) { return false; } for (final AugmentationSchemaNode augmentation : ((AugmentationTarget) schema).getAvailableAugmentations()) { if (augmentation.getDataChildByName(childSchema.getQName()) != null) { return true; } } return false; }
/** * Tries to find in {@code parent} which is dealed as augmentation target node with QName as {@code child}. If such * node is found then it is returned, else null. * * @param parent parent node * @param child child node * @return augmentation schema */ private static AugmentationSchemaNode findCorrespondingAugment(final DataSchemaNode parent, final DataSchemaNode child) { if (parent instanceof AugmentationTarget && !(parent instanceof ChoiceSchemaNode)) { for (AugmentationSchemaNode augmentation : ((AugmentationTarget) parent).getAvailableAugmentations()) { DataSchemaNode childInAugmentation = augmentation.getDataChildByName(child.getQName()); if (childInAugmentation != null) { return augmentation; } } } return null; }
/** * Tries to find in {@code parent} which is dealed as augmentation target node with QName as {@code child}. If such * node is found then it is returned, else null. * * @param parent parent node * @param child child node * @return augmentation schema */ public static AugmentationSchemaNode findCorrespondingAugment(final DataSchemaNode parent, final DataSchemaNode child) { if (!(parent instanceof AugmentationTarget) || parent instanceof ChoiceSchemaNode) { return null; } for (final AugmentationSchemaNode augmentation : ((AugmentationTarget) parent).getAvailableAugmentations()) { final DataSchemaNode childInAugmentation = augmentation.getDataChildByName(child.getQName()); if (childInAugmentation != null) { return augmentation; } } return null; }
/** * Tries to find in {@code parent} which is dealed as augmentation target node with QName as {@code child}. If such * node is found then it is returned, else null. * * @param parent parent node * @param child child node * @return augmentation schema */ private static AugmentationSchemaNode findCorrespondingAugment(final DataSchemaNode parent, final DataSchemaNode child) { if (parent instanceof AugmentationTarget && !(parent instanceof ChoiceSchemaNode)) { for (AugmentationSchemaNode augmentation : ((AugmentationTarget) parent).getAvailableAugmentations()) { DataSchemaNode childInAugmentation = augmentation.getDataChildByName(child.getQName()); if (childInAugmentation != null) { return augmentation; } } } return null; }
/** * Tries to find in {@code parent} which is dealed as augmentation target node with QName as {@code child}. If such * node is found then it is returned, else null. * * @param parent parent node * @param child child node * @return augmentation schema */ public static AugmentationSchemaNode findCorrespondingAugment(final DataSchemaNode parent, final DataSchemaNode child) { if (!(parent instanceof AugmentationTarget) || parent instanceof ChoiceSchemaNode) { return null; } for (final AugmentationSchemaNode augmentation : ((AugmentationTarget) parent).getAvailableAugmentations()) { final DataSchemaNode childInAugmentation = augmentation.getDataChildByName(child.getQName()); if (childInAugmentation != null) { return augmentation; } } return null; }
/** * Returns a SchemaPathUtil for provided child node * <p/> * If supplied child is added by Augmentation this operation returns * a SchemaPathUtil for augmentation, * otherwise returns a SchemaPathUtil for child as * call for {@link #fromDataSchemaNode(org.opendaylight.yangtools.yang.model.api.DataSchemaNode)}. */ private static InstanceIdToNodes<?> fromAugmentation(final DataNodeContainer parent, final AugmentationTarget parentAug, final DataSchemaNode child) { for (final AugmentationSchemaNode aug : parentAug.getAvailableAugmentations()) { final DataSchemaNode potential = aug.getDataChildByName(child.getQName()); if (potential != null) { return new InstanceIdToCompositeNodes.AugmentationNormalization(aug, parent); } } return fromDataSchemaNode(child); }
/** * Returns a SchemaPathUtil for provided child node * <p/> * If supplied child is added by Augmentation this operation returns * a SchemaPathUtil for augmentation, * otherwise returns a SchemaPathUtil for child as * call for {@link #fromDataSchemaNode(org.opendaylight.yangtools.yang.model.api.DataSchemaNode)}. */ private static InstanceIdToNodes<?> fromAugmentation(final DataNodeContainer parent, final AugmentationTarget parentAug, final DataSchemaNode child) { for (final AugmentationSchemaNode aug : parentAug.getAvailableAugmentations()) { final DataSchemaNode potential = aug.getDataChildByName(child.getQName()); if (potential != null) { return new InstanceIdToCompositeNodes.AugmentationNormalization(aug, parent); } } return fromDataSchemaNode(child); }
/** * Returns a DataNormalizationOperation for provided child node. * * <p> * If supplied child is added by Augmentation this operation returns * a DataNormalizationOperation for augmentation, * otherwise returns a DataNormalizationOperation for child as * call for {@link #fromDataSchemaNode(DataSchemaNode)}. */ private static DataNormalizationOperation<?> fromAugmentation(final DataNodeContainer parent, final AugmentationTarget parentAug, final DataSchemaNode child) { AugmentationSchemaNode augmentation = null; for (final AugmentationSchemaNode aug : parentAug.getAvailableAugmentations()) { final DataSchemaNode potential = aug.getDataChildByName(child.getQName()); if (potential != null) { augmentation = aug; break; } } if (augmentation != null) { return new AugmentationNormalization(augmentation, parent); } else { return fromDataSchemaNode(child); } }