Class ApplicationEntityManagerRestController

    • Constructor Detail

      • ApplicationEntityManagerRestController

        public ApplicationEntityManagerRestController()
    • Method Detail

      • createRootPool

        @RequestMapping(method=POST,
                        value="createRootPool/{name}/{description}/{className}/{type}/{sessionId}",
                        produces="application/json")
        public String createRootPool​(@PathVariable("name")
                                     String name,
                                     @PathVariable("description")
                                     String description,
                                     @PathVariable("className")
                                     String className,
                                     @PathVariable("type")
                                     int type,
                                     @PathVariable("sessionId")
                                     String sessionId)
        Creates a pool without a parent. They're used as general purpose place to put inventory objects, or as root for particular models.
        Specified by:
        createRootPool in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        name - Pool name.
        description - Pool description.
        className - What kind of objects can this pool contain?
        type - Type of pool. For possible values see ApplicationManager.POOL_TYPE_XXX.
        sessionId - The session token id.
        Returns:
        The id of the new pool.
      • createPoolInObject

        @RequestMapping(method=POST,
                        value="createPoolInObject/{parentClassName}/{parentId}/{name}/{description}/{className}/{type}/{sessionId}",
                        produces="application/json")
        public String createPoolInObject​(@PathVariable("parentClassName")
                                         String parentClassName,
                                         @PathVariable("parentId")
                                         String parentId,
                                         @PathVariable("name")
                                         String name,
                                         @PathVariable("description")
                                         String description,
                                         @PathVariable("className")
                                         String className,
                                         @PathVariable("type")
                                         int type,
                                         @PathVariable("sessionId")
                                         String sessionId)
        Creates a pool that will have as parent an inventory object. This special containment structure can be used to provide support for new models.
        Specified by:
        createPoolInObject in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        parentClassName - Class name of the parent object.
        parentId - Id of the parent object.
        name - Pool name.
        description - Pool description.
        className - What kind of objects can this pool contain?
        type - Type of pool. For possible values see ApplicationManager.POOL_TYPE_XXX.
        sessionId - The session token id.
        Returns:
        The id of the new pool.
      • createPoolInPool

        @RequestMapping(method=POST,
                        value="createPoolInPool/{parentId}/{name}/{description}/{className}/{type}/{sessionId}",
                        produces="application/json")
        public String createPoolInPool​(@PathVariable("parentId")
                                       String parentId,
                                       @PathVariable("name")
                                       String name,
                                       @PathVariable("description")
                                       String description,
                                       @PathVariable("className")
                                       String className,
                                       @PathVariable("type")
                                       int type,
                                       @PathVariable("sessionId")
                                       String sessionId)
        Creates a pool that will have as parent another pool. This special containment structure can be used to provide support for new models.
        Specified by:
        createPoolInPool in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        parentId - Id of the parent pool.
        name - Pool name.
        description - Pool description.
        className - What kind of objects can this pool contain?
        type - Type of pool. Not used so far, but it will be in the future. It will probably be used to help organize the existing pools.
        sessionId - The session token id.
        Returns:
        The id of the new pool.
      • deletePools

        @RequestMapping(method=DELETE,
                        value="deletePools/{ids}/{sessionId}",
                        produces="application/json")
        public void deletePools​(@PathVariable("ids")
                                String[] ids,
                                @PathVariable("sessionId")
                                String sessionId)
        Deletes a set of pools. Note that this method will delete and commit the changes until it finds an error, so if deleting any of the pools fails, don't try to delete those that were already processed.
        Specified by:
        deletePools in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        ids - The list of ids from the objects to be deleted.
        sessionId - The session token id.
      • setPoolProperties

        @RequestMapping(method=PUT,
                        value="setPoolProperties/{poolId}/{name}/{description}/{sessionId}",
                        produces="application/json")
        public ChangeDescriptor setPoolProperties​(@PathVariable("poolId")
                                                  String poolId,
                                                  @PathVariable("name")
                                                  String name,
                                                  @PathVariable("description")
                                                  String description,
                                                  @PathVariable("sessionId")
                                                  String sessionId)
        Updates a pool. The class name field is read only to preserve the integrity of the pool. Same happens to the field type.
        Specified by:
        setPoolProperties in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        poolId - Pool Id.
        name - Pool name. If null, this field will remain unchanged.
        description - Pool description. If null, this field will remain unchanged.
        sessionId - The session token id.
        Returns:
        The summary of the changes.
      • getBusinessObjectAuditTrail

        @RequestMapping(method=GET,
                        value="getBusinessObjectAuditTrail/{className}/{objectId}/{limit}/{sessionId}",
                        produces="application/json")
        public List<ActivityLogEntry> getBusinessObjectAuditTrail​(@PathVariable("className")
                                                                  String className,
                                                                  @PathVariable("objectId")
                                                                  String objectId,
                                                                  @PathVariable("limit")
                                                                  int limit,
                                                                  @PathVariable("sessionId")
                                                                  String sessionId)
        Gets a business object audit trail.
        Specified by:
        getBusinessObjectAuditTrail in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        className - Object class name.
        objectId - Object id.
        limit - Max number of results to be shown.
        sessionId - The session token id.
        Returns:
        The list of activity entries.
      • getGeneralActivityAuditTrailCount

        @RequestMapping(method=POST,
                        value="getGeneralActivityAuditTrailCount/{page}/{limit}/{sessionId}",
                        produces="application/json")
        public long getGeneralActivityAuditTrailCount​(@PathVariable("page")
                                                      int page,
                                                      @PathVariable("limit")
                                                      int limit,
                                                      @RequestBody
                                                      HashMap<String,​Object> filters,
                                                      @PathVariable("sessionId")
                                                      String sessionId)
        Retrieves the number of general activity log entries.
        Specified by:
        getGeneralActivityAuditTrailCount in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        page - Current page.
        limit - Limit of results per page. 0 to retrieve them all.
        filters - The response may be filtered by user (use key user, value the user name, a String) or event type (use key type, value any from ActivityLogEntry.ACTIVITY_TYPE_XXXX, an integer). If this parameter is null, no filters will be applied. If a key is not present, it won't be used as filter. If both are present, a logical AND will be applied.
        sessionId - The session token id.
        Returns:
        The number of activity log entries.
      • getGeneralActivityAuditTrail

        @RequestMapping(method=POST,
                        value="getGeneralActivityAuditTrail/{page}/{limit}/{sessionId}",
                        produces="application/json")
        public List<ActivityLogEntry> getGeneralActivityAuditTrail​(@PathVariable("page")
                                                                   int page,
                                                                   @PathVariable("limit")
                                                                   int limit,
                                                                   @RequestBody
                                                                   HashMap<String,​Object> filters,
                                                                   @PathVariable("sessionId")
                                                                   String sessionId)
        Retrieves the list of general activity log entries.
        Specified by:
        getGeneralActivityAuditTrail in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        page - Current page
        limit - Limit of results per page. 0 to retrieve them all.
        filters - The response may be filtered by user (use key user, value the user name, a String) or event type (use key type, value any from ActivityLogEntry.ACTIVITY_TYPE_XXXX, an integer). If this parameter is null, no filters will be applied. If a key is not present, it won't be used as filter. If both are present, a logical AND will be applied.
        sessionId - The session token id.
        Returns:
        The list of activity log entries. The entries are sorted by creation date in descending order.
      • getObjectRelatedView

        @RequestMapping(method=GET,
                        value="getObjectRelatedView/{objectId}/{className}/{viewId}/{sessionId}",
                        produces="application/json")
        public ViewObject getObjectRelatedView​(@PathVariable("objectId")
                                               String objectId,
                                               @PathVariable("className")
                                               String className,
                                               @PathVariable("viewId")
                                               long viewId,
                                               @PathVariable("sessionId")
                                               String sessionId)
        Get a view related to an object, such as the default rack or object views.
        Specified by:
        getObjectRelatedView in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        objectId - Object id.
        className - Object class name.
        viewId - 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.
      • getObjectRelatedViews

        @RequestMapping(method=GET,
                        value="getObjectRelatedViews/{objectId}/{className}/{limit}/{sessionId}",
                        produces="application/json")
        public List<ViewObjectLight> getObjectRelatedViews​(@PathVariable("objectId")
                                                           String objectId,
                                                           @PathVariable("className")
                                                           String className,
                                                           @PathVariable("limit")
                                                           int limit,
                                                           @PathVariable("sessionId")
                                                           String sessionId)
        Get a view related to an object, such as the default, rack or equipment views.
        Specified by:
        getObjectRelatedViews in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        objectId - Object id.
        className - Object class name.
        limit - Max number of results.
        sessionId - The session token id.
        Returns:
        The associated views.
      • getGeneralViews

        @RequestMapping(method=GET,
                        value="getGeneralViews/{className}/{limit}/{sessionId}",
                        produces="application/json")
        public List<ViewObjectLight> getGeneralViews​(@PathVariable("className")
                                                     String className,
                                                     @PathVariable("limit")
                                                     int limit,
                                                     @PathVariable("sessionId")
                                                     String sessionId)
        Allows to retrieve a list of views of a certain type, specifying their class.
        Specified by:
        getGeneralViews in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        className - The class name.
        limit - The limit of results. -1 for all.
        sessionId - The session token id.
        Returns:
        The view class name.
      • getGeneralView

        @RequestMapping(method=GET,
                        value="getGeneralView/{viewId}/{sessionId}",
                        produces="application/json")
        public ViewObject getGeneralView​(@PathVariable("viewId")
                                         long viewId,
                                         @PathVariable("sessionId")
                                         String sessionId)
        Returns a view of those that are not related to a particular object (i.e.: GIS views).
        Specified by:
        getGeneralView in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        viewId - View id.
        sessionId - The session token id.
        Returns:
        An object representing the view.
      • createObjectRelatedView

        @RequestMapping(method=POST,
                        value="createObjectRelatedView/{objectId}/{className}/{name}/{description}/{viewClassName}/{structure}/{background}/{sessionId}",
                        produces="application/json")
        public long createObjectRelatedView​(@PathVariable("objectId")
                                            String objectId,
                                            @PathVariable("className")
                                            String className,
                                            @PathVariable("name")
                                            String name,
                                            @PathVariable("description")
                                            String description,
                                            @PathVariable("viewClassName")
                                            String viewClassName,
                                            @PathVariable("structure")
                                            String structure,
                                            @PathVariable("background")
                                            String background,
                                            @PathVariable("sessionId")
                                            String sessionId)
        Creates a view for a given object.If there's already a view of the provided view type, it will be overwritten.
        Specified by:
        createObjectRelatedView in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        objectId - Object id.
        className - Object class name.
        name - View name.
        description - View description.
        viewClassName - View class name (See class ViewObject for details about the supported types).
        structure - The structure of the view as string Base64, from an XML document with the view structure (see http://sourceforge.net/apps/mediawiki/kuwaiba/index.php?title=XML_Documents#To_Save_Object_Views for details about the supported format).
        background - The background image as string Base64. Used "null" for none.
        sessionId - The session token id.
        Returns:
        The id of the new view.
      • createGeneralView

        @RequestMapping(method=POST,
                        value="createGeneralView/{className}/{name}/{description}/{structure}/{background}/{sessionId}",
                        produces="application/json")
        public long createGeneralView​(@PathVariable("className")
                                      String className,
                                      @PathVariable("name")
                                      String name,
                                      @PathVariable("description")
                                      String description,
                                      @PathVariable("structure")
                                      String structure,
                                      @PathVariable("background")
                                      String background,
                                      @PathVariable("sessionId")
                                      String sessionId)
        Creates a view not related to a particular object.
        Specified by:
        createGeneralView in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        className - View class name.
        name - View name.
        description - View description.
        structure - The structure of the view as string Base64, from an XML document specifying the view structure (nodes, edges, control points).
        background - The background image as string Base64. Used "null" for none.
        sessionId - The session token id.
        Returns:
        The id of the newly created view.
      • updateObjectRelatedView

        @RequestMapping(method=PUT,
                        value="updateObjectRelatedView/{objectId}/{className}/{viewId}/{name}/{description}/{structure}/{background}/{sessionId}",
                        produces="application/json")
        public ChangeDescriptor updateObjectRelatedView​(@PathVariable("objectId")
                                                        String objectId,
                                                        @PathVariable("className")
                                                        String className,
                                                        @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 object.If there's already a view of the provided view type, it will be overwritten.
        Specified by:
        updateObjectRelatedView in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        objectId - Object id.
        className - Object 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 (see http://neotropic.co/kuwaiba/wiki/index.php?title=XML_Documents#To_Save_Object_Views for details about the supported format).
        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.
      • updateGeneralView

        @RequestMapping(method=PUT,
                        value="updateGeneralView/{id}/{name}/{description}/{structure}/{background}/{sessionId}",
                        produces="application/json")
        public ChangeDescriptor updateGeneralView​(@PathVariable("id")
                                                  long id,
                                                  @PathVariable("name")
                                                  String name,
                                                  @PathVariable("description")
                                                  String description,
                                                  @PathVariable("structure")
                                                  String structure,
                                                  @PathVariable("background")
                                                  String background,
                                                  @PathVariable("sessionId")
                                                  String sessionId)
        Saves a view not related to a particular object.The view type can not be changed.
        Specified by:
        updateGeneralView in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        id - View id.
        name - View name. Null to leave unchanged.
        description - View description. Null to leave unchanged.
        structure - The structure of the view as string Base64, from an XML document specifying the view structure (nodes, edges, control points). Null to leave unchanged.
        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.
      • deleteGeneralViews

        @RequestMapping(method=DELETE,
                        value="deleteGeneralViews/{ids}/{sessionId}",
                        produces="application/json")
        public void deleteGeneralViews​(@PathVariable("ids")
                                       List<Long> ids,
                                       @PathVariable("sessionId")
                                       String sessionId)
        Deletes a list of general views.
        Specified by:
        deleteGeneralViews in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        ids - The ids of the views to be deleted.
        sessionId - The session token id.
      • attachFileToListTypeItem

        @RequestMapping(method=PUT,
                        value="attachFileToListTypeItem/{name}/{tags}/{file}/{listTypeItemClassName}/{listTypeItemId}/{sessionId}",
                        produces="application/json")
        public long attachFileToListTypeItem​(@PathVariable("name")
                                             String name,
                                             @PathVariable("tags")
                                             String tags,
                                             @PathVariable("file")
                                             String file,
                                             @PathVariable("listTypeItemClassName")
                                             String listTypeItemClassName,
                                             @PathVariable("listTypeItemId")
                                             String listTypeItemId,
                                             @PathVariable("sessionId")
                                             String sessionId)
        Relates a file to a list type item.
        Specified by:
        attachFileToListTypeItem in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        name - The name of the file.
        tags - The tags that describe the contents of the file.
        file - The file itself as string Base64.
        listTypeItemClassName - The list type item class name.
        listTypeItemId - The id of the list type item the file will be attached to.
        sessionId - The session token id.
        Returns:
        The id of the resulting file object.
      • getFilesForListTypeItem

        @RequestMapping(method=GET,
                        value="getFilesForListTypeItem/{className}/{objectId}/{sessionId}",
                        produces="application/json")
        public List<FileObjectLight> getFilesForListTypeItem​(@PathVariable("className")
                                                             String className,
                                                             @PathVariable("objectId")
                                                             String objectId,
                                                             @PathVariable("sessionId")
                                                             String sessionId)
        Fetches the files associated to an inventory object. Note that this call won't retrieve the actual files, but only references to them.
        Specified by:
        getFilesForListTypeItem in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        className - The class of the object whose files will be fetched from.
        objectId - The id of the object whose files will be fetched from.
        sessionId - The session token id.
        Returns:
        The list of files.
      • getFile

        @RequestMapping(method=GET,
                        value="getFile/{id}/{className}/{objectId}/{sessionId}",
                        produces="application/json")
        public FileObject getFile​(@PathVariable("id")
                                  long id,
                                  @PathVariable("className")
                                  String className,
                                  @PathVariable("objectId")
                                  String objectId,
                                  @PathVariable("sessionId")
                                  String sessionId)
        Retrieves a particular file associated to an inventory list type item.This call returns the actual file.
        Specified by:
        getFile in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        id - The id of the file object.
        className - The class of the object the file is associated to.
        objectId - The id of the list type item the file is associated to.
        sessionId - The session token id.
        Returns:
        The file.
      • detachFileFromListTypeItem

        @RequestMapping(method=PUT,
                        value="detachFileFromListTypeItem/{id}/{className}/{objectId}/{sessionId}",
                        produces="application/json")
        public void detachFileFromListTypeItem​(@PathVariable("id")
                                               long id,
                                               @PathVariable("className")
                                               String className,
                                               @PathVariable("objectId")
                                               String objectId,
                                               @PathVariable("sessionId")
                                               String sessionId)
        Releases (and deletes) a file associated to a list type item.
        Specified by:
        detachFileFromListTypeItem in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        id - The id of the file.
        className - The class of the list type item the file is associated to.
        objectId - The id of the list type item the file is associated to.
        sessionId - The session token id.
      • updateFileProperties

        @RequestMapping(method=PUT,
                        value="updateFileProperties/{id}/{className}/{listTypeItemId}/{sessionId}",
                        produces="application/json")
        public void updateFileProperties​(@PathVariable("id")
                                         long id,
                                         @RequestBody
                                         List<StringPair> properties,
                                         @PathVariable("className")
                                         String className,
                                         @PathVariable("listTypeItemId")
                                         String listTypeItemId,
                                         @PathVariable("sessionId")
                                         String sessionId)
        Updates the properties of a file list type item (name or tags).
        Specified by:
        updateFileProperties in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        id - The id of the file.
        properties - The set of properties as a dictionary key-value. Valid keys are "name" and "tags".
        className - The class of the object the file is attached to.
        listTypeItemId - The id of the list type item the file is attached to.
        sessionId - The session token id.
      • createBusinessRule

        @RequestMapping(method=POST,
                        value="createBusinessRule/{name}/{description}/{type}/{scope}/{appliesTo}/{version}/{constraints}/{sessionId}",
                        produces="application/json")
        public long createBusinessRule​(@PathVariable("name")
                                       String name,
                                       @PathVariable("description")
                                       String description,
                                       @PathVariable("type")
                                       int type,
                                       @PathVariable("scope")
                                       int scope,
                                       @PathVariable("appliesTo")
                                       String appliesTo,
                                       @PathVariable("version")
                                       String version,
                                       @PathVariable("constraints")
                                       List<String> constraints,
                                       @PathVariable("sessionId")
                                       String sessionId)
        Creates a business rule given a set of constraints.
        Specified by:
        createBusinessRule in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        name - Rule name.
        description - Rule description.
        type - Rule type. See BusinesRule.TYPE* for possible values.
        scope - The scope of the rule. See BusinesRule.SCOPE* for possible values.
        appliesTo - The class this rule applies to. Can not be null.
        version - The version of the rule. Useful to migrate it if necessary in further versions of the platform.
        constraints - An array with the definition of the logic to be matched with the rule. Can not be empty or null.
        sessionId - The session token id.
        Returns:
        The id of the newly created business rule.
      • deleteBusinessRule

        @RequestMapping(method=DELETE,
                        value="deleteBusinessRule/{id}/{sessionId}",
                        produces="application/json")
        public void deleteBusinessRule​(@PathVariable("id")
                                       long id,
                                       @PathVariable("sessionId")
                                       String sessionId)
        Deletes a business rule.
        Specified by:
        deleteBusinessRule in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        id - Rule id.
        sessionId - The session token id.
      • getBusinessRules

        @RequestMapping(method=GET,
                        value="getBusinessRules/{type}/{sessionId}",
                        produces="application/json")
        public List<BusinessRule> getBusinessRules​(@PathVariable("type")
                                                   int type,
                                                   @PathVariable("sessionId")
                                                   String sessionId)
        Retrieves the business rules of a particular type.
        Specified by:
        getBusinessRules in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        type - Rule type. See BusinesRule.TYPE* for possible values. Use -1 to retrieve all.
        sessionId - The session token id.
        Returns:
        The list of business rules with the matching type.
      • getClassHierachy

        @RequestMapping(method=GET,
                        value="getClassHierachy/{showAll}/{sessionId}",
                        produces="application/json")
        public byte[] getClassHierachy​(@PathVariable("showAll")
                                       boolean showAll,
                                       @PathVariable("sessionId")
                                       String sessionId)
        Get the data model class hierarchy as an XML document.
        Specified by:
        getClassHierachy in interface ApplicationEntityManagerRestOpenApi
        Parameters:
        showAll -
        sessionId - The session token id.
        Returns:
        The class hierarchy as an XML document.