diff options
author | Niranjana <niranjana.y60@wipro.com> | 2021-03-22 11:39:08 +0000 |
---|---|---|
committer | Niranjana <niranjana.y60@wipro.com> | 2021-03-24 11:31:03 +0000 |
commit | 9764b6bb545a8edd4979c481627c38c1892f207e (patch) | |
tree | c6b6133144fa7812710f76ced95bbcb243bb9446 /ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimRepositoryService.java | |
parent | 43e39ceab8e35a0a54ae72252b46491f362a0749 (diff) |
Update schema and format java files
Issue-ID: INT-1892
Signed-off-by: Niranjana <niranjana.y60@wipro.com>
Change-Id: Ib35c35cf7ac7a858311618e741c9327d7630aed6
Diffstat (limited to 'ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimRepositoryService.java')
-rw-r--r-- | ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimRepositoryService.java | 409 |
1 files changed, 213 insertions, 196 deletions
diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimRepositoryService.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimRepositoryService.java index e51af6f..ecc76b3 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimRepositoryService.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimRepositoryService.java @@ -23,6 +23,7 @@ package org.onap.ransim.rest.api.services; import java.util.ArrayList; import java.util.List; import java.util.Optional; + import org.apache.log4j.Logger; import org.onap.ransim.rest.api.models.CellDetails; import org.onap.ransim.rest.api.models.CellNeighbor; @@ -40,225 +41,241 @@ import org.springframework.stereotype.Service; @Service public class RansimRepositoryService { - static Logger log = Logger.getLogger(RansimRepositoryService.class.getName()); + static Logger log = Logger.getLogger(RansimRepositoryService.class.getName()); - @Autowired - CellDetailsRepo cellDetailsRepo; + @Autowired + CellDetailsRepo cellDetailsRepo; - @Autowired - NetconfServersRepo netconfServersRepo; + @Autowired + NetconfServersRepo netconfServersRepo; - @Autowired - CellNeighborRepo cellNeighborRepo; + @Autowired + CellNeighborRepo cellNeighborRepo; - @Autowired - NeighborDetailsRepo neighborDetailsRepo; + @Autowired + NeighborDetailsRepo neighborDetailsRepo; - @Autowired - OperationLogRepo operationLogRepo; + @Autowired + OperationLogRepo operationLogRepo; - /** - * Method to retrieve cell details - * @param nodeId - * @return - */ - public CellDetails getCellDetail(String nodeId) { - Optional<CellDetails> cd = cellDetailsRepo.findById(nodeId); - CellDetails cellDetails = null; - if (cd.isPresent()) { - cellDetails = cd.get(); - } - return cellDetails; - } + /** + * Method to retrieve cell details + * + * @param nodeId + * @return + */ + public CellDetails getCellDetail(String nodeId) { + Optional<CellDetails> cd = cellDetailsRepo.findById(nodeId); + CellDetails cellDetails = null; + if (cd.isPresent()) { + cellDetails = cd.get(); + } + return cellDetails; + } - /** - * Method to retrieve netconf server details - * @param serverId - * @return - */ - public NetconfServers getNetconfServer(String serverId) { - Optional<NetconfServers> serverDetails = netconfServersRepo.findById(serverId); - NetconfServers server = null; - if (serverDetails.isPresent()) { - server = serverDetails.get(); - } - return server; - } + /** + * Method to retrieve netconf server details + * + * @param serverId + * @return + */ + public NetconfServers getNetconfServer(String serverId) { + Optional<NetconfServers> serverDetails = netconfServersRepo.findById(serverId); + NetconfServers server = null; + if (serverDetails.isPresent()) { + server = serverDetails.get(); + } + return server; + } - /** - * Method to retrieve cell neighbors - * @param nodeId - * @return - */ - public CellNeighbor getCellNeighbor(String nodeId) { - Optional<CellNeighbor> cellNeighborDetails = cellNeighborRepo.findById(nodeId); - CellNeighbor cellNeighbor = null; - if (cellNeighborDetails.isPresent()) { - cellNeighbor = cellNeighborDetails.get(); - } - return cellNeighbor; - } + /** + * Method to retrieve cell neighbors + * + * @param nodeId + * @return + */ + public CellNeighbor getCellNeighbor(String nodeId) { + Optional<CellNeighbor> cellNeighborDetails = cellNeighborRepo.findById(nodeId); + CellNeighbor cellNeighbor = null; + if (cellNeighborDetails.isPresent()) { + cellNeighbor = cellNeighborDetails.get(); + } + return cellNeighbor; + } - /** - * Method to retrieve all cell details - * @return - */ - public List<CellDetails> getCellDetailsList() { - Iterable<CellDetails> cellsList = cellDetailsRepo.findAll(); - if (cellsList != null) { - return (List<CellDetails>) cellsList; - } else { - return new ArrayList<>(); - } - } + /** + * Method to retrieve all cell details + * + * @return + */ + public List<CellDetails> getCellDetailsList() { + Iterable<CellDetails> cellsList = cellDetailsRepo.findAll(); + if (cellsList != null) { + return (List<CellDetails>) cellsList; + } else { + return new ArrayList<>(); + } + } - /** - * Method to retrieve cells with no server ids - * @return - */ - public List<CellDetails> getCellsWithNoServerIds() { - List<CellDetails> cellsList = cellDetailsRepo.findCellsWithNoServerId(); - if (cellsList != null) { - return cellsList; - } else { - return new ArrayList<>(); - } - } + /** + * Method to retrieve cells with no server ids + * + * @return + */ + public List<CellDetails> getCellsWithNoServerIds() { + List<CellDetails> cellsList = cellDetailsRepo.findCellsWithNoServerId(); + if (cellsList != null) { + return cellsList; + } else { + return new ArrayList<>(); + } + } - /** - * Method to retrieve cell with collision or confusion - * @return - */ - public List<CellDetails> getCellsWithCollisionOrConfusion() { - List<CellDetails> cellsList = cellDetailsRepo.getCellsWithCollisionOrConfusion(); - if (cellsList != null) { - return cellsList; - } else { - return new ArrayList<>(); - } - } + /** + * Method to retrieve cell with collision or confusion + * + * @return + */ + public List<CellDetails> getCellsWithCollisionOrConfusion() { + List<CellDetails> cellsList = cellDetailsRepo.getCellsWithCollisionOrConfusion(); + if (cellsList != null) { + return cellsList; + } else { + return new ArrayList<>(); + } + } - /** - * Method to retrieve operation log - * @return - */ - public List<OperationLog> getOperationLogList() { - Iterable<OperationLog> opLogList = operationLogRepo.findAll(); - if (opLogList != null) { - return (List<OperationLog>) opLogList; - } else { - return new ArrayList<>(); - } - } + /** + * Method to retrieve operation log + * + * @return + */ + public List<OperationLog> getOperationLogList() { + Iterable<OperationLog> opLogList = operationLogRepo.findAll(); + if (opLogList != null) { + return (List<OperationLog>) opLogList; + } else { + return new ArrayList<>(); + } + } - /** - * Method to retrieve all netconf servers - * @return - */ - public List<NetconfServers> getNetconfServersList() { - Iterable<NetconfServers> serversList = netconfServersRepo.findAll(); - if (serversList != null) { - return (List<NetconfServers>) serversList; - } else { - return new ArrayList<>(); - } - } + /** + * Method to retrieve all netconf servers + * + * @return + */ + public List<NetconfServers> getNetconfServersList() { + Iterable<NetconfServers> serversList = netconfServersRepo.findAll(); + if (serversList != null) { + return (List<NetconfServers>) serversList; + } else { + return new ArrayList<>(); + } + } - /** - * Method to retrieve all cell neighbors - * @return - */ - public List<CellNeighbor> getCellNeighborList() { - Iterable<CellNeighbor> cellNeighborList = cellNeighborRepo.findAll(); - if (cellNeighborList != null) { - return (List<CellNeighbor>) cellNeighborList; - } else { - return new ArrayList<>(); - } - } + /** + * Method to retrieve all cell neighbors + * + * @return + */ + public List<CellNeighbor> getCellNeighborList() { + Iterable<CellNeighbor> cellNeighborList = cellNeighborRepo.findAll(); + if (cellNeighborList != null) { + return (List<CellNeighbor>) cellNeighborList; + } else { + return new ArrayList<>(); + } + } - /** - * Method to delete specific cells - * @param deleteCelldetail - */ - public void deleteCellDetails(CellDetails deleteCelldetail) { + /** + * Method to delete specific cells + * + * @param deleteCelldetail + */ + public void deleteCellDetails(CellDetails deleteCelldetail) { - if (deleteCelldetail.getServerId() != null) { - NetconfServers ns = getNetconfServer(deleteCelldetail.getServerId()); - if (ns != null) { - ns.getCells().remove(deleteCelldetail); - netconfServersRepo.save(ns); - } - } - cellDetailsRepo.deleteById(deleteCelldetail.getNodeId()); - } + if (deleteCelldetail.getServerId() != null) { + NetconfServers ns = getNetconfServer(deleteCelldetail.getServerId()); + if (ns != null) { + ns.getCells().remove(deleteCelldetail); + netconfServersRepo.save(ns); + } + } + cellDetailsRepo.deleteById(deleteCelldetail.getNodeId()); + } - /** - * Method to delete cell neighbors - * @param deleteCellNeighbor - */ - public void deleteCellNeighbor(CellNeighbor deleteCellNeighbor) { - cellNeighborRepo.deleteById(deleteCellNeighbor.getNodeId()); - } + /** + * Method to delete cell neighbors + * + * @param deleteCellNeighbor + */ + public void deleteCellNeighbor(CellNeighbor deleteCellNeighbor) { + cellNeighborRepo.deleteById(deleteCellNeighbor.getNodeId()); + } - /** - * Method to delete all netconf servers - */ - public void deleteNetconfServers() { - netconfServersRepo.deleteAll(); - } + /** + * Method to delete all netconf servers + */ + public void deleteNetconfServers() { + netconfServersRepo.deleteAll(); + } - /** - * Method to delete all cell neighbors - */ - public void deleteCellNeighbors() { - cellNeighborRepo.deleteAll(); - } + /** + * Method to delete all cell neighbors + */ + public void deleteCellNeighbors() { + cellNeighborRepo.deleteAll(); + } - /** - * Method to delete all cells - */ - public void deleteAllCellDetails() { - cellDetailsRepo.deleteAll(); - } + /** + * Method to delete all cells + */ + public void deleteAllCellDetails() { + cellDetailsRepo.deleteAll(); + } - /** - * Method to save cells - * @param cellDetail - */ - public void mergeCellDetails(CellDetails cellDetail) { - cellDetailsRepo.save(cellDetail); - } + /** + * Method to save cells + * + * @param cellDetail + */ + public void mergeCellDetails(CellDetails cellDetail) { + cellDetailsRepo.save(cellDetail); + } - /** - * Method to save neighbors - * @param neighborDetails - */ - public void mergeNeighborDetails(NeighborDetails neighborDetails) { - neighborDetailsRepo.save(neighborDetails); - } + /** + * Method to save neighbors + * + * @param neighborDetails + */ + public void mergeNeighborDetails(NeighborDetails neighborDetails) { + neighborDetailsRepo.save(neighborDetails); + } - /** - * Method to save netconf servers - * @param netconfServers - */ - public void mergeNetconfServers(NetconfServers netconfServers) { - netconfServersRepo.save(netconfServers); - } + /** + * Method to save netconf servers + * + * @param netconfServers + */ + public void mergeNetconfServers(NetconfServers netconfServers) { + netconfServersRepo.save(netconfServers); + } - /** - * Method to save cell neighbors - * @param cellNeighbor - */ - public void mergeCellNeighbor(CellNeighbor cellNeighbor) { - cellNeighborRepo.save(cellNeighbor); - } + /** + * Method to save cell neighbors + * + * @param cellNeighbor + */ + public void mergeCellNeighbor(CellNeighbor cellNeighbor) { + cellNeighborRepo.save(cellNeighbor); + } - /** - * Method to save operation log - * @param opLog - */ - public void mergeOperationLog(OperationLog opLog) { - operationLogRepo.save(opLog); - } + /** + * Method to save operation log + * + * @param opLog + */ + public void mergeOperationLog(OperationLog opLog) { + operationLogRepo.save(opLog); + } } |