[ONOS-5482][ONOS-5275] Yms Operation requirement Implementation in onos-yang-tools
Change-Id: I463ed105f85ca65a61ff251e5ca062903d465551
diff --git a/generator/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java b/generator/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
index 6bfd9a8..d73a0d6 100644
--- a/generator/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
+++ b/generator/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
@@ -731,6 +731,10 @@
* Static attribute for of.
*/
public static final String OF = "of";
+ /**
+ * Static attribute for of.
+ */
+ public static final String OF_CAPS = "Of";
/**
* Static attribute for other.
@@ -848,6 +852,11 @@
public static final String OPEN_CLOSE_BRACKET_STRING = "()";
/**
+ * Static attribute for empty parameter function call.
+ */
+ public static final String OPEN_CLOSE_DIAMOND_STRING = "<>";
+
+ /**
* Static attribute for open curly bracket syntax.
*/
public static final String OPEN_CURLY_BRACKET = "{";
@@ -944,6 +953,16 @@
public static final String VALUE_LEAF_SET = "isLeafValueSet";
/**
+ * Static attribute for is valueLeafFlags method prefix.
+ */
+ public static final String VALUE_LEAF = "valueLeafFlags";
+
+ /**
+ * Static attribute for is selectLeafFlags method prefix.
+ */
+ public static final String SELECT_LEAF = "selectLeafFlags";
+
+ /**
* Static attribute for is isSelectLeaf method prefix.
*/
public static final String IS_SELECT_LEAF = "isSelectLeaf";
@@ -1120,6 +1139,11 @@
public static final String BIT_SET = "BitSet";
/**
+ * Augment map type.
+ */
+ public static final String AUGMENT_MAP_TYPE = "Map<Class<?>, Object>";
+
+ /**
* Byte java built in type.
*/
public static final String BYTE = "byte";
@@ -1452,6 +1476,12 @@
"MoreObjects.toStringHelper(getClass())";
/**
+ * Static attribute for to string method.
+ */
+ public static final String GOOGLE_MORE_OBJECT_METHOD_STATIC_STRING =
+ "MoreObjects.toStringHelper";
+
+ /**
* Static attribute for java utilities import package.
*/
public static final String JAVA_UTIL_PKG = "java.util";
@@ -1493,6 +1523,12 @@
"yangAugmentedInfo";
/**
+ * Static attribute for AugmentedInfo class.
+ */
+ public static final String YANG_AUGMENTED_INFO_MAP =
+ "yangAugmentedInfoMap";
+
+ /**
* Static attribute for augmented.
*/
public static final String AUGMENTED = "Augmented";
@@ -1732,7 +1768,7 @@
* Static attribute for YANG node operation type class.
*/
public static final String OPERATION_TYPE_CLASS =
- "OnosYangNodeOperationType";
+ "OnosYangOpType";
/**
* Static attribute for YANG node operation type attribute.
@@ -1823,6 +1859,14 @@
*/
public static final String ERROR_MSG_JAVA_IDENTITY = "Expected java " +
"identity instance node ";
+
+ /**
+ * Static attribute for error msg.
+ */
+ public static final String ERROR_MSG_FOR_AUGMENT_LINKING = "Augment " +
+ "linking does not support linking when path contains " +
+ "notification/grouping for path: ";
+
/**
* Static attribute for in.
*/
diff --git a/generator/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java b/generator/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java
index 7698d89..7d36c0f 100644
--- a/generator/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java
+++ b/generator/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java
@@ -101,7 +101,7 @@
name = YangIoUtils.getSmallCase(name);
switch (type) {
- case IMPL_CLASS: {
+ case DEFAULT_CLASS: {
return generateForClass(name);
}
case BUILDER_CLASS: {
@@ -424,7 +424,28 @@
* @return javaDocs
*/
private static String generateForClass(String className) {
- return getJavaDocForClass(className, IMPL_CLASS_JAVA_DOC, EMPTY_STRING);
+ return getJavaDocForDefaultClass(className, IMPL_CLASS_JAVA_DOC, EMPTY_STRING);
+ }
+
+ private static String addFlagJavaDoc() {
+ return " *\n" +
+ " * <p>\n" +
+ " * valueLeafFlags identify the leafs whose value are " +
+ "explicitly set\n" +
+ " * Applicable in protocol edit and query operation.\n" +
+ " * </p>\n" +
+ " *\n" +
+ " * <p>\n" +
+ " * selectLeafFlags identify the leafs to be selected, in" +
+ " a query operation.\n" +
+ " * </p>\n" +
+ " *\n" +
+ " * <p>\n" +
+ " * Operation type specify the node specific operation in" +
+ " protocols like NETCONF.\n" +
+ " * Applicable in protocol edit operation, not applicable" +
+ " in query operation.\n" +
+ " * </p>\n";
}
/**
@@ -650,6 +671,21 @@
}
/**
+ * Returns class javadoc.
+ *
+ * @param name name of class
+ * @param type type of javadoc
+ * @param indent indentation
+ * @return class javadoc
+ */
+ private static String getJavaDocForDefaultClass(String name, String type,
+ String indent) {
+ return NEW_LINE + indent + JAVA_DOC_FIRST_LINE + indent + type +
+ getSmallCase(name) + PERIOD + NEW_LINE + indent
+ + addFlagJavaDoc() + JAVA_DOC_END_LINE;
+ }
+
+ /**
* Returns javadoc start line.
*
* @param name name of attribute
@@ -712,7 +748,7 @@
/**
* For class.
*/
- IMPL_CLASS,
+ DEFAULT_CLASS,
/**
* For builder class.
diff --git a/generator/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java b/generator/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
index e1020a1..1e856bf 100644
--- a/generator/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
+++ b/generator/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
@@ -138,7 +138,7 @@
bufferedWriter.write(getJavaDoc(PACKAGE_INFO, classInfo, isChildNode,
null));
String pkg = PACKAGE + SPACE + pack + SEMI_COLON;
- if (pkg.length() > LINE_SIZE) {
+ if (pkg.length() >= LINE_SIZE) {
pkg = processModifications(pkg, LINE_SIZE);
}
bufferedWriter.write(pkg);
@@ -361,7 +361,7 @@
String line = bufferReader.readLine();
while (line != null) {
- if (line.length() > LINE_SIZE) {
+ if (line.length() >= LINE_SIZE) {
line = processModifications(line, LINE_SIZE);
}
stringBuilder.append(line);
@@ -564,7 +564,7 @@
String temp;
for (String str : array) {
if (!str.contains(OPEN_CURLY_BRACKET)) {
- if (str.length() > SUB_LINE_SIZE) {
+ if (str.length() >= SUB_LINE_SIZE) {
count = getSplitString(str, newArray, count);
} else {
newArray.add(str);