Add 'direct' keyword to descendants option to query direct children (ep1)
[cps.git] / cps-service / src / main / java / org / onap / cps / spi / FetchDescendantsOption.java
index 0257499..3b90b06 100644 (file)
@@ -42,7 +42,7 @@ public class FetchDescendantsOption {
     }
 
     private static final Pattern FETCH_DESCENDANTS_OPTION_PATTERN =
-        Pattern.compile("^$|^all$|^none$|^[0-9]+$|^-1$");
+        Pattern.compile("^$|^all$|^none$|^direct$|^[0-9]+$|^-1$|^1$");
 
     private final int depth;
 
@@ -96,6 +96,8 @@ public class FetchDescendantsOption {
             return FetchDescendantsOption.OMIT_DESCENDANTS;
         } else if ("-1".equals(fetchDescendantsOptionAsString) || "all".equals(fetchDescendantsOptionAsString)) {
             return FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS;
+        } else if ("1".equals(fetchDescendantsOptionAsString) || "direct".equals(fetchDescendantsOptionAsString)) {
+            return FetchDescendantsOption.DIRECT_CHILDREN_ONLY;
         } else {
             final Integer depth = Integer.valueOf(fetchDescendantsOptionAsString);
             return new FetchDescendantsOption(depth);