CPS Validator Changes
[cps.git] / cps-service / src / main / java / org / onap / cps / api / impl / CpsQueryServiceImpl.java
index c2003d6..7b9043a 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2021 Nordix Foundation
+ *  ============LICENSE_START=======================================================
+ *  Copyright (C) 2021-2022 Nordix Foundation
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
 package org.onap.cps.api.impl;
 
 import java.util.Collection;
+import lombok.RequiredArgsConstructor;
 import org.onap.cps.api.CpsQueryService;
 import org.onap.cps.spi.CpsDataPersistenceService;
 import org.onap.cps.spi.FetchDescendantsOption;
 import org.onap.cps.spi.model.DataNode;
-import org.onap.cps.utils.CpsValidator;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.onap.cps.spi.utils.CpsValidator;
 import org.springframework.stereotype.Service;
 
 @Service
+@RequiredArgsConstructor
 public class CpsQueryServiceImpl implements CpsQueryService {
 
-    @Autowired
-    private CpsDataPersistenceService cpsDataPersistenceService;
+    private final CpsDataPersistenceService cpsDataPersistenceService;
+    private final CpsValidator cpsValidator;
 
     @Override
     public Collection<DataNode> queryDataNodes(final String dataspaceName, final String anchorName,
         final String cpsPath, final FetchDescendantsOption fetchDescendantsOption) {
-        CpsValidator.validateNameCharacters(dataspaceName, anchorName);
+        cpsValidator.validateNameCharacters(dataspaceName, anchorName);
         return cpsDataPersistenceService.queryDataNodes(dataspaceName, anchorName, cpsPath, fetchDescendantsOption);
     }
 }