Class LayoutRestController

  • All Implemented Interfaces:
    LayoutRestOpenApi

    @RestController
    @RequestMapping("/v2.1.1/layout-editor/")
    public class LayoutRestController
    extends Object
    implements LayoutRestOpenApi
    Layout Editor Rest Controller.
    Author:
    Mauricio Ruiz Beltrán <mauricio.ruiz@kuwaiba.org>
    • Constructor Detail

      • LayoutRestController

        public LayoutRestController()
    • Method Detail

      • createListTypeItemRelatedLayout

        @RequestMapping(method=POST,
                        value="createListTypeItemRelatedLayout/{listTypeItemId}/{listTypeItemClassName}/{viewClassName}/{name}/{description}/{structure}/{background}/{sessionId}",
                        produces="application/json")
        public long createListTypeItemRelatedLayout​(@PathVariable("listTypeItemId")
                                                    String listTypeItemId,
                                                    @PathVariable("listTypeItemClassName")
                                                    String listTypeItemClassName,
                                                    @PathVariable("viewClassName")
                                                    String viewClassName,
                                                    @PathVariable("name")
                                                    String name,
                                                    @PathVariable("description")
                                                    String description,
                                                    @PathVariable("structure")
                                                    String structure,
                                                    @PathVariable("background")
                                                    String background,
                                                    @PathVariable("sessionId")
                                                    String sessionId)
        Creates a view for a given list type item. If there's already a view of the provided view type, it will be overwritten.
        Specified by:
        createListTypeItemRelatedLayout in interface LayoutRestOpenApi
        Parameters:
        listTypeItemId - List type item id.
        listTypeItemClassName - List type item class name.
        viewClassName - View class name.
        name - View name.
        description - View description.
        structure - The structure of the view as string Base64,from an XML document with the view structure
         
          <view version="">
              <layout name="" x="" y="" width="" height="" type="">
                  <shape type="" x="" y="" height="" width="" opaque=""
                         isEquipment="" name="" id="" className="" color="" borderColor="">
                  </shape> 
                  <shape ... >
                  </shape>
                  <shape ... >
                  </shape>
                  .
                  .
                  .
              </layout>
          </view>
         
         
        background - The background image as string Base64. If any, "null" otherwise.
        sessionId - The session token id.
        Returns:
        The id of the new view.
      • getLayouts

        @RequestMapping(method=GET,
                        value="getLayouts/{limit}/{sessionId}",
                        produces="application/json")
        public List<ViewObjectLight> getLayouts​(@PathVariable("limit")
                                                int limit,
                                                @PathVariable("sessionId")
                                                String sessionId)
        Allows to retrieve a list of all existent layout views.
        Specified by:
        getLayouts in interface LayoutRestOpenApi
        Parameters:
        limit - The limit of results. -1 for all.
        sessionId - The session token id.
        Returns:
        The list of views.
      • getLayout

        @RequestMapping(method=GET,
                        value="getLayout/{viewId}/{sessionId}",
                        produces="application/json")
        public ViewObject getLayout​(@PathVariable("viewId")
                                    long viewId,
                                    @PathVariable("sessionId")
                                    String sessionId)
        Returns a layout view with the given id.
        Specified by:
        getLayout in interface LayoutRestOpenApi
        Parameters:
        viewId - View id.
        sessionId - The session token id.
        Returns:
        An object representing the view.
      • getListTypeItemForLayout

        @RequestMapping(method=GET,
                        value="getListTypeItemForLayout/{viewId}/{sessionId}",
                        produces="application/json")
        public BusinessObjectLight getListTypeItemForLayout​(@PathVariable("viewId")
                                                            long viewId,
                                                            @PathVariable("sessionId")
                                                            String sessionId)
        Returns the list type item related with the given view.
        Specified by:
        getListTypeItemForLayout in interface LayoutRestOpenApi
        Parameters:
        viewId - View id.
        sessionId - The session token id.
        Returns:
        An object representing the list type item.
      • createLayout

        @RequestMapping(method=POST,
                        value="createLayout/{viewClassName}/{name}/{description}/{structure}/{background}/{sessionId}",
                        produces="application/json")
        public long createLayout​(@PathVariable("viewClassName")
                                 String viewClassName,
                                 @PathVariable("name")
                                 String name,
                                 @PathVariable("description")
                                 String description,
                                 @PathVariable("structure")
                                 String structure,
                                 @PathVariable("background")
                                 String background,
                                 @PathVariable("sessionId")
                                 String sessionId)
        Creates a new layout view.Creates a new Layout view with the given data.
        Specified by:
        createLayout in interface LayoutRestOpenApi
        Parameters:
        viewClassName - View class name. If any, "null" otherwise.
        name - View name.
        description - View description.
        structure - The structure of the view as string Base64,from an XML document with the view structure
         
          <view version="">
              <layout name="" x="" y="" width="" height="" type="">
                  <shape type="" x="" y="" height="" width="" opaque=""
                         isEquipment="" name="" id="" className="" color="" borderColor="">
                  </shape> 
                  <shape ... >
                  </shape>
                  <shape ... >
                  </shape>
                  .
                  .
                  .
              </layout>
          </view>
         
         
        background - The background image as string Base64. If any, "null" otherwise.
        sessionId - The session token id.
        Returns:
        The id of the new view.
      • setListTypeItemRelatedLayout

        @RequestMapping(method=PUT,
                        value="setListTypeItemRelatedLayout/{listTypeItemId}/{listTypeItemClassName}/{viewId}/{sessionId}",
                        produces="application/json")
        public void setListTypeItemRelatedLayout​(@PathVariable("listTypeItemId")
                                                 String listTypeItemId,
                                                 @PathVariable("listTypeItemClassName")
                                                 String listTypeItemClassName,
                                                 @PathVariable("viewId")
                                                 long viewId,
                                                 @PathVariable("sessionId")
                                                 String sessionId)
        Relate a list type item with a view. Creates a relationship between the given list type and layout view.
        Specified by:
        setListTypeItemRelatedLayout in interface LayoutRestOpenApi
        Parameters:
        listTypeItemId - List type item id.
        listTypeItemClassName - List type item class name.
        viewId - The view id.
        sessionId - The session token id.
      • releaseListTypeItemRelatedLayout

        @RequestMapping(method=PUT,
                        value="releaseListTypeItemRelatedLayout/{listTypeItemId}/{listTypeItemClassName}/{viewId}/{sessionId}",
                        produces="application/json")
        public void releaseListTypeItemRelatedLayout​(@PathVariable("listTypeItemId")
                                                     String listTypeItemId,
                                                     @PathVariable("listTypeItemClassName")
                                                     String listTypeItemClassName,
                                                     @PathVariable("viewId")
                                                     long viewId,
                                                     @PathVariable("sessionId")
                                                     String sessionId)
        Release a list type item with a view.Deletes a relationship between the given list type and layout view.
        Specified by:
        releaseListTypeItemRelatedLayout in interface LayoutRestOpenApi
        Parameters:
        listTypeItemId - List type item id.
        listTypeItemClassName - List type item class name.
        viewId - The view id.
        sessionId - The session token id.
      • getListTypeItemRelatedLayout

        @RequestMapping(method=GET,
                        value="getListTypeItemRelatedLayout/{listTypeItemId}/{listTypeItemClassName}/{viewId}/{sessionId}",
                        produces="application/json")
        public ViewObject getListTypeItemRelatedLayout​(@PathVariable("listTypeItemId")
                                                       String listTypeItemId,
                                                       @PathVariable("listTypeItemClassName")
                                                       String listTypeItemClassName,
                                                       @PathVariable("viewId")
                                                       long viewId,
                                                       @PathVariable("sessionId")
                                                       String sessionId)
        Gets a view related to a list type item, such as the default, rack or equipment views.
        Specified by:
        getListTypeItemRelatedLayout in interface LayoutRestOpenApi
        Parameters:
        listTypeItemId - List type item id.
        listTypeItemClassName - List type item class.
        viewId - The view id.
        sessionId - The session token id.
        Returns:
        The associated view (there should be only one of each type). Null if there's none yet.
      • updateListTypeItemRelatedLayout

        @RequestMapping(method=PUT,
                        value="updateListTypeItemRelatedLayout/{listTypeItemId}/{listTypeItemClassName}/{viewId}/{name}/{description}/{structure}/{background}/{sessionId}",
                        produces="application/json")
        public ChangeDescriptor updateListTypeItemRelatedLayout​(@PathVariable("listTypeItemId")
                                                                String listTypeItemId,
                                                                @PathVariable("listTypeItemClassName")
                                                                String listTypeItemClassName,
                                                                @PathVariable("viewId")
                                                                long viewId,
                                                                @PathVariable("name")
                                                                String name,
                                                                @PathVariable("description")
                                                                String description,
                                                                @PathVariable("structure")
                                                                String structure,
                                                                @PathVariable("background")
                                                                String background,
                                                                @PathVariable("sessionId")
                                                                String sessionId)
        Updates a view for a given list type item. If there's already a view of the provided view type, it will be overwritten.
        Specified by:
        updateListTypeItemRelatedLayout in interface LayoutRestOpenApi
        Parameters:
        listTypeItemId - List type item id.
        listTypeItemClassName - List type item class name.
        viewId - View Id.
        name - View name.
        description - View description.
        structure - The structure of the view as string Base64,from an XML document with the view structure
         
          <view version="">
              <layout name="" x="" y="" width="" height="" type="">
                  <shape type="" x="" y="" height="" width="" opaque=""
                         isEquipment="" name="" id="" className="" color="" borderColor="">
                  </shape> 
                  <shape ... >
                  </shape>
                  <shape ... >
                  </shape>
                  .
                  .
                  .
              </layout>
          </view>
         
         
        background - The background image as string Base64. If "null", the previous will be removed, if 0-sized array, it will remain unchanged.
        sessionId - The session token id.
        Returns:
        The summary of the changes.
      • updateLayout

        @RequestMapping(method=PUT,
                        value="updateLayout/{viewId}/{name}/{description}/{structure}/{background}/{sessionId}",
                        produces="application/json")
        public ChangeDescriptor updateLayout​(@PathVariable("viewId")
                                             long viewId,
                                             @PathVariable("name")
                                             String name,
                                             @PathVariable("description")
                                             String description,
                                             @PathVariable("structure")
                                             String structure,
                                             @PathVariable("background")
                                             String background,
                                             @PathVariable("sessionId")
                                             String sessionId)
        Updates a layout view. Updates the given layout view with the parameters provided.
        Specified by:
        updateLayout in interface LayoutRestOpenApi
        Parameters:
        viewId - View Id.
        name - View name.
        description - View description.
        structure - The structure of the view as string Base64,from an XML document with the view structure
         
          <view version="">
              <layout name="" x="" y="" width="" height="" type="">
                  <shape type="" x="" y="" height="" width="" opaque=""
                         isEquipment="" name="" id="" className="" color="" borderColor="">
                  </shape> 
                  <shape ... >
                  </shape>
                  <shape ... >
                  </shape>
                  .
                  .
                  .
              </layout>
          </view>
         
         
        background - The background image as string Base64. If "null", the previous will be removed, if 0-sized array, it will remain unchanged.
        sessionId - The session token id.
        Returns:
        The summary of the changes.
      • getListTypeItemRelatedLayouts

        @RequestMapping(method=GET,
                        value="getListTypeItemRelatedLayouts/{listTypeItemId}/{listTypeItemClassName}/{limit}/{sessionId}",
                        produces="application/json")
        public List<ViewObjectLight> getListTypeItemRelatedLayouts​(@PathVariable("listTypeItemId")
                                                                   String listTypeItemId,
                                                                   @PathVariable("listTypeItemClassName")
                                                                   String listTypeItemClassName,
                                                                   @PathVariable("limit")
                                                                   int limit,
                                                                   @PathVariable("sessionId")
                                                                   String sessionId)
        Gets the views related to a list type item, such as the default, rack or equipment views.
        Specified by:
        getListTypeItemRelatedLayouts in interface LayoutRestOpenApi
        Parameters:
        listTypeItemId - List type item id.
        listTypeItemClassName - List type item class name.
        limit - Max number of results.
        sessionId - The session token id.
        Returns:
        The associated views.
      • deleteListTypeItemRelatedLayout

        @RequestMapping(method=DELETE,
                        value="deleteListTypeItemRelatedLayout/{listTypeItemId}/{listTypeItemClassName}/{viewId}/{sessionId}",
                        produces="application/json")
        public void deleteListTypeItemRelatedLayout​(@PathVariable("listTypeItemId")
                                                    String listTypeItemId,
                                                    @PathVariable("listTypeItemClassName")
                                                    String listTypeItemClassName,
                                                    @PathVariable("viewId")
                                                    long viewId,
                                                    @PathVariable("sessionId")
                                                    String sessionId)
        Deletes a list type item related view.
        Specified by:
        deleteListTypeItemRelatedLayout in interface LayoutRestOpenApi
        Parameters:
        listTypeItemId - List type item id.
        listTypeItemClassName - List type class name.
        viewId - Related view id.
        sessionId - The session token id.
      • deleteLayout

        @RequestMapping(method=DELETE,
                        value="deleteLayout/{viewId}/{sessionId}",
                        produces="application/json")
        public void deleteLayout​(@PathVariable("viewId")
                                 long viewId,
                                 @PathVariable("sessionId")
                                 String sessionId)
        Deletes a layout view.
        Specified by:
        deleteLayout in interface LayoutRestOpenApi
        Parameters:
        viewId - Related view id.
        sessionId - The session token id.
      • getDeviceLayouts

        @RequestMapping(method=GET,
                        value="getDeviceLayouts/{sessionId}",
                        produces="application/json")
        public List<BusinessObjectLight> getDeviceLayouts​(@PathVariable("sessionId")
                                                          String sessionId)
        Gets the list of template elements with a device layout.
        Specified by:
        getDeviceLayouts in interface LayoutRestOpenApi
        Parameters:
        sessionId - The session token id.
        Returns:
        The list of template elements with a device layout.
      • getDeviceLayoutStructure

        @RequestMapping(method=GET,
                        value="getDeviceLayoutStructure/{id}/{className}/{sessionId}",
                        produces="application/json")
        public byte[] getDeviceLayoutStructure​(@PathVariable("id")
                                               String id,
                                               @PathVariable("className")
                                               String className,
                                               @PathVariable("sessionId")
                                               String sessionId)
        Gets the device layout structure.
         
          <deviceLayoutStructure>
              <device id="" className="" name=""/>
              ...
              .
              .
              <device id="" className="" name="" parentId="">
                  <model id="" className="" name="">
                      <view id="" className="">
                          <structure>
                              Base64                      
                          </structure>
                      </view>
                  </model>
              </device>
              ...
              .
              .
              <device id="" className="" name="" parentId=""/>
              ...
              .
              .
              <device id="" className="" name="" parentId="">
                  <model id="" className="" name="">
                      <view id="" className="">
                          <structure>
                              Base64                      
                          </structure>
                      </view>
                  </model>
              </device>
          </deviceLayoutStructure>
         
         
        Specified by:
        getDeviceLayoutStructure in interface LayoutRestOpenApi
        Parameters:
        id - Object id.
        className - Object class.
        sessionId - The session token id.
        Returns:
        The structure of the device layout.