Class ApplicationEntityManagerRestController
- java.lang.Object
-
- org.neotropic.kuwaiba.northbound.rest.aem.ApplicationEntityManagerRestController
-
- All Implemented Interfaces:
ApplicationEntityManagerRestOpenApi
@RestController @RequestMapping("/v2.1.1/core/aem/") public class ApplicationEntityManagerRestController extends Object implements ApplicationEntityManagerRestOpenApi
Set of resources to manage the application entities.- Author:
- Mauricio Ruiz Beltrán <mauricio.ruiz@kuwaiba.org>
-
-
Constructor Summary
Constructors Constructor Description ApplicationEntityManagerRestController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
attachFileToListTypeItem(String name, String tags, String file, String listTypeItemClassName, String listTypeItemId, String sessionId)
Relates a file to a list type item.long
createBusinessRule(String name, String description, int type, int scope, String appliesTo, String version, List<String> constraints, String sessionId)
Creates a business rule given a set of constraints.long
createGeneralView(String className, String name, String description, String structure, String background, String sessionId)
Creates a view not related to a particular object.long
createObjectRelatedView(String objectId, String className, String name, String description, String viewClassName, String structure, String background, String sessionId)
Creates a view for a given object.If there's already a view of the provided view type, it will be overwritten.String
createPoolInObject(String parentClassName, String parentId, String name, String description, String className, int type, String sessionId)
Creates a pool that will have as parent an inventory object.String
createPoolInPool(String parentId, String name, String description, String className, int type, String sessionId)
Creates a pool that will have as parent another pool.String
createRootPool(String name, String description, String className, int type, String sessionId)
Creates a pool without a parent.void
deleteBusinessRule(long id, String sessionId)
Deletes a business rule.void
deleteGeneralViews(List<Long> ids, String sessionId)
Deletes a list of general views.void
deletePools(String[] ids, String sessionId)
Deletes a set of pools.void
detachFileFromListTypeItem(long id, String className, String objectId, String sessionId)
Releases (and deletes) a file associated to a list type item.List<ActivityLogEntry>
getBusinessObjectAuditTrail(String className, String objectId, int limit, String sessionId)
Gets a business object audit trail.List<BusinessRule>
getBusinessRules(int type, String sessionId)
Retrieves the business rules of a particular type.byte[]
getClassHierachy(boolean showAll, String sessionId)
Get the data model class hierarchy as an XML document.FileObject
getFile(long id, String className, String objectId, String sessionId)
Retrieves a particular file associated to an inventory list type item.This call returns the actual file.List<FileObjectLight>
getFilesForListTypeItem(String className, String objectId, String sessionId)
Fetches the files associated to an inventory object.List<ActivityLogEntry>
getGeneralActivityAuditTrail(int page, int limit, HashMap<String,Object> filters, String sessionId)
Retrieves the list of general activity log entries.long
getGeneralActivityAuditTrailCount(int page, int limit, HashMap<String,Object> filters, String sessionId)
Retrieves the number of general activity log entries.ViewObject
getGeneralView(long viewId, String sessionId)
Returns a view of those that are not related to a particular object (i.e.: GIS views).List<ViewObjectLight>
getGeneralViews(String className, int limit, String sessionId)
Allows to retrieve a list of views of a certain type, specifying their class.ViewObject
getObjectRelatedView(String objectId, String className, long viewId, String sessionId)
Get a view related to an object, such as the default rack or object views.List<ViewObjectLight>
getObjectRelatedViews(String objectId, String className, int limit, String sessionId)
Get a view related to an object, such as the default, rack or equipment views.ChangeDescriptor
setPoolProperties(String poolId, String name, String description, String sessionId)
Updates a pool.void
updateFileProperties(long id, List<StringPair> properties, String className, String listTypeItemId, String sessionId)
Updates the properties of a file list type item (name or tags).ChangeDescriptor
updateGeneralView(long id, String name, String description, String structure, String background, String sessionId)
Saves a view not related to a particular object.The view type can not be changed.ChangeDescriptor
updateObjectRelatedView(String objectId, String className, long viewId, String name, String description, String structure, String background, String sessionId)
Updates a view for a given object.If there's already a view of the provided view type, it will be overwritten.
-
-
-
Field Detail
-
PATH
public static final String PATH
Path that includes the Kuwaiba version and core- See Also:
- Constant Field Values
-
-
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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- Parameters:
page
- Current page.limit
- Limit of results per page. 0 to retrieve them all.filters
- The response may be filtered by user (use keyuser
, value the user name, a String) or event type (use keytype
, 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 interfaceApplicationEntityManagerRestOpenApi
- Parameters:
page
- Current pagelimit
- Limit of results per page. 0 to retrieve them all.filters
- The response may be filtered by user (use keyuser
, value the user name, a String) or event type (use keytype
, 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- 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 interfaceApplicationEntityManagerRestOpenApi
- Parameters:
showAll
-sessionId
- The session token id.- Returns:
- The class hierarchy as an XML document.
-
-