Merge "Bug 1125: Added regression test"
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / restconf / impl / IdentityValuesDTO.java
index 5fd36cb19681323f695445c43a6542ccc5866826..4e797d905739a6b894d2c6a9179b2219af621943 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 package org.opendaylight.controller.sal.restconf.impl;
 
 import java.util.ArrayList;
@@ -7,33 +14,42 @@ import java.util.List;
 public final class IdentityValuesDTO {
 
     private final List<IdentityValue> elementData = new ArrayList<>();
+    private final String originValue;
 
-    public IdentityValuesDTO(String namespace, String value, String prefix) {
+    public IdentityValuesDTO(String namespace, String value, String prefix, String originValue) {
         elementData.add(new IdentityValue(namespace, value, prefix));
+        this.originValue = originValue;
     }
-    
+
+    public IdentityValuesDTO(String originValue) {
+        this.originValue = originValue;
+    }
+
     public IdentityValuesDTO() {
-        
+        originValue = null;
     }
 
     public void add(String namespace, String value, String prefix) {
         elementData.add(new IdentityValue(namespace, value, prefix));
     }
-    
+
     public void add(IdentityValue identityValue) {
         elementData.add(identityValue);
     }
-    
 
     public List<IdentityValue> getValuesWithNamespaces() {
         return Collections.unmodifiableList(elementData);
     }
-    
+
     @Override
     public String toString() {
         return elementData.toString();
     }
 
+    public String getOriginValue() {
+        return originValue;
+    }
+
     public static final class IdentityValue {
 
         private final String namespace;
@@ -69,7 +85,7 @@ public final class IdentityValuesDTO {
         public void setPredicates(List<Predicate> predicates) {
             this.predicates = predicates;
         }
-        
+
         @Override
         public String toString() {
             StringBuilder sb = new StringBuilder();
@@ -93,22 +109,22 @@ public final class IdentityValuesDTO {
         }
 
     }
-    
+
     public static final class Predicate {
-        
+
         private final IdentityValue name;
         private final String value;
-        
+
         public Predicate(IdentityValue name, String value) {
             super();
             this.name = name;
             this.value = value;
         }
-        
+
         public IdentityValue getName() {
             return name;
         }
-        
+
         public String getValue() {
             return value;
         }
@@ -124,10 +140,10 @@ public final class IdentityValuesDTO {
             }
             return sb.toString();
         }
-        
+
         public boolean isLeafList() {
             return name == null ? true : false;
         }
-        
+
     }
 }