+ /**
+ * This method convert cm handle data nodes to yang model cm handles.
+ * @param cmHandleDataNodes the datanode of the cm handle
+ * @return yang model cm handles
+ */
+ public static Collection<YangModelCmHandle> convertDataNodesToYangModelCmHandles(
+ final Collection<DataNode> cmHandleDataNodes) {
+ final Collection<YangModelCmHandle> yangModelCmHandles = new ArrayList<>(cmHandleDataNodes.size());
+ cmHandleDataNodes.forEach(dataNode -> {
+ final String cmHandleId = extractCmHandleIdFromXpath(dataNode.getXpath());
+ yangModelCmHandles.add(convertCmHandleToYangModel(dataNode, cmHandleId));
+ });
+ return yangModelCmHandles;
+ }
+
+ /**
+ * This method extract cm handle id from xpath of data node.
+ * @param xpath for data node of the cm handle
+ * @return cm handle Id
+ */
+ public static String extractCmHandleIdFromXpath(final String xpath) {
+ final Matcher matcher = cmHandleIdInXpathPattern.matcher(xpath);
+ matcher.find();
+ return matcher.group(1);
+ }
+
+