test_class.declarator: geoServer
test_class.modifier: @Mock
test_class.original_string: @Mock
      GeoServer geoServer;
test_class.type: GeoServer
test_class.var_name: geoServer
test_class.declarator: recent
test_class.modifier: @Mock
test_class.original_string: @Mock
      RecentObjectCache recent;
test_class.type: RecentObjectCache
test_class.var_name: recent
test_class.declarator: ctrl
test_class.modifier: @InjectMocks
test_class.original_string: @InjectMocks
      MapController ctrl;
test_class.type: MapController
test_class.var_name: ctrl
test_class.declarator: mvc
test_class.original_string: MockMvc mvc;
test_class.type: MockMvc
test_class.var_name: mvc
test_class.file: geoserver/webapp/api-composer/src/test/java/com/boundlessgeo/geoserver/api/controllers/MapControllerTest.java
test_class.identifier: MapControllerTest
test_case.body: @Test
      public void testList() throws Exception {
          MockGeoServer.get().catalog()
            .resources()
              .resource("workspaces/foo/layergroups/map1.xml", "layergroup placeholder")
              .resource("workspaces/foo/layergroups/map2.xml", "layergroup placeholder")
            .geoServer()
              .catalog()
            .workspace("foo", "http://scratch.org", true)
              .map("map1")
                .defaults()
                .layer("one").featureType().defaults().map()
                .layer("two").featureType().defaults().map().workspace()
              .map("map2")
                .defaults()
                .layer("three").featureType().defaults().map()
                .layer("four").featureType().defaults()
            .geoServer().build(geoServer);
  
          MvcResult result = mvc.perform(get("/app/api/maps/foo"))
              .andExpect(status().isOk())
              .andExpect(content().contentType(MediaType.APPLICATION_JSON))
              .andReturn();
  
          JSONObj obj = JSONWrapper.read(result.getResponse().getContentAsString()).toObject();
          assertEquals(2, obj.integer("total").intValue());
  
          JSONArr arr = obj.array("maps");
          assertEquals(2,arr.size());
  
          Iterables.find(arr, new Predicate<Object>() {
              @Override
              public boolean apply(@Nullable Object o) {
                  return "map1".equals(JSONWrapper.wrap(o).toObject().str("name"));
              }
          });
          Iterables.find(arr, new Predicate<Object>() {
              @Override
              public boolean apply(@Nullable Object o) {
                  return "map2".equals(JSONWrapper.wrap(o).toObject().str("name"));
              }
          });
      }
