Class ResourceRestService


  • @Component("resourceRestService")
    @Path("resources")
    public class ResourceRestService
    extends OnmsRestService
    Read-only API for retrieving resources.
    Author:
    jwhite
    • Constructor Detail

      • ResourceRestService

        public ResourceRestService()
    • Method Detail

      • getResources

        @GET
        @Produces({"application/xml","application/json","application/atom+xml"})
        @Transactional(readOnly=true)
        public ResourceDTOCollection getResources​(@DefaultValue("1") @QueryParam("depth")
                                                  int depth)
      • getResourceById

        @GET
        @Path("{resourceId}")
        @Produces({"application/xml","application/json","application/atom+xml"})
        @Transactional(readOnly=true)
        public ResourceDTO getResourceById​(@PathParam("resourceId")
                                           String resourceId,
                                           @DefaultValue("-1") @QueryParam("depth")
                                           int depth)
      • deleteResourceById

        @DELETE
        @Path("{resourceId}")
        @Transactional(readOnly=false)
        public void deleteResourceById​(@PathParam("resourceId")
                                       String resourceId)
      • getResourceForNode

        @GET
        @Path("fornode/{nodeCriteria}")
        @Produces({"application/xml","application/json","application/atom+xml"})
        @Transactional(readOnly=true)
        public ResourceDTO getResourceForNode​(@PathParam("nodeCriteria")
                                              String nodeCriteria,
                                              @DefaultValue("-1") @QueryParam("depth")
                                              int depth)
      • select

        @GET
        @Path("select")
        @Produces({"application/xml","application/json","application/atom+xml"})
        @Transactional(readOnly=true)
        public List<ResourceDTO> select​(@DefaultValue("") @QueryParam("nodes")
                                        String nodes,
                                        @DefaultValue("") @QueryParam("filterRules")
                                        String filterRules,
                                        @DefaultValue("") @QueryParam("nodeSubresources")
                                        String nodeSubresources,
                                        @DefaultValue("") @QueryParam("stringProperties")
                                        String stringProperties)
        Selects nodes and parts of there resource information.
        • If no nodeSubresources criteria is given then all subresources are returned but their nested content is not included.
        • If no stringProperties criteria is given then all string properties are included.
        Parameters:
        nodes - Comma separated list of node ids; both, database ids and foreign ids are supported
        filterRules - Comma separated list of rule names for selecting nodes
        nodeSubresources - Comma separated list of subresource names (the part after the dot)
        stringProperties - Comma separated list of property names
        Returns:
      • saveResourcesWithId

        @POST
        @Path("generateId")
        @Consumes("application/json")
        @Produces("application/json")
        public javax.ws.rs.core.Response saveResourcesWithId​(String[] resources)