Class ApplicationEntityManagerImpl
- java.lang.Object
-
- org.neotropic.kuwaiba.core.persistence.reference.neo4j.ApplicationEntityManagerImpl
-
- All Implemented Interfaces:
AbstractEntityManager
,ApplicationEntityManager
@Service public class ApplicationEntityManagerImpl extends Object implements ApplicationEntityManager
Application Entity Manager reference implementation- Author:
- Charles Edward Bedon Cortazar <charles.bedon@kuwaiba.org>
-
-
Field Summary
-
Fields inherited from interface org.neotropic.kuwaiba.core.apis.persistence.application.ApplicationEntityManager
CLASS_POOL, POOL_TYPE_GENERAL_PURPOSE, POOL_TYPE_MODULE_COMPONENT, POOL_TYPE_MODULE_ROOT
-
-
Constructor Summary
Constructors Constructor Description ApplicationEntityManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addObjectTofavoritesFolder(String objectClass, String objectId, long favoritesFolderId, long userId)
Adds an object to the favorites foldervoid
addUserToGroup(long userId, long groupId)
Adds a user to a grouplong
attachFileToListTypeItem(String name, String tags, byte[] file, String listTypeItemClass, String listTypeItemId)
Relates a file to a list type itemvoid
checkRelationshipByAttributeValueBusinessRules(String sourceObjectClassName, String sourceObjectId, String targetObjectClassName, String targetObjectId)
check if a relationship can be established between two objects with the attribute values defined in the rulevoid
closeSession(String sessionId)
Closes a session,void
commitActivity(String processInstanceId, String activityDefinitionId, Artifact artifact)
Saves the artifact generated once an activity has been completed (for example, the user filled in a form).String[]
copyTemplateElements(String[] sourceObjectsClassNames, String[] sourceObjectsIds, String newParentClassName, String newParentId)
Copy template elements within templates.String[]
copyTemplateSpecialElement(String[] sourceObjectsClassNames, String[] sourceObjectsIds, String newParentClassName, String newParentId)
Copy template special elements within templates,String[]
createBulkSpecialTemplateElement(String stElementClass, String stElementParentClassName, String stElementParentId, String stElementNamePattern)
Creates multiple special template elements using a given name patternString[]
createBulkTemplateElement(String templateElementClassName, String templateElementParentClassName, String templateElementParentId, String templateElementNamePattern)
Creates multiple template elements using a given name patternlong
createBusinessRule(String ruleName, String ruleDescription, int ruleType, int ruleScope, String appliesTo, String ruleVersion, List<String> constraints)
Creates a business rule given a set of constraintslong
createConfigurationVariable(String configVariablesPoolId, String name, String description, int type, boolean masked, String valueDefinition)
Creates a configuration variable inside a pool.A configuration variable is a place where a value will be stored so it can retrieved by whomever need it.String
createConfigurationVariablesPool(String name, String description)
Creates a pool of configuration variableslong
createFavoritesFolderForUser(String name, long userId)
Create a relationship between an user and a new favorites folderlong
createFilterDefinition(String name, String description, String className, String script, boolean enabled)
Creates a filter.void
createGeneralActivityLogEntry(String userName, int type, String notes)
Creates a general activity log entry, that is, an entry that is not associated to a particular objectvoid
createGeneralActivityLogEntry(String userName, int type, ChangeDescriptor changeDescriptor)
Creates a general activity log entry, that is, an entry that is not associated to a particular objectlong
createGeneralView(String viewClass, String name, String description, byte[] structure, byte[] background)
Creates a view not related to a particular objectlong
createGroup(String groupName, String description, List<Long> users)
Creates a grouplong
createLayout(String viewClassName, String name, String description, byte[] structure, byte[] background)
Creates a new layout view.String
createListTypeItem(String className, String name, String displayName)
Creates a list type itemlong
createListTypeItemRelatedLayout(String listTypeItemId, String listTypeItemClassName, String viewClassName, String name, String description, byte[] structure, byte[] background)
Creates a view for a given list type item.long
createObjectActivityLogEntry(String userName, String className, String oid, int type, String affectedProperties, String oldValues, String newValues, String notes)
Creates an object activity log entry, that is, an entry that is directly related to an object, such as the modification of the value of an attributevoid
createObjectActivityLogEntry(String userName, String className, String oid, int type, ChangeDescriptor changeDescriptor)
Creates an object activity log entry, that is, an entry that is directly related to an object, such as the modification of the value of an attributelong
createObjectRelatedView(String oid, String objectClass, String name, String description, String viewClassName, byte[] structure, byte[] background)
Creates a view for a given object.long
createOSPView(String name, String description, byte[] structure)
Creates an Outside Plant ViewString
createPoolInObject(String parentClassname, String parentId, String name, String description, String instancesOfClass, int type)
Creates a pool that will have as parent an inventory object.String
createPoolInPool(String parentId, String name, String description, String instancesOfClass, int type)
Creates a pool that will have as parent another pool.String
createProcessDefinition(String name, String description, String version, boolean enabled, byte[] structure)
Creates a process definition.String
createProcessInstance(String processDefinitionId, String processInstanceName, String processInstanceDescription)
Creates an instance of a process, that is, starts onelong
createQuery(String queryName, long ownerOid, byte[] queryStructure, String description)
Creates a QueryString
createRootPool(String name, String description, String instancesOfClass, int type)
Creates a pool without a parent.String
createScriptedQueriesPool(String name, String description)
Creates a scripted queries pool.String
createScriptedQuery(String scriptedQueriesPoolId, String name, String description, String script, boolean enabled)
Creates a scripted query.String
createScriptedQueryParameter(String scriptedQueryId, String name, String description, String type, boolean mandatory, Object defaultValue)
Creates a scripted query parameter.Session
createSession(String userName, String password, int sessionType)
Creates a session.long
createTask(String name, String description, boolean enabled, boolean commitOnExecute, String script, List<StringPair> parameters, TaskScheduleDescriptor schedule, TaskNotificationDescriptor notificationType)
Creates and schedule a task.String
createTemplate(String templateClass, String templateName)
Creates a template.String
createTemplateElement(String templateElementClass, String templateElementParentClassName, String templateElementParentId, String templateElementName)
Creates an object inside a template.TemplateObject
createTemplateElementFromNode(org.neo4j.graphdb.Node templateInstanceNode, String className)
String
createTemplateSpecialElement(String tsElementClass, String tsElementParentClassName, String tsElementParentId, String tsElementName)
Create an special object inside an templatelong
createUser(String userName, String password, String firstName, String lastName, boolean enabled, int type, String email, List<Privilege> privileges, long defaultGroupId)
Creates a user.long
createValidatorDefinition(String name, String description, String classToBeApplied, String script, boolean enabled, String userName)
Creates a validator definition.void
deleteBusinessRule(long businessRuleId)
Deletes a business rulevoid
deleteConfigurationVariable(String name, String userName)
Deletes a configuration variablevoid
deleteConfigurationVariablesPool(String poolId, String userName)
Deletes a configuration variables pool.Deleting a pool also deletes the config variables contained withinvoid
deleteFavoritesFolders(long[] favoritesFolderId, long userId)
Delete a Bookmark Folder of an Uservoid
deleteFilterDefinition(long filterId, String className)
Deletes a filter definitionvoid
deleteGeneralViews(List<Long> ids)
Deletes a list of general viewsvoid
deleteGroups(List<Long> oids)
Removes a list of groupsvoid
deleteLayout(long viewId)
Deletes a layout viewvoid
deleteListTypeItem(String className, String oid, boolean realeaseRelationships)
Deletes a list type itemvoid
deleteListTypeItemRelatedLayout(String listTypeItemId, String listTypeItemClass, long viewId)
Deletes a list type item related viewvoid
deleteOSPView(long viewId)
Deletes an existing OSP viewvoid
deletePool(org.neo4j.graphdb.Node poolNode)
void
deletePools(String[] ids)
Deletes a set of pools.void
deleteProcessDefinition(String processDefinitionId)
Deletes a process definitionvoid
deleteProcessInstance(String processInstanceId)
Deletes a process instancevoid
deleteQuery(long queryOid)
Deletes a Queryvoid
deleteScriptedQueriesPool(String scriptedQueriesPoolId)
Deletes a scripted queries pool.void
deleteScriptedQuery(String scriptedQueryId)
Deletes an scripted query given the id.void
deleteScriptedQueryParameter(String scriptedQueryParameterId)
Deletes a scripted query parameter.void
deleteTask(long taskId)
Deletes a task and unsubscribes all users from itChangeDescriptor
deleteTemplateElement(String templateElementClass, String templateElementId)
Deletes an element within a template or a template itself.void
deleteUsers(List<Long> oids)
Removes a list of usersvoid
deleteValidatorDefinition(long validatorDefinitionId, String userName)
Deletes a validator definitionvoid
detachFileFromListTypeItem(long fileObjectId, String className, String objectId)
Releases (and deletes) a file associated to a list type itemHashMap<String,BusinessObjectList>
executeCustomDbCode(String dbCode, boolean needReturn)
Allows to execute custom database queries.List<Properties>
executeCustomScriptedQuery(String queryName, Properties parameters)
This method is the evolution of the deprecatedApplicationEntityManager.executeCustomDbCode(java.lang.String, boolean)
.List<ResultRecord>
executeQuery(ExtendedQuery query)
Used to perform complex queries.ScriptedQueryResult
executeScriptedQuery(String scriptedQueryId, ScriptedQueryParameter... parameters)
Executes the scripted query.TaskResult
executeTask(long taskId)
Executes a task on demand.ActivityDefinition
getActivityDefinition(String processDefinitionId, String activityDefinitionId)
Retrieves a process definitionList<ConfigurationVariable>
getAllConfigurationVariables()
Gets all the configuration variables in the database, no matter what pool they belong to.List<FilterDefinition>
getAllFilterDefinitions(HashMap<String,Object> attributesToFilter, int page, int limit)
Retrieves all the filters created in the inventory.long
getAllFilterDefinitionsCount(HashMap<String,Object> attributesToFilter)
Counts all the Filters definition createdList<ValidatorDefinition>
getAllValidatorDefinitions()
Gets all validator definitions, no matter what class they are related to.ArtifactDefinition
getArtifactDefinitionForActivity(String processDefinitionId, String activityDefinitionId)
Given an activity definition, returns the artifact definition associated to itArtifact
getArtifactForActivity(String processInstanceId, String activityId)
Gets the artifact associated to an activity (for example, a form that was already filled in by a user in a previous, already committed activity)List<ActivityLogEntry>
getBusinessObjectAuditTrail(String objectClass, String objectId, int limit)
Gets a business object audit trailList<BusinessRule>
getBusinessRules(int type)
Retrieves the business rules of a particular type.byte[]
getClassHierachy(boolean showAll)
Get the data model class hierarchy as an XML documentProperties
getConfiguration()
Gets the configuration variables of this managerConfigurationVariable
getConfigurationVariable(String name)
Retrieves a configuration variableList<ConfigurationVariable>
getConfigurationVariablesInPool(String poolId)
Gets the configuration variables in a configuration variable poolList<InventoryObjectPool>
getConfigurationVariablesPools()
Retrieves the list of pools of config variablesList<ConfigurationVariable>
getConfigurationVariablesWithPrefix(String prefix)
Gets the configuration variables with a given prefixObject
getConfigurationVariableValue(String name)
Retrieves only the value of a configuration variable.List<BusinessObjectLight>
getDeviceLayouts()
Gets the list of template elements with a device layoutbyte[]
getDeviceLayoutStructure(String oid, String className)
Gets the device layout structure.FavoritesFolder
getFavoritesFolder(long favoritesFolderId, long userId)
Gets a favorites folderList<FavoritesFolder>
getFavoritesFoldersForObject(long userId, String objectClass, String objectId)
Get the bookmarks where an object is associatedList<FavoritesFolder>
getFavoritesFoldersForUser(long userId)
Get the favorites folders create by an user.FileObject
getFile(long fileObjectId, String className, String objectId)
Retrieves a particular file associated to an inventory list type item.List<FileObjectLight>
getFilesForListTypeItem(String className, String objectId)
Fetches the files associated to an inventory object.List<FilterDefinition>
getFilterDefinitionsForClass(String className, boolean includeParentClassesFilters, boolean ignoreCache, HashMap<String,Object> attributesToFilter, int page, int limit)
For a given class retrieves all its filters definitions (also the filters of its parent classes could be included).long
getFilterDefinitionsForClassCount(String className, boolean includeParentClassesFilters, boolean ignoreCache, HashMap<String,Object> attributesToFilter, int page, int limit)
For a given class name returns the count of the filters definitionsList<ActivityLogEntry>
getGeneralActivityAuditTrail(int page, int limit, HashMap<String,Object> filters)
Retrieves the list of general activity log entrieslong
getGeneralActivityAuditTrailCount(int page, int limit, HashMap<String,Object> filters)
Retrieves the number of general activity log entriesViewObject
getGeneralView(long viewId)
Returns a view of those that are not related to a particular object (i.e.: GIS views)List<ViewObjectLight>
getGeneralViews(String viewClass, int limit)
Allows to retrieve a list of views of a certain type, specifying their classList<GroupProfile>
getGroups()
Retrieves the list of all groupsList<GroupProfileLight>
getGroupsForUser(long userId)
Retrieves the list of groups a user belongs toList<ClassMetadataLight>
getInstanceableListTypes()
Get the possible list typesViewObject
getLayout(long layoutViewId)
Returns a layout view with the given idList<ViewObjectLight>
getLayouts(int limit)
Allows to retrieve a list of all existent layout views.BusinessObject
getListTypeItem(String listTypeClassName, String listTypeItemId)
Retrieves list type item given its idBusinessObjectLight
getListTypeItemForLayout(long layoutViewId)
Returns the list type item related with the given viewList<ViewObjectLight>
getListTypeItemRelatedLayout(String listTypeItemId, String listTypeItemClass, int limit)
Gets the views related to a list type item, such as the default, rack or equipment viewsViewObject
getListTypeItemRelatedLayout(String listTypeItemId, String listTypeItemClass, long viewId)
Gets a view related to a list type item, such as the default, rack or equipment viewsList<BusinessObjectLight>
getListTypeItems(String className)
Retrieves all the items related to a given list typeList<BusinessObjectLight>
getListTypeItemUses(String listTypeItemClass, String listTypeItemId, int limit)
Retrieves the objects that make reference to a given list type itemBusinessObjectLight
getListTypeItemWithName(String listTypeClassName, String listTypeItemName)
Retrieves a list type item given its nameActivityDefinition
getNextActivityForProcessInstance(String processInstanceId)
Requests for the next activity to be executed in a process instance.ViewObject
getObjectRelatedView(String oid, String objectClass, long viewId)
Get a view related to an object, such as the default rack or object viewsList<ViewObjectLight>
getObjectRelatedViews(String oid, String objectClass, int limit)
Get a view related to an object, such as the default, rack or equipment viewsList<BusinessObjectLight>
getObjectsInFavoritesFolder(long favoritesFolderId, long userId, int limit)
Get the object assigned to the bookmarkViewObject
getOSPView(long viewId)
Retrieves the specific information about an existing OSP viewList<ViewObjectLight>
getOSPViews()
Retrieves the existing OSP viewsProcessDefinition
getProcessDefinition(String processDefinitionId)
Retrieves a process definitionList<ProcessDefinition>
getProcessDefinitions()
Gets a process definition instancesProcessInstance
getProcessInstance(String processInstanceId)
Gets a process instanceList<ActivityDefinition>
getProcessInstanceActivitiesPath(String processInstanceId)
Gets Process Instance Activities PathList<ProcessInstance>
getProcessInstances(String processDefinitionId)
Gets a process instances of a process definitionList<CompactQuery>
getQueries(boolean showPublic)
Gets all queriesCompactQuery
getQuery(long queryOid)
Gets a single queryList<ScriptedQuery>
getScriptedQueries(String filterName, boolean ignoreDisabled, int skip, int limit)
Gets a set of scripted queries.List<ScriptedQuery>
getScriptedQueriesByPoolId(String scriptedQueriesPoolId, String filterName, boolean ignoreDisabled, int skip, int limit)
Gets a set of scripted queries in a scripted queries pool the its id.List<ScriptedQuery>
getScriptedQueriesByPoolName(String scriptedQueriesPoolName, String filterName, boolean ignoreDisabled, int skip, int limit)
Gets a set of scripted queries in a scripted queries pool the its name.ScriptedQueriesPool
getScriptedQueriesPool(String scriptedQueriesPoolId)
Gets a scripted queries pool.ScriptedQueriesPool
getScriptedQueriesPoolByName(String scriptedQueriesPoolName)
Gets a scripted queries pool given the name.int
getScriptedQueriesPoolCount(String filterName)
Counts the scripted queries pools.List<ScriptedQueriesPool>
getScriptedQueriesPools(String filterName, int skip, int limit)
Gets a set of scripted queries pools.ScriptedQuery
getScriptedQuery(String scriptedQueryId)
Gets a scripted query given its idint
getScriptedQueryCount(String filterName)
Counts the scripted queries.int
getScriptedQueryCountByPoolId(String scriptedQueriesPoolId, String filterName, boolean ignoreDisabled)
Counts the scripted queries filter by name in a scripted queries pool.int
getScriptedQueryCountByPoolName(String scriptedQueriesPoolName, String filterName)
Counts the scripted queries filter by name in a scripted queries pool.ScriptedQueryParameter
getScriptedQueryParameter(String scriptedQueryParameterId)
Gets an scripted query paramter.List<ScriptedQueryParameter>
getScriptedQueryParameters(String scriptedQueryId)
Gets the scripted query parameters.ConcurrentHashMap<String,Session>
getSessions()
Gets current sessionsList<UserProfileLight>
getSubscribersForTask(long taskId)
Gets the subscribers of a particular taskTask
getTask(long taskId)
Retrieves the information about a particular taskList<Task>
getTasks()
Gets all registered tasksList<Task>
getTasksForUser(long userId)
Gets the tasks associated to a particular userTemplateObject
getTemplateElement(String templateElementClass, String templateElementId)
Retrives all the information of a given template element.List<TemplateObjectLight>
getTemplateElementChildren(String templateElementClass, String templateElementId)
Retrieves the children of a given template element.List<TemplateObjectLight>
getTemplatesForClass(String className)
Gets the templates available for a given classTemplateObjectLight
getTemplateSpecialAttribute(String templateElementId)
Gets the template element to which a specific Template Element is related.List<TemplateObjectLight>
getTemplateSpecialElementChildren(String tsElementClass, String tsElementId)
Retrieves the children of a given template special element.UserProfile
getUserInSession(String sessionId)
Retrieves a user from the session ring given a session idList<UserProfile>
getUsers()
Retrieves the list of all usersList<UserProfile>
getUsersInGroup(long groupId)
Gets all the users in a groupList<ValidatorDefinition>
getValidatorDefinitionsForClass(String className)
Retrieves all the validator definitions in the systemvoid
initCache()
This optional method clears and builds the cache components needed in the current entity manager.boolean
isSessionValid(String username, String token)
Tells if a given pair user-session token is valid.void
releaseListTypeItem(String className, String listTypeItemId)
Release a list type item relationshipsvoid
releaseListTypeItemRelatedLayout(String listTypeItemId, String listTypeItemClass, long viewId)
Release a list type item with a view.void
reloadProcessDefinitions()
Updates the process definitionsvoid
removeObjectFromfavoritesFolder(String objectClass, String objectId, long favoritesFolderId, long userId)
Removes an object associated to a favorites foldervoid
removePrivilegeFromGroup(long groupId, String featureToken)
Removes a privilege from a uservoid
removePrivilegeFromUser(long userId, String featureToken)
Removes a privilege from a uservoid
removeUserFromGroup(long userId, long groupId)
Removes a user from a groupList<Validator>
runValidationsForObject(String objectClass, long objectId)
Runs the existing validations for the class associated to the given object.ChangeDescriptor
saveQuery(long queryOid, String queryName, long ownerOid, byte[] queryStructure, String description)
Updates an existing queryvoid
setConfiguration(Properties properties)
Configuration variables (usually, yet not necessarily read from a config file) that will be used to process some calls (for example file paths or constants).void
setGroupProperties(long id, String groupName, String description)
Set the attributes of a groupvoid
setListTypeItemRelatedLayout(String listTypeItemId, String listTypeItemClass, long viewId)
Relate a list type item with a view.ChangeDescriptor
setPoolProperties(String poolId, String name, String description)
Updates a pool.void
setPrivilegeToGroup(long groupId, String featureToken, int accessLevel)
Sets a privilege to a group.void
setPrivilegeToUser(long userId, String featureToken, int accessLevel)
Sets a privilege to a user.void
setUserProperties(long oid, String userName, String password, String firstName, String lastName, int enabled, int type, String email)
Set the properties of a given user using the id to search for itvoid
setUserProperties(String formerUsername, String newUserName, String password, String firstName, String lastName, int enabled, int type, String email)
Updates the attributes of a user, using its username as key to find itChangeDescriptor
subscribeUserToTask(long userId, long taskId)
Subscribes a user to a task, so it will be notified of the result of its executionChangeDescriptor
unsubscribeUserFromTask(long userId, long taskId)
Unsubscribes a user from a task, so it will no longer be notified about the result of its executionvoid
updateActivity(String processInstanceId, String activityDefinitionId, Artifact artifact)
Updates the artifact generated once an activity has been completed (for example, the user filled in a form).void
updateConfigurationVariable(String name, String propertyToUpdate, String newValue)
Updates the value of a configuration variable.See ##createConfigurationVariable(long, java.lang.String, java.lang.String, int, boolean, java.lang.String)
for value definition syntaxvoid
updateConfigurationVariablesPool(String poolId, String propertyToUpdate, String value, String userName)
Updates an attribute of a given configuration variables poolvoid
updateFavoritesFolder(long favoritesFolderId, long userId, String favoritesFolderName)
Updates a favorites foldervoid
updateFileProperties(long fileObjectId, List<StringPair> properties, String className, String objectId)
Updates the properties of a file list type item (name or tags)void
updateFilterDefinition(long filterId, String name, String description, String className, String script, Boolean enabled)
Updates the properties of a filter, null values will be ignored; when the script of the filter definition its been updated it will tries to compile the script to create a Filter instance, if the compilation fails the filter attribute in the filter definition will remains nullChangeDescriptor
updateGeneralView(long oid, String name, String description, byte[] structure, byte[] background)
Saves a view not related to a particular object.ChangeDescriptor
updateLayout(long viewId, String name, String description, byte[] structure, byte[] background)
Updates a layout view.ChangeDescriptor
updateListTypeItem(String className, String oid, HashMap<String,String> attributes)
Updates a list type item.Formerly this functionality was provided byBusinessEntityManager
updateObject
, but the implementation was split in two methods.ChangeDescriptor
updateListTypeItemRelatedLayout(String listTypeItemId, String listTypeItemClass, long viewId, String name, String description, byte[] structure, byte[] background)
Updates a view for a given list type item.ChangeDescriptor
updateObjectRelatedView(String oid, String objectClass, long viewId, String name, String description, byte[] structure, byte[] background)
Updates a view for a given object.void
updateOSPView(long viewId, String name, String description, byte[] structure)
Updates an existing OSP viewvoid
updateProcessDefinition(String processDefinitionId, List<StringPair> properties, byte[] structure)
Updates a process definition, either its standard properties or its structurevoid
updateProcessInstance(String processInstanceId, String name, String description)
Updates the process instance name and description.void
updateScriptedQueriesPool(String scriptedQueriesPoolId, String name, String description)
Updates a scripted queries pool.void
updateScriptedQuery(String scriptedQueryId, String name, String description, String script, boolean enabled)
Updates a scripted query given its idvoid
updateScriptedQueryParameter(String scriptedQueryParameterId, String name, String description, String type, boolean mandatory, Object defaultValue)
Updates a scripted query parameter.ChangeDescriptor
updateTaskNotificationType(long taskId, TaskNotificationDescriptor notificationType)
Updates a task notification typeChangeDescriptor
updateTaskParameters(long taskId, List<StringPair> parameters)
Updates the parameters of a task.ChangeDescriptor
updateTaskProperties(long taskId, String propertyName, String propertyValue)
Updates any of these properties from a task: name, description, enabled and scriptChangeDescriptor
updateTaskSchedule(long taskId, TaskScheduleDescriptor schedule)
Updates a task scheduleChangeDescriptor
updateTemplateElement(String templateElementClass, String templateElementId, String[] attributeNames, String[] attributeValues)
Updates the value of an attribute of a template element.void
updateValidatorDefinition(long validatorDefinitionId, String name, String description, String classToBeApplied, String script, Boolean enabled, String userName)
Updates the properties of a validator.The null values will be ignoredvoid
validateCall(String methodName, String username)
Checks if a call to a single method can be made by a particular user.void
validateCall(String methodName, String ipAddress, String sessionId)
Validates if a user is allowed to call a given a northbound interface method
-
-
-
Method Detail
-
initCache
public void initCache()
Description copied from interface:AbstractEntityManager
This optional method clears and builds the cache components needed in the current entity manager.- Specified by:
initCache
in interfaceAbstractEntityManager
-
getSessions
public ConcurrentHashMap<String,Session> getSessions()
Description copied from interface:ApplicationEntityManager
Gets current sessions- Specified by:
getSessions
in interfaceApplicationEntityManager
- Returns:
- A dictionary whose keys are the session tokens and the values are the session related objects
-
isSessionValid
public boolean isSessionValid(String username, String token)
Description copied from interface:ApplicationEntityManager
Tells if a given pair user-session token is valid.- Specified by:
isSessionValid
in interfaceApplicationEntityManager
- Parameters:
username
- The user name.token
- The session token.- Returns:
- True if the token exists and corresponds to the given user.
-
validateCall
public void validateCall(String methodName, String username)
Description copied from interface:ApplicationEntityManager
Checks if a call to a single method can be made by a particular user. This is temporary an applicable only to web service calls.- Specified by:
validateCall
in interfaceApplicationEntityManager
- Parameters:
methodName
- The name of the method to be matched.username
- The session attempting to make the call.
-
createUser
public long createUser(String userName, String password, String firstName, String lastName, boolean enabled, int type, String email, List<Privilege> privileges, long defaultGroupId) throws InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Creates a user. System users ("hard-coded" kind of users used for internal tasks that can not be deleted nor modified byu the end users) can only be manipulated (that is, anything but created) by accessing directly to the database- Specified by:
createUser
in interfaceApplicationEntityManager
- Parameters:
userName
- New user's name. Mandatory.password
- New user's passwordfirstName
- New user's first namelastName
- New user's last nameenabled
- Shall the new user be enabled by defaulttype
- User type. See UserProfileLight.USER_TYPE_* for possible valuesemail
- New user's emailprivileges
- New user's privileges. Use null for nonedefaultGroupId
- Default group this user will be associated to- Returns:
- The id of the newly created user
- Throws:
InvalidArgumentException
- If the username is null or empty or the username already exists, if the user type is invalid or if the password is an empty string.
-
setUserProperties
public void setUserProperties(long oid, String userName, String password, String firstName, String lastName, int enabled, int type, String email) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Set the properties of a given user using the id to search for it- Specified by:
setUserProperties
in interfaceApplicationEntityManager
- Parameters:
oid
- User iduserName
- New user's name. Use null to leave it unchangedpassword
- New user's password. Use null to leave it unchangedfirstName
- New user's first name. Use null to leave it unchangedlastName
- New user's last name. Use null to leave it unchangedenabled
- 0 for false, 1 for true, -1 to leave it unchangedtype
- User type. See UserProfile.USER_TYPE* for possible values. Use -1 to leave it unchangedemail
- New user's email. Use null to leave it unchanged- Throws:
InvalidArgumentException
- If the username is null or empty or the username already exists, if the user type is invalid or if the password is an empty string, or if it is attempted to change the user name of the admin user name, or if this operation is attempted on a system user. Also, if the new user type is invalid.ApplicationObjectNotFoundException
- If the user could not be found
-
setUserProperties
public void setUserProperties(String formerUsername, String newUserName, String password, String firstName, String lastName, int enabled, int type, String email) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Updates the attributes of a user, using its username as key to find it- Specified by:
setUserProperties
in interfaceApplicationEntityManager
- Parameters:
formerUsername
- Current user namenewUserName
- New name. Null if unchangedpassword
- Password. Null if unchangedfirstName
- User's first name. Null if unchangedlastName
- User's last name. Null if unchangedenabled
- 0 for false, 1 for true, -1 to leave it unchangedtype
- User type. See UserProfile.USER_TYPE* for possible values. -1 to leave it unchangedemail
- User's email. Null if unchanged- Throws:
InvalidArgumentException
- If the username is null or empty or the username already exists, if the user type is invalid or if the password is an empty string, or if it is attempted to change the user name of the admin user name, or if this operation is attempted on a system user. Also, if the new user type is invalid.ApplicationObjectNotFoundException
- If the user could not be found
-
addUserToGroup
public void addUserToGroup(long userId, long groupId) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Adds a user to a group- Specified by:
addUserToGroup
in interfaceApplicationEntityManager
- Parameters:
userId
- The id of the user to be added to the groupgroupId
- Id of the group which the user will be added to- Throws:
InvalidArgumentException
- If the user is already related to that group.ApplicationObjectNotFoundException
- If the user or group can not be found
-
removeUserFromGroup
public void removeUserFromGroup(long userId, long groupId) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Removes a user from a group- Specified by:
removeUserFromGroup
in interfaceApplicationEntityManager
- Parameters:
userId
- The id of the user to be added to the groupgroupId
- Id of the group which the user will be added to- Throws:
InvalidArgumentException
- If the user is not related to that groupApplicationObjectNotFoundException
- If the user or the group could not be found
-
setPrivilegeToUser
public void setPrivilegeToUser(long userId, String featureToken, int accessLevel) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Sets a privilege to a user. If the feature token provided already has been assigned to the user, the access level will be changed, otherwise, a privilege will be created- Specified by:
setPrivilegeToUser
in interfaceApplicationEntityManager
- Parameters:
userId
- The user IdfeatureToken
- The feature token. See class Privilege for details. Note that this token must match to the one expected by the client application. That's the only way the correct features will be enabled.accessLevel
- The feature token. See class Privilege.ACCESS_LEVEL* for details.- Throws:
InvalidArgumentException
- If the access level is invalid or if the featureToken has a wrong formatApplicationObjectNotFoundException
- If the user could not be found.
-
setPrivilegeToGroup
public void setPrivilegeToGroup(long groupId, String featureToken, int accessLevel) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Sets a privilege to a group. If the feature token provided already has been assigned to the group, the access level will be changed, otherwise, a privilege will be created- Specified by:
setPrivilegeToGroup
in interfaceApplicationEntityManager
- Parameters:
groupId
- The group IdfeatureToken
- The feature token. See class Privilege for details. Note that this token must match to the one expected by the client application. That's the only way the correct features will be enabled.accessLevel
- The feature token. See class Privilege.ACCESS_LEVEL* for details.- Throws:
InvalidArgumentException
- If the access level is invalid or if the featureToken has a wrong formatApplicationObjectNotFoundException
- If the group could not be found
-
removePrivilegeFromUser
public void removePrivilegeFromUser(long userId, String featureToken) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Removes a privilege from a user- Specified by:
removePrivilegeFromUser
in interfaceApplicationEntityManager
- Parameters:
userId
- Id of the userfeatureToken
- The feature token. See class Privilege for details.- Throws:
InvalidArgumentException
- If the feature token is not related to the userApplicationObjectNotFoundException
- If the user could not be found
-
removePrivilegeFromGroup
public void removePrivilegeFromGroup(long groupId, String featureToken) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Removes a privilege from a user- Specified by:
removePrivilegeFromGroup
in interfaceApplicationEntityManager
- Parameters:
groupId
- Id of the groupfeatureToken
- The feature token. See class Privilege for details.- Throws:
InvalidArgumentException
- If the feature token is not related to the groupApplicationObjectNotFoundException
- If the group could not be found
-
createGroup
public long createGroup(String groupName, String description, List<Long> users) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Creates a group- Specified by:
createGroup
in interfaceApplicationEntityManager
- Parameters:
groupName
- The group namedescription
- The group descriptionusers
- users who belong the group- Returns:
- The new group id.
- Throws:
InvalidArgumentException
- if there's already a group with that nameApplicationObjectNotFoundException
- If any of the provided users could not be found
-
getUsers
public List<UserProfile> getUsers()
Description copied from interface:ApplicationEntityManager
Retrieves the list of all users- Specified by:
getUsers
in interfaceApplicationEntityManager
- Returns:
- The list of users
-
getGroups
public List<GroupProfile> getGroups()
Description copied from interface:ApplicationEntityManager
Retrieves the list of all groups- Specified by:
getGroups
in interfaceApplicationEntityManager
- Returns:
- An array of GroupProfile
-
setGroupProperties
public void setGroupProperties(long id, String groupName, String description) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Set the attributes of a group- Specified by:
setGroupProperties
in interfaceApplicationEntityManager
- Parameters:
id
- The oid of the group.groupName
- The name of the group. Use null to leave the old value.description
- The description of the group. Use null to leave the old value.- Throws:
InvalidArgumentException
- If any of the privileges ids is invalid.ApplicationObjectNotFoundException
- If the group could not be found.
-
deleteUsers
public void deleteUsers(List<Long> oids) throws ApplicationObjectNotFoundException, InvalidArgumentException, OperationNotPermittedException
Description copied from interface:ApplicationEntityManager
Removes a list of users- Specified by:
deleteUsers
in interfaceApplicationEntityManager
- Parameters:
oids
- The ids of the users to be deleted.- Throws:
ApplicationObjectNotFoundException
- If any of the users could not be found.InvalidArgumentException
- If any of the users is the default administrator, which can't be deletedOperationNotPermittedException
-
deleteGroups
public void deleteGroups(List<Long> oids) throws ApplicationObjectNotFoundException, InvalidArgumentException, OperationNotPermittedException
Description copied from interface:ApplicationEntityManager
Removes a list of groups- Specified by:
deleteGroups
in interfaceApplicationEntityManager
- Parameters:
oids
- The oid of the groups to delete.- Throws:
ApplicationObjectNotFoundException
- If any of the groups could not be found.InvalidArgumentException
- If the group you are trying to delete contains the default administratorOperationNotPermittedException
-
createListTypeItem
public String createListTypeItem(String className, String name, String displayName) throws MetadataObjectNotFoundException, InvalidArgumentException, OperationNotPermittedException
Description copied from interface:ApplicationEntityManager
Creates a list type item- Specified by:
createListTypeItem
in interfaceApplicationEntityManager
- Parameters:
className
- List typename
- new item's namedisplayName
- new item's display name- Returns:
- new item's id
- Throws:
MetadataObjectNotFoundException
- if className is not an existing classInvalidArgumentException
- if the class provided is not a list typeOperationNotPermittedException
- If the class is abstract or marked as in design.
-
updateListTypeItem
public ChangeDescriptor updateListTypeItem(String className, String oid, HashMap<String,String> attributes) throws MetadataObjectNotFoundException, ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Updates a list type item.Formerly this functionality was provided byBusinessEntityManager
updateObject
, but the implementation was split in two methods.- Specified by:
updateListTypeItem
in interfaceApplicationEntityManager
- Parameters:
className
- The class of the LTI to be updated. it must be a subclass of GenericObjectListoid
- The id of the LTI to be updated.attributes
- The attributes to be changed.- Returns:
- The summary of the changes made.
- Throws:
MetadataObjectNotFoundException
- If the list type does not exist.ApplicationObjectNotFoundException
- If the LTI does not exist.InvalidArgumentException
- If the class provided is not a subclass of GenericObjectList.
-
deleteListTypeItem
public void deleteListTypeItem(String className, String oid, boolean realeaseRelationships) throws MetadataObjectNotFoundException, OperationNotPermittedException, BusinessObjectNotFoundException, InvalidArgumentException, NotAuthorizedException
Description copied from interface:ApplicationEntityManager
Deletes a list type item- Specified by:
deleteListTypeItem
in interfaceApplicationEntityManager
- Parameters:
className
- List type item classoid
- list type item oidrealeaseRelationships
- Should the relationships be released- Throws:
MetadataObjectNotFoundException
- if the class name is not validOperationNotPermittedException
- if the object has relationshipsBusinessObjectNotFoundException
- if the list type item can't be foundInvalidArgumentException
- If the class provided is not a list typeNotAuthorizedException
- If the user can't delete a list type item
-
releaseListTypeItem
public void releaseListTypeItem(String className, String listTypeItemId) throws MetadataObjectNotFoundException, OperationNotPermittedException, BusinessObjectNotFoundException, InvalidArgumentException, NotAuthorizedException
Description copied from interface:ApplicationEntityManager
Release a list type item relationships- Specified by:
releaseListTypeItem
in interfaceApplicationEntityManager
- Parameters:
className
- list type item class namelistTypeItemId
- list type item oid- Throws:
MetadataObjectNotFoundException
- if the class name is not validOperationNotPermittedException
- if the object has relationshipsBusinessObjectNotFoundException
- if the list type item can't be foundInvalidArgumentException
- If the class provided is not a list typeNotAuthorizedException
- If the user can't delete a list type item
-
getListTypeItems
public List<BusinessObjectLight> getListTypeItems(String className) throws MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Retrieves all the items related to a given list type- Specified by:
getListTypeItems
in interfaceApplicationEntityManager
- Parameters:
className
- list type- Returns:
- A list of RemoteBusinessObjectLight instances representing the items
- Throws:
MetadataObjectNotFoundException
- if className is not an existing classInvalidArgumentException
- if the class provided is not a list type
-
getListTypeItem
public BusinessObject getListTypeItem(String listTypeClassName, String listTypeItemId) throws MetadataObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Retrieves list type item given its id- Specified by:
getListTypeItem
in interfaceApplicationEntityManager
- Parameters:
listTypeClassName
- The class name of list type itemlistTypeItemId
- The id of list type item- Returns:
- A RemoteBusinessObjectLight instance representing the item
- Throws:
MetadataObjectNotFoundException
- If the list type class Name is not an existing classInvalidArgumentException
- if the list type class name provided is not a list typeApplicationObjectNotFoundException
- If the the item id can not be found
-
getListTypeItemWithName
public BusinessObjectLight getListTypeItemWithName(String listTypeClassName, String listTypeItemName) throws MetadataObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Retrieves a list type item given its name- Specified by:
getListTypeItemWithName
in interfaceApplicationEntityManager
- Parameters:
listTypeClassName
- The class name of list type itemlistTypeItemName
- The name of list type item- Returns:
- A RemoteBusinessObjectLight instance representing the item
- Throws:
MetadataObjectNotFoundException
- If the list type class Name is not an existing classInvalidArgumentException
- if the list type class name provided is not a list typeApplicationObjectNotFoundException
- If the the item id can not be found
-
getInstanceableListTypes
public List<ClassMetadataLight> getInstanceableListTypes() throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Get the possible list types- Specified by:
getInstanceableListTypes
in interfaceApplicationEntityManager
- Returns:
- A list of ClassMetadataLight instances representing the possible list types
- Throws:
ApplicationObjectNotFoundException
- if the GenericObjectList class does not exist
-
createListTypeItemRelatedLayout
public long createListTypeItemRelatedLayout(String listTypeItemId, String listTypeItemClassName, String viewClassName, String name, String description, byte[] structure, byte[] background) throws MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Creates a view for a given list type item. If there's already a view of the provided view type, it will be overwritten- Specified by:
createListTypeItemRelatedLayout
in interfaceApplicationEntityManager
- Parameters:
listTypeItemId
- list type item idlistTypeItemClassName
- list type item class nameviewClassName
- view class namename
- view namedescription
- view descriptionstructure
- XML document with the view structurebackground
- background image- Returns:
- The id of the new view.
- Throws:
MetadataObjectNotFoundException
- if the list type item class can not be foundInvalidArgumentException
- if the view type is not supported
-
getLayouts
public List<ViewObjectLight> getLayouts(int limit) throws InvalidArgumentException, NotAuthorizedException
Description copied from interface:ApplicationEntityManager
Allows to retrieve a list of all existent layout views.- Specified by:
getLayouts
in interfaceApplicationEntityManager
- Parameters:
limit
- The limit of results. -1 for all- Returns:
- The list of views
- Throws:
InvalidArgumentException
- If the view class does not existNotAuthorizedException
- If the user is not allowed to query for general views
-
getLayout
public ViewObject getLayout(long layoutViewId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Returns a layout view with the given id- Specified by:
getLayout
in interfaceApplicationEntityManager
- Parameters:
layoutViewId
- view id- Returns:
- An object representing the view
- Throws:
ApplicationObjectNotFoundException
- If the requested view is not found
-
getListTypeItemForLayout
public BusinessObjectLight getListTypeItemForLayout(long layoutViewId) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Returns the list type item related with the given view- Specified by:
getListTypeItemForLayout
in interfaceApplicationEntityManager
- Parameters:
layoutViewId
- view id- Returns:
- An object representing the list type item
- Throws:
ApplicationObjectNotFoundException
- If the given view is not foundInvalidArgumentException
- if the object cannot be created from the list type item node
-
createLayout
public long createLayout(String viewClassName, String name, String description, byte[] structure, byte[] background) throws InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Creates a new layout view. Creates a new Layout view with the given data- Specified by:
createLayout
in interfaceApplicationEntityManager
- Parameters:
viewClassName
- view class namename
- view namedescription
- view descriptionstructure
- XML document with the view structurebackground
- background image- Returns:
- The id of the new view.
- Throws:
InvalidArgumentException
- if the view type is not supported
-
setListTypeItemRelatedLayout
public void setListTypeItemRelatedLayout(String listTypeItemId, String listTypeItemClass, long viewId) throws ApplicationObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Relate a list type item with a view. Creates a relationship between the given list type and layout view.- Specified by:
setListTypeItemRelatedLayout
in interfaceApplicationEntityManager
- Parameters:
listTypeItemId
- list type item idlistTypeItemClass
- list type item class nameviewId
- the view id- Throws:
ApplicationObjectNotFoundException
- if the view does not existMetadataObjectNotFoundException
- if the list type item class can not be foundInvalidArgumentException
- if the view type is not supported
-
releaseListTypeItemRelatedLayout
public void releaseListTypeItemRelatedLayout(String listTypeItemId, String listTypeItemClass, long viewId) throws MetadataObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Release a list type item with a view. Deletes a relationship between the given list type and layout view.- Specified by:
releaseListTypeItemRelatedLayout
in interfaceApplicationEntityManager
- Parameters:
listTypeItemId
- list type item idlistTypeItemClass
- list type item class nameviewId
- the view id- Throws:
MetadataObjectNotFoundException
- if the list type item class can not be foundInvalidArgumentException
- if the view type is not supportedApplicationObjectNotFoundException
- if the view does not exist
-
updateListTypeItemRelatedLayout
public ChangeDescriptor updateListTypeItemRelatedLayout(String listTypeItemId, String listTypeItemClass, long viewId, String name, String description, byte[] structure, byte[] background) throws MetadataObjectNotFoundException, InvalidArgumentException, BusinessObjectNotFoundException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Updates a view for a given list type item. If there's already a view of the provided view type, it will be overwritten- Specified by:
updateListTypeItemRelatedLayout
in interfaceApplicationEntityManager
- Parameters:
listTypeItemId
- list type item idlistTypeItemClass
- list type item classviewId
- viewIdname
- view namedescription
- view descriptionstructure
- XML document with the view structurebackground
- Background image. If null, the previous will be removed, if 0-sized array, it will remain unchanged- Returns:
- The summary of the changes
- Throws:
MetadataObjectNotFoundException
- if the list type item class can not be foundInvalidArgumentException
- if the view type is not supportedBusinessObjectNotFoundException
- if the list type item can not be foundApplicationObjectNotFoundException
- If the view can not be found
-
updateLayout
public ChangeDescriptor updateLayout(long viewId, String name, String description, byte[] structure, byte[] background) throws MetadataObjectNotFoundException, InvalidArgumentException, BusinessObjectNotFoundException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Updates a layout view. Updates the given layout view with the parameters provided.- Specified by:
updateLayout
in interfaceApplicationEntityManager
- Parameters:
viewId
- viewIdname
- view namedescription
- view descriptionstructure
- XML document with the view structurebackground
- Background image. If null, the previous will be removed, if 0-sized array, it will remain unchanged- Returns:
- The summary of the changes
- Throws:
MetadataObjectNotFoundException
- if the list type item class can not be foundInvalidArgumentException
- if the view type is not supportedBusinessObjectNotFoundException
- if the list type item can not be foundApplicationObjectNotFoundException
- If the view can not be found
-
getListTypeItemRelatedLayout
public ViewObject getListTypeItemRelatedLayout(String listTypeItemId, String listTypeItemClass, long viewId) throws MetadataObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Gets a view related to a list type item, such as the default, rack or equipment views- Specified by:
getListTypeItemRelatedLayout
in interfaceApplicationEntityManager
- Parameters:
listTypeItemId
- list type item idlistTypeItemClass
- list type item classviewId
- view id- Returns:
- The associated view (there should be only one of each type). Null if there's none yet
- Throws:
MetadataObjectNotFoundException
- if the corresponding class metadata can not be foundInvalidArgumentException
- if the provided view type is not supportedApplicationObjectNotFoundException
- if the list type item or the view can not be found
-
getListTypeItemRelatedLayout
public List<ViewObjectLight> getListTypeItemRelatedLayout(String listTypeItemId, String listTypeItemClass, int limit) throws MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Gets the views related to a list type item, such as the default, rack or equipment views- Specified by:
getListTypeItemRelatedLayout
in interfaceApplicationEntityManager
- Parameters:
listTypeItemId
- list type item idlistTypeItemClass
- list type class namelimit
- max number of results- Returns:
- The associated views
- Throws:
MetadataObjectNotFoundException
- if the corresponding class metadata can not be foundInvalidArgumentException
- if the provided view type is not supported
-
deleteListTypeItemRelatedLayout
public void deleteListTypeItemRelatedLayout(String listTypeItemId, String listTypeItemClass, long viewId) throws MetadataObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Deletes a list type item related view- Specified by:
deleteListTypeItemRelatedLayout
in interfaceApplicationEntityManager
- Parameters:
listTypeItemId
- list type item idlistTypeItemClass
- list type class nameviewId
- related view id- Throws:
MetadataObjectNotFoundException
- if the list type item class can not be foundInvalidArgumentException
- if the list type item can no be found using the idApplicationObjectNotFoundException
- if the view can not be found
-
deleteLayout
public void deleteLayout(long viewId) throws MetadataObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Deletes a layout view- Specified by:
deleteLayout
in interfaceApplicationEntityManager
- Parameters:
viewId
- related view id- Throws:
MetadataObjectNotFoundException
- if the list type item class can not be foundInvalidArgumentException
- if the list type item can no be found using the idApplicationObjectNotFoundException
- if the view can not be found
-
getListTypeItemUses
public List<BusinessObjectLight> getListTypeItemUses(String listTypeItemClass, String listTypeItemId, int limit) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Retrieves the objects that make reference to a given list type item- Specified by:
getListTypeItemUses
in interfaceApplicationEntityManager
- Parameters:
listTypeItemClass
- The list type classlistTypeItemId
- The list type item idlimit
- The limit of results. Use -1 to retrieve all.- Returns:
- The list of business objects related to the list type item
- Throws:
ApplicationObjectNotFoundException
InvalidArgumentException
-
getDeviceLayouts
public List<BusinessObjectLight> getDeviceLayouts() throws InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Gets the list of template elements with a device layout- Specified by:
getDeviceLayouts
in interfaceApplicationEntityManager
- Returns:
- the list of template elements with a device layout
- Throws:
InvalidArgumentException
- If any template does not have uuid
-
getDeviceLayoutStructure
public byte[] getDeviceLayoutStructure(String oid, String className) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Gets the device layout structure.<deviceLayoutStructure> <device id="" className="" name=""/> ... . . <device id="" className="" name="" parentId=""> <model id="" className="" name=""> <view id="" className=""> <structure> Base64 </structure> </view> </model> </device> ... . . <device id="" className="" name="" parentId=""/> ... . . <device id="" className="" name="" parentId=""> <model id="" className="" name=""> <view id="" className=""> <structure> Base64 </structure> </view> </model> </device> </deviceLayoutStructure>
- Specified by:
getDeviceLayoutStructure
in interfaceApplicationEntityManager
- Parameters:
oid
- object idclassName
- object class- Returns:
- The structure of the device layout
- Throws:
ApplicationObjectNotFoundException
- In case that any of the devices contained within the main one has a malformed model attribute.InvalidArgumentException
- If the structure is somehow malformed.
-
createObjectRelatedView
public long createObjectRelatedView(String oid, String objectClass, String name, String description, String viewClassName, byte[] structure, byte[] background) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
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 interfaceApplicationEntityManager
- Parameters:
oid
- object's oidobjectClass
- object classname
- view namedescription
- view descriptionviewClassName
- view class name (See class ViewObject for details about the supported types)structure
- 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
- background image- Returns:
- The id of the new view.
- Throws:
BusinessObjectNotFoundException
- if the object can not be foundMetadataObjectNotFoundException
- if the object class can not be foundInvalidArgumentException
- if the view type is not supported
-
createGeneralView
public long createGeneralView(String viewClass, String name, String description, byte[] structure, byte[] background) throws InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Creates a view not related to a particular object- Specified by:
createGeneralView
in interfaceApplicationEntityManager
- Parameters:
viewClass
- View classname
- view namedescription
- view descriptionstructure
- XML document specifying the view structure (nodes, edges, control points)background
- Background image- Returns:
- The id of the newly created view
- Throws:
InvalidArgumentException
- if the view type is invalid
-
updateObjectRelatedView
public ChangeDescriptor updateObjectRelatedView(String oid, String objectClass, long viewId, String name, String description, byte[] structure, byte[] background) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
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 interfaceApplicationEntityManager
- Parameters:
oid
- object's oidobjectClass
- object classviewId
- viewIdname
- view namedescription
- view descriptionstructure
- 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
- Background image. If null, the previous will be removed, if 0-sized array, it will remain unchanged- Returns:
- The summary of the changes
- Throws:
BusinessObjectNotFoundException
- if the object can not be foundMetadataObjectNotFoundException
- if the object class can not be foundInvalidArgumentException
- if the view type is not supportedApplicationObjectNotFoundException
- If the view can not be found
-
updateGeneralView
public ChangeDescriptor updateGeneralView(long oid, String name, String description, byte[] structure, byte[] background) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Saves a view not related to a particular object. The view type can not be changed- Specified by:
updateGeneralView
in interfaceApplicationEntityManager
- Parameters:
oid
- View idname
- view name. Null to leave unchangeddescription
- view description. Null to leave unchangedstructure
- XML document specifying the view structure (nodes, edges, control points). Null to leave unchangedbackground
- Background image. If null, the previous will be removed, if 0-sized array, it will remain unchanged- Returns:
- The summary of the changes.
- Throws:
InvalidArgumentException
- if the view type is invalid or if the background could not be saved.ApplicationObjectNotFoundException
- if the view couldn't be found
-
deleteGeneralViews
public void deleteGeneralViews(List<Long> ids) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Deletes a list of general views- Specified by:
deleteGeneralViews
in interfaceApplicationEntityManager
- Parameters:
ids
- The ids of the views to be deleted.- Throws:
ApplicationObjectNotFoundException
- if the view can't be found
-
getObjectRelatedView
public ViewObject getObjectRelatedView(String oid, String objectClass, long viewId) throws ApplicationObjectNotFoundException, BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Get a view related to an object, such as the default rack or object views- Specified by:
getObjectRelatedView
in interfaceApplicationEntityManager
- Parameters:
oid
- object's idobjectClass
- object's classviewId
- view id- Returns:
- The associated view (there should be only one of each type). Null if there's none yet
- Throws:
ApplicationObjectNotFoundException
- if the object or the view can not be foundBusinessObjectNotFoundException
- If the object can not be foundMetadataObjectNotFoundException
- if the corresponding class metadata can not be foundInvalidArgumentException
- if the provided view type is not supported
-
getObjectRelatedViews
public List<ViewObjectLight> getObjectRelatedViews(String oid, String objectClass, int limit) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Get a view related to an object, such as the default, rack or equipment views- Specified by:
getObjectRelatedViews
in interfaceApplicationEntityManager
- Parameters:
oid
- object's idobjectClass
- object's classlimit
- max number of results- Returns:
- The associated views
- Throws:
BusinessObjectNotFoundException
- if the object can not be foundMetadataObjectNotFoundException
- if the corresponding class metadata can not be foundInvalidArgumentException
- if the provided view type is not supported
-
getGeneralViews
public List<ViewObjectLight> getGeneralViews(String viewClass, int limit) throws InvalidArgumentException, NotAuthorizedException
Description copied from interface:ApplicationEntityManager
Allows to retrieve a list of views of a certain type, specifying their class- Specified by:
getGeneralViews
in interfaceApplicationEntityManager
- Parameters:
viewClass
- The class namelimit
- The limit of results. -1 for all- Returns:
- The list of views
- Throws:
InvalidArgumentException
- If the view class does not existNotAuthorizedException
- If the user is not allowed to query for general views
-
getGeneralView
public ViewObject getGeneralView(long viewId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Returns a view of those that are not related to a particular object (i.e.: GIS views)- Specified by:
getGeneralView
in interfaceApplicationEntityManager
- Parameters:
viewId
- view id- Returns:
- An object representing the view
- Throws:
ApplicationObjectNotFoundException
- If the requested view is not found
-
createQuery
public long createQuery(String queryName, long ownerOid, byte[] queryStructure, String description) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Creates a Query- Specified by:
createQuery
in interfaceApplicationEntityManager
- Parameters:
queryName
- The name of the query.ownerOid
- The if of the user that will own the query. Use -1 to make it public.queryStructure
- The structure of the query as an XML document.description
- The description of the query.- Returns:
- The id of the newly created query.
- Throws:
ApplicationObjectNotFoundException
- If the owner could not be found.
-
saveQuery
public ChangeDescriptor saveQuery(long queryOid, String queryName, long ownerOid, byte[] queryStructure, String description) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Updates an existing query- Specified by:
saveQuery
in interfaceApplicationEntityManager
- Parameters:
queryOid
- The id of the queryqueryName
- The name of the query. Leave null to keep the old value.ownerOid
- The id of the user that owns this query. Use -1 to keep the old value.queryStructure
- The structure of the query as an XML document. Leave null to keep the old value.description
- The description of the query. Leave null to keep the old value.- Returns:
- The summary of the changes.
- Throws:
ApplicationObjectNotFoundException
- If the query can not be found.
-
deleteQuery
public void deleteQuery(long queryOid) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Deletes a Query- Specified by:
deleteQuery
in interfaceApplicationEntityManager
- Parameters:
queryOid
- The id of the query.- Throws:
ApplicationObjectNotFoundException
- If the query could not be found
-
getQueries
public List<CompactQuery> getQueries(boolean showPublic)
Description copied from interface:ApplicationEntityManager
Gets all queries- Specified by:
getQueries
in interfaceApplicationEntityManager
- Parameters:
showPublic
- Include public queries or show only the private ones.- Returns:
- The list of queries.
-
getQuery
public CompactQuery getQuery(long queryOid) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Gets a single query- Specified by:
getQuery
in interfaceApplicationEntityManager
- Parameters:
queryOid
- The id of the query.- Returns:
- The query as an object.
- Throws:
ApplicationObjectNotFoundException
- If the query could not be found.
-
executeQuery
public List<ResultRecord> executeQuery(ExtendedQuery query) throws MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Used to perform complex queries. Please note that the first record is reserved for the column headers, so and empty result set will have at least one record.- Specified by:
executeQuery
in interfaceApplicationEntityManager
- Parameters:
query
- The code-friendly representation of the query made using the graphical query builder- Returns:
- a set of objects matching the specified criteria as ResultRecord array
- Throws:
MetadataObjectNotFoundException
- If the class to be search is cannot be foundInvalidArgumentException
- If any instance does not have a uuid
-
getClassHierachy
public byte[] getClassHierachy(boolean showAll) throws MetadataObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Get the data model class hierarchy as an XML document- Specified by:
getClassHierachy
in interfaceApplicationEntityManager
- Returns:
- The class hierarchy as an XML document
- Throws:
MetadataObjectNotFoundException
- If one of the core classes could not be found
-
createRootPool
public String createRootPool(String name, String description, String instancesOfClass, int type) throws MetadataObjectNotFoundException
Description copied from interface:ApplicationEntityManager
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 interfaceApplicationEntityManager
- Parameters:
name
- Pool namedescription
- Pool descriptioninstancesOfClass
- What kind of objects can this pool contain?type
- Type of pool. For possible values see ApplicationManager.POOL_TYPE_XXX- Returns:
- The id of the new pool
- Throws:
MetadataObjectNotFoundException
- If instancesOfClass is not a valid subclass of InventoryObject
-
createPoolInObject
public String createPoolInObject(String parentClassname, String parentId, String name, String description, String instancesOfClass, int type) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException
Description copied from interface:ApplicationEntityManager
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 interfaceApplicationEntityManager
- Parameters:
parentClassname
- Class name of the parent objectparentId
- Id of the parent objectname
- Pool namedescription
- Pool descriptioninstancesOfClass
- What kind of objects can this pool contain?type
- Type of pool. For possible values see ApplicationManager.POOL_TYPE_XXX- Returns:
- The id of the new pool
- Throws:
MetadataObjectNotFoundException
- If instancesOfClass is not a valid subclass of InventoryObjectBusinessObjectNotFoundException
- If the parent object can not be found
-
createPoolInPool
public String createPoolInPool(String parentId, String name, String description, String instancesOfClass, int type) throws MetadataObjectNotFoundException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
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 interfaceApplicationEntityManager
- Parameters:
parentId
- Id of the parent poolname
- Pool namedescription
- Pool descriptioninstancesOfClass
- 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- Returns:
- The id of the new pool
- Throws:
MetadataObjectNotFoundException
- If instancesOfClass is not a valid subclass of InventoryObjectApplicationObjectNotFoundException
- If the parent object can not be found
-
deletePools
public void deletePools(String[] ids) throws ApplicationObjectNotFoundException, OperationNotPermittedException
Description copied from interface:ApplicationEntityManager
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 interfaceApplicationEntityManager
- Parameters:
ids
- the list of ids from the objects to be deleted- Throws:
ApplicationObjectNotFoundException
- If any of the pools to be deleted couldn't be foundOperationNotPermittedException
- If any of the objects in the pool can not be deleted because it's not a business related instance (it's more a security restriction)
-
setPoolProperties
public ChangeDescriptor setPoolProperties(String poolId, String name, String description)
Description copied from interface:ApplicationEntityManager
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 interfaceApplicationEntityManager
- Parameters:
poolId
- Pool Idname
- Pool name. If null, this field will remain unchangeddescription
- Pool description. If null, this field will remain unchanged- Returns:
- The summary of the changes.
-
getBusinessObjectAuditTrail
public List<ActivityLogEntry> getBusinessObjectAuditTrail(String objectClass, String objectId, int limit) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Gets a business object audit trail- Specified by:
getBusinessObjectAuditTrail
in interfaceApplicationEntityManager
- Parameters:
objectClass
- Object classobjectId
- Object idlimit
- Max number of results to be shown- Returns:
- The list of activity entries
- Throws:
BusinessObjectNotFoundException
- If the object can not be foundMetadataObjectNotFoundException
- If the provided class couldn't be foundInvalidArgumentException
- If the class provided is not subclass of InventoryObject
-
getGeneralActivityAuditTrailCount
public long getGeneralActivityAuditTrailCount(int page, int limit, HashMap<String,Object> filters)
Description copied from interface:ApplicationEntityManager
Retrieves the number of general activity log entries- Specified by:
getGeneralActivityAuditTrailCount
in interfaceApplicationEntityManager
- Parameters:
page
- current pagelimit
- limit of results per page. 0 to retrieve them allfilters
- 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.- Returns:
- The number of activity log entries.
-
getGeneralActivityAuditTrail
public List<ActivityLogEntry> getGeneralActivityAuditTrail(int page, int limit, HashMap<String,Object> filters)
Description copied from interface:ApplicationEntityManager
Retrieves the list of general activity log entries- Specified by:
getGeneralActivityAuditTrail
in interfaceApplicationEntityManager
- Parameters:
page
- current pagelimit
- limit of results per page. 0 to retrieve them allfilters
- 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.- Returns:
- The list of activity log entries. The entries are sorted by creation date in descending order.
-
validateCall
public void validateCall(String methodName, String ipAddress, String sessionId) throws NotAuthorizedException
Description copied from interface:ApplicationEntityManager
Validates if a user is allowed to call a given a northbound interface method- Specified by:
validateCall
in interfaceApplicationEntityManager
- Parameters:
methodName
- The method to check if the user is allowed to call it.ipAddress
- The IP address the method is being invoked fromsessionId
- The session token- Throws:
NotAuthorizedException
- If the user is not allowed to invoke the method
-
createSession
public Session createSession(String userName, String password, int sessionType) throws ApplicationObjectNotFoundException, NotAuthorizedException
Description copied from interface:ApplicationEntityManager
Creates a session. System users can not create sessions.- Specified by:
createSession
in interfaceApplicationEntityManager
- Parameters:
userName
- User namepassword
- PasswordsessionType
- The type of session to be created. This type depends on what kind of client is trying to access (a desktop client, a web client, a web service user, etc. See Session.TYPE_XXX for possible session types- Returns:
- A session object with information about the session itself plus information about the user
- Throws:
ApplicationObjectNotFoundException
- If the user does not existNotAuthorizedException
- If the password is incorrect or if the user is not enabled, or if a system user is used to create the session.
-
getUserInSession
public UserProfile getUserInSession(String sessionId)
Description copied from interface:ApplicationEntityManager
Retrieves a user from the session ring given a session id- Specified by:
getUserInSession
in interfaceApplicationEntityManager
- Parameters:
sessionId
- The session token- Returns:
- The user associated to a given session
-
getUsersInGroup
public List<UserProfile> getUsersInGroup(long groupId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Gets all the users in a group- Specified by:
getUsersInGroup
in interfaceApplicationEntityManager
- Parameters:
groupId
- The id of the group- Returns:
- The list of users in that group
- Throws:
ApplicationObjectNotFoundException
- If the group could not be found.
-
getGroupsForUser
public List<GroupProfileLight> getGroupsForUser(long userId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Retrieves the list of groups a user belongs to- Specified by:
getGroupsForUser
in interfaceApplicationEntityManager
- Parameters:
userId
- The id of the user- Returns:
- The list of groups for this user
- Throws:
ApplicationObjectNotFoundException
- If the user could not be found
-
closeSession
public void closeSession(String sessionId) throws NotAuthorizedException
Description copied from interface:ApplicationEntityManager
Closes a session,- Specified by:
closeSession
in interfaceApplicationEntityManager
- Parameters:
sessionId
- The session id- Throws:
NotAuthorizedException
- If the session ID is Invalid.
-
setConfiguration
public void setConfiguration(Properties properties)
Description copied from interface:AbstractEntityManager
Configuration variables (usually, yet not necessarily read from a config file) that will be used to process some calls (for example file paths or constants).- Specified by:
setConfiguration
in interfaceAbstractEntityManager
- Parameters:
properties
- The set of properties. Each EM should document its variables and what are their default values.
-
getConfiguration
public Properties getConfiguration()
Description copied from interface:ApplicationEntityManager
Gets the configuration variables of this manager- Specified by:
getConfiguration
in interfaceApplicationEntityManager
- Returns:
- A Properties object with the configuration variables
-
createGeneralActivityLogEntry
public void createGeneralActivityLogEntry(String userName, int type, String notes) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Creates a general activity log entry, that is, an entry that is not associated to a particular object- Specified by:
createGeneralActivityLogEntry
in interfaceApplicationEntityManager
- Parameters:
userName
- User that performed the actiontype
- Type of action. See class ActivityLogEntry for possible valuesnotes
- Optional additional notes related to the action. The Id of the element, if it was created/deleted. Null if no notes should be added- Throws:
ApplicationObjectNotFoundException
- If the log root node could not be found
-
createGeneralActivityLogEntry
public void createGeneralActivityLogEntry(String userName, int type, ChangeDescriptor changeDescriptor) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Creates a general activity log entry, that is, an entry that is not associated to a particular object- Specified by:
createGeneralActivityLogEntry
in interfaceApplicationEntityManager
- Parameters:
userName
- User that performed the actiontype
- Type of action. See class ActivityLogEntry for possible valueschangeDescriptor
- The descriptor with all the changes performed by the method- Throws:
ApplicationObjectNotFoundException
- If the log root node could not be found
-
createObjectActivityLogEntry
public long createObjectActivityLogEntry(String userName, String className, String oid, int type, String affectedProperties, String oldValues, String newValues, String notes) throws ApplicationObjectNotFoundException, BusinessObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Creates an object activity log entry, that is, an entry that is directly related to an object, such as the modification of the value of an attribute- Specified by:
createObjectActivityLogEntry
in interfaceApplicationEntityManager
- Parameters:
userName
- User that performs the operationclassName
- The class of the object being modifiedoid
- The oid of the object being modifiedtype
- The type of action. See ActivityLogEntry class for possible valuesaffectedProperties
- Properties that were affected. Normally, they're separated by spaces, but it's not requiredoldValues
- Old values. Normally, they're separated by spaces, but it's not requirednewValues
- New values. Normally, they're separated by spaces, but it's not requirednotes
- Additional notes associated with the change- Returns:
- The id of the object activity log entry
- Throws:
ApplicationObjectNotFoundException
- If the object activity log could no be foundBusinessObjectNotFoundException
- If the modified object itself could not be found
-
createObjectActivityLogEntry
public void createObjectActivityLogEntry(String userName, String className, String oid, int type, ChangeDescriptor changeDescriptor) throws ApplicationObjectNotFoundException, BusinessObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Creates an object activity log entry, that is, an entry that is directly related to an object, such as the modification of the value of an attribute- Specified by:
createObjectActivityLogEntry
in interfaceApplicationEntityManager
- Parameters:
userName
- User that performs the operationclassName
- The class of the object being modifiedoid
- The oid of the object being modifiestype
- The type of action. See ActivityLogEntry class for possible valueschangeDescriptor
- The summary of the changes that were done- Throws:
ApplicationObjectNotFoundException
- If the object activity log could no be foundBusinessObjectNotFoundException
- If the modified object itself could not be found
-
createTask
public long createTask(String name, String description, boolean enabled, boolean commitOnExecute, String script, List<StringPair> parameters, TaskScheduleDescriptor schedule, TaskNotificationDescriptor notificationType)
Description copied from interface:ApplicationEntityManager
Creates and schedule a task. A task is an application entity that allows to run jobs that will be executed depending on certain schedule- Specified by:
createTask
in interfaceApplicationEntityManager
- Parameters:
name
- Task namedescription
- Task descriptionenabled
- Is the task enabled?commitOnExecute
- Should this task commit the changes made (if any) after executing it?script
- The script to be executedparameters
- The parameters for the scriptschedule
- When the task should be executednotificationType
- How the result of the task should be notified to the associated users- Returns:
- The id of the newly created task
-
updateTaskProperties
public ChangeDescriptor updateTaskProperties(long taskId, String propertyName, String propertyValue) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Updates any of these properties from a task: name, description, enabled and script- Specified by:
updateTaskProperties
in interfaceApplicationEntityManager
- Parameters:
taskId
- Task idpropertyName
- Property name. Possible values: "name", "description", "enabled" and "script"propertyValue
- The value of the property. For the property "enabled", the allowed values are "true" and "false"- Returns:
- The summary of the changes
- Throws:
ApplicationObjectNotFoundException
- If the task could not be foundInvalidArgumentException
- If the property name has an invalid value
-
updateTaskParameters
public ChangeDescriptor updateTaskParameters(long taskId, List<StringPair> parameters) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Updates the parameters of a task. If any of the values is null, that parameter will be deleted, if the parameter does not exist, it will be created- Specified by:
updateTaskParameters
in interfaceApplicationEntityManager
- Parameters:
taskId
- Task idparameters
- The parameters to be modified as pairs paramName/paramValue- Returns:
- The summary of the changes
- Throws:
ApplicationObjectNotFoundException
- If the task could not be found
-
updateTaskSchedule
public ChangeDescriptor updateTaskSchedule(long taskId, TaskScheduleDescriptor schedule) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Updates a task schedule- Specified by:
updateTaskSchedule
in interfaceApplicationEntityManager
- Parameters:
taskId
- Task idschedule
- New schedule- Returns:
- The summary of the changes
- Throws:
ApplicationObjectNotFoundException
- If the task could not be found
-
updateTaskNotificationType
public ChangeDescriptor updateTaskNotificationType(long taskId, TaskNotificationDescriptor notificationType) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Updates a task notification type- Specified by:
updateTaskNotificationType
in interfaceApplicationEntityManager
- Parameters:
taskId
- Task idnotificationType
- New notification type- Returns:
- The summary of the changes
- Throws:
ApplicationObjectNotFoundException
- If the task could not be found
-
deleteTask
public void deleteTask(long taskId) throws ApplicationObjectNotFoundException, OperationNotPermittedException
Description copied from interface:ApplicationEntityManager
Deletes a task and unsubscribes all users from it- Specified by:
deleteTask
in interfaceApplicationEntityManager
- Parameters:
taskId
- Task id- Throws:
ApplicationObjectNotFoundException
- If the task could not be foundOperationNotPermittedException
-
subscribeUserToTask
public ChangeDescriptor subscribeUserToTask(long userId, long taskId) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Subscribes a user to a task, so it will be notified of the result of its execution- Specified by:
subscribeUserToTask
in interfaceApplicationEntityManager
- Parameters:
userId
- Id of the usertaskId
- Id of the task- Returns:
- The summary of the changes
- Throws:
ApplicationObjectNotFoundException
- If the task or the user could not be foundInvalidArgumentException
- If the user is already subscribed to the task
-
unsubscribeUserFromTask
public ChangeDescriptor unsubscribeUserFromTask(long userId, long taskId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Unsubscribes a user from a task, so it will no longer be notified about the result of its execution- Specified by:
unsubscribeUserFromTask
in interfaceApplicationEntityManager
- Parameters:
userId
- Id of the usertaskId
- Id of the task- Returns:
- The summary of the changes
- Throws:
ApplicationObjectNotFoundException
- If the task or the user could not be found
-
getTask
public Task getTask(long taskId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Retrieves the information about a particular task- Specified by:
getTask
in interfaceApplicationEntityManager
- Parameters:
taskId
- Id of the task- Returns:
- A remote task object representing the task
- Throws:
ApplicationObjectNotFoundException
- If the task could not be found
-
getSubscribersForTask
public List<UserProfileLight> getSubscribersForTask(long taskId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Gets the subscribers of a particular task- Specified by:
getSubscribersForTask
in interfaceApplicationEntityManager
- Parameters:
taskId
- task id- Returns:
- The list of users subscribers to the task identified with the id taskId
- Throws:
ApplicationObjectNotFoundException
- Id the task could not be found
-
getTasks
public List<Task> getTasks()
Description copied from interface:ApplicationEntityManager
Gets all registered tasks- Specified by:
getTasks
in interfaceApplicationEntityManager
- Returns:
- A list with the task objects
-
getTasksForUser
public List<Task> getTasksForUser(long userId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Gets the tasks associated to a particular user- Specified by:
getTasksForUser
in interfaceApplicationEntityManager
- Parameters:
userId
- Id if the user- Returns:
- A list with the task objects
- Throws:
ApplicationObjectNotFoundException
- If the user can not be found
-
executeTask
public TaskResult executeTask(long taskId) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Executes a task on demand. The task may have user-defined parameters that must be set usingApplicationEntityManager.updateTaskParameters(long, java.util.List)
before running the task.- Specified by:
executeTask
in interfaceApplicationEntityManager
- Parameters:
taskId
- Id of the task. Could be known by callingApplicationEntityManager.getTasks()
first.- Returns:
- An
TaskResult
instance representing the task result. - Throws:
ApplicationObjectNotFoundException
- If the task could not be found.InvalidArgumentException
- If the task doesn't have a script.
-
createTemplate
public String createTemplate(String templateClass, String templateName) throws MetadataObjectNotFoundException, OperationNotPermittedException
Description copied from interface:ApplicationEntityManager
Creates a template.- Specified by:
createTemplate
in interfaceApplicationEntityManager
- Parameters:
templateClass
- The class you want to create a template for.templateName
- The name of the template. It can not be null.- Returns:
- The id of the newly created template.
- Throws:
MetadataObjectNotFoundException
- If the provided class does not existOperationNotPermittedException
- If the template class is abstract.
-
createTemplateElement
public String createTemplateElement(String templateElementClass, String templateElementParentClassName, String templateElementParentId, String templateElementName) throws MetadataObjectNotFoundException, ApplicationObjectNotFoundException, OperationNotPermittedException
Description copied from interface:ApplicationEntityManager
Creates an object inside a template.- Specified by:
createTemplateElement
in interfaceApplicationEntityManager
- Parameters:
templateElementClass
- Class of the object you want to create.templateElementParentClassName
- Class of the parent to the object you want to create.templateElementParentId
- Id of the parent to the object you want to create.templateElementName
- Name of the element.- Returns:
- The id of the new object.
- Throws:
MetadataObjectNotFoundException
- If the object (or its parent) class could not be foundApplicationObjectNotFoundException
- If the parent object could not be foundOperationNotPermittedException
- If the class provided to create the new element from is abstract.
-
createTemplateSpecialElement
public String createTemplateSpecialElement(String tsElementClass, String tsElementParentClassName, String tsElementParentId, String tsElementName) throws OperationNotPermittedException, MetadataObjectNotFoundException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Create an special object inside an template- Specified by:
createTemplateSpecialElement
in interfaceApplicationEntityManager
- Parameters:
tsElementClass
- Template special element classtsElementParentClassName
- Template special element parent class nametsElementParentId
- Template special element parent IdtsElementName
- Template special element name- Returns:
- The id of the new object
- Throws:
OperationNotPermittedException
- If the element class are not a possible special child of the element parent class Or if the element class given are abstractMetadataObjectNotFoundException
- If the element class or element parent class can not be foundApplicationObjectNotFoundException
- If the element parent can no be found
-
createBulkTemplateElement
public String[] createBulkTemplateElement(String templateElementClassName, String templateElementParentClassName, String templateElementParentId, String templateElementNamePattern) throws MetadataObjectNotFoundException, OperationNotPermittedException, ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Creates multiple template elements using a given name pattern- Specified by:
createBulkTemplateElement
in interfaceApplicationEntityManager
- Parameters:
templateElementClassName
- The class name of the new set of template elementstemplateElementParentClassName
- The parent class name of the new set of template elementstemplateElementParentId
- The parent id of the new set of template elementstemplateElementNamePattern
- Name pattern of the new set of template elements- Returns:
- An array of ids for the new template elements
- Throws:
MetadataObjectNotFoundException
- If the parent class name or the template element class name cannot be foundOperationNotPermittedException
- If the given template element class cannot be a child of the given parentApplicationObjectNotFoundException
- If the parent class name cannot be foundInvalidArgumentException
- If the given pattern to generate the name has less possibilities that the number of template elements to be created
-
createBulkSpecialTemplateElement
public String[] createBulkSpecialTemplateElement(String stElementClass, String stElementParentClassName, String stElementParentId, String stElementNamePattern) throws OperationNotPermittedException, MetadataObjectNotFoundException, ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Creates multiple special template elements using a given name pattern- Specified by:
createBulkSpecialTemplateElement
in interfaceApplicationEntityManager
- Parameters:
stElementClass
- The class name of the new set of special template elementsstElementParentClassName
- The parent class name of the new set of special template elementsstElementParentId
- The parent id of the new set of special template elementsstElementNamePattern
- Name pattern of the new set of special template elements- Returns:
- An array if ids for the new special template elements
- Throws:
OperationNotPermittedException
- If the parent class name or the special template element class name cannot be foundMetadataObjectNotFoundException
- If the given special template element class cannot be a child of the given parentApplicationObjectNotFoundException
- If the parent class name cannot be foundInvalidArgumentException
- If the given pattern to generate the name has less possibilities that the number of special template elements to be created
-
updateTemplateElement
public ChangeDescriptor updateTemplateElement(String templateElementClass, String templateElementId, String[] attributeNames, String[] attributeValues) throws MetadataObjectNotFoundException, ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Updates the value of an attribute of a template element.- Specified by:
updateTemplateElement
in interfaceApplicationEntityManager
- Parameters:
templateElementClass
- Class of the element you want to update.templateElementId
- 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 upfate. For list types, it's the id of the related type- Returns:
- The summary of the changes
- Throws:
MetadataObjectNotFoundException
- If any of the classes provided as arguments do not existApplicationObjectNotFoundException
- If the template element could not be foundInvalidArgumentException
- If the arrays attributeNames and attributeValues have different sizes
-
deleteTemplateElement
public ChangeDescriptor deleteTemplateElement(String templateElementClass, String templateElementId) throws MetadataObjectNotFoundException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Deletes an element within a template or a template itself.- Specified by:
deleteTemplateElement
in interfaceApplicationEntityManager
- Parameters:
templateElementClass
- The template element class.templateElementId
- The template element id.- Returns:
- The summary of the changes
- Throws:
MetadataObjectNotFoundException
- If the element's class could not be found.ApplicationObjectNotFoundException
- If the element could not be found.
-
getTemplatesForClass
public List<TemplateObjectLight> getTemplatesForClass(String className) throws MetadataObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Gets the templates available for a given class- Specified by:
getTemplatesForClass
in interfaceApplicationEntityManager
- Parameters:
className
- Class whose templates we need- Returns:
- A list of templates (actually, the top element) as a list of RemoteOObjects
- Throws:
MetadataObjectNotFoundException
- If the class provided could not be found.
-
getTemplateElementChildren
public List<TemplateObjectLight> getTemplateElementChildren(String templateElementClass, String templateElementId)
Description copied from interface:ApplicationEntityManager
Retrieves the children of a given template element.- Specified by:
getTemplateElementChildren
in interfaceApplicationEntityManager
- Parameters:
templateElementClass
- Template element class.templateElementId
- Template element id.- Returns:
- The template element's children as a list of RemoteBusinessObjectLight instances.
-
getTemplateSpecialElementChildren
public List<TemplateObjectLight> getTemplateSpecialElementChildren(String tsElementClass, String tsElementId)
Description copied from interface:ApplicationEntityManager
Retrieves the children of a given template special element.- Specified by:
getTemplateSpecialElementChildren
in interfaceApplicationEntityManager
- Parameters:
tsElementClass
- Template special element class.tsElementId
- Template special element id.- Returns:
- The template element's children as a list of RemoteBusinessObjectLight instances.
-
getTemplateElement
public TemplateObject getTemplateElement(String templateElementClass, String templateElementId) throws MetadataObjectNotFoundException, ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Retrives all the information of a given template element.- Specified by:
getTemplateElement
in interfaceApplicationEntityManager
- Parameters:
templateElementClass
- Template element class.templateElementId
- Template element id.- Returns:
- The template element information
- Throws:
MetadataObjectNotFoundException
- If the template class does not existApplicationObjectNotFoundException
- If the template element could not be found.InvalidArgumentException
- If an attribute value can't be mapped into value.
-
copyTemplateElements
public String[] copyTemplateElements(String[] sourceObjectsClassNames, String[] sourceObjectsIds, String newParentClassName, String newParentId) throws MetadataObjectNotFoundException, ApplicationObjectNotFoundException, ArraySizeMismatchException
Description copied from interface:ApplicationEntityManager
Copy template elements within templates. Should not be used to copy entire templates.- Specified by:
copyTemplateElements
in interfaceApplicationEntityManager
- 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.- Returns:
- An array with the ids of the newly created elements in the same order they were provided.
- Throws:
MetadataObjectNotFoundException
- If any of the classes could not be found.ApplicationObjectNotFoundException
- If any of the source template elements could not be found.ArraySizeMismatchException
- If the arrays provided as arguments have different sizes.
-
copyTemplateSpecialElement
public String[] copyTemplateSpecialElement(String[] sourceObjectsClassNames, String[] sourceObjectsIds, String newParentClassName, String newParentId) throws ArraySizeMismatchException, ApplicationObjectNotFoundException, MetadataObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Copy template special elements within templates,- Specified by:
copyTemplateSpecialElement
in interfaceApplicationEntityManager
- 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.- Returns:
- An array with the ids of the newly created special elements in the same order they were provided.
- Throws:
ArraySizeMismatchException
- If the arrays provided as arguments have different sizes.ApplicationObjectNotFoundException
- If any of the source template elements could not be found.MetadataObjectNotFoundException
- If any of the classes could not be found.
-
getTemplateSpecialAttribute
public TemplateObjectLight getTemplateSpecialAttribute(String templateElementId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Gets the template element to which a specific Template Element is related.- Specified by:
getTemplateSpecialAttribute
in interfaceApplicationEntityManager
- Parameters:
templateElementId
- Id of template element.- Returns:
- The template element information
- Throws:
ApplicationObjectNotFoundException
- if the template could not be found
-
executeCustomDbCode
public HashMap<String,BusinessObjectList> executeCustomDbCode(String dbCode, boolean needReturn) throws NotAuthorizedException
Description copied from interface:ApplicationEntityManager
Allows to execute custom database queries. This method should not be used as it's only a temporary solution- Specified by:
executeCustomDbCode
in interfaceApplicationEntityManager
- Parameters:
dbCode
- A string with the query- Returns:
- A table with results, that could also be interpreted as a multidimensional array with numerous paths
- Throws:
NotAuthorizedException
- If the user is not allowed to run arbitrary code on the database
-
executeCustomScriptedQuery
public List<Properties> executeCustomScriptedQuery(String queryName, Properties parameters) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
This method is the evolution of the deprecatedApplicationEntityManager.executeCustomDbCode(java.lang.String, boolean)
. It allows the user to execute scripts that usually perform queries to the data base using the native query language and then pre-process the result before returning anything.- Specified by:
executeCustomScriptedQuery
in interfaceApplicationEntityManager
- Parameters:
queryName
- The (unique) name of the query.parameters
- The parameters as entries in a Properties object. The consumer of the script must be aware of the format of the parameters. They could be provided as simple strings, or in their former types.- Returns:
- A list of results as
Properties
instances instances. As a way of speaking, every Properties instances is like a row in a table of results. - Throws:
ApplicationObjectNotFoundException
- If the scripted query with the name provided could not be found.InvalidArgumentException
- If any of the parameters is invalid or if an unexpected error occurred during the execution of the script.
-
deletePool
public void deletePool(org.neo4j.graphdb.Node poolNode) throws OperationNotPermittedException
- Throws:
OperationNotPermittedException
-
addObjectTofavoritesFolder
public void addObjectTofavoritesFolder(String objectClass, String objectId, long favoritesFolderId, long userId) throws ApplicationObjectNotFoundException, MetadataObjectNotFoundException, BusinessObjectNotFoundException, OperationNotPermittedException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Adds an object to the favorites folder- Specified by:
addObjectTofavoritesFolder
in interfaceApplicationEntityManager
- Parameters:
objectClass
- Object classobjectId
- Object idfavoritesFolderId
- favorites folder iduserId
- User Id- Throws:
ApplicationObjectNotFoundException
- If the favorites folder can not be foundMetadataObjectNotFoundException
- If the object can not be foundBusinessObjectNotFoundException
- If the object can not be foundOperationNotPermittedException
- If the object have a relationship with the favorite folderInvalidArgumentException
- If a node does not have uuid
-
removeObjectFromfavoritesFolder
public void removeObjectFromfavoritesFolder(String objectClass, String objectId, long favoritesFolderId, long userId) throws ApplicationObjectNotFoundException, MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Removes an object associated to a favorites folder- Specified by:
removeObjectFromfavoritesFolder
in interfaceApplicationEntityManager
- Parameters:
objectClass
- Object classobjectId
- Object idfavoritesFolderId
- favorites folder iduserId
- User Id- Throws:
ApplicationObjectNotFoundException
- If the favorites folder can not be foundMetadataObjectNotFoundException
- If the object can not be foundBusinessObjectNotFoundException
- If the object can not be foundInvalidArgumentException
- If a node does not have uuid
-
createFavoritesFolderForUser
public long createFavoritesFolderForUser(String name, long userId) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Create a relationship between an user and a new favorites folder- Specified by:
createFavoritesFolderForUser
in interfaceApplicationEntityManager
- Parameters:
name
- favorites folder nameuserId
- User id- Returns:
- The new favorites folder Id
- Throws:
ApplicationObjectNotFoundException
- If the user can not be foundInvalidArgumentException
- If the name is null or empty
-
deleteFavoritesFolders
public void deleteFavoritesFolders(long[] favoritesFolderId, long userId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Delete a Bookmark Folder of an User- Specified by:
deleteFavoritesFolders
in interfaceApplicationEntityManager
- Parameters:
favoritesFolderId
- favorites folder iduserId
- User Id- Throws:
ApplicationObjectNotFoundException
- If any favorites folder in the array can not be found
-
getFavoritesFoldersForUser
public List<FavoritesFolder> getFavoritesFoldersForUser(long userId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Get the favorites folders create by an user.- Specified by:
getFavoritesFoldersForUser
in interfaceApplicationEntityManager
- Parameters:
userId
- user id- Returns:
- List of Bookmarks folders for an User
- Throws:
ApplicationObjectNotFoundException
- If the user can not be found
-
getObjectsInFavoritesFolder
public List<BusinessObjectLight> getObjectsInFavoritesFolder(long favoritesFolderId, long userId, int limit) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Get the object assigned to the bookmark- Specified by:
getObjectsInFavoritesFolder
in interfaceApplicationEntityManager
- Parameters:
favoritesFolderId
- favorites folder iduserId
- User Idlimit
- Max number of results- Returns:
- List of objects related to bookmark
- Throws:
ApplicationObjectNotFoundException
- If the favorites folder can not be foundInvalidArgumentException
- If any of the object does not have uuid
-
getFavoritesFoldersForObject
public List<FavoritesFolder> getFavoritesFoldersForObject(long userId, String objectClass, String objectId) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Get the bookmarks where an object is associated- Specified by:
getFavoritesFoldersForObject
in interfaceApplicationEntityManager
- Parameters:
userId
- User idobjectClass
- Object classobjectId
- Object id- Returns:
- list of favorites folders where an object are an item
- Throws:
MetadataObjectNotFoundException
- If the object can not be foundBusinessObjectNotFoundException
- If the object can not be foundApplicationObjectNotFoundException
- If the object is associated to a bookmark folder but The favorites folder is not associated to the current userInvalidArgumentException
- If nodes do not have uuid
-
getFavoritesFolder
public FavoritesFolder getFavoritesFolder(long favoritesFolderId, long userId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Gets a favorites folder- Specified by:
getFavoritesFolder
in interfaceApplicationEntityManager
- Parameters:
favoritesFolderId
- favorites folder iduserId
- User id- Returns:
- The favorite folder with id
- Throws:
ApplicationObjectNotFoundException
- If the favorites folder can not be found
-
updateFavoritesFolder
public void updateFavoritesFolder(long favoritesFolderId, long userId, String favoritesFolderName) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Updates a favorites folder- Specified by:
updateFavoritesFolder
in interfaceApplicationEntityManager
- Parameters:
favoritesFolderId
- favorites folder iduserId
- User IdfavoritesFolderName
- favorites folder name- Throws:
ApplicationObjectNotFoundException
- If the favorites folder can not be foundInvalidArgumentException
- If the name of the favorites folder is null or empty
-
attachFileToListTypeItem
public long attachFileToListTypeItem(String name, String tags, byte[] file, String listTypeItemClass, String listTypeItemId) throws BusinessObjectNotFoundException, OperationNotPermittedException, MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Relates a file to a list type item- Specified by:
attachFileToListTypeItem
in interfaceApplicationEntityManager
- Parameters:
name
- The name of the filetags
- The tags that describe the contents of the filefile
- The file itselflistTypeItemClass
- the list type classlistTypeItemId
- The id of the list type item the file will be attached to- Returns:
- The id of the resulting file object
- Throws:
BusinessObjectNotFoundException
- If the inventory object could not be foundOperationNotPermittedException
- If there's some sort of system restriction that prevented the file to be createdMetadataObjectNotFoundException
- If the class provided does not existInvalidArgumentException
- If the file size exceeds the max permitted (default value is 10MB)
-
getFilesForListTypeItem
public List<FileObjectLight> getFilesForListTypeItem(String className, String objectId) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
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 interfaceApplicationEntityManager
- Parameters:
className
- The class of the object whose files will be fetched fromobjectId
- The id of the object whose files will be fetched from- Returns:
- The list of files
- Throws:
BusinessObjectNotFoundException
- If the object could not be foundMetadataObjectNotFoundException
- If the class provided does not existInvalidArgumentException
- If the object id is null
-
getFile
public FileObject getFile(long fileObjectId, String className, String objectId) throws BusinessObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Retrieves a particular file associated to an inventory list type item. This call returns the actual file- Specified by:
getFile
in interfaceApplicationEntityManager
- Parameters:
fileObjectId
- The id of the file objectclassName
- The class of the object the file is associated toobjectId
- The id of the list type item the file is associated to- Returns:
- The file
- Throws:
BusinessObjectNotFoundException
- If the object could not be foundInvalidArgumentException
- If for some low level reason, the file could not be read from its original locationMetadataObjectNotFoundException
- If the class provided does not exist
-
detachFileFromListTypeItem
public void detachFileFromListTypeItem(long fileObjectId, String className, String objectId) throws BusinessObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Releases (and deletes) a file associated to a list type item- Specified by:
detachFileFromListTypeItem
in interfaceApplicationEntityManager
- Parameters:
fileObjectId
- The id of the fileclassName
- The class of the list type item the file is associated toobjectId
- The id of the list type item the file is associated to- Throws:
BusinessObjectNotFoundException
- If the object could not be foundInvalidArgumentException
- If for some low level reason, the file could not be deleted from diskMetadataObjectNotFoundException
- If the class provided does not exist
-
updateFileProperties
public void updateFileProperties(long fileObjectId, List<StringPair> properties, String className, String objectId) throws BusinessObjectNotFoundException, ApplicationObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Updates the properties of a file list type item (name or tags)- Specified by:
updateFileProperties
in interfaceApplicationEntityManager
- Parameters:
fileObjectId
- The id of the fileproperties
- 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 toobjectId
- The id of the list type item the file is attached to- Throws:
BusinessObjectNotFoundException
- If the list type item file is attached to could not be foundApplicationObjectNotFoundException
- If the file could not be foundInvalidArgumentException
- if any of the properties has an invalid name or if the file name is emptyMetadataObjectNotFoundException
- If the class of the object file is attached to could not be found
-
createBusinessRule
public long createBusinessRule(String ruleName, String ruleDescription, int ruleType, int ruleScope, String appliesTo, String ruleVersion, List<String> constraints) throws InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Creates a business rule given a set of constraints- Specified by:
createBusinessRule
in interfaceApplicationEntityManager
- Parameters:
ruleName
- Rule nameruleDescription
- Rule descriptionruleType
- Rule type. See BusinesRule.TYPE* for possible values.ruleScope
- The scope of the rule. See BusinesRule.SCOPE* for possible values.appliesTo
- The class this rule applies to. Can not be null.ruleVersion
- The version of the rule. Useful to migrate it if necessary in further versions of the platformconstraints
- An array with the definition of the logic to be matched with the rule. Can not be empty or null- Returns:
- The id of the newly created business rule
- Throws:
InvalidArgumentException
- If any of the parameters is null (strings) or leer than 1 or if the constraints array is null or empty
-
deleteBusinessRule
public void deleteBusinessRule(long businessRuleId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Deletes a business rule- Specified by:
deleteBusinessRule
in interfaceApplicationEntityManager
- Parameters:
businessRuleId
- Rule id- Throws:
ApplicationObjectNotFoundException
- If the given rule does not exist
-
getBusinessRules
public List<BusinessRule> getBusinessRules(int type)
Description copied from interface:ApplicationEntityManager
Retrieves the business rules of a particular type.- Specified by:
getBusinessRules
in interfaceApplicationEntityManager
- Parameters:
type
- Rule type. See BusinesRule.TYPE* for possible values. Use -1 to retrieve all- Returns:
- The list of business rules with the matching type.
-
checkRelationshipByAttributeValueBusinessRules
public void checkRelationshipByAttributeValueBusinessRules(String sourceObjectClassName, String sourceObjectId, String targetObjectClassName, String targetObjectId) throws BusinessRuleException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
check if a relationship can be established between two objects with the attribute values defined in the rule- Specified by:
checkRelationshipByAttributeValueBusinessRules
in interfaceApplicationEntityManager
- Parameters:
sourceObjectClassName
- The class of the element that's the subject of the rulesourceObjectId
- The id of the subject of the ruletargetObjectClassName
- The class of the element that's the object of the ruletargetObjectId
- The id of the object of the rule- Throws:
BusinessRuleException
- If the rule matches, and the involved objects don't comply with the conditions stated by the ruleInvalidArgumentException
- If the rule is malformed or can not be read.
-
getArtifactForActivity
public Artifact getArtifactForActivity(String processInstanceId, String activityId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Gets the artifact associated to an activity (for example, a form that was already filled in by a user in a previous, already committed activity)- Specified by:
getArtifactForActivity
in interfaceApplicationEntityManager
- Parameters:
processInstanceId
- The id of the process instance. This process may have been ended already.activityId
- The id of the activity the artifact belongs to- Returns:
- The artifact corresponding to the given activity
- Throws:
ApplicationObjectNotFoundException
- If the process instance or activity couldn't be found.
-
getArtifactDefinitionForActivity
public ArtifactDefinition getArtifactDefinitionForActivity(String processDefinitionId, String activityDefinitionId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Given an activity definition, returns the artifact definition associated to it- Specified by:
getArtifactDefinitionForActivity
in interfaceApplicationEntityManager
- Parameters:
processDefinitionId
- The id of the process the activity is related toactivityDefinitionId
- The id of the activity- Returns:
- An object containing the artifact definition
- Throws:
ApplicationObjectNotFoundException
- If the process or the activity could not be found
-
commitActivity
public void commitActivity(String processInstanceId, String activityDefinitionId, Artifact artifact) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Saves the artifact generated once an activity has been completed (for example, the user filled in a form).- Specified by:
commitActivity
in interfaceApplicationEntityManager
- Parameters:
processInstanceId
- The process instance the activity belongs toactivityDefinitionId
- The activity idartifact
- The artifact to be saved- Throws:
ApplicationObjectNotFoundException
- If the process could not be found or if the activity definition could not be foundInvalidArgumentException
- If the activity had been already executed, of there's a mismatch in the artifact versions or if the user is not an authorized actor to carry on with the activity
-
updateActivity
public void updateActivity(String processInstanceId, String activityDefinitionId, Artifact artifact) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Updates the artifact generated once an activity has been completed (for example, the user filled in a form).- Specified by:
updateActivity
in interfaceApplicationEntityManager
- Parameters:
processInstanceId
- The process instance the activity belongs toactivityDefinitionId
- The activity idartifact
- The artifact to be saved- Throws:
ApplicationObjectNotFoundException
- If the process could not be found or if the activity definition could not be foundInvalidArgumentException
- If the activity had been already executed, of there's a mismatch in the artifact versions or if the user is not an authorized actor to carry on with the activity
-
getProcessInstanceActivitiesPath
public List<ActivityDefinition> getProcessInstanceActivitiesPath(String processInstanceId) throws InventoryException
Description copied from interface:ApplicationEntityManager
Gets Process Instance Activities Path- Specified by:
getProcessInstanceActivitiesPath
in interfaceApplicationEntityManager
- Parameters:
processInstanceId
- Process Instance Id to get path- Returns:
- The activity definition
- Throws:
InventoryException
- If the process instance cannot be found.
-
getNextActivityForProcessInstance
public ActivityDefinition getNextActivityForProcessInstance(String processInstanceId) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Requests for the next activity to be executed in a process instance.- Specified by:
getNextActivityForProcessInstance
in interfaceApplicationEntityManager
- Parameters:
processInstanceId
- The running process to get the next activity from- Returns:
- The activity definition
- Throws:
ApplicationObjectNotFoundException
- If the process instance could not be foundInvalidArgumentException
- If the process already ended
-
getProcessDefinition
public ProcessDefinition getProcessDefinition(String processDefinitionId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Retrieves a process definition- Specified by:
getProcessDefinition
in interfaceApplicationEntityManager
- Parameters:
processDefinitionId
- The id of the process- Returns:
- The process definition. It contains an XML document to be parsed by the consumer
- Throws:
ApplicationObjectNotFoundException
- If the process could not be found or if it's malformed
-
getActivityDefinition
public ActivityDefinition getActivityDefinition(String processDefinitionId, String activityDefinitionId)
Description copied from interface:ApplicationEntityManager
Retrieves a process definition- Specified by:
getActivityDefinition
in interfaceApplicationEntityManager
- Parameters:
processDefinitionId
- The id of the process definitionactivityDefinitionId
- The id of the Activity definition- Returns:
- The activity definition
-
deleteProcessDefinition
public void deleteProcessDefinition(String processDefinitionId) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Deletes a process definition- Specified by:
deleteProcessDefinition
in interfaceApplicationEntityManager
- Parameters:
processDefinitionId
- The process definition to be deleted- Throws:
ApplicationObjectNotFoundException
- If the process definition could not be foundInvalidArgumentException
- if there are process instances related to the process definition
-
updateProcessDefinition
public void updateProcessDefinition(String processDefinitionId, List<StringPair> properties, byte[] structure) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Updates a process definition, either its standard properties or its structure- Specified by:
updateProcessDefinition
in interfaceApplicationEntityManager
- Parameters:
processDefinitionId
- The process definition idproperties
- A key value dictionary with the standard properties to be updated. These properties are: name, description, version and enabled (use 'true' or 'false' for the latter)structure
- A byte array withe XML process definition body- Throws:
ApplicationObjectNotFoundException
- If the process definition could not be foundInvalidArgumentException
- If the structure is invalid or If one of the properties is malformed or has an unexpected name
-
createProcessDefinition
public String createProcessDefinition(String name, String description, String version, boolean enabled, byte[] structure) throws InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Creates a process definition. A process definition is the metadata that defines the steps and constraints of a given project- Specified by:
createProcessDefinition
in interfaceApplicationEntityManager
- Parameters:
name
- The name of the new process definitiondescription
- The description of the new process definitionversion
- The version of the new process definition. This is a three numbers, dot separated string (e.g. 2.4.1)enabled
- If the project is enabled to create instances from itstructure
- The structure of the process definition. It's an XML document that represents a BPMN process definition- Returns:
- The id of the newly created process definition
- Throws:
InvalidArgumentException
- If the process structure defines a malformed process or if the version is invalid
-
getProcessInstances
public List<ProcessInstance> getProcessInstances(String processDefinitionId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Gets a process instances of a process definition- Specified by:
getProcessInstances
in interfaceApplicationEntityManager
- Parameters:
processDefinitionId
- The process definition id- Returns:
- The process instances
- Throws:
ApplicationObjectNotFoundException
- If the process definition could not be found
-
getProcessDefinitions
public List<ProcessDefinition> getProcessDefinitions()
Description copied from interface:ApplicationEntityManager
Gets a process definition instances- Specified by:
getProcessDefinitions
in interfaceApplicationEntityManager
- Returns:
- The process instances
-
getProcessInstance
public ProcessInstance getProcessInstance(String processInstanceId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Gets a process instance- Specified by:
getProcessInstance
in interfaceApplicationEntityManager
- Parameters:
processInstanceId
- Process Instance Id- Returns:
- a Process Instance for the given id
- Throws:
ApplicationObjectNotFoundException
- If the process instance could not be found
-
reloadProcessDefinitions
public void reloadProcessDefinitions() throws InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Updates the process definitions- Specified by:
reloadProcessDefinitions
in interfaceApplicationEntityManager
- Throws:
InvalidArgumentException
-
createProcessInstance
public String createProcessInstance(String processDefinitionId, String processInstanceName, String processInstanceDescription) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Creates an instance of a process, that is, starts one- Specified by:
createProcessInstance
in interfaceApplicationEntityManager
- Parameters:
processDefinitionId
- The id of the process to be startedprocessInstanceName
- The name of the new processprocessInstanceDescription
- The description of the new process- Returns:
- The id of the newly created process instance
- Throws:
ApplicationObjectNotFoundException
- If the process definition could not be foundInvalidArgumentException
- If the process definition is disabled
-
updateProcessInstance
public void updateProcessInstance(String processInstanceId, String name, String description)
Description copied from interface:ApplicationEntityManager
Updates the process instance name and description.- Specified by:
updateProcessInstance
in interfaceApplicationEntityManager
- Parameters:
processInstanceId
- The process instance id.name
- The process instance name to update.description
- The process instance description to update.
-
deleteProcessInstance
public void deleteProcessInstance(String processInstanceId) throws OperationNotPermittedException
Description copied from interface:ApplicationEntityManager
Deletes a process instance- Specified by:
deleteProcessInstance
in interfaceApplicationEntityManager
- Parameters:
processInstanceId
- Process Instance Id- Throws:
OperationNotPermittedException
- If the process can no be deleted
-
createConfigurationVariable
public long createConfigurationVariable(String configVariablesPoolId, String name, String description, int type, boolean masked, String valueDefinition) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Creates a configuration variable inside a pool.A configuration variable is a place where a value will be stored so it can retrieved by whomever need it. These variables are typically used to store values that help other modules to work, such as URLs, user names, dimensions, etc- Specified by:
createConfigurationVariable
in interfaceApplicationEntityManager
- Parameters:
configVariablesPoolId
- The id of the pool where the config variable will be putname
- The name of the pool. This value can not be null or empty. Duplicate variable names are not alloweddescription
- The description of the what the variable doestype
- The type of the variable. Use 1 for number, 2 for strings, 3 for booleans, 4 for unidimensional arrays and 5 for matrixes.masked
- If the value should be masked when rendered (for security reasons, for example)valueDefinition
- In most cases (primitive types like numbers, strings or booleans) will be the actual value of the variable as a string (for example "5" or "admin" or "true"). For arrays and matrixes use the following notation:
Arrays: (value1,value2,value3,valueN), matrixes: [(row1col1, row1col2,... row1colN), (row2col1, row2col2,... row2colN), (rowNcol1, rowNcol2,... rowNcolN)]. The values will be interpreted as strings- Returns:
- The id of the newly created variable
- Throws:
ApplicationObjectNotFoundException
- If the parent pool could not be foundInvalidArgumentException
- If the name is empty, the type is invalid, the value definition is empty
-
updateConfigurationVariable
public void updateConfigurationVariable(String name, String propertyToUpdate, String newValue) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Updates the value of a configuration variable.See ##createConfigurationVariable(long, java.lang.String, java.lang.String, int, boolean, java.lang.String)
for value definition syntax- Specified by:
updateConfigurationVariable
in interfaceApplicationEntityManager
- Parameters:
name
- The current name of the variable that will be modifiedpropertyToUpdate
- The name of the property to be updated. Possible values are: "name", "description", "type", "masked" and "value"newValue
- The new value as string- Throws:
InvalidArgumentException
- If the property to be updated can not be recognizedApplicationObjectNotFoundException
- If the configuration variable can not be found
-
deleteConfigurationVariable
public void deleteConfigurationVariable(String name, String userName) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Deletes a configuration variable- Specified by:
deleteConfigurationVariable
in interfaceApplicationEntityManager
- Parameters:
name
- The name of the variable to be deleteduserName
- The session token- Throws:
ApplicationObjectNotFoundException
- If the configuration variable could not be found
-
getConfigurationVariable
public ConfigurationVariable getConfigurationVariable(String name) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Retrieves a configuration variable- Specified by:
getConfigurationVariable
in interfaceApplicationEntityManager
- Parameters:
name
- The name of the variable to be retrieved- Returns:
- The variable
- Throws:
ApplicationObjectNotFoundException
- If the variable could not be found
-
getConfigurationVariableValue
public Object getConfigurationVariableValue(String name) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Retrieves only the value of a configuration variable. Masked values are returned as null.- Specified by:
getConfigurationVariableValue
in interfaceApplicationEntityManager
- Parameters:
name
- The name of the variable. Masked values are returned as null.- Returns:
- The value of the variable as a java object/data type. The numbers are returned as floats.
The arrays and matrixes are returned as
ArrayList<String>
andArrayList
instances respectively - Throws:
InvalidArgumentException
- If the value of the variable could not be successfully translated into a java type variableApplicationObjectNotFoundException
- If no configuration variable with that name could be found.
-
getConfigurationVariablesInPool
public List<ConfigurationVariable> getConfigurationVariablesInPool(String poolId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Gets the configuration variables in a configuration variable pool- Specified by:
getConfigurationVariablesInPool
in interfaceApplicationEntityManager
- Parameters:
poolId
- The id pool to retrieve the variables from- Returns:
- The list of config variables in the given pool
- Throws:
ApplicationObjectNotFoundException
- If the pool could not be found
-
getConfigurationVariablesWithPrefix
public List<ConfigurationVariable> getConfigurationVariablesWithPrefix(String prefix)
Description copied from interface:ApplicationEntityManager
Gets the configuration variables with a given prefix- Specified by:
getConfigurationVariablesWithPrefix
in interfaceApplicationEntityManager
- Parameters:
prefix
- The prefix of the variables name- Returns:
- The list of configuration variables with the given prefix
-
getAllConfigurationVariables
public List<ConfigurationVariable> getAllConfigurationVariables()
Description copied from interface:ApplicationEntityManager
Gets all the configuration variables in the database, no matter what pool they belong to.- Specified by:
getAllConfigurationVariables
in interfaceApplicationEntityManager
- Returns:
- The list of existing configuration variables.
-
getConfigurationVariablesPools
public List<InventoryObjectPool> getConfigurationVariablesPools()
Description copied from interface:ApplicationEntityManager
Retrieves the list of pools of config variables- Specified by:
getConfigurationVariablesPools
in interfaceApplicationEntityManager
- Returns:
- The available pools of configuration variables
-
createConfigurationVariablesPool
public String createConfigurationVariablesPool(String name, String description) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Creates a pool of configuration variables- Specified by:
createConfigurationVariablesPool
in interfaceApplicationEntityManager
- Parameters:
name
- The name of the pool. Empty or null values are not alloweddescription
- The description of the pool- Returns:
- The id of the newly created pool
- Throws:
InvalidArgumentException
- If the name provided is null or emptyApplicationObjectNotFoundException
- If the log root node could not be found
-
updateConfigurationVariablesPool
public void updateConfigurationVariablesPool(String poolId, String propertyToUpdate, String value, String userName) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Updates an attribute of a given configuration variables pool- Specified by:
updateConfigurationVariablesPool
in interfaceApplicationEntityManager
- Parameters:
poolId
- The id of the pool to updatepropertyToUpdate
- The property to update. The valid values are "name" and "description"value
- The value of the property to be updateduserName
- The session token- Throws:
InvalidArgumentException
- If the property provided is not validApplicationObjectNotFoundException
- If the pool could not be found
-
deleteConfigurationVariablesPool
public void deleteConfigurationVariablesPool(String poolId, String userName) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Deletes a configuration variables pool.Deleting a pool also deletes the config variables contained within- Specified by:
deleteConfigurationVariablesPool
in interfaceApplicationEntityManager
- Parameters:
poolId
- The id of the pool to be deleteduserName
- The session token- Throws:
ApplicationObjectNotFoundException
- If the pool could not be found
-
createOSPView
public long createOSPView(String name, String description, byte[] structure) throws InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Creates an Outside Plant View- Specified by:
createOSPView
in interfaceApplicationEntityManager
- Parameters:
name
- The name of the new viewdescription
- The description of the new viewstructure
- The XML document with the contents of the view. The format of the XML document is consistent with the other views- Returns:
- The id of the newly created view
- Throws:
InvalidArgumentException
- If the name is empty.
-
getOSPView
public ViewObject getOSPView(long viewId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Retrieves the specific information about an existing OSP view- Specified by:
getOSPView
in interfaceApplicationEntityManager
- Parameters:
viewId
- The id of the view- Returns:
- An object containing the view details and structure
- Throws:
ApplicationObjectNotFoundException
- If the view could not be found
-
getOSPViews
public List<ViewObjectLight> getOSPViews() throws InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Retrieves the existing OSP views- Specified by:
getOSPViews
in interfaceApplicationEntityManager
- Returns:
- The list of existing OSP views
- Throws:
InvalidArgumentException
- If one of the views is malformed
-
updateOSPView
public void updateOSPView(long viewId, String name, String description, byte[] structure) throws ApplicationObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Updates an existing OSP view- Specified by:
updateOSPView
in interfaceApplicationEntityManager
- Parameters:
viewId
- The id of the viewname
- The new name of the view. Null if to remain unchangeddescription
- The new description of the view. Null if to remain unchangedstructure
- The new content of the view. Null if to remain unchanged- Throws:
ApplicationObjectNotFoundException
- If the view could not be foundInvalidArgumentException
- If the new name (if applicable) is empty
-
createValidatorDefinition
public long createValidatorDefinition(String name, String description, String classToBeApplied, String script, boolean enabled, String userName) throws InvalidArgumentException, MetadataObjectNotFoundException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Creates a validator definition.- Specified by:
createValidatorDefinition
in interfaceApplicationEntityManager
- Parameters:
name
- The name of the validator. It's recommended to use camel case notation (for example thisIsAName). This field is mandatorydescription
- The optional description of the validatorclassToBeApplied
- The class or super class of the classes whose instances will be checked against this validatorscript
- The groovy script containing the logic of the validator , that is, theenabled
- If this validador should be applied or notuserName
- The session token- Returns:
- The id of the newly created validator definition
- Throws:
InvalidArgumentException
- If the name is null or emptyMetadataObjectNotFoundException
- If the classToBeApplied argument could not be foundApplicationObjectNotFoundException
- If the log root node could not be found
-
updateValidatorDefinition
public void updateValidatorDefinition(long validatorDefinitionId, String name, String description, String classToBeApplied, String script, Boolean enabled, String userName) throws ApplicationObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Updates the properties of a validator.The null values will be ignored- Specified by:
updateValidatorDefinition
in interfaceApplicationEntityManager
- Parameters:
validatorDefinitionId
- The id of teh validator definition to be updatedname
- The new name, if any, null otherwisedescription
- The new description, if any, null otherwiseclassToBeApplied
- The new class to be associated to this validator, if any, null otherwisescript
- The new script, if any, null otherwiseenabled
- If the validator should be enabled or not, if any, null otherwiseuserName
- The session token- Throws:
ApplicationObjectNotFoundException
- If the validator definition could not be foundMetadataObjectNotFoundException
- If the classToBeApplied parameter is not validInvalidArgumentException
- If the name is not null, but it is empty
-
getValidatorDefinitionsForClass
public List<ValidatorDefinition> getValidatorDefinitionsForClass(String className)
Description copied from interface:ApplicationEntityManager
Retrieves all the validator definitions in the system- Specified by:
getValidatorDefinitionsForClass
in interfaceApplicationEntityManager
- Parameters:
className
- The class to retrieve the validator definitions from.- Returns:
- The list of validator definitions
-
getAllValidatorDefinitions
public List<ValidatorDefinition> getAllValidatorDefinitions()
Description copied from interface:ApplicationEntityManager
Gets all validator definitions, no matter what class they are related to.- Specified by:
getAllValidatorDefinitions
in interfaceApplicationEntityManager
- Returns:
- The list of validators.
-
runValidationsForObject
public List<Validator> runValidationsForObject(String objectClass, long objectId) throws BusinessObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Runs the existing validations for the class associated to the given object. Validators set to enabled = false will be ignored- Specified by:
runValidationsForObject
in interfaceApplicationEntityManager
- Parameters:
objectClass
- The class of the objectobjectId
- The id of the object- Returns:
- The list of validators associated to the object and its class
- Throws:
BusinessObjectNotFoundException
- If the object can not be found
-
deleteValidatorDefinition
public void deleteValidatorDefinition(long validatorDefinitionId, String userName) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Deletes a validator definition- Specified by:
deleteValidatorDefinition
in interfaceApplicationEntityManager
- Parameters:
validatorDefinitionId
- the id of the validator to be deleteduserName
- The session token- Throws:
ApplicationObjectNotFoundException
- If the validator definition could not be found
-
deleteOSPView
public void deleteOSPView(long viewId) throws ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Deletes an existing OSP view- Specified by:
deleteOSPView
in interfaceApplicationEntityManager
- Parameters:
viewId
- The id of the view to be deleted- Throws:
ApplicationObjectNotFoundException
- If the view could not be found
-
createTemplateElementFromNode
public TemplateObject createTemplateElementFromNode(org.neo4j.graphdb.Node templateInstanceNode, String className) throws InvalidArgumentException, MetadataObjectNotFoundException
-
createFilterDefinition
public long createFilterDefinition(String name, String description, String className, String script, boolean enabled) throws InvalidArgumentException, MetadataObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Creates a filter.- Specified by:
createFilterDefinition
in interfaceApplicationEntityManager
- Parameters:
name
- The name of the filter. It's recommended to use camel case notation (for example thisIsAName). This field is mandatorydescription
- The optional description of the filterclassName
- The class or super class of the classes whose instances will be checked against this filterscript
- The groovy script containing the logic of the filter , that is, theenabled
- If this filter should be applied or not- Returns:
- The id of the newly created filter definition
- Throws:
InvalidArgumentException
- If the name is null or emptyMetadataObjectNotFoundException
- If the classToBeApplied argument could not be found
-
updateFilterDefinition
public void updateFilterDefinition(long filterId, String name, String description, String className, String script, Boolean enabled) throws ApplicationObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException, ScriptNotCompiledException
Description copied from interface:ApplicationEntityManager
Updates the properties of a filter, null values will be ignored; when the script of the filter definition its been updated it will tries to compile the script to create a Filter instance, if the compilation fails the filter attribute in the filter definition will remains null- Specified by:
updateFilterDefinition
in interfaceApplicationEntityManager
- Parameters:
filterId
- The id of the filter definition to be updatedname
- The new name, not nulldescription
- The new description, if any, null otherwiseclassName
- The new class to be associated to this filer, if any, null otherwisescript
- The new script, if any, null otherwiseenabled
- If the filer should be enabled or not, false by default- Throws:
ApplicationObjectNotFoundException
- If the filter definition could not be foundMetadataObjectNotFoundException
- If the classToBeApplied parameter is not validInvalidArgumentException
- If the name is not null, but it is emptyScriptNotCompiledException
- if the filter script could no be compiled due to syntax errors
-
getFilterDefinitionsForClass
public List<FilterDefinition> getFilterDefinitionsForClass(String className, boolean includeParentClassesFilters, boolean ignoreCache, HashMap<String,Object> attributesToFilter, int page, int limit) throws InvalidArgumentException
Description copied from interface:ApplicationEntityManager
For a given class retrieves all its filters definitions (also the filters of its parent classes could be included).- Specified by:
getFilterDefinitionsForClass
in interfaceApplicationEntityManager
- Parameters:
className
- The class to retrieve the filter definitions from.includeParentClassesFilters
- if the return must include the filters of the parent classignoreCache
- to avoid filters from the cache useful in filters module edition, or to get cached filters useful when retrieve filters to executeattributesToFilter
- attributes to filter the FiltersDefinition null to not filterpage
- page the number of page of number of elements to skip, -1 to not skip any resultlimit
- limit of results per page, -1 to retrieve all elements- Returns:
- The list of filter definitions
- Throws:
InvalidArgumentException
- if class name is null
-
getFilterDefinitionsForClassCount
public long getFilterDefinitionsForClassCount(String className, boolean includeParentClassesFilters, boolean ignoreCache, HashMap<String,Object> attributesToFilter, int page, int limit) throws InvalidArgumentException
Description copied from interface:ApplicationEntityManager
For a given class name returns the count of the filters definitions- Specified by:
getFilterDefinitionsForClassCount
in interfaceApplicationEntityManager
- Parameters:
className
- The class to retrieve the filter definitions from.includeParentClassesFilters
- if the return must include the filters of the parent classignoreCache
- to avoid filters from the cache useful in filters module edition, or to get cached filters useful when retrieve filters to executeattributesToFilter
- attributes to filter the FiltersDefinition null to not filter, attributes to filter: onlyEnabled, filter's name onlyEnabled return only the enabled filters definitions e.g for the router class, include filters created in class GenericNetworkElementpage
- page the number of page of number of elements to skip, -1 to not skip any resultlimit
- limit of results per page, -1 to retrieve all elements- Returns:
- the count of filters definitions
- Throws:
InvalidArgumentException
- if class name is null
-
getAllFilterDefinitions
public List<FilterDefinition> getAllFilterDefinitions(HashMap<String,Object> attributesToFilter, int page, int limit)
Description copied from interface:ApplicationEntityManager
Retrieves all the filters created in the inventory.- Specified by:
getAllFilterDefinitions
in interfaceApplicationEntityManager
- Parameters:
attributesToFilter
- attributes to filter the FiltersDefinition null to not filterpage
- page the number of page of number of elements to skip, -1 to not skip any resultlimit
- limit of results per page, -1 to retrieve all elements- Returns:
- The list of filter definitions
-
getAllFilterDefinitionsCount
public long getAllFilterDefinitionsCount(HashMap<String,Object> attributesToFilter)
Description copied from interface:ApplicationEntityManager
Counts all the Filters definition created- Specified by:
getAllFilterDefinitionsCount
in interfaceApplicationEntityManager
- Parameters:
attributesToFilter
- attributes to filter the count of FiltersDefinition, null to not filter- Returns:
- the count of FiltersDefinitions
-
deleteFilterDefinition
public void deleteFilterDefinition(long filterId, String className) throws InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Deletes a filter definition- Specified by:
deleteFilterDefinition
in interfaceApplicationEntityManager
- Parameters:
filterId
- the id of the filter to be deletedclassName
- the class name of the filter to be deleted, used to remove the filter from the cache- Throws:
InvalidArgumentException
- If the class name parameter was send in null
-
createScriptedQueriesPool
public String createScriptedQueriesPool(String name, String description) throws InvalidArgumentException, ExecutionException
Description copied from interface:ApplicationEntityManager
Creates a scripted queries pool.- Specified by:
createScriptedQueriesPool
in interfaceApplicationEntityManager
- Parameters:
name
- Scripted queries pool name.description
- Scripted queries pool description.- Returns:
- The scripted queries pool id.
- Throws:
InvalidArgumentException
- If the name or description are null or empty.ExecutionException
- If the scripted queries was not created.
-
updateScriptedQueriesPool
public void updateScriptedQueriesPool(String scriptedQueriesPoolId, String name, String description) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Updates a scripted queries pool.- Specified by:
updateScriptedQueriesPool
in interfaceApplicationEntityManager
- Parameters:
scriptedQueriesPoolId
- Scripted queries pool id.name
- Scripted queries pool name.description
- Scripted queries pool description.- Throws:
InvalidArgumentException
- If the scripted queries pool id or name is null or empty.ApplicationObjectNotFoundException
- If the scripted queries pool cannot be found.
-
deleteScriptedQueriesPool
public void deleteScriptedQueriesPool(String scriptedQueriesPoolId) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Deletes a scripted queries pool.- Specified by:
deleteScriptedQueriesPool
in interfaceApplicationEntityManager
- Parameters:
scriptedQueriesPoolId
- Scripted queries pool id.- Throws:
InvalidArgumentException
- If the scripted queries pool id is null or empty.ApplicationObjectNotFoundException
- If the scripted queries pool cannot be found.
-
getScriptedQueriesPoolByName
public ScriptedQueriesPool getScriptedQueriesPoolByName(String scriptedQueriesPoolName) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Gets a scripted queries pool given the name.- Specified by:
getScriptedQueriesPoolByName
in interfaceApplicationEntityManager
- Parameters:
scriptedQueriesPoolName
- Scripted queries pool name.- Returns:
- A scripted queries pool.
- Throws:
InvalidArgumentException
- If the scripted queries pool name is null or empty.ApplicationObjectNotFoundException
- If the scripted queries pool cannot be found.
-
getScriptedQueriesPool
public ScriptedQueriesPool getScriptedQueriesPool(String scriptedQueriesPoolId) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Gets a scripted queries pool.- Specified by:
getScriptedQueriesPool
in interfaceApplicationEntityManager
- Parameters:
scriptedQueriesPoolId
- Scripted queries pool id.- Returns:
- A scripted queries pool.
- Throws:
InvalidArgumentException
- If the scripted queries pool id is null or empty.ApplicationObjectNotFoundException
- If the scripted queries pool id.
-
getScriptedQueriesPoolCount
public int getScriptedQueriesPoolCount(String filterName)
Description copied from interface:ApplicationEntityManager
Counts the scripted queries pools.- Specified by:
getScriptedQueriesPoolCount
in interfaceApplicationEntityManager
- Parameters:
filterName
- Scripted queries pool name to filter.- Returns:
- The size of scripted queries pools.
-
getScriptedQueriesPools
public List<ScriptedQueriesPool> getScriptedQueriesPools(String filterName, int skip, int limit)
Description copied from interface:ApplicationEntityManager
Gets a set of scripted queries pools.- Specified by:
getScriptedQueriesPools
in interfaceApplicationEntityManager
- Parameters:
filterName
- Filter by scripted queries pool name.skip
- Result skiplimit
- Result limit- Returns:
- A set of scripted queries pools.
-
getScriptedQueryCountByPoolId
public int getScriptedQueryCountByPoolId(String scriptedQueriesPoolId, String filterName, boolean ignoreDisabled)
Description copied from interface:ApplicationEntityManager
Counts the scripted queries filter by name in a scripted queries pool.- Specified by:
getScriptedQueryCountByPoolId
in interfaceApplicationEntityManager
- Parameters:
scriptedQueriesPoolId
- Scripted queries pool id.filterName
- Filter by scripted query name.ignoreDisabled
- True to ignore disabled scripted queries.- Returns:
- The size of scripted queries.
-
getScriptedQueriesByPoolId
public List<ScriptedQuery> getScriptedQueriesByPoolId(String scriptedQueriesPoolId, String filterName, boolean ignoreDisabled, int skip, int limit)
Description copied from interface:ApplicationEntityManager
Gets a set of scripted queries in a scripted queries pool the its id.- Specified by:
getScriptedQueriesByPoolId
in interfaceApplicationEntityManager
- Parameters:
scriptedQueriesPoolId
- Scripted queries pool id.filterName
- Scripted query name filter.ignoreDisabled
- True to return all scripted queries. False to return the enabled only.skip
- Result skip.limit
- Result limit.- Returns:
- A set of scripted queries in a scripted queries pool.
-
getScriptedQueryCountByPoolName
public int getScriptedQueryCountByPoolName(String scriptedQueriesPoolName, String filterName) throws InvalidArgumentException, ExecutionException
Description copied from interface:ApplicationEntityManager
Counts the scripted queries filter by name in a scripted queries pool.- Specified by:
getScriptedQueryCountByPoolName
in interfaceApplicationEntityManager
- Parameters:
scriptedQueriesPoolName
- Scripted queries pool name.filterName
- Scripted query name to filter.- Returns:
- The size of scripted queries
- Throws:
InvalidArgumentException
- If the scripted queries pool name is null or empty. If the filter name is null.ExecutionException
- It the scripted query count by pool name ended with errors.
-
getScriptedQueriesByPoolName
public List<ScriptedQuery> getScriptedQueriesByPoolName(String scriptedQueriesPoolName, String filterName, boolean ignoreDisabled, int skip, int limit)
Description copied from interface:ApplicationEntityManager
Gets a set of scripted queries in a scripted queries pool the its name.- Specified by:
getScriptedQueriesByPoolName
in interfaceApplicationEntityManager
- Parameters:
scriptedQueriesPoolName
- Scripted queries pool name.filterName
- Scripted query name filter.ignoreDisabled
- True to return all scripted queries. False to return the enabled only.skip
- Result skip.limit
- Result limit.- Returns:
- A set of scripted queries in a scripted queries pool.
-
createScriptedQuery
public String createScriptedQuery(String scriptedQueriesPoolId, String name, String description, String script, boolean enabled) throws InvalidArgumentException, ExecutionException
Description copied from interface:ApplicationEntityManager
Creates a scripted query.- Specified by:
createScriptedQuery
in interfaceApplicationEntityManager
- Parameters:
scriptedQueriesPoolId
- Scripted queries pool id.name
- Scripted query name.description
- Scripted query description.script
- Scripted query script.enabled
- True to enable the Scripted query.- Returns:
- The scripted query id.
- Throws:
InvalidArgumentException
- If the scripted queries pool id or the name are null or empty.ExecutionException
- If the scripted query was not created.
-
updateScriptedQuery
public void updateScriptedQuery(String scriptedQueryId, String name, String description, String script, boolean enabled) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Updates a scripted query given its id- Specified by:
updateScriptedQuery
in interfaceApplicationEntityManager
- Parameters:
scriptedQueryId
- The scripted query idname
- New scripting query namedescription
- New scripting query descriptionscript
- New query scriptenabled
- New value, True to enable the scripting query- Throws:
InvalidArgumentException
- If the scripted query id or name are null or empty.ApplicationObjectNotFoundException
- If the scripted query cannot be found.
-
deleteScriptedQuery
public void deleteScriptedQuery(String scriptedQueryId) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Deletes an scripted query given the id.- Specified by:
deleteScriptedQuery
in interfaceApplicationEntityManager
- Parameters:
scriptedQueryId
- The scripting query id- Throws:
InvalidArgumentException
- If the scripted query id is null or empty.ApplicationObjectNotFoundException
- If the scripted query cannot be found.
-
getScriptedQuery
public ScriptedQuery getScriptedQuery(String scriptedQueryId) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Gets a scripted query given its id- Specified by:
getScriptedQuery
in interfaceApplicationEntityManager
- Parameters:
scriptedQueryId
- The scripted query id- Returns:
- A scripted query.
- Throws:
InvalidArgumentException
- If the scripted query id is null or empty.ApplicationObjectNotFoundException
- If the scripted query cannot be found.
-
getScriptedQueryCount
public int getScriptedQueryCount(String filterName)
Description copied from interface:ApplicationEntityManager
Counts the scripted queries.- Specified by:
getScriptedQueryCount
in interfaceApplicationEntityManager
- Parameters:
filterName
- Scripted query name to filter.- Returns:
- The size of scripted queries
-
getScriptedQueries
public List<ScriptedQuery> getScriptedQueries(String filterName, boolean ignoreDisabled, int skip, int limit)
Description copied from interface:ApplicationEntityManager
Gets a set of scripted queries.- Specified by:
getScriptedQueries
in interfaceApplicationEntityManager
- Parameters:
filterName
- Scripted query name to filter.ignoreDisabled
- True to return all scripted queries. False to return the enabled only.skip
- Result skiplimit
- Result limit- Returns:
- A set of scripted queries.
-
executeScriptedQuery
public ScriptedQueryResult executeScriptedQuery(String scriptedQueryId, ScriptedQueryParameter... parameters) throws InvalidArgumentException, ApplicationObjectNotFoundException, ExecutionException
Description copied from interface:ApplicationEntityManager
Executes the scripted query.- Specified by:
executeScriptedQuery
in interfaceApplicationEntityManager
- Parameters:
scriptedQueryId
- The scripted query classparameters
- The scripted query parameters- Returns:
- The result of execute the scripted query.
- Throws:
InvalidArgumentException
- If the scripted query id is null or empty.ApplicationObjectNotFoundException
- If the scripted query cannot be found.ExecutionException
- If the scripted query script cannot be execute.
-
createScriptedQueryParameter
public String createScriptedQueryParameter(String scriptedQueryId, String name, String description, String type, boolean mandatory, Object defaultValue) throws InvalidArgumentException, ExecutionException
Description copied from interface:ApplicationEntityManager
Creates a scripted query parameter.- Specified by:
createScriptedQueryParameter
in interfaceApplicationEntityManager
- Parameters:
scriptedQueryId
- The scripted query id.name
- The scripted query parameter namedescription
- The scripted query parameter description.type
- The scripted query parameter type.mandatory
- True scripted query parameter is mandatory.defaultValue
- The scripted query parameter default value.- Returns:
- The scripted query parameter id.
- Throws:
InvalidArgumentException
- If the scripted query id or name are null.ExecutionException
- If the scripted query parameter was not created.
-
updateScriptedQueryParameter
public void updateScriptedQueryParameter(String scriptedQueryParameterId, String name, String description, String type, boolean mandatory, Object defaultValue) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Updates a scripted query parameter.- Specified by:
updateScriptedQueryParameter
in interfaceApplicationEntityManager
- Parameters:
scriptedQueryParameterId
- The scripted query parameter name.name
- The scripted query parameter name.description
- The scripted query parameter description.type
- The scripted query parameter type.mandatory
- True if the scripted query parameter is mandatory.defaultValue
- The scripted query parameter default value.- Throws:
InvalidArgumentException
- If the scripted query parameter id or name are null.ApplicationObjectNotFoundException
- If the scripted query parameter cannot be found.
-
deleteScriptedQueryParameter
public void deleteScriptedQueryParameter(String scriptedQueryParameterId) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Deletes a scripted query parameter.- Specified by:
deleteScriptedQueryParameter
in interfaceApplicationEntityManager
- Parameters:
scriptedQueryParameterId
- The id of the scripted query parameter to delete.- Throws:
InvalidArgumentException
- If the scripted query parameter id is null.ApplicationObjectNotFoundException
- If the scripted query parameter cannot be found.
-
getScriptedQueryParameter
public ScriptedQueryParameter getScriptedQueryParameter(String scriptedQueryParameterId) throws InvalidArgumentException, ApplicationObjectNotFoundException
Description copied from interface:ApplicationEntityManager
Gets an scripted query paramter.- Specified by:
getScriptedQueryParameter
in interfaceApplicationEntityManager
- Parameters:
scriptedQueryParameterId
- The scripted query parameter id.- Returns:
- The scripted query parameter.
- Throws:
InvalidArgumentException
- If the scripted query parameter id is null.ApplicationObjectNotFoundException
- If the scripted query parameter cannot be found.
-
getScriptedQueryParameters
public List<ScriptedQueryParameter> getScriptedQueryParameters(String scriptedQueryId) throws InvalidArgumentException
Description copied from interface:ApplicationEntityManager
Gets the scripted query parameters.- Specified by:
getScriptedQueryParameters
in interfaceApplicationEntityManager
- Parameters:
scriptedQueryId
- The scripted query id.- Returns:
- The scripted query parameters.
- Throws:
InvalidArgumentException
- If the scripted query id is null.
-
-