private static DataNodeContainer augmentationProxy(final AugmentationSchemaNode augmentation, final DataNodeContainer schema) { final Set<DataSchemaNode> children = new HashSet<>(); for (final DataSchemaNode augNode : augmentation.getChildNodes()) { children.add(schema.getDataChildByName(augNode.getQName())); } return new EffectiveAugmentationSchema(augmentation, children); }
/** * Returns an AugmentationSchemaNode as effective in a parent node. * * @param schema Augmentation schema * @param parent Parent schema * @return Adjusted Augmentation schema * @throws NullPointerException if any of the arguments is null */ public static AugmentationSchemaNode create(final AugmentationSchemaNode schema, final DataNodeContainer parent) { Set<DataSchemaNode> children = new HashSet<>(); for (DataSchemaNode augNode : schema.getChildNodes()) { children.add(parent.getDataChildByName(augNode.getQName())); } return new EffectiveAugmentationSchema(schema, children); }
/** * Returns an AugmentationSchemaNode as effective in a parent node. * * @param schema Augmentation schema * @param parent Parent schema * @return Adjusted Augmentation schema * @throws NullPointerException if any of the arguments is null */ public static AugmentationSchemaNode create(final AugmentationSchemaNode schema, final DataNodeContainer parent) { Set<DataSchemaNode> children = new HashSet<>(); for (DataSchemaNode augNode : schema.getChildNodes()) { children.add(parent.getDataChildByName(augNode.getQName())); } return new EffectiveAugmentationSchema(schema, children); }
public Entry<AugmentationIdentifier, AugmentationSchema> getResolvedAugmentationSchema(final DataNodeContainer target, final Class<? extends Augmentation<?>> aug) { final AugmentationSchema origSchema = getAugmentationDefinition(aug); Preconditions.checkArgument(origSchema != null, "Augmentation %s is not known in current schema context",aug); /* * FIXME: Validate augmentation schema lookup * * Currently this algorithm, does not verify if instantiated child nodes * are real one derived from augmentation schema. The problem with * full validation is, if user used copy builders, he may use * augmentation which was generated for different place. * * If this augmentations have same definition, we emit same identifier * with data and it is up to underlying user to validate data. * */ final Set<QName> childNames = new HashSet<>(); final Set<DataSchemaNode> realChilds = new HashSet<>(); for (final DataSchemaNode child : origSchema.getChildNodes()) { realChilds.add(target.getDataChildByName(child.getQName())); childNames.add(child.getQName()); } final AugmentationIdentifier identifier = new AugmentationIdentifier(childNames); final AugmentationSchema proxy = new EffectiveAugmentationSchema(origSchema, realChilds); return new AbstractMap.SimpleEntry<>(identifier, proxy); }
final AugmentationSchemaNode proxy = new EffectiveAugmentationSchema(origSchemas.stream().findFirst().get(), realChilds); return new SimpleEntry<>(identifier, proxy);
final AugmentationSchemaNode proxy = new EffectiveAugmentationSchema(origSchema, realChilds); return new SimpleEntry<>(identifier, proxy);