Class TemplateRestController

  • All Implemented Interfaces:
    TemplateRestOpenApi

    @RestController
    @RequestMapping("/v2.1.1/template-manager/")
    public class TemplateRestController
    extends Object
    implements TemplateRestOpenApi
    Template Rest Controller.
    Author:
    Mauricio Ruiz Beltrán <mauricio.ruiz@kuwaiba.org>
    • Constructor Detail

      • TemplateRestController

        public TemplateRestController()
    • Method Detail

      • createTemplate

        @RequestMapping(method=POST,
                        value="createTemplate/{className}/{name}/{sessionId}",
                        produces="application/json")
        public String createTemplate​(@PathVariable("className")
                                     String className,
                                     @PathVariable("name")
                                     String name,
                                     @PathVariable("sessionId")
                                     String sessionId)
        Creates a template.
        Specified by:
        createTemplate in interface TemplateRestOpenApi
        Parameters:
        className - The class you want to create a template for.
        name - The name of the template. It can not be null.
        sessionId - The session token id.
        Returns:
        The id of the newly created template.
      • createTemplateElement

        @RequestMapping(method=POST,
                        value="createTemplateElement/{className}/{parentClassName}/{parentId}/{name}/{sessionId}",
                        produces="application/json")
        public String createTemplateElement​(@PathVariable("className")
                                            String className,
                                            @PathVariable("parentClassName")
                                            String parentClassName,
                                            @PathVariable("parentId")
                                            String parentId,
                                            @PathVariable("name")
                                            String name,
                                            @PathVariable("sessionId")
                                            String sessionId)
        Creates an object inside a template.
        Specified by:
        createTemplateElement in interface TemplateRestOpenApi
        Parameters:
        className - Class of the object you want to create.
        parentClassName - Class of the parent to the object you want to create.
        parentId - Id of the parent to the object you want to create.
        name - Name of the element.
        sessionId - The session token id.
        Returns:
        The id of the new object.
      • createTemplateSpecialElement

        @RequestMapping(method=POST,
                        value="createTemplateSpecialElement/{className}/{parentClassName}/{parentId}/{name}/{sessionId}",
                        produces="application/json")
        public String createTemplateSpecialElement​(@PathVariable("className")
                                                   String className,
                                                   @PathVariable("parentClassName")
                                                   String parentClassName,
                                                   @PathVariable("parentId")
                                                   String parentId,
                                                   @PathVariable("name")
                                                   String name,
                                                   @PathVariable("sessionId")
                                                   String sessionId)
        Create an special object inside an template.
        Specified by:
        createTemplateSpecialElement in interface TemplateRestOpenApi
        Parameters:
        className - Template special element class.
        parentClassName - Template special element parent class name.
        parentId - Template special element parent Id.
        name - Template special element name.
        sessionId - The session token id.
        Returns:
        The id of the new object.
      • createBulkTemplateElement

        @RequestMapping(method=POST,
                        value="createBulkTemplateElement/{className}/{parentClassName}/{parentId}/{sessionId}",
                        produces="application/json")
        public String[] createBulkTemplateElement​(@PathVariable("className")
                                                  String className,
                                                  @PathVariable("parentClassName")
                                                  String parentClassName,
                                                  @PathVariable("parentId")
                                                  String parentId,
                                                  @RequestBody
                                                  String namePattern,
                                                  @PathVariable("sessionId")
                                                  String sessionId)
        Creates multiple template elements using a given name pattern.
        Specified by:
        createBulkTemplateElement in interface TemplateRestOpenApi
        Parameters:
        className - The class name of the new set of template elements.
        parentClassName - The parent class name of the new set of template elements.
        parentId - The parent id of the new set of template elements.
        namePattern - Name pattern of the new set of template elements.
        sessionId - The session token id.
        Returns:
        An array of ids for the new template elements.
      • createBulkSpecialTemplateElement

        @RequestMapping(method=POST,
                        value="createBulkSpecialTemplateElement/{className}/{parentClassName}/{parentId}/{sessionId}",
                        produces="application/json")
        public String[] createBulkSpecialTemplateElement​(@PathVariable("className")
                                                         String className,
                                                         @PathVariable("parentClassName")
                                                         String parentClassName,
                                                         @PathVariable("parentId")
                                                         String parentId,
                                                         @RequestBody
                                                         String namePattern,
                                                         @PathVariable("sessionId")
                                                         String sessionId)
        Creates multiple special template elements using a given name pattern.
        Specified by:
        createBulkSpecialTemplateElement in interface TemplateRestOpenApi
        Parameters:
        className - The class name of the new set of special template elements.
        parentClassName - The parent class name of the new set of special template elements.
        parentId - The parent id of the new set of special template elements.
        namePattern - Name pattern of the new set of special template elements.
        sessionId - The session token id.
        Returns:
        An array if ids for the new special template elements.
      • updateTemplateElement

        @RequestMapping(method=PUT,
                        value="updateTemplateElement/{className}/{id}/{attributeNames}/{attributeValues}/{sessionId}",
                        produces="application/json")
        public ChangeDescriptor updateTemplateElement​(@PathVariable("className")
                                                      String className,
                                                      @PathVariable("id")
                                                      String id,
                                                      @PathVariable("attributeNames")
                                                      String[] attributeNames,
                                                      @PathVariable("attributeValues")
                                                      String[] attributeValues,
                                                      @PathVariable("sessionId")
                                                      String sessionId)
        Updates the value of an attribute of a template element.
        Specified by:
        updateTemplateElement in interface TemplateRestOpenApi
        Parameters:
        className - Class of the element you want to update.
        id - Id of the element you want to update.
        attributeNames - Names of the attributes that you want to be updated as an array of strings.
        attributeValues - The values of the attributes you want to update. For list types, it's the id of the related type.
        sessionId - The session token id.
        Returns:
        The summary of the changes.
      • deleteTemplateElement

        @RequestMapping(method=DELETE,
                        value="deleteTemplateElement/{className}/{id}/{sessionId}",
                        produces="application/json")
        public ChangeDescriptor deleteTemplateElement​(@PathVariable("className")
                                                      String className,
                                                      @PathVariable("id")
                                                      String id,
                                                      @PathVariable("sessionId")
                                                      String sessionId)
        Deletes an element within a template or a template itself.
        Specified by:
        deleteTemplateElement in interface TemplateRestOpenApi
        Parameters:
        className - The template element class.
        id - The template element id.
        sessionId - The session token id.
        Returns:
        The summary of the changes.
      • getTemplatesForClass

        @RequestMapping(method=GET,
                        value="getTemplatesForClass/{className}/{sessionId}",
                        produces="application/json")
        public List<TemplateObjectLight> getTemplatesForClass​(@PathVariable("className")
                                                              String className,
                                                              @PathVariable("sessionId")
                                                              String sessionId)
        Gets the templates available for a given class.
        Specified by:
        getTemplatesForClass in interface TemplateRestOpenApi
        Parameters:
        className - Class whose templates we need.
        sessionId - The session token id.
        Returns:
        A list of templates (actually, the top element) as a list of RemoteObjects.
      • getTemplateElementChildren

        @RequestMapping(method=GET,
                        value="getTemplateElementChildren/{className}/{id}/{sessionId}",
                        produces="application/json")
        public List<TemplateObjectLight> getTemplateElementChildren​(@PathVariable("className")
                                                                    String className,
                                                                    @PathVariable("id")
                                                                    String id,
                                                                    @PathVariable("sessionId")
                                                                    String sessionId)
        Retrieves the children of a given template element.
        Specified by:
        getTemplateElementChildren in interface TemplateRestOpenApi
        Parameters:
        className - Template element class.
        id - Template element id.
        sessionId - The session token id.
        Returns:
        The template element's children as a list of RemoteBusinessObjectLight instances.
      • getTemplateSpecialElementChildren

        @RequestMapping(method=GET,
                        value="getTemplateSpecialElementChildren/{className}/{id}/{sessionId}",
                        produces="application/json")
        public List<TemplateObjectLight> getTemplateSpecialElementChildren​(@PathVariable("className")
                                                                           String className,
                                                                           @PathVariable("id")
                                                                           String id,
                                                                           @PathVariable("sessionId")
                                                                           String sessionId)
        Retrieves the children of a given template special element.
        Specified by:
        getTemplateSpecialElementChildren in interface TemplateRestOpenApi
        Parameters:
        className - Template special element class.
        id - Template special element id.
        sessionId - The session token id.
        Returns:
        The template element's children as a list of RemoteBusinessObjectLight instances.
      • getTemplateElement

        @RequestMapping(method=GET,
                        value="getTemplateElement/{className}/{id}/{sessionId}",
                        produces="application/json")
        public TemplateObject getTemplateElement​(@PathVariable("className")
                                                 String className,
                                                 @PathVariable("id")
                                                 String id,
                                                 @PathVariable("sessionId")
                                                 String sessionId)
        Retrieves all the information of a given template element.
        Specified by:
        getTemplateElement in interface TemplateRestOpenApi
        Parameters:
        className - Template element class.
        id - Template element id.
        sessionId - The session token id.
        Returns:
        The template element information.
      • copyTemplateElements

        @RequestMapping(method=PUT,
                        value="copyTemplateElements/{sourceObjectsClassNames}/{sourceObjectsIds}/{newParentClassName}/{newParentId}/{sessionId}",
                        produces="application/json")
        public String[] copyTemplateElements​(@PathVariable("sourceObjectsClassNames")
                                             String[] sourceObjectsClassNames,
                                             @PathVariable("sourceObjectsIds")
                                             String[] sourceObjectsIds,
                                             @PathVariable("newParentClassName")
                                             String newParentClassName,
                                             @PathVariable("newParentId")
                                             String newParentId,
                                             @PathVariable("sessionId")
                                             String sessionId)
        Copy template elements within templates. Should not be used to copy entire templates.
        Specified by:
        copyTemplateElements in interface TemplateRestOpenApi
        Parameters:
        sourceObjectsClassNames - Array with the class names of the elements to be copied.
        sourceObjectsIds - Array with the ids of the elements to be copied.
        newParentClassName - Class of the parent of the copied objects.
        newParentId - Id of the parent of the copied objects.
        sessionId - The session token id.
        Returns:
        An array with the ids of the newly created elements in the same order they were provided.
      • copyTemplateSpecialElement

        @RequestMapping(method=PUT,
                        value="copyTemplateSpecialElement/{sourceObjectsClassNames}/{sourceObjectsIds}/{newParentClassName}/{newParentId}/{sessionId}",
                        produces="application/json")
        public String[] copyTemplateSpecialElement​(@PathVariable("sourceObjectsClassNames")
                                                   String[] sourceObjectsClassNames,
                                                   @PathVariable("sourceObjectsIds")
                                                   String[] sourceObjectsIds,
                                                   @PathVariable("newParentClassName")
                                                   String newParentClassName,
                                                   @PathVariable("newParentId")
                                                   String newParentId,
                                                   @PathVariable("sessionId")
                                                   String sessionId)
        Copy template special elements within templates.
        Specified by:
        copyTemplateSpecialElement in interface TemplateRestOpenApi
        Parameters:
        sourceObjectsClassNames - Array with the class names of the special elements to be copied.
        sourceObjectsIds - Array with the ids of the special elements to be copied.
        newParentClassName - Class of the parent of the copied objects.
        newParentId - Id of the parent of the copied objects.
        sessionId - The session token id.
        Returns:
        An array with the ids of the newly created special elements in the same order they were provided.