update sparky with configurable features
[aai/sparky-be.git] / sparkybe-onap-service / src / main / java / org / onap / aai / sparky / editattributes / AttributeUpdater.java
index 5d71135..23928a5 100644 (file)
@@ -1,26 +1,22 @@
 /**
- * ============LICENSE_START===================================================
- * SPARKY (AAI UI service)
- * ============================================================================
- * Copyright © 2017 AT&T Intellectual Property.
- * Copyright © 2017 Amdocs
- * All rights reserved.
- * ============================================================================
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *       http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * ============LICENSE_END=====================================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
  */
 package org.onap.aai.sparky.editattributes;
 
@@ -137,16 +133,18 @@ public class AttributeUpdater {
   private UserValidator validator;
   private OxmModelLoader oxmModelLoader;
   private OxmEntityLookup oxmEntityLookup;
+  private String domain;
   
   /**
    * Instantiates a new attribute updater.
    * @throws AttributeUpdateException 
    */
-  public AttributeUpdater(OxmModelLoader oxmModelLoader, OxmEntityLookup oxmEntityLookup, ActiveInventoryAdapter activeInventoryAdapter) throws AttributeUpdateException {
+  public AttributeUpdater(OxmModelLoader oxmModelLoader, OxmEntityLookup oxmEntityLookup, ActiveInventoryAdapter activeInventoryAdapter,String domain) throws AttributeUpdateException {
     super();
     this.oxmModelLoader = oxmModelLoader;
     this.oxmEntityLookup = oxmEntityLookup;
     this.aaiAdapter = activeInventoryAdapter;
+    this.domain = domain;
     
     try {
       this.validator = new UserValidator();
@@ -160,10 +158,10 @@ public class AttributeUpdater {
 
     String versionStr = null;
     if (oxmModelLoader != null) {
-      versionStr = String.valueOf(oxmModelLoader.getLatestVersionNum());
+      versionStr = String.valueOf(oxmModelLoader.getOxmApiVersion());
     }
 
-    return "/aai/v" + versionStr;
+    return "/" + domain + "/v" + versionStr;
 
   }
   
@@ -267,7 +265,7 @@ public class AttributeUpdater {
     String version = getVersionFromUri(objectUri);
 
     if ( null == version ) {
-      version = "v" + String.valueOf(oxmModelLoader.getLatestVersionNum());
+      version = "v" + String.valueOf(oxmModelLoader.getOxmApiVersion());
     }
     object.setSchemaVersion(version);