test_case.class_method_signature: MapControllerTest.testList()
test_case.full_signature: @Test public void testList()
test_case.identifier: testList
test_case.invocations: build geoServer defaults featureType layer map defaults featureType layer defaults map workspace map defaults featureType layer map defaults featureType layer defaults map workspace catalog geoServer resource resource resources catalog get andReturn andExpect andExpect perform get isOk status contentType content toObject read getContentAsString getResponse assertEquals intValue integer array assertEquals size find equals str toObject wrap find equals str toObject wrap
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testList()
focal_class.declarator: LOG = Logging.getLogger(MapController.class)
focal_class.modifier: static
focal_class.original_string: static Logger LOG = Logging.getLogger(MapController.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: layerController
focal_class.modifier: @Autowired
focal_class.original_string: @Autowired
      LayerController layerController;
focal_class.type: LayerController
focal_class.var_name: layerController
focal_class.file: geoserver/webapp/api-composer/src/main/java/com/boundlessgeo/geoserver/api/controllers/MapController.java
focal_class.identifier: MapController
focal_class.class_method_signature: MapController.MapController(GeoServer geoServer, RecentObjectCache recentCache)
focal_class.full_signature: @Autowired public  MapController(GeoServer geoServer, RecentObjectCache recentCache)
focal_class.identifier: MapController
focal_class.modifiers: @Autowired public
focal_class.parameters: (GeoServer geoServer, RecentObjectCache recentCache)
focal_class.signature:  MapController(GeoServer geoServer, RecentObjectCache recentCache)
focal_class.class_method_signature: MapController.create(@PathVariable String wsName, @RequestBody JSONObj obj, HttpServletRequest req)
focal_class.full_signature: @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) public @ResponseBody JSONObj create(@PathVariable String wsName, @RequestBody JSONObj obj, HttpServletRequest req)
focal_class.identifier: create
focal_class.modifiers: @RequestMapping(value = "/{wsName:.+}", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) public @ResponseBody
focal_class.parameters: (@PathVariable String wsName, @RequestBody JSONObj obj, HttpServletRequest req)
focal_class.return: JSONObj
focal_class.signature: JSONObj create(@PathVariable String wsName, @RequestBody JSONObj obj, HttpServletRequest req)
focal_class.class_method_signature: MapController.updateBounds(ReferencedEnvelope bounds, LayerInfo layer)
focal_class.full_signature:  void updateBounds(ReferencedEnvelope bounds, LayerInfo layer)
focal_class.identifier: updateBounds
focal_class.parameters: (ReferencedEnvelope bounds, LayerInfo layer)
focal_class.return: void
focal_class.signature: void updateBounds(ReferencedEnvelope bounds, LayerInfo layer)
focal_class.class_method_signature: MapController.delete(@PathVariable String wsName, @PathVariable String name)
focal_class.full_signature: @RequestMapping(value = "/{wsName}/{name:.+}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void delete(@PathVariable String wsName, @PathVariable String name)
focal_class.identifier: delete
focal_class.modifiers: @RequestMapping(value = "/{wsName}/{name:.+}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) public
focal_class.parameters: (@PathVariable String wsName, @PathVariable String name)
focal_class.return: void
focal_class.signature: void delete(@PathVariable String wsName, @PathVariable String name)
focal_class.class_method_signature: MapController.get(@PathVariable String wsName,
                                       @PathVariable String name, HttpServletRequest req)
focal_class.full_signature: @RequestMapping(value="/{wsName}/{name:.+}", method = RequestMethod.GET) public @ResponseBody JSONObj get(@PathVariable String wsName,
                                       @PathVariable String name, HttpServletRequest req)
focal_class.identifier: get
focal_class.modifiers: @RequestMapping(value="/{wsName}/{name:.+}", method = RequestMethod.GET) public @ResponseBody
focal_class.parameters: (@PathVariable String wsName,
                                       @PathVariable String name, HttpServletRequest req)
focal_class.return: JSONObj
focal_class.signature: JSONObj get(@PathVariable String wsName,
                                       @PathVariable String name, HttpServletRequest req)
focal_class.class_method_signature: MapController.patch(@PathVariable String wsName,
                                         @PathVariable String name,
                                         @RequestBody JSONObj obj,HttpServletRequest req)
focal_class.full_signature: @RequestMapping(value = "/{wsName}/{name:.+}", method = RequestMethod.PATCH) public @ResponseBody JSONObj patch(@PathVariable String wsName,
                                         @PathVariable String name,
                                         @RequestBody JSONObj obj,HttpServletRequest req)
focal_class.identifier: patch
focal_class.modifiers: @RequestMapping(value = "/{wsName}/{name:.+}", method = RequestMethod.PATCH) public @ResponseBody
focal_class.parameters: (@PathVariable String wsName,
                                         @PathVariable String name,
                                         @RequestBody JSONObj obj,HttpServletRequest req)
focal_class.return: JSONObj
focal_class.signature: JSONObj patch(@PathVariable String wsName,
                                         @PathVariable String name,
                                         @RequestBody JSONObj obj,HttpServletRequest req)
focal_class.class_method_signature: MapController.put(@PathVariable String wsName,
                                       @PathVariable String name, 
                                       @RequestBody JSONObj obj,
                                       HttpServletRequest req)
focal_class.full_signature: @RequestMapping(value = "/{wsName}/{name:.+}", method = RequestMethod.PUT) public @ResponseBody JSONObj put(@PathVariable String wsName,
                                       @PathVariable String name, 
                                       @RequestBody JSONObj obj,
                                       HttpServletRequest req)
focal_class.identifier: put
focal_class.modifiers: @RequestMapping(value = "/{wsName}/{name:.+}", method = RequestMethod.PUT) public @ResponseBody
focal_class.parameters: (@PathVariable String wsName,
                                       @PathVariable String name, 
                                       @RequestBody JSONObj obj,
                                       HttpServletRequest req)
focal_class.return: JSONObj
focal_class.signature: JSONObj put(@PathVariable String wsName,
                                       @PathVariable String name, 
                                       @RequestBody JSONObj obj,
                                       HttpServletRequest req)
focal_class.class_method_signature: MapController.bounds(@PathVariable String wsName,
                                       @PathVariable String name, 
                                       @RequestBody JSONObj obj,
                                       HttpServletRequest req)
focal_class.full_signature: @RequestMapping(value = "/{wsName}/{name:.+}/bounds", method = RequestMethod.PUT) public @ResponseBody JSONObj bounds(@PathVariable String wsName,
                                       @PathVariable String name, 
                                       @RequestBody JSONObj obj,
                                       HttpServletRequest req)
focal_class.identifier: bounds
focal_class.modifiers: @RequestMapping(value = "/{wsName}/{name:.+}/bounds", method = RequestMethod.PUT) public @ResponseBody
focal_class.parameters: (@PathVariable String wsName,
                                       @PathVariable String name, 
                                       @RequestBody JSONObj obj,
                                       HttpServletRequest req)
focal_class.return: JSONObj
focal_class.signature: JSONObj bounds(@PathVariable String wsName,
                                       @PathVariable String name, 
                                       @RequestBody JSONObj obj,
                                       HttpServletRequest req)
focal_class.class_method_signature: MapController.copy(@PathVariable String wsName,
                                       @PathVariable String name, 
                                       @RequestBody JSONObj obj,
                                       HttpServletRequest req)
focal_class.full_signature: @RequestMapping(value = "/{wsName}/{name}/copy", method = RequestMethod.PUT) public @ResponseBody JSONObj copy(@PathVariable String wsName,
                                       @PathVariable String name, 
                                       @RequestBody JSONObj obj,
                                       HttpServletRequest req)
focal_class.identifier: copy
focal_class.modifiers: @RequestMapping(value = "/{wsName}/{name}/copy", method = RequestMethod.PUT) public @ResponseBody
focal_class.parameters: (@PathVariable String wsName,
                                       @PathVariable String name, 
                                       @RequestBody JSONObj obj,
                                       HttpServletRequest req)
focal_class.return: JSONObj
focal_class.signature: JSONObj copy(@PathVariable String wsName,
                                       @PathVariable String name, 
                                       @RequestBody JSONObj obj,
                                       HttpServletRequest req)
focal_class.class_method_signature: MapController.list(@PathVariable String wsName,
        @RequestParam(value="page", required=false) Integer page,
        @RequestParam(value="count", required=false, defaultValue=""+DEFAULT_PAGESIZE) Integer count,
        @RequestParam(value="sort", required=false) String sort,
        @RequestParam(value="filter", required=false) String textFilter)
focal_class.full_signature: @RequestMapping(value="/{wsName:.+}", method = RequestMethod.GET) public @ResponseBody JSONObj list(@PathVariable String wsName,
        @RequestParam(value="page", required=false) Integer page,
        @RequestParam(value="count", required=false, defaultValue=""+DEFAULT_PAGESIZE) Integer count,
        @RequestParam(value="sort", required=false) String sort,
        @RequestParam(value="filter", required=false) String textFilter)
focal_class.identifier: list
focal_class.modifiers: @RequestMapping(value="/{wsName:.+}", method = RequestMethod.GET) public @ResponseBody
focal_class.parameters: (@PathVariable String wsName,
        @RequestParam(value="page", required=false) Integer page,
        @RequestParam(value="count", required=false, defaultValue=""+DEFAULT_PAGESIZE) Integer count,
        @RequestParam(value="sort", required=false) String sort,
        @RequestParam(value="filter", required=false) String textFilter)
focal_class.return: JSONObj
focal_class.signature: JSONObj list(@PathVariable String wsName,
        @RequestParam(value="page", required=false) Integer page,
        @RequestParam(value="count", required=false, defaultValue=""+DEFAULT_PAGESIZE) Integer count,
        @RequestParam(value="sort", required=false) String sort,
        @RequestParam(value="filter", required=false) String textFilter)
focal_class.class_method_signature: MapController.mapLayerList(LayerGroupInfo map, HttpServletRequest req)
focal_class.full_signature: private JSONArr mapLayerList(LayerGroupInfo map, HttpServletRequest req)
focal_class.identifier: mapLayerList
focal_class.modifiers: private
focal_class.parameters: (LayerGroupInfo map, HttpServletRequest req)
focal_class.return: JSONArr
focal_class.signature: JSONArr mapLayerList(LayerGroupInfo map, HttpServletRequest req)
focal_class.class_method_signature: MapController.mapLayerListGet(@PathVariable String wsName,
                              @PathVariable String name, HttpServletRequest req)
focal_class.full_signature: @RequestMapping(value="/{wsName}/{name}/layers", method = RequestMethod.GET) public @ResponseBody JSONArr mapLayerListGet(@PathVariable String wsName,
                              @PathVariable String name, HttpServletRequest req)
focal_class.identifier: mapLayerListGet
focal_class.modifiers: @RequestMapping(value="/{wsName}/{name}/layers", method = RequestMethod.GET) public @ResponseBody
focal_class.parameters: (@PathVariable String wsName,
                              @PathVariable String name, HttpServletRequest req)
focal_class.return: JSONArr
focal_class.signature: JSONArr mapLayerListGet(@PathVariable String wsName,
                              @PathVariable String name, HttpServletRequest req)
focal_class.class_method_signature: MapController.mapLayerListPut(@PathVariable String wsName,
                                                   @PathVariable String name,
                                                   @RequestBody JSONArr layers, HttpServletRequest req)
focal_class.full_signature: @RequestMapping(value="/{wsName}/{name}/layers", method = RequestMethod.PUT) public @ResponseBody JSONArr mapLayerListPut(@PathVariable String wsName,
                                                   @PathVariable String name,
                                                   @RequestBody JSONArr layers, HttpServletRequest req)
focal_class.identifier: mapLayerListPut
focal_class.modifiers: @RequestMapping(value="/{wsName}/{name}/layers", method = RequestMethod.PUT) public @ResponseBody
focal_class.parameters: (@PathVariable String wsName,
                                                   @PathVariable String name,
                                                   @RequestBody JSONArr layers, HttpServletRequest req)
focal_class.return: JSONArr
focal_class.signature: JSONArr mapLayerListPut(@PathVariable String wsName,
                                                   @PathVariable String name,
                                                   @RequestBody JSONArr layers, HttpServletRequest req)
focal_class.class_method_signature: MapController.mapLayerListPost(@PathVariable String wsName,
                                                    @PathVariable String name,
                                                    @RequestBody JSONArr layers, HttpServletRequest req)
focal_class.full_signature: @RequestMapping(value="/{wsName}/{name}/layers", method = RequestMethod.POST) public @ResponseBody JSONArr mapLayerListPost(@PathVariable String wsName,
                                                    @PathVariable String name,
                                                    @RequestBody JSONArr layers, HttpServletRequest req)
focal_class.identifier: mapLayerListPost
focal_class.modifiers: @RequestMapping(value="/{wsName}/{name}/layers", method = RequestMethod.POST) public @ResponseBody
focal_class.parameters: (@PathVariable String wsName,
                                                    @PathVariable String name,
                                                    @RequestBody JSONArr layers, HttpServletRequest req)
focal_class.return: JSONArr
focal_class.signature: JSONArr mapLayerListPost(@PathVariable String wsName,
                                                    @PathVariable String name,
                                                    @RequestBody JSONArr layers, HttpServletRequest req)
focal_class.class_method_signature: MapController.mapLayerGet(@PathVariable String wsName,
                                               @PathVariable String mpName,
                                               @PathVariable String name, HttpServletRequest req)
focal_class.full_signature: @RequestMapping(value="/{wsName}/{mpName}/layers/{name:.+}", method = RequestMethod.GET) public @ResponseBody JSONObj mapLayerGet(@PathVariable String wsName,
                                               @PathVariable String mpName,
                                               @PathVariable String name, HttpServletRequest req)
focal_class.identifier: mapLayerGet
focal_class.modifiers: @RequestMapping(value="/{wsName}/{mpName}/layers/{name:.+}", method = RequestMethod.GET) public @ResponseBody
focal_class.parameters: (@PathVariable String wsName,
                                               @PathVariable String mpName,
                                               @PathVariable String name, HttpServletRequest req)
focal_class.return: JSONObj
focal_class.signature: JSONObj mapLayerGet(@PathVariable String wsName,
                                               @PathVariable String mpName,
                                               @PathVariable String name, HttpServletRequest req)
focal_class.class_method_signature: MapController.listRecentMaps()
focal_class.full_signature: @RequestMapping(value="/recent", method = RequestMethod.GET) public @ResponseBody JSONArr listRecentMaps()
focal_class.identifier: listRecentMaps
focal_class.modifiers: @RequestMapping(value="/recent", method = RequestMethod.GET) public @ResponseBody
focal_class.parameters: ()
focal_class.return: JSONArr
focal_class.signature: JSONArr listRecentMaps()
focal_class.class_method_signature: MapController.mapLayerDelete(@PathVariable String wsName,
                                                  @PathVariable String mapName,
                                                  @PathVariable String name, HttpServletRequest req)
focal_class.full_signature: @RequestMapping(value="/{wsName}/{mapName}/layers/{name:.+}", method = RequestMethod.DELETE) public @ResponseBody JSONObj mapLayerDelete(@PathVariable String wsName,
                                                  @PathVariable String mapName,
                                                  @PathVariable String name, HttpServletRequest req)
focal_class.identifier: mapLayerDelete
focal_class.modifiers: @RequestMapping(value="/{wsName}/{mapName}/layers/{name:.+}", method = RequestMethod.DELETE) public @ResponseBody
focal_class.parameters: (@PathVariable String wsName,
                                                  @PathVariable String mapName,
                                                  @PathVariable String name, HttpServletRequest req)
focal_class.return: JSONObj
focal_class.signature: JSONObj mapLayerDelete(@PathVariable String wsName,
                                                  @PathVariable String mapName,
                                                  @PathVariable String name, HttpServletRequest req)
focal_class.class_method_signature: MapController.checkMap(LayerGroupInfo map)
focal_class.full_signature: private boolean checkMap(LayerGroupInfo map)
focal_class.identifier: checkMap
focal_class.modifiers: private
focal_class.parameters: (LayerGroupInfo map)
focal_class.return: boolean
focal_class.signature: boolean checkMap(LayerGroupInfo map)
focal_class.class_method_signature: MapController.map(JSONObj obj, LayerGroupInfo map, String wsName)
focal_class.full_signature:  JSONObj map(JSONObj obj, LayerGroupInfo map, String wsName)
focal_class.identifier: map
focal_class.parameters: (JSONObj obj, LayerGroupInfo map, String wsName)
focal_class.return: JSONObj
focal_class.signature: JSONObj map(JSONObj obj, LayerGroupInfo map, String wsName)
focal_class.class_method_signature: MapController.mapDetails(JSONObj obj, LayerGroupInfo map, String wsName, HttpServletRequest req)
focal_class.full_signature:  JSONObj mapDetails(JSONObj obj, LayerGroupInfo map, String wsName, HttpServletRequest req)
focal_class.identifier: mapDetails
focal_class.parameters: (JSONObj obj, LayerGroupInfo map, String wsName, HttpServletRequest req)
focal_class.return: JSONObj
focal_class.signature: JSONObj mapDetails(JSONObj obj, LayerGroupInfo map, String wsName, HttpServletRequest req)
focal_class.class_method_signature: MapController.layer(JSONObj obj, PublishedInfo l, HttpServletRequest req)
focal_class.full_signature: private JSONObj layer(JSONObj obj, PublishedInfo l, HttpServletRequest req)
focal_class.identifier: layer
focal_class.modifiers: private
focal_class.parameters: (JSONObj obj, PublishedInfo l, HttpServletRequest req)
focal_class.return: JSONObj
focal_class.signature: JSONObj layer(JSONObj obj, PublishedInfo l, HttpServletRequest req)
focal_class.class_method_signature: MapController.findMapLayer( LayerGroupInfo map, String name )
focal_class.full_signature: private PublishedInfo findMapLayer( LayerGroupInfo map, String name )
focal_class.identifier: findMapLayer
focal_class.modifiers: private
focal_class.parameters: ( LayerGroupInfo map, String name )
focal_class.return: PublishedInfo
focal_class.signature: PublishedInfo findMapLayer( LayerGroupInfo map, String name )
focal_class.superclass: extends ApiController
focal_method.body: @RequestMapping(value="/{wsName:.+}", method = RequestMethod.GET)
      public @ResponseBody JSONObj list(@PathVariable String wsName,
        @RequestParam(value="page", required=false) Integer page,
        @RequestParam(value="count", required=false, defaultValue=""+DEFAULT_PAGESIZE) Integer count,
        @RequestParam(value="sort", required=false) String sort,
        @RequestParam(value="filter", required=false) String textFilter) {
  
          Catalog cat = geoServer.getCatalog();
  
          if ("default".equals(wsName)) {
              WorkspaceInfo def = cat.getDefaultWorkspace();
              if (def != null) {
                  wsName = def.getName();
              }
          }
  
          Filter filter = equal("workspace.name", wsName);
          if (textFilter != null) {
              filter = Predicates.and(filter, Predicates.fullTextSearch(textFilter));
          }
  
          SortBy sortBy = parseSort(sort);
  
          Integer total = cat.count(LayerGroupInfo.class, filter);
          
          JSONObj obj = new JSONObj();
          
          JSONArr arr = obj.putArray("maps");
          try (
              CloseableIterator<LayerGroupInfo> it =
                  cat.list(LayerGroupInfo.class, filter, offset(page, count), count, sortBy);
          ) {
              while (it.hasNext()) {
                  LayerGroupInfo map = it.next();
                  if( checkMap( map ) ){
                      map(arr.addObject(), map, wsName);
                  } else {
                      //If a layer group is not shown, also remove it from the total count
                      total--;
                  }
              }
          }
          obj.put("total", total);
          obj.put("page", page != null ? page : 0);
          obj.put("count", Math.min(total, count != null ? count : total));
          return obj;
      }
focal_method.class_method_signature: MapController.list(@PathVariable String wsName,
        @RequestParam(value="page", required=false) Integer page,
        @RequestParam(value="count", required=false, defaultValue=""+DEFAULT_PAGESIZE) Integer count,
        @RequestParam(value="sort", required=false) String sort,
        @RequestParam(value="filter", required=false) String textFilter)
focal_method.full_signature: @RequestMapping(value="/{wsName:.+}", method = RequestMethod.GET) public @ResponseBody JSONObj list(@PathVariable String wsName,
        @RequestParam(value="page", required=false) Integer page,
        @RequestParam(value="count", required=false, defaultValue=""+DEFAULT_PAGESIZE) Integer count,
        @RequestParam(value="sort", required=false) String sort,
        @RequestParam(value="filter", required=false) String textFilter)
focal_method.identifier: list
focal_method.invocations: getCatalog equals getDefaultWorkspace getName equal and fullTextSearch parseSort count putArray list offset hasNext next checkMap map addObject put put put min
focal_method.modifiers: @RequestMapping(value="/{wsName:.+}", method = RequestMethod.GET) public @ResponseBody
focal_method.parameters: (@PathVariable String wsName,
        @RequestParam(value="page", required=false) Integer page,
        @RequestParam(value="count", required=false, defaultValue=""+DEFAULT_PAGESIZE) Integer count,
        @RequestParam(value="sort", required=false) String sort,
        @RequestParam(value="filter", required=false) String textFilter)
focal_method.return: JSONObj
focal_method.signature: JSONObj list(@PathVariable String wsName,
        @RequestParam(value="page", required=false) Integer page,
        @RequestParam(value="count", required=false, defaultValue=""+DEFAULT_PAGESIZE) Integer count,
        @RequestParam(value="sort", required=false) String sort,
        @RequestParam(value="filter", required=false) String textFilter)