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 ApplicationEntityManagerRestOpenApiSet 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 longattachFileToListTypeItem(String name, String tags, String file, String listTypeItemClassName, String listTypeItemId, String sessionId)Relates a file to a list type item.longcreateBusinessRule(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.longcreateGeneralView(String className, String name, String description, String structure, String background, String sessionId)Creates a view not related to a particular object.longcreateObjectRelatedView(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.StringcreatePoolInObject(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.StringcreatePoolInPool(String parentId, String name, String description, String className, int type, String sessionId)Creates a pool that will have as parent another pool.StringcreateRootPool(String name, String description, String className, int type, String sessionId)Creates a pool without a parent.voiddeleteBusinessRule(long id, String sessionId)Deletes a business rule.voiddeleteGeneralViews(List<Long> ids, String sessionId)Deletes a list of general views.voiddeletePools(String[] ids, String sessionId)Deletes a set of pools.voiddetachFileFromListTypeItem(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.FileObjectgetFile(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.longgetGeneralActivityAuditTrailCount(int page, int limit, HashMap<String,Object> filters, String sessionId)Retrieves the number of general activity log entries.ViewObjectgetGeneralView(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.ViewObjectgetObjectRelatedView(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.ChangeDescriptorsetPoolProperties(String poolId, String name, String description, String sessionId)Updates a pool.voidupdateFileProperties(long id, List<StringPair> properties, String className, String listTypeItemId, String sessionId)Updates the properties of a file list type item (name or tags).ChangeDescriptorupdateGeneralView(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.ChangeDescriptorupdateObjectRelatedView(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:
createRootPoolin 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:
createPoolInObjectin 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:
createPoolInPoolin 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:
deletePoolsin 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:
setPoolPropertiesin 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:
getBusinessObjectAuditTrailin 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:
getGeneralActivityAuditTrailCountin 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:
getGeneralActivityAuditTrailin 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:
getObjectRelatedViewin 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:
getObjectRelatedViewsin 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:
getGeneralViewsin 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:
getGeneralViewin 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:
createObjectRelatedViewin 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:
createGeneralViewin 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:
updateObjectRelatedViewin 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:
updateGeneralViewin 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:
deleteGeneralViewsin 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:
attachFileToListTypeItemin 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:
getFilesForListTypeItemin 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:
getFilein 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:
detachFileFromListTypeItemin 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:
updateFilePropertiesin 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:
createBusinessRulein 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:
deleteBusinessRulein 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:
getBusinessRulesin 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:
getClassHierachyin interfaceApplicationEntityManagerRestOpenApi- Parameters:
showAll-sessionId- The session token id.- Returns:
- The class hierarchy as an XML document.
-
-