/** * Checks if supplied schema node belong to specified Data Tree type. All nodes belong to the operational tree, * nodes in configuration tree are marked as such. * * @param treeType Tree Type * @param node Schema node * @return {@code true} if the node matches the tree type, {@code false} otherwise. */ static boolean belongsToTree(final TreeType treeType, final DataSchemaNode node) { return treeType == TreeType.OPERATIONAL || node.isConfiguration(); } }
/** * Checks if supplied schema node belong to specified Data Tree type. All nodes belong to the operational tree, * nodes in configuration tree are marked as such. * * @param treeType Tree Type * @param node Schema node * @return {@code true} if the node matches the tree type, {@code false} otherwise. */ static boolean belongsToTree(final TreeType treeType, final DataSchemaNode node) { return treeType == TreeType.OPERATIONAL || node.isConfiguration(); } }
@Override public boolean isConfiguration() { return caseShorthandNode.isConfiguration(); }
private void emitBodyOfDataSchemaNode(final DataSchemaNode dataSchemaNode) { dataSchemaNode.getWhenCondition().ifPresent(this::emitWhen); // FIXME: BUG-2444: *(ifFeatureNode ) if (dataSchemaNode instanceof MustConstraintAware) { ((MustConstraintAware) dataSchemaNode).getMustConstraints().forEach(this::emitMust); } emitConfigNode(dataSchemaNode.isConfiguration()); emitDocumentedNode(dataSchemaNode); emitUnknownStatementNodes(dataSchemaNode.getUnknownSchemaNodes()); }
private void addApis(DataSchemaNode node, List<Api> apis, String parentPath, List<Parameter> parentPathParams, SchemaContext schemaContext, boolean addConfigApi) { Api api = new Api(); List<Parameter> pathParams = new ArrayList<>(parentPathParams); String resourcePath = parentPath + createPath(node, pathParams, schemaContext) + "/"; LOG.debug("Adding path: [{}]", resourcePath); api.setPath(resourcePath); Iterable<DataSchemaNode> childSchemaNodes = Collections.<DataSchemaNode>emptySet(); if ((node instanceof ListSchemaNode) || (node instanceof ContainerSchemaNode)) { DataNodeContainer dataNodeContainer = (DataNodeContainer) node; childSchemaNodes = dataNodeContainer.getChildNodes(); } api.setOperations(operation(node, pathParams, addConfigApi, childSchemaNodes)); apis.add(api); for (DataSchemaNode childNode : childSchemaNodes) { if (childNode instanceof ListSchemaNode || childNode instanceof ContainerSchemaNode) { // keep config and operation attributes separate. if (childNode.isConfiguration() == addConfigApi) { addApis(childNode, apis, resourcePath, pathParams, schemaContext, addConfigApi); } } } }
public static ModificationApplyOperation from(final DataSchemaNode schemaNode, final DataTreeConfiguration treeConfig) { if (treeConfig.getTreeType() == TreeType.CONFIGURATION) { checkArgument(schemaNode.isConfiguration(), "Supplied %s does not belongs to configuration tree.", schemaNode.getPath()); } if (schemaNode instanceof ContainerSchemaNode) { return ContainerModificationStrategy.of((ContainerSchemaNode) schemaNode, treeConfig); } else if (schemaNode instanceof ListSchemaNode) { return fromListSchemaNode((ListSchemaNode) schemaNode, treeConfig); } else if (schemaNode instanceof ChoiceSchemaNode) { return new ChoiceModificationStrategy((ChoiceSchemaNode) schemaNode, treeConfig); } else if (schemaNode instanceof LeafListSchemaNode) { return fromLeafListSchemaNode((LeafListSchemaNode) schemaNode, treeConfig); } else if (schemaNode instanceof LeafSchemaNode) { return new LeafModificationStrategy((LeafSchemaNode) schemaNode); } throw new IllegalArgumentException("Not supported schema node type for " + schemaNode.getClass()); }
for (DataSchemaNode node : dataSchemaNodes) { if ((node instanceof ListSchemaNode) || (node instanceof ContainerSchemaNode)) { LOG.debug("Is Configuration node [{}] [{}]", node.isConfiguration(), node.getQName().getLocalName()); if (node.isConfiguration()) { // This node's config statement is true. resourcePath = getDataStorePath("/config/", context);
public static ModificationApplyOperation from(final DataSchemaNode schemaNode, final DataTreeConfiguration treeConfig) { if (treeConfig.getTreeType() == TreeType.CONFIGURATION) { checkArgument(schemaNode.isConfiguration(), "Supplied %s does not belongs to configuration tree.", schemaNode.getPath()); } if (schemaNode instanceof ContainerSchemaNode) { final ContainerSchemaNode containerSchema = (ContainerSchemaNode) schemaNode; return containerSchema.isPresenceContainer() ? new PresenceContainerModificationStrategy(containerSchema, treeConfig) : new StructuralContainerModificationStrategy(containerSchema, treeConfig); } else if (schemaNode instanceof ListSchemaNode) { return fromListSchemaNode((ListSchemaNode) schemaNode, treeConfig); } else if (schemaNode instanceof ChoiceSchemaNode) { return new ChoiceModificationStrategy((ChoiceSchemaNode) schemaNode, treeConfig); } else if (schemaNode instanceof LeafListSchemaNode) { return fromLeafListSchemaNode((LeafListSchemaNode) schemaNode, treeConfig); } else if (schemaNode instanceof LeafSchemaNode) { return new LeafModificationStrategy((LeafSchemaNode) schemaNode); } throw new IllegalArgumentException("Not supported schema node type for " + schemaNode.getClass()); }
if (node.isConfiguration() == isConfig) {