diff options
author | DylanB95EST <dylan.byrne@est.tech> | 2022-04-11 09:24:59 +0100 |
---|---|---|
committer | DylanB95EST <dylan.byrne@est.tech> | 2022-04-11 09:25:04 +0100 |
commit | 9dc0930e3c8f520b97b37c5bce7636288682ade8 (patch) | |
tree | 17c117f0b1b68207cba8fab84d11159142a1839c /cps-service/src/main/java/org | |
parent | ac6f54fcfd2b07a4804620bd9cfa6de6ce4e1c0c (diff) |
Fix Sonar Qube Violations
Immediately return expression
Issue-ID: CPS-475
Change-Id: I2c33c94bef1ff097786299d3a037feea2b4ebbff
Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
Diffstat (limited to 'cps-service/src/main/java/org')
-rwxr-xr-x | cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java index 99358984c7..b95ad051e6 100755 --- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java @@ -58,7 +58,7 @@ public class CpsDataServiceImpl implements CpsDataService { public void saveData(final String dataspaceName, final String anchorName, final String jsonData, final OffsetDateTime observedTimestamp) { CpsValidator.validateNameCharacters(dataspaceName, anchorName); - final var dataNode = buildDataNode(dataspaceName, anchorName, ROOT_NODE_XPATH, jsonData); + final DataNode dataNode = buildDataNode(dataspaceName, anchorName, ROOT_NODE_XPATH, jsonData); cpsDataPersistenceService.storeDataNode(dataspaceName, anchorName, dataNode); processDataUpdatedEventAsync(dataspaceName, anchorName, observedTimestamp, ROOT_NODE_XPATH, Operation.CREATE); } @@ -67,7 +67,7 @@ public class CpsDataServiceImpl implements CpsDataService { public void saveData(final String dataspaceName, final String anchorName, final String parentNodeXpath, final String jsonData, final OffsetDateTime observedTimestamp) { CpsValidator.validateNameCharacters(dataspaceName, anchorName); - final var dataNode = buildDataNode(dataspaceName, anchorName, parentNodeXpath, jsonData); + final DataNode dataNode = buildDataNode(dataspaceName, anchorName, parentNodeXpath, jsonData); cpsDataPersistenceService.addChildDataNode(dataspaceName, anchorName, parentNodeXpath, dataNode); processDataUpdatedEventAsync(dataspaceName, anchorName, observedTimestamp, parentNodeXpath, Operation.CREATE); } @@ -94,7 +94,7 @@ public class CpsDataServiceImpl implements CpsDataService { public void updateNodeLeaves(final String dataspaceName, final String anchorName, final String parentNodeXpath, final String jsonData, final OffsetDateTime observedTimestamp) { CpsValidator.validateNameCharacters(dataspaceName, anchorName); - final var dataNode = buildDataNode(dataspaceName, anchorName, parentNodeXpath, jsonData); + final DataNode dataNode = buildDataNode(dataspaceName, anchorName, parentNodeXpath, jsonData); cpsDataPersistenceService .updateDataLeaves(dataspaceName, anchorName, dataNode.getXpath(), dataNode.getLeaves()); processDataUpdatedEventAsync(dataspaceName, anchorName, observedTimestamp, parentNodeXpath, Operation.UPDATE); @@ -117,8 +117,7 @@ public class CpsDataServiceImpl implements CpsDataService { @Override public String startSession() { - final String sessionId = cpsDataPersistenceService.startSession(); - return sessionId; + return cpsDataPersistenceService.startSession(); } @Override @@ -130,7 +129,7 @@ public class CpsDataServiceImpl implements CpsDataService { public void replaceNodeTree(final String dataspaceName, final String anchorName, final String parentNodeXpath, final String jsonData, final OffsetDateTime observedTimestamp) { CpsValidator.validateNameCharacters(dataspaceName, anchorName); - final var dataNode = buildDataNode(dataspaceName, anchorName, parentNodeXpath, jsonData); + final DataNode dataNode = buildDataNode(dataspaceName, anchorName, parentNodeXpath, jsonData); cpsDataPersistenceService.replaceDataNodeTree(dataspaceName, anchorName, dataNode); processDataUpdatedEventAsync(dataspaceName, anchorName, observedTimestamp, parentNodeXpath, Operation.UPDATE); } @@ -164,7 +163,7 @@ public class CpsDataServiceImpl implements CpsDataService { public void deleteDataNodes(final String dataspaceName, final String anchorName, final OffsetDateTime observedTimestamp) { CpsValidator.validateNameCharacters(dataspaceName, anchorName); - final var anchor = cpsAdminService.getAnchor(dataspaceName, anchorName); + final Anchor anchor = cpsAdminService.getAnchor(dataspaceName, anchorName); cpsDataPersistenceService.deleteDataNodes(dataspaceName, anchorName); processDataUpdatedEventAsync(anchor, ROOT_NODE_XPATH, Operation.DELETE, observedTimestamp); } @@ -180,8 +179,8 @@ public class CpsDataServiceImpl implements CpsDataService { private DataNode buildDataNode(final String dataspaceName, final String anchorName, final String parentNodeXpath, final String jsonData) { - final var anchor = cpsAdminService.getAnchor(dataspaceName, anchorName); - final var schemaContext = getSchemaContext(dataspaceName, anchor.getSchemaSetName()); + final Anchor anchor = cpsAdminService.getAnchor(dataspaceName, anchorName); + final SchemaContext schemaContext = getSchemaContext(dataspaceName, anchor.getSchemaSetName()); if (ROOT_NODE_XPATH.equals(parentNodeXpath)) { final NormalizedNode<?, ?> normalizedNode = YangUtils.parseJsonData(jsonData, schemaContext); @@ -200,8 +199,8 @@ public class CpsDataServiceImpl implements CpsDataService { final String parentNodeXpath, final String jsonData) { - final var anchor = cpsAdminService.getAnchor(dataspaceName, anchorName); - final var schemaContext = getSchemaContext(dataspaceName, anchor.getSchemaSetName()); + final Anchor anchor = cpsAdminService.getAnchor(dataspaceName, anchorName); + final SchemaContext schemaContext = getSchemaContext(dataspaceName, anchor.getSchemaSetName()); final NormalizedNode<?, ?> normalizedNode = YangUtils.parseJsonData(jsonData, schemaContext, parentNodeXpath); final Collection<DataNode> dataNodes = new DataNodeBuilder() @@ -218,7 +217,7 @@ public class CpsDataServiceImpl implements CpsDataService { private void processDataUpdatedEventAsync(final String dataspaceName, final String anchorName, final OffsetDateTime observedTimestamp, final String xpath, final Operation operation) { - final var anchor = cpsAdminService.getAnchor(dataspaceName, anchorName); + final Anchor anchor = cpsAdminService.getAnchor(dataspaceName, anchorName); this.processDataUpdatedEventAsync(anchor, xpath, operation, observedTimestamp); } |