Revise controller error handling
[portal/ric-dashboard.git] / webapp-backend / src / main / java / org / oransc / ric / portal / dashboard / controller / AnrXappController.java
index 55b4212..ae6845b 100644 (file)
@@ -50,8 +50,13 @@ import org.springframework.web.bind.annotation.RestController;
 import io.swagger.annotations.ApiOperation;
 
 /**
- * Provides methods to contact the ANR xApp which manages a Neighbor Cell
- * Relation Table (NCRT).
+ * Proxies calls from the front end to the ANR xApp, which manages a Neighbor
+ * Cell Relation Table (NCRT).
+ * 
+ * If a method throws RestClientResponseException, it is handled by
+ * {@link CustomResponseEntityExceptionHandler#handleProxyMethodException(Exception, org.springframework.web.context.request.WebRequest)}
+ * which returns status 502. All other exceptions are handled by Spring which
+ * returns status 500.
  */
 @Configuration
 @RestController
@@ -72,10 +77,6 @@ public class AnrXappController {
        // Path parameters
        public static final String PP_SERVING = "servingcells";
        public static final String PP_NEIGHBOR = "neighborcells";
-       // Query parameters
-       public static final String QP_NODEB = "ggnodeb";
-       public static final String QP_SERVING = "servingCellNrcgi";
-       public static final String QP_NEIGHBOR = "neighborCellNrpci";
 
        // Populated by the autowired constructor
        private final HealthApi healthApi;
@@ -129,12 +130,12 @@ public class AnrXappController {
        @GetMapping(NCRT_METHOD)
        @Secured({ DashboardConstants.ROLE_ADMIN, DashboardConstants.ROLE_STANDARD })
        public NeighborCellRelationTable getNcrt( //
-                       @RequestParam(name = QP_NODEB, required = false) String ggnbId, //
-                       @RequestParam(name = QP_SERVING, required = false) String servingCellNrcgi, //
-                       @RequestParam(name = QP_NEIGHBOR, required = false) String neighborCellNrpci) {
-               logger.debug("getNcrt: ggnbid {}, servingCellNrpci {}, neighborCellNrcgi {}", ggnbId, servingCellNrcgi,
+                       @RequestParam(required = false) String ggnodeb, //
+                       @RequestParam(required = false) String servingCellNrcgi, //
+                       @RequestParam(required = false) String neighborCellNrpci) {
+               logger.debug("getNcrt: ggnbid {}, servingCellNrpci {}, neighborCellNrcgi {}", ggnodeb, servingCellNrcgi,
                                neighborCellNrpci);
-               return ncrtApi.getNcrt(ggnbId, servingCellNrcgi, neighborCellNrpci);
+               return ncrtApi.getNcrt(ggnodeb, servingCellNrcgi, neighborCellNrpci);
        }
 
        // /ncrt/servingcells/{servCellNrcgi}/neighborcells/{neighCellNrpci} :