@Override public Set<ChoiceCaseNode> apply(final ChoiceSchemaNode node) { return node.getCases(); } };
/** * Returns the concrete case according to specified Q name. * * @param qname * QName of sought Choice Case Node * @return child case node of this Choice if child with given name is present, empty otherwise. * @throws NullPointerException if qname is null */ default Optional<CaseSchemaNode> findCase(final QName qname) { return Optional.ofNullable(getCases().get(requireNonNull(qname))); }
private static ChoiceSchemaNode findChoice(final Iterable<ChoiceSchemaNode> choices, final QName child) { ChoiceSchemaNode foundChoice = null; choiceLoop: for (final ChoiceSchemaNode choice : choices) { for (final CaseSchemaNode caze : choice.getCases().values()) { if (findChildSchemaNode(caze, child).isPresent()) { foundChoice = choice; break choiceLoop; } } } return foundChoice; }
public static AugmentationSchemaNode findSchemaForAugment(final ChoiceSchemaNode schema, final Set<QName> qnames) { for (final CaseSchemaNode choiceCaseNode : schema.getCases().values()) { final Optional<AugmentationSchemaNode> schemaForAugment = findAugment(choiceCaseNode, qnames); if (schemaForAugment.isPresent()) { return schemaForAugment.get(); } } throw new IllegalStateException(String.format("Unknown augmentation node detected, identified by: %s, in: %s", qnames, schema)); }
private static ChoiceSchemaNode findChoice(final Iterable<ChoiceSchemaNode> choices, final QName child) { for (ChoiceSchemaNode choice : choices) { // FIXME: this looks weird: what are we looking for again? for (CaseSchemaNode caze : choice.getCases().values()) { if (findChildSchemaNode(caze, child) != null) { return choice; } } } return null; }
private static SchemaNode findChildInCases(final ChoiceSchemaNode parent, final QName qname) { DataSchemaNode schema = null; for (final CaseSchemaNode caze : parent.getCases().values()) { final DataSchemaNode potential = caze.getDataChildByName(qname); if (potential != null) { schema = potential; break; } } return schema; }
private static SchemaNode findCaseByChild(final ChoiceSchemaNode parent, final QName qname) { DataSchemaNode schema = null; for (final CaseSchemaNode caze : parent.getCases().values()) { final DataSchemaNode potential = caze.getDataChildByName(qname); if (potential != null) { schema = caze; break; } } return schema; }
private static DataNodeContainer findInCases(final ChoiceSchemaNode choiceNode, final QName targetQName) { for (CaseSchemaNode caze : choiceNode.getCases().values()) { Optional<DataNodeContainer> potential = findDataNodeContainer(caze, targetQName); if (potential.isPresent()) { return potential.get(); } } return null; }
private static ChoiceSchemaNode findChoice(final Iterable<ChoiceSchemaNode> choices, final QName child) { for (final ChoiceSchemaNode choice : choices) { for (final CaseSchemaNode caze : choice.getCases().values()) { if (findChildSchemaNode(caze, child).isPresent()) { return choice; } } } return null; }
private static ChoiceSchemaNode findChoice(final Iterable<ChoiceSchemaNode> choices, final QName child) { for (ChoiceSchemaNode choice : choices) { // FIXME: this looks weird: what are we looking for again? for (CaseSchemaNode caze : choice.getCases().values()) { if (findChildSchemaNode(caze, child) != null) { return choice; } } } return null; }
private static DataNodeContainer findInCases(final ChoiceSchemaNode choiceNode, final QName targetQName) { for (ChoiceCaseNode caze : choiceNode.getCases()) { Optional<DataNodeContainer> potential = findDataNodeContainer(caze, targetQName); if (potential.isPresent()) { return potential.get(); } } return null; }
private static DataSchemaNode searchInCases(final ChoiceSchemaNode choiceNode, final QName arg) { Set<ChoiceCaseNode> cases = choiceNode.getCases(); for (ChoiceCaseNode caseNode : cases) { DataSchemaNode node = caseNode.getDataChildByName(arg); if (node != null) { return node; } } return null; }
private static DataSchemaNode childByQName(final ChoiceSchemaNode container, final QName name) { for (final ChoiceCaseNode caze : container.getCases()) { final DataSchemaNode ret = ControllerContext.childByQName(caze, name); if (ret != null) { return ret; } } return null; }
private static DataNodeContainer findInCases(final ChoiceSchemaNode choiceNode, final QName targetQName) { for (final CaseSchemaNode caze : choiceNode.getCases().values()) { final Optional<DataNodeContainer> potential = findDataNodeContainer(caze, targetQName); if (potential.isPresent()) { return potential.get(); } } return null; }
private static ChoiceSchemaNode findChoice(final Iterable<ChoiceSchemaNode> choices, final QName child) { for (final ChoiceSchemaNode choice : choices) { for (final CaseSchemaNode caze : choice.getCases().values()) { if (findChildSchemaNode(caze, child).isPresent()) { return choice; } } } return null; }
public static AugmentationSchemaNode findSchemaForAugment(final ChoiceSchemaNode schema, final Set<QName> qnames) { for (final CaseSchemaNode choiceCaseNode : schema.getCases().values()) { final Optional<AugmentationSchemaNode> schemaForAugment = findAugment(choiceCaseNode, qnames); if (schemaForAugment.isPresent()) { return schemaForAugment.get(); } } throw new IllegalStateException(String.format("Unknown augmentation node detected, identified by: %s, in: %s", qnames, schema)); }
public static DataSchemaNode findSchemaForChild(final ChoiceSchemaNode schema, final QName childPartialQName) { for (final CaseSchemaNode choiceCaseNode : schema.getCases().values()) { final Optional<DataSchemaNode> childSchema = findFirstSchema(childPartialQName, choiceCaseNode.getChildNodes()); if (childSchema.isPresent()) { return childSchema.get(); } } throw new IllegalStateException(String.format("Unknown child(ren) node(s) detected, identified by: %s, in: %s", childPartialQName, schema)); }
public static DataSchemaNode findSchemaForChild(final ChoiceSchemaNode schema, final QName childPartialQName) { for (final CaseSchemaNode choiceCaseNode : schema.getCases().values()) { final Optional<DataSchemaNode> childSchema = findFirstSchema(childPartialQName, choiceCaseNode.getChildNodes()); if (childSchema.isPresent()) { return childSchema.get(); } } throw new IllegalStateException(String.format("Unknown child(ren) node(s) detected, identified by: %s, in: %s", childPartialQName, schema)); }
public static Optional<CaseSchemaNode> detectCase(final ChoiceSchemaNode schema, final DataContainerChild<?, ?> child) { for (final CaseSchemaNode choiceCaseNode : schema.getCases().values()) { if (child instanceof AugmentationNode && belongsToCaseAugment(choiceCaseNode, (AugmentationIdentifier) child.getIdentifier())) { return Optional.of(choiceCaseNode); } else if (choiceCaseNode.getDataChildByName(child.getNodeType()) != null) { return Optional.of(choiceCaseNode); } } return Optional.empty(); }
ChoiceNodeNormalization(final ChoiceSchemaNode schema) { super(NodeIdentifier.create(schema.getQName())); final ImmutableMap.Builder<PathArgument, InstanceIdToNodes<?>> byArgBuilder = ImmutableMap.builder(); for (final CaseSchemaNode caze : schema.getCases().values()) { for (final DataSchemaNode cazeChild : caze.getChildNodes()) { final InstanceIdToNodes<?> childOp = fromDataSchemaNode(cazeChild); byArgBuilder.put(childOp.getIdentifier(), childOp); } } byArg = byArgBuilder.build(); }