Interface BusinessEntityManager
-
- All Superinterfaces:
AbstractEntityManager
- All Known Implementing Classes:
BusinessEntityManagerImpl
public interface BusinessEntityManager extends AbstractEntityManager
This is the entity in charge of manipulating business objects- Author:
- Charles Edward Bedon Cortazar <charles.bedon@kuwaiba.org>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addParentToSpecialObject(String specialObjectClass, String specialObjectId, String parentClass, String parentId)
Breaks the special hierarchy to enable special children to have more than one parent.long
attachFileToObject(String name, String tags, byte[] file, String className, String objectId)
Relates a file to an inventory objectboolean
canDeleteObject(String className, String oid)
Checks recursively if it's safe to delete a single objectString[]
copyObjects(String targetClassName, String targetOid, HashMap<String,List<String>> objects, boolean recursive)
Copy a set of objectsString
copyPoolItem(String poolId, String poolItemClassName, String poolItemId, boolean recursive)
Copy a pool item from a pool to another poolString[]
copySpecialObjects(String targetClassName, String targetOid, HashMap<String,List<String>> objects, boolean recursive)
Copy a set of special objects (this is used to copy objects when they are containment are set in the special containment hierarchy) use case: to move physical links into a wire Containerlong
countChildren(String objectClass, String objectId)
Counts if an object has childrenlong
countSpecialChildren(String objectClass, String objectId)
Counts if an object has special childrenString[]
createBulkObjects(String className, String parentClassName, String parentOid, String namePattern, String templateId)
Creates multiple objects using a given name patternString[]
createBulkSpecialObjects(String className, String parentClassName, String parentId, String namePattern, String templateId)
Creates multiple special objects using a given name patternlong
createClassLevelReport(String className, String reportName, String reportDescription, String script, int outputType, boolean enabled)
Creates a class level report (a report that will be available for all instances of a given class -and its subclasses-)String
createContact(String contactClass, String customerClassName, String customerId, String userName)
Creates a contact.Contacts are always associated to a customerString
createHeadlessObject(String className, HashMap<String,String> attributes, String templateId)
Creates an object without parent.long
createInventoryLevelReport(String reportName, String reportDescription, String script, int outputType, boolean enabled, List<StringPair> parameters)
Creates an inventory level report (a report that is not tied to a particlar instance or class.String
createObject(String className, String parentClassName, String parentOid, HashMap<String,String> attributes, String templateId)
Creates a new inventory objectString
createObject(String className, String parentClassName, HashMap<String,String> attributes, String templateId, String criteria)
Creates an objectString
createPoolItem(String poolId, String className, HashMap<String,String> attributes, String templateId)
Creates an object inside a poolString
createSpecialObject(String className, String parentClassName, String parentOid, HashMap<String,String> attributes, String templateId)
Creates a new inventory object for a domain specific model (where the standard containment rules don't apply)HashMap<String,String>
createSpecialObjectUsingTemplate(String className, String parentClassName, String parentOid, HashMap<String,String> attributes, String templateId)
Equal tocreateSpecialObject(java.lang.String, java.lang.String, java.lang.String, java.util.HashMap, java.lang.String)
but the return is a map of ids.void
createSpecialRelationship(String aObjectClass, String aObjectId, String bObjectClass, String bObjectId, String name, boolean unique)
Creates a relationship between two elements and labels it.void
createSpecialRelationship(String aObjectClass, String aObjectId, String bObjectClass, String bObjectId, String name, boolean unique, HashMap<String,Object> properties)
This method creates a special relationship with a set of property valuesvoid
deleteContact(String contactClass, String contactId, String userName)
Deletes a contactvoid
deleteObject(String className, String oid, boolean releaseRelationships)
Deletes a single objectvoid
deleteObjects(HashMap<String,List<String>> objects, boolean releaseRelationships)
Deletes a set of objectsChangeDescriptor
deleteReport(long reportId)
Deletes a reportvoid
detachFileFromObject(long fileObjectId, String className, String objectId)
Releases (and deletes) a file associated to an inventory objectbyte[]
executeClassLevelReport(String objectClassName, String objectId, long reportId)
Executes a class level report and returns the result.byte[]
executeInventoryLevelReport(long reportId, List<StringPair> parameters)
Executes an inventory level report and returns the result.List<BusinessObjectLightList>
findRoutesThroughSpecialRelationships(String objectAClassName, String objectAId, String objectBClassName, String objectBId, String relationshipName)
Finds all possible routes between two given inventory objectsList<AnnotatedBusinessObjectLight>
getAnnotatedSpecialAttribute(String objectClass, String objectId, String specialAttributeName)
This method will extract the object at the other side of the special relationship and all the properties of the relationship itselfString
getAttributeValueAsString(String objectClass, String objectId, String attributeName)
Utility method that returns the value of an attribute of a given object as a string.HashMap<String,String>
getAttributeValuesAsString(String objectClass, String objectId)
Fetches the attributes of an inventory object (and their values) and returns them as strings.List<BusinessObject>
getChildrenOfClass(String parentOid, String parentClass, String classToFilter, int page, int maxResults)
Gets the direct children of a given object of a given class.List<BusinessObjectLight>
getChildrenOfClassLight(String parentOid, String parentClass, String classToFilter, int maxResults)
Same as getChildrenOfClass, but returns only the light version of the objectsList<BusinessObjectLight>
getChildrenOfClassLightRecursive(String parentOid, String parentClass, String classToFilter, HashMap<String,String> attributesToFilters, int page, int limit)
Gets all class and abstract class children of a given class to filter in a hierarchy with root in the given parent.List<ReportMetadataLight>
getClassLevelReports(String className, boolean recursive, boolean includeDisabled)
Gets the class level reports associated to the given class (or its superclasses)BusinessObjectLight
getCommonParent(String aObjectClass, String aOid, String bObjectClass, String bOid)
Finds the common parent between two objects.Contact
getContact(String contactClass, String contactId)
Gets the entire information of a given contactList<BusinessObjectLight>
getContactResources(String contactClass, String contactId)
Retrieves the list of resources (inventory objects) related to a contact.List<Contact>
getContacts(int page, int limit, HashMap<String,Object> filters)
Retrieves the list of contacts that matches the search criteriaList<Contact>
getContactsForCustomer(String customerClass, String customerId)
Retrieves the list of contacts associated to a customerFileObject
getFile(long fileObjectId, String className, String objectId)
Retrieves a particular file associated to an inventory object.List<FileObjectLight>
getFilesForObject(String className, String objectId)
Fetches the files associated to an inventory object.Map<BusinessObjectLight,List<FileObjectLight>>
getFilesFromRelatedListTypeItems(String ObjectUuid)
Retrieves a map with the files related to the list type item attributes of the given objectBusinessObject
getFirstParentOfClass(String objectClassName, String oid, String objectToMatchClassName)
Gets the first occurrence of a parent with a given class (according to the special and standard containment hierarchy) (for example "give me the parent of this port until you find the nearest rack")List<ReportMetadataLight>
getInventoryLevelReports(boolean includeDisabled)
Gets the inventory class reports.List<BusinessObjectLight>
getMultipleParents(String objectId)
Gets the parents of an object that breaks the containment rule of having only one parent.BusinessObject
getObject(String className, String oid)
Gets the detailed information about an objectList<BusinessObjectLight>
getObjectChildren(long classId, String oid, int maxResults)
Gets the children of a given object, providing the class and object id.List<BusinessObjectLight>
getObjectChildren(String className, String oid, int maxResults)
Gets the children of a given objectList<BusinessObjectLight>
getObjectChildren(String className, String oid, HashMap<String,String> filters, long skip, long limit)
Get a set of children to the given the parent class name and id.long
getObjectChildrenCount(String className, String oid, HashMap<String,String> filters)
Get the child count given the parent class name and id.BusinessObjectLight
getObjectLight(String className, String oid)
Gets the simplified information about an objectList<BusinessObjectLight>
getObjectsByNameAndClassName(List<String> names, int skip, int limit, String... clasessToFilter)
Gets a set of objects by its exact names and class names, used to know if an object with the same its already created in the inventory e.g.List<BusinessObjectLight>
getObjectsLight(HashMap<String,String> ids)
Retrieves a list of objects based on the provided UUIDs.List<BusinessObject>
getObjectsOfClass(String className, int maxResults)
Recursively gets all the instances of given classList<BusinessObjectLight>
getObjectsOfClassLight(String className, long page, long limit)
Recursively gets all the light instances of given class, without filters.List<BusinessObjectLight>
getObjectsOfClassLight(String className, HashMap<String,String> filters, long page, long limit)
Recursively gets all the light instances of given classList<BusinessObjectLight>
getObjectSpecialChildren(String objectClass, String objectId)
Gets the special children of a given objectlong
getObjectSpecialChildrenCount(String objectClassName, String objectId, String... childrenClassNamesToFilter)
Gets the special children of a given objectList<BusinessObjectLight>
getObjectSpecialChildrenWithFilters(String objectClass, String objectId, List<String> childrenClassNamesToFilter, int page, int limit)
Gets the special children of a given objectList<BusinessObject>
getObjectsWithFilter(String className, String filterName, String filterValue)
Same asgetObjectsWithFilterLight(java.lang.String, java.lang.String, java.lang.String)
, but returns the full information about the objects involvedList<BusinessObjectLight>
getObjectsWithFilterLight(String className, String filterName, String filterValue)
Retrieves a list of light instances of a given class given a simple filter.BusinessObjectLight
getParent(String objectClass, String oid)
Deprecated.This method will be renamed in future versions to support multiple parents.List<BusinessObjectLight>
getParents(String objectClassName, String oid)
Deprecated.This method will be renamed in future versions to support hierarchical parents.List<BusinessObjectLight>
getParentsUntilFirstOfClass(String objectClassName, String oid, String... objectToMatchClassNames)
Gets the list of parents (according to the special and standard containment hierarchy) until it finds an instance of class objectToMatchClassName (for example "give me the parents of this port until you find the nearest rack")BusinessObjectLight
getPhysicalNodeToObjectInWarehouse(String objectClassName, String objectId)
Gets the physical node of a warehouse itemInventoryObjectPool
getPool(String poolId)
Gets a pool by its idList<BusinessObjectLight>
getPoolItems(String poolId, int limit)
Retrieves the list of objects from a poolList<BusinessObjectLight>
getPoolItemsByClassName(String poolId, String className, int page, int limit)
Retrieves the list of objects from a poollong
getPoolItemsCount(String poolId, String className)
Count the total of objects in a poolList<InventoryObjectPool>
getPoolsInObject(String objectClassName, String objectId, String poolClass)
Retrieves the pools associated to a particular objectList<InventoryObjectPool>
getPoolsInPool(String parentPoolId, String poolClassName)
Retrieves the pools associated to a particular poollong
getPoolsInPoolCount(String parentPoolId, String poolClassName)
Retrieves the total count of pools associated to a particular poolReportMetadata
getReport(long reportId)
Gets the information related to a class level report.List<InventoryObjectPool>
getRootPools(String className, int type, boolean includeSubclasses)
Retrieves the pools that don't have any parent and are normally intended to be managed by the Pool ManagerList<BusinessObjectLight>
getSiblings(String className, String oid, int maxResults)
Gets the siblings of a given object in the containment hierarchyList<BusinessObjectLight>
getSpecialAttribute(String objectClass, String objectId, String specialAttributeName)
Gets the value of a special attribute.HashMap<String,List<BusinessObjectLight>>
getSpecialAttributes(String className, String objectId, String... attributeNames)
Returns the specified special relationships of a given object as a hashmap whose keys are the names of the relationships and the values the list of related objects.List<BusinessObjectLight>
getSpecialChildrenOfClassLight(String parentOid, String parentClass, String classToFilter, int maxResults)
Returns the special children of a given object as RemoteBusinessObjectLight instances.This method is not recursive.List<BusinessObjectLight>
getSpecialChildrenOfClassLightRecursive(String parentOid, String parentClass, String classToFilter, int maxResults)
Gets all class and abstract class special children of a given class to filter in a hierarchy with root in the given parent.List<BusinessObjectLight>
getSuggestedChildrenWithFilter(String parentClass, String parentId, String filter, boolean ignoreSpecialChildren, int skip, int limit, String... clasessToFilter)
Gets a set of suggested children with filter (no recursive).List<BusinessObjectLight>
getSuggestedObjectsWithFilter(String filter, int limit)
Suggests a number of objects based on a search string.List<BusinessObjectLight>
getSuggestedObjectsWithFilter(String filter, int skip, int limit, String... classesToFilter)
Gets a set of suggested objects with filter.List<BusinessObjectLight>
getSuggestedObjectsWithFilter(String filter, String superClass, int limit)
Deprecated.HashMap<String,List<BusinessObjectLight>>
getSuggestedObjectsWithFilterGroupedByClassName(List<String> classesNamesToFilter, String filter, long classesSkip, long classesLimit, long objectSkip, long objectLimit)
Suggests a number of objects based on a search string.HashMap<String,List<InventoryObjectPool>>
getSuggestedPoolsByName(List<String> classesNamesToFilter, String nameTofilter, long poolSkip, long poolLimit, long objectSkip, long objectLimit)
Suggests a number of pools based on a search string (the pool name).List<BusinessObjectLight>
getWarehousesInObject(String objectClassName, String objectId)
Gets the warehouses in a objectBusinessObjectLight
getWarehouseToObject(String objectClassName, String objectId)
Gets warehouse related to objectboolean
hasRelationship(String objectClass, String objectId, String relationshipName, int numberOfRelationships)
Checks if an object has a given number of standard relationships with another objectboolean
hasSpecialAttribute(String objectClass, String objectId, String attributeName)
Check if an object has a given special attribute.boolean
hasSpecialRelationship(String objectClass, String objectId, String relationshipName, int numberOfRelationships)
Checks if an object has a given number of special relationships with another objectboolean
isParent(String parentClass, String parentId, String childClass, String childId)
Checks if a given object is parent to another, according to the standard or special containment hierarchy.void
moveObjects(String targetClassName, String targetOid, HashMap<String,String[]> objects)
Move a list of objects to a new parent: this methods ignores those who can't be moved and raises an OperationNotPermittedException, however, it will move those which can be movedvoid
moveObjectsToPool(String targetClassName, String targetOid, HashMap<String,String[]> objects)
Move a list of objects to a new parent: this methods ignores those who can't be moved and raises an OperationNotPermittedException, however, it will move those which can be movedvoid
movePoolItem(String poolId, String poolItemClassName, String poolItemId)
Move a pool item from a pool to another poolvoid
moveSpecialObjects(String targetClassName, String targetOid, HashMap<String,String[]> objects)
Move a list of objects to a new parent(taking into account the special hierarchy containment): this methods ignores those who can't be moved and raises an OperationNotPermittedException, however, it will move those which can be movedvoid
relateObjectToContact(String objectClass, String objectId, String contactClass, String contactId, String userName)
Relates an inventory object to a contact.void
releaseObjectFromContact(String objectClass, String objectId, String contactClass, String contactId, String userName)
Releases an inventory object from a contact.void
releaseRelationships(String objectClass, String objectId, List<String> relationshipsToRelease)
Releases all the relationships with the given names associated to the object provided.void
releaseSpecialRelationship(String objectClass, String objectId, String otherObjectId, String relationshipName)
Release all special relationships with a given namevoid
releaseSpecialRelationshipInTargetObject(String objectClass, String objectId, String relationshipName, String targetId)
Release all special relationships with a given name whose target object id matches with the one providedList<Contact>
searchForContacts(String searchString, int maxResults)
Searches in all the properties of a contact for a given stringvoid
updateContact(String contactClass, String contactId, List<StringPair> properties, String userName)
Updates a contact's informationvoid
updateFileProperties(long fileObjectId, List<StringPair> properties, String className, String objectId)
Updates the properties of a file object (name or tags)ChangeDescriptor
updateObject(String className, String oid, HashMap<String,String> attributes)
Updates an object attributes.ChangeDescriptor
updateReport(long reportId, String reportName, String reportDescription, Boolean enabled, Integer type, String script)
Updates the properties of an existing class level report.ChangeDescriptor
updateReportParameters(long reportId, List<StringPair> parameters)
Updates the parameters of a report-
Methods inherited from interface org.neotropic.kuwaiba.core.apis.persistence.AbstractEntityManager
initCache, setConfiguration
-
-
-
-
Method Detail
-
createObject
String createObject(String className, String parentClassName, String parentOid, HashMap<String,String> attributes, String templateId) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException, OperationNotPermittedException, ApplicationObjectNotFoundException
Creates a new inventory object- Parameters:
className
- Name of the class which this object will be instantiated fromparentClassName
- Parent object class name. If null, the parent will be the DummyRoot nodeparentOid
- Parent's oid. If -1, the parent will be the DummyRoot nodeattributes
- Attributes to be set by default in the new object. It's a HashMap where the keys are the attribute names and the values, the values for such attributes. Note that binary type attributes can't be set here.templateId
- Template id to be used to create the current object. Template values can be overridden if "attributeValues" is not empty. Use an empty string or null to not use a Template.- Returns:
- The object's id
- Throws:
MetadataObjectNotFoundException
- Thrown if the object's class can't be foundBusinessObjectNotFoundException
- Thrown if the parent id is not foundOperationNotPermittedException
- If there's a business constraint that doesn't allow to create the object.InvalidArgumentException
- If any of the attribute values has an invalid value or format.ApplicationObjectNotFoundException
- If the specified template could not be found
-
createObject
String createObject(String className, String parentClassName, HashMap<String,String> attributes, String templateId, String criteria) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException, OperationNotPermittedException, ApplicationObjectNotFoundException
Creates an object- Parameters:
className
- Class the object will be instance ofparentClassName
- Class of the parent the object will be instance of. Use root for the navigation treecriteria
- Criteria to search for the parent. This is a string with two parts: One is the name of the attribute and the other its value, both separated by a fixed colon :. Example: name:Colombiaattributes
- Dictionary with the names and the values of the attributes to be set.templateId
- The id of the template to be used to create this object. This id was probably retrieved by {@link ApplicationEntityManager.getTemplatesForClass(String)} before. Use a null or empty string to not use a template.- Returns:
- The id of the new object.
- Throws:
MetadataObjectNotFoundException
- Thrown if the object's class can't be foundBusinessObjectNotFoundException
- Thrown if the parent id is not foundInvalidArgumentException
- If any of the attribute values has an invalid value or format.OperationNotPermittedException
- If there's a business constraint that doesn't allow to create the object.ApplicationObjectNotFoundException
- If the specified template could not be found.
-
createSpecialObject
String createSpecialObject(String className, String parentClassName, String parentOid, HashMap<String,String> attributes, String templateId) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Creates a new inventory object for a domain specific model (where the standard containment rules don't apply)- Parameters:
className
- Name of the class which this object will be instantiated fromparentClassName
- Parent object class nameparentOid
- Parent's oidattributes
- Attributes to be set by default in the new object. It's a HashMap where the keys are the attribute names and the values, the values for such attributes. Note that binary type attributes can't be set here.templateId
- The id of the template to be used to create this object. This id was probably retrieved by {@link ApplicationEntityManager.getTemplatesForClass(String)} before. Use a null or empty string to not use a template.- Returns:
- The id of the new object.
- Throws:
MetadataObjectNotFoundException
- Thrown if the object's class can't be foundBusinessObjectNotFoundException
- Thrown if the parent id is not foundInvalidArgumentException
- If any of the attribute values has an invalid value or format.ApplicationObjectNotFoundException
- If the specified template could not be found.
-
createSpecialObjectUsingTemplate
HashMap<String,String> createSpecialObjectUsingTemplate(String className, String parentClassName, String parentOid, HashMap<String,String> attributes, String templateId) throws BusinessObjectNotFoundException, OperationNotPermittedException, MetadataObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Equal tocreateSpecialObject(java.lang.String, java.lang.String, java.lang.String, java.util.HashMap, java.lang.String)
but the return is a map of ids. Creates a new inventory object for a domain specific model (where the standard containment rules don't apply)- Parameters:
className
- Name of the class which this object will be instantiated fromparentClassName
- Parent object class nameparentOid
- Parent's oidattributes
- Attributes to be set by default in the new object. It's a HashMap where the keys are the attribute names and the values, the values for such attributes. Note that binary type attributes can't be set here.templateId
- The id of the template to be used to create this object. This id was probably retrieved by {@link ApplicationEntityManager.getTemplatesForClass(String)} before. Use a null or empty string to not use a template.- Returns:
- The id of the new object.
- Throws:
MetadataObjectNotFoundException
- Thrown if the object's class can't be foundBusinessObjectNotFoundException
- Thrown if the parent id is not foundOperationNotPermittedException
- If the update can't be performed due to a format issueInvalidArgumentException
- If any of the attribute values has an invalid value or format.ApplicationObjectNotFoundException
- If the specified template could not be found.
-
addParentToSpecialObject
void addParentToSpecialObject(String specialObjectClass, String specialObjectId, String parentClass, String parentId) throws BusinessObjectNotFoundException, OperationNotPermittedException, MetadataObjectNotFoundException, InvalidArgumentException
Breaks the special hierarchy to enable special children to have more than one parent.- Parameters:
specialObjectClass
- Special object class namespecialObjectId
- Special Object IdparentClass
- Parent Object classparentId
- Parent Object id- Throws:
BusinessObjectNotFoundException
OperationNotPermittedException
MetadataObjectNotFoundException
InvalidArgumentException
-
createHeadlessObject
String createHeadlessObject(String className, HashMap<String,String> attributes, String templateId) throws MetadataObjectNotFoundException, InvalidArgumentException, OperationNotPermittedException, ApplicationObjectNotFoundException
Creates an object without parent. This might be particularly useful for complex models. Use it carefully to avoid leaving orphan objects. Always provide custom methods to delete- Parameters:
className
- The class name of the object to be created.attributes
- The initial set of attributes (as pairs attribute name - value) to be set. These values will override those in the template used (if any).templateId
- The id of the template to be used to create the object. Use null or an empty string to not use any template.- Returns:
- The id of the newly created object.
- Throws:
MetadataObjectNotFoundException
- If the class provided does not exist.InvalidArgumentException
- If the format of any of the default attributes provided is incorrect.OperationNotPermittedException
- If the class provided is marked as in design or it is abstract.ApplicationObjectNotFoundException
- If the template provided does not exist.
-
createPoolItem
String createPoolItem(String poolId, String className, HashMap<String,String> attributes, String templateId) throws ApplicationObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException
Creates an object inside a pool- Parameters:
poolId
- Parent pool idclassName
- Class this object is going to be instance ofattributes
- The list of attributes to be set initially. The values are serialized objects.templateId
- The id of the template to be used to create this object. This id was probably retrieved by {@link ApplicationEntityManager.getTemplatesForClass(String)} before. Use a null or empty string to not use a template.- Returns:
- the id of the newly created object
- Throws:
ApplicationObjectNotFoundException
- If the parent pool can't be foundInvalidArgumentException
- If any of the attributes or its type is invalidMetadataObjectNotFoundException
- If the class name could not be found
-
createBulkObjects
String[] createBulkObjects(String className, String parentClassName, String parentOid, String namePattern, String templateId) throws MetadataObjectNotFoundException, OperationNotPermittedException, BusinessObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Creates multiple objects using a given name pattern- Parameters:
className
- The class name for the new objectsparentClassName
- The parent class name for the new objectsparentOid
- The object id of the parentnamePattern
- A pattern to create the names for the new objectstemplateId
- a template id for the objects creation, it could be null if no template is required- Returns:
- An arrays of ids for the new objects
- Throws:
MetadataObjectNotFoundException
- If the className or the parentClassName can not be found.BusinessObjectNotFoundException
- If the parent node can not be found.InvalidArgumentException
- If the given name pattern not match with the regular expression to build the new object name.OperationNotPermittedException
- If the className is not a possible children of parentClassName. If the className is not in design or are abstract. If the className is not an InventoryObject.ApplicationObjectNotFoundException
- if the given template id does not exist.
-
createBulkSpecialObjects
String[] createBulkSpecialObjects(String className, String parentClassName, String parentId, String namePattern, String templateId) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, OperationNotPermittedException, InvalidArgumentException, ApplicationObjectNotFoundException
Creates multiple special objects using a given name pattern- Parameters:
className
- The class name for the new special objectsparentClassName
- The parent class name for the new special objectsparentId
- The object id of the parentnamePattern
- A pattern to create the names for the new special objectstemplateId
- The id of the template to be used for the set of objects to be created. Used null for none.- Returns:
- An array of ids for the new special objects
- Throws:
MetadataObjectNotFoundException
- If the className or the parentClassName can not be found.BusinessObjectNotFoundException
- If the parent node can not be found.InvalidArgumentException
- If the given name pattern not match with the regular expression to build the new object name.OperationNotPermittedException
- If the className is not a possible special children of parentClassName. If the className is not in design or are abstract. If the className is not an InventoryObject.ApplicationObjectNotFoundException
- If the provided template could not be found.
-
getObject
BusinessObject getObject(String className, String oid) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Gets the detailed information about an object- Parameters:
className
- Object class nameoid
- Object's oid- Returns:
- A detailed representation of the requested object
- Throws:
MetadataObjectNotFoundException
- If the className class can't be foundBusinessObjectNotFoundException
- If the requested object can't be foundInvalidArgumentException
- If the object id can not be found.
-
getObjectSpecialChildren
List<BusinessObjectLight> getObjectSpecialChildren(String objectClass, String objectId) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Gets the special children of a given object- Parameters:
objectClass
- Object classobjectId
- object id- Returns:
- The list of special children.
- Throws:
MetadataObjectNotFoundException
- If the class could not be foundBusinessObjectNotFoundException
- If the object could not be found.InvalidArgumentException
- If the object id is null
-
getObjectSpecialChildrenWithFilters
List<BusinessObjectLight> getObjectSpecialChildrenWithFilters(String objectClass, String objectId, List<String> childrenClassNamesToFilter, int page, int limit) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Gets the special children of a given object- Parameters:
objectClass
- Object classobjectId
- object idfilters
- attributes values to filter the returnpage
- the number of results to skip or the pagethe
- limit of results per page- Returns:
- The list of special children.
- Throws:
MetadataObjectNotFoundException
- If the class could not be foundBusinessObjectNotFoundException
- If the object could not be found.InvalidArgumentException
- If the object id is null
-
getObjectSpecialChildrenCount
long getObjectSpecialChildrenCount(String objectClassName, String objectId, String... childrenClassNamesToFilter) throws BusinessObjectNotFoundException, InvalidArgumentException
Gets the special children of a given object- Parameters:
objectClass
- Object classobjectId
- object id- Returns:
- The list of special children.
- Throws:
MetadataObjectNotFoundException
- If the class could not be foundBusinessObjectNotFoundException
- If the object could not be found.InvalidArgumentException
- If the object id is null
-
getObjectLight
BusinessObjectLight getObjectLight(String className, String oid) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Gets the simplified information about an object- Parameters:
className
- Object class nameoid
- Object's oid- Returns:
- A detailed representation of the requested object
- Throws:
MetadataObjectNotFoundException
- If the className class can't be foundBusinessObjectNotFoundException
- If the requested object can't be foundInvalidArgumentException
- If the oid is null
-
getObjectsLight
List<BusinessObjectLight> getObjectsLight(HashMap<String,String> ids) throws BusinessObjectNotFoundException, InvalidArgumentException
Retrieves a list of objects based on the provided UUIDs.- Parameters:
ids
- A HashMap containing UUIDs as keys and their corresponding className as values. These UUIDs are used to match against the inventory objects in the database.- Returns:
- A list of BusinessObjectLightinstances representing the found objects.
- Throws:
BusinessObjectNotFoundException
- If no objects corresponding to the provided UUIDs are found.InvalidArgumentException
- If the provided UUIDs are null or empty.
-
getObjectsWithFilterLight
List<BusinessObjectLight> getObjectsWithFilterLight(String className, String filterName, String filterValue) throws InvalidArgumentException
Retrieves a list of light instances of a given class given a simple filter. This method will search for all objects with a string-based attribute (filterName) whose value matches a value provided (filterValue)- Parameters:
className
- The class of the objects to be searched. This method support abstract superclasses as wellfilterName
- The attribute to be used as filter. This will work only with String-type attributes. Example: serialNumber. To list type attributes the filter must be applied to the name. Example: filterName: model, filterValue: XYZfilterValue
- The value to be use to match the instances. Example "Serial-12345"- Returns:
- The list of instances that matches the filterName/filterValue criteria
- Throws:
InvalidArgumentException
- If the uuid attribute could not be found in the result nodes
-
getObjectsWithFilter
List<BusinessObject> getObjectsWithFilter(String className, String filterName, String filterValue) throws InvalidArgumentException
Same asgetObjectsWithFilterLight(java.lang.String, java.lang.String, java.lang.String)
, but returns the full information about the objects involved- Parameters:
className
- The class of the objects to be searched. This method support abstract superclasses as wellfilterName
- The attribute to be used as filter. This will work only with String-type attributes. Example: serialNumber. To list type attributes the filter must be applied to the name. Example: filterName: model, filterValue: XYZfilterValue
- The value to be use to match the instances. Example "Serial-12345"- Returns:
- The list of instances that matches the filterName/filterValue criteria
- Throws:
InvalidArgumentException
- If it's not possible to construct the RemoteBusinessObjects from the information in the database
-
getSuggestedObjectsWithFilter
List<BusinessObjectLight> getSuggestedObjectsWithFilter(String filter, int limit)
Suggests a number of objects based on a search string. The search string is matched against the name of the object, its class name or its class display name.- Parameters:
filter
- The string to use as search filter.limit
- The limit of results. Use -1 to retrieve all.- Returns:
- A list of up to #
limit
suggested objects matching the criteria, alphabetically sorted.
-
getSuggestedObjectsWithFilter
@Deprecated List<BusinessObjectLight> getSuggestedObjectsWithFilter(String filter, String superClass, int limit)
Deprecated.Same asgetSuggestedObjectsWithFilter(java.lang.String, int)
, but the results will be instances of the super class provided or one of its subclasses. In reality, this method could do the same asgetSuggestedObjectsWithFilter(java.lang.String, int)
withsuperClass
set toInventoryObject
, but the implementation of both methods may differ significantly in terms of performance and complexity.- Parameters:
filter
- The search stringsuperClass
- The results will be instances of this class or one of its subclasseslimit
- The limit of results. Use -1 to retrieve all- Returns:
- A list of up to #
limit
suggested objects matching the criteria, alphabetically sorted
-
getSuggestedObjectsWithFilter
List<BusinessObjectLight> getSuggestedObjectsWithFilter(String filter, int skip, int limit, String... classesToFilter)
Gets a set of suggested objects with filter.- Parameters:
filter
- a possible part of the name of an object(s) or class(es).skip
- The number of leading suggested objects to skip.limit
- The number of suggested objects the result should be limited to.classesToFilter
- The suggested objects will be instance of this classes or subclasses.- Returns:
- List of suggested objects.
-
getObjectsByNameAndClassName
List<BusinessObjectLight> getObjectsByNameAndClassName(List<String> names, int skip, int limit, String... clasessToFilter) throws InvalidArgumentException
Gets a set of objects by its exact names and class names, used to know if an object with the same its already created in the inventory e.g. an IP address or a subnet in the ipam module can not be repeated- Parameters:
names
- the exact names of the objectsskip
- the pagelimit
- the limit per pageclasessToFilter
- class names of the objects- Returns:
- a list of objects
- Throws:
InvalidArgumentException
-
getSuggestedChildrenWithFilter
List<BusinessObjectLight> getSuggestedChildrenWithFilter(String parentClass, String parentId, String filter, boolean ignoreSpecialChildren, int skip, int limit, String... clasessToFilter)
Gets a set of suggested children with filter (no recursive).- Parameters:
parentClass
- The parent class name.parentId
- The parent id.filter
- Filter children (no recursive) by name or class.ignoreSpecialChildren
- True to ignore special children in the suggested children (no recursive).skip
- The number of leading children to skip.limit
- The number of children the result should be limited to.clasessToFilter
- The suggested children will be instance of this classes or subclasses.- Returns:
- List of suggested children (no recursive).
-
getAttributeValueAsString
String getAttributeValueAsString(String objectClass, String objectId, String attributeName) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Utility method that returns the value of an attribute of a given object as a string. In date-type attributes, it will return the formatted dated, while in list types, it will return the name of the linked element- Parameters:
objectClass
- The class of the objectobjectId
- The id of the objectattributeName
- The attribute whose value will be retrieved- Returns:
- The value of the requested attribute. Null values are possible
- Throws:
MetadataObjectNotFoundException
- If the class of the object could not be foundBusinessObjectNotFoundException
- If the object itself could not be foundInvalidArgumentException
- Check with the data model integrity, because this would mean that a the type of the attribute should be a list type, but it's notApplicationObjectNotFoundException
- Check with the data model integrity, because this would mean that a list type item related to the object is not an instance of the right list type class
-
getAttributeValuesAsString
HashMap<String,String> getAttributeValuesAsString(String objectClass, String objectId) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Fetches the attributes of an inventory object (and their values) and returns them as strings. This is useful mainly to display property sheets and reports, so it's not necessary to always check if an attribute is a list type and retrieve its string representation- Parameters:
objectClass
- The class of the objectobjectId
- The id of the object- Returns:
- A dictionary with the name of the attributes and their values represented as strings
- Throws:
MetadataObjectNotFoundException
- If the class of the object could not be foundBusinessObjectNotFoundException
- If the object itself could not be foundInvalidArgumentException
- Check with the data model integrity, because this would mean that a the type of the attribute should be a list type, but it's notApplicationObjectNotFoundException
- Check with the data model integrity, because this would mean that a list type item related to the object is not an instance of the right list type class
-
getCommonParent
BusinessObjectLight getCommonParent(String aObjectClass, String aOid, String bObjectClass, String bOid) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Finds the common parent between two objects.- Parameters:
aObjectClass
- Object A class name.aOid
- Object A id.bObjectClass
- Object B class name.bOid
- Object B id.- Returns:
- The common parent or null if none.
- Throws:
BusinessObjectNotFoundException
- If any of the objects could not be found.MetadataObjectNotFoundException
- If any of the classes provided could not be found.InvalidArgumentException
- If the database object could not be properly mapped into a serializable Java object.
-
getParent
@Deprecated BusinessObjectLight getParent(String objectClass, String oid) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Deprecated.This method will be renamed in future versions to support multiple parents.Gets the parent of a given object in the containment hierarchy- Parameters:
objectClass
- Object classoid
- Object id- Returns:
- The immediate parent. Null if the parent is null. A dummy object with id -1 if the parent is DummyRoot
- Throws:
BusinessObjectNotFoundException
- If the requested object can't be foundMetadataObjectNotFoundException
- If any of the class nodes involved is malformedInvalidArgumentException
- If the database object could not be properly mapped into a serializable java object.
-
getParents
@Deprecated List<BusinessObjectLight> getParents(String objectClassName, String oid) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Deprecated.This method will be renamed in future versions to support hierarchical parents.Retrieves recursively the list of parents of an object in the containment hierarchy- Parameters:
oid
- Object idobjectClassName
- Object class- Returns:
- The list of parents
- Throws:
BusinessObjectNotFoundException
- If the object does not existMetadataObjectNotFoundException
- If the class can not be foundInvalidArgumentException
- If the oid is null
-
getParentsUntilFirstOfClass
List<BusinessObjectLight> getParentsUntilFirstOfClass(String objectClassName, String oid, String... objectToMatchClassNames) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, ApplicationObjectNotFoundException, InvalidArgumentException
Gets the list of parents (according to the special and standard containment hierarchy) until it finds an instance of class objectToMatchClassName (for example "give me the parents of this port until you find the nearest rack")- Parameters:
objectClassName
- Class of the object to get the parents fromoid
- Id of the object to get the parents fromobjectToMatchClassNames
- Classes of the objects that will limit the search. It can be a superclass, if you want to match many classes at once- Returns:
- The list of parents until an instance of objectToMatchClassName is found. If no instance of that class is found, all parents until the Dummy Root will be returned
- Throws:
BusinessObjectNotFoundException
- If the object to evaluate can not be foundMetadataObjectNotFoundException
- If any of the classes provided could not be foundApplicationObjectNotFoundException
- If the object provided is not in the standard containment hierarchyInvalidArgumentException
- If the oid is null
-
getFirstParentOfClass
BusinessObject getFirstParentOfClass(String objectClassName, String oid, String objectToMatchClassName) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, ApplicationObjectNotFoundException, InvalidArgumentException
Gets the first occurrence of a parent with a given class (according to the special and standard containment hierarchy) (for example "give me the parent of this port until you find the nearest rack")- Parameters:
objectClassName
- Class of the object to get the parent fromoid
- Id of the object to get the parent fromobjectToMatchClassName
- Class of the object that will limit the search. It can be a superclass, if you want to match many classes at once- Returns:
- The the first occurrence of a parent with a given class. If no instance of that class is found, the child of Dummy Root related in this hierarchy will be returned
- Throws:
BusinessObjectNotFoundException
- If the object to evaluate can not be foundMetadataObjectNotFoundException
- If any of the classes provided could not be foundApplicationObjectNotFoundException
- If the object provided is not in the standard containment hierarchyInvalidArgumentException
- If the oid is null
-
getMultipleParents
List<BusinessObjectLight> getMultipleParents(String objectId) throws InvalidArgumentException
Gets the parents of an object that breaks the containment rule of having only one parent. For example the links and containers in the Outside Plant Module.- Parameters:
objectId
- Object Id.- Returns:
- The set of parents.
- Throws:
InvalidArgumentException
- If the object id is null.
-
isParent
boolean isParent(String parentClass, String parentId, String childClass, String childId) throws InvalidArgumentException
Checks if a given object is parent to another, according to the standard or special containment hierarchy.- Parameters:
parentClass
- Alleged parent Class Name.parentId
- Alleged parent id.childClass
- Child Class Name.childId
- Child Id.- Returns:
- True if the given parent has the given child (according to the special and standard containment hierarchy)
- Throws:
InvalidArgumentException
-
canDeleteObject
boolean canDeleteObject(String className, String oid) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, OperationNotPermittedException, InvalidArgumentException
Checks recursively if it's safe to delete a single object- Parameters:
className
- Object's class nameoid
- Objects oid- Returns:
- True if the object does not have relationships that keep it from being deleted. False otherwise.
- Throws:
BusinessObjectNotFoundException
- If the object couldn't be foundMetadataObjectNotFoundException
- If the requested object class can't be foundOperationNotPermittedException
- If the object could not be deleted because there's some business rules that avoids it or it has incoming relationships.InvalidArgumentException
-
deleteObjects
void deleteObjects(HashMap<String,List<String>> objects, boolean releaseRelationships) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, OperationNotPermittedException, InvalidArgumentException
Deletes a set of objects- Parameters:
releaseRelationships
- If all the relationships should be release upon deleting the objects. If false, an OperationNotPermittedException will be raised if the object has incoming relationships.objects
- a hashmap where the class name is the key and the value is a list of long containing the ids of the objects to be deleted that are instance of the key class- Throws:
BusinessObjectNotFoundException
- If the requested object can't be foundMetadataObjectNotFoundException
- If the requested object class can't be foundOperationNotPermittedException
- If the update can't be performed due a business rule or because the object is blocked or it has relationships and releaseRelationships is falseInvalidArgumentException
- If the uuid can not be found
-
deleteObject
void deleteObject(String className, String oid, boolean releaseRelationships) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, OperationNotPermittedException, InvalidArgumentException
Deletes a single object- Parameters:
className
- Object's class nameoid
- Objects oidreleaseRelationships
- Release relationships automatically. If set to false, it will fail if the object already has incoming relationships- Throws:
BusinessObjectNotFoundException
- If the object couldn't be foundMetadataObjectNotFoundException
- If the class could not be foundOperationNotPermittedException
- If the object could not be deleted because there's some business rules that avoids it or it has incoming relationships.InvalidArgumentException
- If the oid is null
-
updateObject
ChangeDescriptor updateObject(String className, String oid, HashMap<String,String> attributes) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, OperationNotPermittedException, InvalidArgumentException
Updates an object attributes. Note that you can't set binary attributes through this method. Use setBinaryAttributes instead.- Parameters:
className
- Object class nameoid
- Object's oidattributes
- The attributes to be updated (the key is the attribute name, the value is and array with the value -or values in case of MANY TO MANY list type attributes-)- Returns:
- The summary of the changes that were made
- Throws:
MetadataObjectNotFoundException
- If the object class can't be foundBusinessObjectNotFoundException
- If the object can't be foundOperationNotPermittedException
- If the update can't be performed due a business rule or because the object is blockedInvalidArgumentException
- If any of the names provided does not exist or can't be set using this method or of the value of any of the attributes can not be mapped correctly or if the class provided is not a subclass ofInventoryObject
.
-
moveObjectsToPool
void moveObjectsToPool(String targetClassName, String targetOid, HashMap<String,String[]> objects) throws BusinessObjectNotFoundException, OperationNotPermittedException, MetadataObjectNotFoundException, InvalidArgumentException
Move a list of objects to a new parent: this methods ignores those who can't be moved and raises an OperationNotPermittedException, however, it will move those which can be moved- Parameters:
objects
- Map using the object class name as keys and the respective objects oids as valuestargetClassName
- Parent's class nametargetOid
- Parent's oid- Throws:
MetadataObjectNotFoundException
- If the object's or new parent's class can't be foundBusinessObjectNotFoundException
- If the object or its new parent can't be foundOperationNotPermittedException
- If the update can't be performed due to a business ruleInvalidArgumentException
- If inventory object/pool does no have uuid
-
moveObjects
void moveObjects(String targetClassName, String targetOid, HashMap<String,String[]> objects) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, OperationNotPermittedException, InvalidArgumentException
Move a list of objects to a new parent: this methods ignores those who can't be moved and raises an OperationNotPermittedException, however, it will move those which can be moved- Parameters:
objects
- Map using the object class name as keys and the respective objects oids as valuestargetClassName
- Parent's class nametargetOid
- Parent's oid- Throws:
MetadataObjectNotFoundException
- If the object's or new parent's class can't be foundBusinessObjectNotFoundException
- If the object or its new parent can't be foundOperationNotPermittedException
- If the update can't be performed due to a business ruleInvalidArgumentException
- If inventory object/pool does not have uuid
-
moveSpecialObjects
void moveSpecialObjects(String targetClassName, String targetOid, HashMap<String,String[]> objects) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, OperationNotPermittedException, InvalidArgumentException
Move a list of objects to a new parent(taking into account the special hierarchy containment): this methods ignores those who can't be moved and raises an OperationNotPermittedException, however, it will move those which can be moved- Parameters:
objects
- Map using the object class name as keys and the respective objects oids as valuestargetClassName
- Parent's class nametargetOid
- Parent's oid- Throws:
MetadataObjectNotFoundException
- If the object's or new parent's class can't be foundBusinessObjectNotFoundException
- If the object or its new parent can't be foundOperationNotPermittedException
- If the update can't be performed due to a business ruleInvalidArgumentException
- If an inventory object/pool does not have uuid
-
movePoolItem
void movePoolItem(String poolId, String poolItemClassName, String poolItemId) throws ApplicationObjectNotFoundException, InvalidArgumentException, BusinessObjectNotFoundException, MetadataObjectNotFoundException
Move a pool item from a pool to another pool- Parameters:
poolId
- The id of the pool nodepoolItemClassName
- The class name for the pool itempoolItemId
- The id for the pool item- Throws:
ApplicationObjectNotFoundException
- If the pool node can not be foundInvalidArgumentException
- If the pool item can not be move to the selected poolBusinessObjectNotFoundException
- If the pool item can not be foundMetadataObjectNotFoundException
- If the pool item class name can no be found
-
copyObjects
String[] copyObjects(String targetClassName, String targetOid, HashMap<String,List<String>> objects, boolean recursive) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, OperationNotPermittedException, InvalidArgumentException
Copy a set of objects- Parameters:
objects
- Hashmap with the objects class names as keys and their oids as valuestargetClassName
- Target parent's class nametargetOid
- Target parent's oidrecursive
- If this operation should also copy the children objects recursively- Returns:
- A list containing the newly created object ids
- Throws:
MetadataObjectNotFoundException
- If any of the provided classes couldn't be foundBusinessObjectNotFoundException
- If any of the template objects couldn't be foundOperationNotPermittedException
- If the target parent can't contain any of the new instancesInvalidArgumentException
- If an inventory object id is null
-
copySpecialObjects
String[] copySpecialObjects(String targetClassName, String targetOid, HashMap<String,List<String>> objects, boolean recursive) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Copy a set of special objects (this is used to copy objects when they are containment are set in the special containment hierarchy) use case: to move physical links into a wire Container- Parameters:
objects
- Hashmap with the objects class names as keys and their oids as valuestargetClassName
- Target parent's class nametargetOid
- Target parent's oidrecursive
- If this operation should also copy the children objects recursively- Returns:
- A list containing the newly created object ids
- Throws:
MetadataObjectNotFoundException
- If any of the provided classes couldn't be foundBusinessObjectNotFoundException
- If any of the template objects couldn't be foundInvalidArgumentException
- If the objects can not be copied to the specified parent (most likely due to containment restrictions).
-
copyPoolItem
String copyPoolItem(String poolId, String poolItemClassName, String poolItemId, boolean recursive) throws ApplicationObjectNotFoundException, InvalidArgumentException, BusinessObjectNotFoundException, MetadataObjectNotFoundException
Copy a pool item from a pool to another pool- Parameters:
poolId
- The id of the pool nodepoolItemClassName
- The class name for the pool itempoolItemId
- The id for the pool itemrecursive
- If this operation should also copy the children objects recursively- Returns:
- The newly created object id
- Throws:
ApplicationObjectNotFoundException
- If the pool node can not be foundInvalidArgumentException
- If the pool item can not be move to the selected poolBusinessObjectNotFoundException
- If the pool item can not be foundMetadataObjectNotFoundException
- If the pool item class name can no be found
-
getObjectChildren
List<BusinessObjectLight> getObjectChildren(String className, String oid, int maxResults) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Gets the children of a given object- Parameters:
className
- Object's class nameoid
- Object's oidmaxResults
- max number of children to be returned, -1 to return all- Returns:
- The list of children
- Throws:
MetadataObjectNotFoundException
- If the object's can't be foundBusinessObjectNotFoundException
- If the object or its new parent can't be foundInvalidArgumentException
- If oid is null
-
getObjectChildren
List<BusinessObjectLight> getObjectChildren(long classId, String oid, int maxResults) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Gets the children of a given object, providing the class and object id.- Parameters:
classId
- The id of the class the object is instance ofoid
- The oid of the objectmaxResults
- The max number of results to be retrieved. Use 0 to retrieve all- Returns:
- The list of children.
- Throws:
BusinessObjectNotFoundException
- If the object could not be found.MetadataObjectNotFoundException
- If the class could not be found.InvalidArgumentException
- If the oid is null
-
getChildrenOfClass
List<BusinessObject> getChildrenOfClass(String parentOid, String parentClass, String classToFilter, int page, int maxResults) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Gets the direct children of a given object of a given class.- Parameters:
parentOid
- parent idparentClass
- Parent classclassToFilter
- Class to be match againstpage
- the number of page of the number of elements to skipmaxResults
- max number of results. 0 to get all- Returns:
- A list of children of parentid/parentClass instance that are instances of classToFilter.
- Throws:
MetadataObjectNotFoundException
- If any of the classes can not be foundBusinessObjectNotFoundException
- If parent object can not be foundInvalidArgumentException
- If the database objects can not be correctly mapped into serializable Java objects.
-
getSpecialChildrenOfClassLight
List<BusinessObjectLight> getSpecialChildrenOfClassLight(String parentOid, String parentClass, String classToFilter, int maxResults) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Returns the special children of a given object as RemoteBusinessObjectLight instances.This method is not recursive.- Parameters:
parentOid
- The id of the parent objectparentClass
- The class name of the parent objectclassToFilter
- The superclass/class to be used to filter the results. You can also use abstract superclasses.maxResults
- The max number of results to fetch. Use -1 to retrieve all- Returns:
- The list of special children of the given object, filtered using classToFilter
- Throws:
MetadataObjectNotFoundException
- If the parent class name provided could not be foundBusinessObjectNotFoundException
- If the parent object could not be foundInvalidArgumentException
- If the filter class is invalid.
-
getChildrenOfClassLightRecursive
List<BusinessObjectLight> getChildrenOfClassLightRecursive(String parentOid, String parentClass, String classToFilter, HashMap<String,String> attributesToFilters, int page, int limit) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Gets all class and abstract class children of a given class to filter in a hierarchy with root in the given parent. i.e.: all the ports in Router, all the Routers in a City- Parameters:
parentOid
- Object id of the root parent of the hierarchyparentClass
- Class name of the root parent of the hierarchyclassToFilter
- Class name of the expected childrenattributesToFilters
- if filtering by the attributes of the retrieved objectspage
- The page or the number of elements to skip, no pagination -1limit
- Maximum number of results, -1 no limit- Returns:
- The list of object instance of the given class to filter
- Throws:
MetadataObjectNotFoundException
- If the parent class is not foundBusinessObjectNotFoundException
- If the parent is not foundInvalidArgumentException
- If the parent Id is null
-
getSpecialChildrenOfClassLightRecursive
List<BusinessObjectLight> getSpecialChildrenOfClassLightRecursive(String parentOid, String parentClass, String classToFilter, int maxResults) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Gets all class and abstract class special children of a given class to filter in a hierarchy with root in the given parent. Use case: used in some class level and inventory level reports script- Parameters:
parentOid
- Object id of the root parent of the hierarchyparentClass
- Class name of the root parent of the hierarchyclassToFilter
- Class name of the expected childrenmaxResults
- Maximum number of results, -1 no limit- Returns:
- The list of object instance of the given class to filter
- Throws:
MetadataObjectNotFoundException
- If the parent class is not foundBusinessObjectNotFoundException
- If the parent is not foundInvalidArgumentException
- If the parent Id is null
-
getChildrenOfClassLight
List<BusinessObjectLight> getChildrenOfClassLight(String parentOid, String parentClass, String classToFilter, int maxResults) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Same as getChildrenOfClass, but returns only the light version of the objects- Parameters:
parentOid
- parent idparentClass
- Parent classclassToFilter
- Class to be match againstmaxResults
- max number of results. 0 to get all- Returns:
- A list of children of parentid/parentClass instance, instances of classToFilter
- Throws:
MetadataObjectNotFoundException
- If any of the classes can not be foundBusinessObjectNotFoundException
- If parent object can not be foundInvalidArgumentException
- If the parent object id is null
-
getSiblings
List<BusinessObjectLight> getSiblings(String className, String oid, int maxResults) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Gets the siblings of a given object in the containment hierarchy- Parameters:
className
- Object classoid
- Object oidmaxResults
- Max number of results to be returned- Returns:
- List of siblings
- Throws:
MetadataObjectNotFoundException
- If the class does not existBusinessObjectNotFoundException
- If the object does not existInvalidArgumentException
- If the oid is null
-
getObjectsOfClassLight
List<BusinessObjectLight> getObjectsOfClassLight(String className, HashMap<String,String> filters, long page, long limit) throws InvalidArgumentException, MetadataObjectNotFoundException
Recursively gets all the light instances of given class- Parameters:
className
- Class name. It must be a subclass of InventoryObjectfilters
- map of filters key: attribute name, value: attribute valuepage
- page or number of elements to skiplimit
- max count of child per page- Returns:
- a set of instances of the class
- Throws:
InvalidArgumentException
- If the class name is nullMetadataObjectNotFoundException
- If the provided class name doesn't exists
-
getObjectsOfClassLight
List<BusinessObjectLight> getObjectsOfClassLight(String className, long page, long limit) throws InvalidArgumentException, MetadataObjectNotFoundException
Recursively gets all the light instances of given class, without filters.- Parameters:
className
- Class name. It must be a subclass of InventoryObjectpage
- page or number of elements to skiplimit
- max count of child per page- Returns:
- a set of instances of the class
- Throws:
InvalidArgumentException
- If the class name is nullMetadataObjectNotFoundException
- If the provided class name doesn't exists
-
getObjectsOfClass
List<BusinessObject> getObjectsOfClass(String className, int maxResults) throws MetadataObjectNotFoundException, InvalidArgumentException
Recursively gets all the instances of given class- Parameters:
className
- Class name. It mist be a subclass of InventoryObjectmaxResults
- Max number of results. 0 to get all- Returns:
- a list of instances
- Throws:
MetadataObjectNotFoundException
- if the class can not be foundInvalidArgumentException
- If the class is not subclass of InventoryObject
-
createSpecialRelationship
void createSpecialRelationship(String aObjectClass, String aObjectId, String bObjectClass, String bObjectId, String name, boolean unique) throws BusinessObjectNotFoundException, OperationNotPermittedException, MetadataObjectNotFoundException, InvalidArgumentException
Creates a relationship between two elements and labels it. Use with extreme care, since it can create arbitrary relationships- Parameters:
aObjectClass
- a side object classaObjectId
- a side object idbObjectClass
- b side object classbObjectId
- b side object idname
- Name to label the new relationshipunique
- If there could be only one relationship between both elements with that name- Throws:
BusinessObjectNotFoundException
- If any of the objects can't be foundOperationNotPermittedException
- if any of the objects involved can't be connected (i.e. if it's not an inventory object)MetadataObjectNotFoundException
- if any of the classes provided can not be foundInvalidArgumentException
- If the a/bObjectId are null
-
createSpecialRelationship
void createSpecialRelationship(String aObjectClass, String aObjectId, String bObjectClass, String bObjectId, String name, boolean unique, HashMap<String,Object> properties) throws BusinessObjectNotFoundException, OperationNotPermittedException, MetadataObjectNotFoundException, InvalidArgumentException
This method creates a special relationship with a set of property values- Parameters:
aObjectClass
- The class of the first object to relatedaObjectId
- The id of the first object to relatedbObjectClass
- The class of the second object to relatedbObjectId
- The id of the first object to relatedname
- The name of the relationshipunique
- If there could be only one relationship between both elements with that nameproperties
- A hash with the set of properties and their respective values- Throws:
BusinessObjectNotFoundException
- If any of the objects can not be foundOperationNotPermittedException
- If, due to a business rule, the objects can not be relatedMetadataObjectNotFoundException
- If any of the classes specified does not existInvalidArgumentException
- If the a/bObjectId are null
-
releaseSpecialRelationship
void releaseSpecialRelationship(String objectClass, String objectId, String otherObjectId, String relationshipName) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Release all special relationships with a given name- Parameters:
objectClass
- Object classobjectId
- Object idotherObjectId
- The object we want to be released from. -1 To all objects related with relationships with that namerelationshipName
- Relationship name- Throws:
BusinessObjectNotFoundException
- If the object can not be foundMetadataObjectNotFoundException
- If the class can not be foundInvalidArgumentException
- If objectId or otherObjectId are null
-
releaseSpecialRelationshipInTargetObject
void releaseSpecialRelationshipInTargetObject(String objectClass, String objectId, String relationshipName, String targetId) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Release all special relationships with a given name whose target object id matches with the one provided- Parameters:
objectClass
- Object classobjectId
- Object idrelationshipName
- Relationship nametargetId
- Id of the object at the end of the relationship- Throws:
BusinessObjectNotFoundException
- If the object can not be foundMetadataObjectNotFoundException
- If the class can not be foundInvalidArgumentException
- If the object/targetId are null
-
getSpecialAttribute
List<BusinessObjectLight> getSpecialAttribute(String objectClass, String objectId, String specialAttributeName) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Gets the value of a special attribute. A special attribute is one belonging to a business domain specific attribute (usually a model. Domain specific attribute information is not filed under the standard metadata but a special one. Implementations may vary)- Parameters:
objectClass
- object's classobjectId
- object's idspecialAttributeName
- Special attribute name- Returns:
- A list of objects related to the object through a special relationship. An empty array if the object provided is not related to others using that relationship.
- Throws:
BusinessObjectNotFoundException
- if the object can not be foundMetadataObjectNotFoundException
- if either the object class or the attribute can not be foundInvalidArgumentException
- If the object id is null
-
getAnnotatedSpecialAttribute
List<AnnotatedBusinessObjectLight> getAnnotatedSpecialAttribute(String objectClass, String objectId, String specialAttributeName) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
This method will extract the object at the other side of the special relationship and all the properties of the relationship itself- Parameters:
objectClass
- The class of the object whose special attribute will be retrieved fromobjectId
- The object's idspecialAttributeName
- The name of the special attribute- Returns:
- The list of elements related with such relationship plus the properties of theirs relationships
- Throws:
BusinessObjectNotFoundException
- If the object could not be foundMetadataObjectNotFoundException
- If the object class could not be foundInvalidArgumentException
- If the object id is null
-
getSpecialAttributes
HashMap<String,List<BusinessObjectLight>> getSpecialAttributes(String className, String objectId, String... attributeNames) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Returns the specified special relationships of a given object as a hashmap whose keys are the names of the relationships and the values the list of related objects. If no filter (attributeNames) is provided, all special attributes (relationships) will be returned- Parameters:
className
- Object classobjectId
- Object IdattributeNames
- The list of special attributes (relationships) to be fetched. if none provided, the method will return all of them.- Returns:
- The hash map with the existing special relationships and the associated objects
- Throws:
MetadataObjectNotFoundException
- If the class provided does not existBusinessObjectNotFoundException
- if the object does not existInvalidArgumentException
- If the object id is null
-
hasRelationship
boolean hasRelationship(String objectClass, String objectId, String relationshipName, int numberOfRelationships) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Checks if an object has a given number of standard relationships with another object- Parameters:
objectClass
- Object classobjectId
- Object idrelationshipName
- Relationship namenumberOfRelationships
- Number of relationships- Returns:
- True if the object has numberOfRelationships relationships with another object
- Throws:
BusinessObjectNotFoundException
- If the object can not be foundMetadataObjectNotFoundException
- If objectClass does not existInvalidArgumentException
- If the object id is null
-
hasSpecialAttribute
boolean hasSpecialAttribute(String objectClass, String objectId, String attributeName) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Check if an object has a given special attribute.- Parameters:
objectClass
- Object classobjectId
- Object idattributeName
- Attribute name- Returns:
- True if the object has special attributes
- Throws:
MetadataObjectNotFoundException
BusinessObjectNotFoundException
InvalidArgumentException
-
countChildren
long countChildren(String objectClass, String objectId) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Counts if an object has children- Parameters:
objectClass
- Object classobjectId
- Object id- Returns:
- Number of children
- Throws:
MetadataObjectNotFoundException
BusinessObjectNotFoundException
InvalidArgumentException
-
countSpecialChildren
long countSpecialChildren(String objectClass, String objectId) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Counts if an object has special children- Parameters:
objectClass
-objectId
-- Returns:
- Number of special children
- Throws:
MetadataObjectNotFoundException
BusinessObjectNotFoundException
InvalidArgumentException
-
releaseRelationships
void releaseRelationships(String objectClass, String objectId, List<String> relationshipsToRelease) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Releases all the relationships with the given names associated to the object provided. If no relationships with such names exist, the method will do nothing. Use this method with extreme care, you can seriously affect the relational integrity of the system- Parameters:
objectClass
- The class of the target objectobjectId
- The id of the target objectrelationshipsToRelease
- An array with the relationships to be released- Throws:
MetadataObjectNotFoundException
- If the class provided does not existBusinessObjectNotFoundException
- If the object could not be foundInvalidArgumentException
- If any of the relationships is now allowed according to the defined data model
-
hasSpecialRelationship
boolean hasSpecialRelationship(String objectClass, String objectId, String relationshipName, int numberOfRelationships) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Checks if an object has a given number of special relationships with another object- Parameters:
objectClass
- Object classobjectId
- Object idrelationshipName
- Relationship namenumberOfRelationships
- Number of relationships- Returns:
- True if the object has numberOfRelationships relationships with another object
- Throws:
BusinessObjectNotFoundException
- If the object can not be foundMetadataObjectNotFoundException
- if objectClass does not existInvalidArgumentException
- If the object id is null
-
findRoutesThroughSpecialRelationships
List<BusinessObjectLightList> findRoutesThroughSpecialRelationships(String objectAClassName, String objectAId, String objectBClassName, String objectBId, String relationshipName) throws InvalidArgumentException
Finds all possible routes between two given inventory objects- Parameters:
objectAClassName
- Inventory object A class nameobjectAId
- Inventory object A idobjectBClassName
- Inventory object B class nameobjectBId
- Inventory object B idrelationshipName
- The name of the relationship used to navigate through nodes and find the route- Returns:
- A list of the routes, including only the nodes as RemoteBusinessObjectLights
- Throws:
InvalidArgumentException
- If any of the inventory objects does not have uuid
-
attachFileToObject
long attachFileToObject(String name, String tags, byte[] file, String className, String objectId) throws BusinessObjectNotFoundException, OperationNotPermittedException, MetadataObjectNotFoundException, InvalidArgumentException
Relates a file to an inventory object- Parameters:
name
- The name of the filetags
- The tags that describe the contents of the filefile
- The file itselfclassName
- The class of the object the file will be attached toobjectId
- The id of the object 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)
-
getFilesForObject
List<FileObjectLight> getFilesForObject(String className, String objectId) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Fetches the files associated to an inventory object. Note that this call won't retrieve the actual files, but only references to them- 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
FileObject getFile(long fileObjectId, String className, String objectId) throws BusinessObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException
Retrieves a particular file associated to an inventory object. This call returns the actual file- Parameters:
fileObjectId
- The id of the file objectclassName
- The class of the object the file is associated toobjectId
- The id of the object 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
-
detachFileFromObject
void detachFileFromObject(long fileObjectId, String className, String objectId) throws BusinessObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException
Releases (and deletes) a file associated to an inventory object- Parameters:
fileObjectId
- The id of the file objectclassName
- The class of the object the file is associated toobjectId
- The id of the object 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
void updateFileProperties(long fileObjectId, List<StringPair> properties, String className, String objectId) throws BusinessObjectNotFoundException, ApplicationObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException
Updates the properties of a file object (name or tags)- Parameters:
fileObjectId
- The id of the file objectproperties
- 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 object the file is attached to- Throws:
BusinessObjectNotFoundException
- If the object file is attached to could not be foundApplicationObjectNotFoundException
- If the file object 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
-
getFilesFromRelatedListTypeItems
Map<BusinessObjectLight,List<FileObjectLight>> getFilesFromRelatedListTypeItems(String ObjectUuid)
Retrieves a map with the files related to the list type item attributes of the given object- Parameters:
ObjectUuid
- the object id- Returns:
- The map with the files. The key is the list type item and the value a list with the related files
-
createContact
String createContact(String contactClass, String customerClassName, String customerId, String userName) throws BusinessObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException, ApplicationObjectNotFoundException
Creates a contact.Contacts are always associated to a customer- Parameters:
contactClass
- Class of the contact. This class should always be a subclass of GenericContactcustomerClassName
- The class of the customer this contact will be associated tocustomerId
- The id of the customer this contact will be associated touserName
- The user name of the session- Returns:
- The id of the newly created contact
- Throws:
BusinessObjectNotFoundException
- If the customer could not be foundInvalidArgumentException
- If any of the properties or its value is invalidMetadataObjectNotFoundException
- If the customer class could not be foundApplicationObjectNotFoundException
- If the object activity log could no be found
-
updateContact
void updateContact(String contactClass, String contactId, List<StringPair> properties, String userName) throws BusinessObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException, ApplicationObjectNotFoundException
Updates a contact's information- Parameters:
contactClass
- The class of the contactcontactId
- The id of the contactproperties
- The attributes to be updated. The list types require only the id of the linked list type as a stringuserName
- The user name of the session- Throws:
BusinessObjectNotFoundException
- If the contact could not be foundInvalidArgumentException
- If any of the properties or its value is invalidMetadataObjectNotFoundException
- If the contact class could not be foundApplicationObjectNotFoundException
- If the object activity log could no be found
-
deleteContact
void deleteContact(String contactClass, String contactId, String userName) throws BusinessObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException, ApplicationObjectNotFoundException
Deletes a contact- Parameters:
contactClass
- The class of the contactcontactId
- The id of the contactuserName
- The user name of the session- Throws:
BusinessObjectNotFoundException
- If the contact could not be foundInvalidArgumentException
- If the name is empty or there's an attempt to change the creationDateMetadataObjectNotFoundException
- If the class could not be foundApplicationObjectNotFoundException
- If the object activity log could no be found
-
getContact
Contact getContact(String contactClass, String contactId) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Gets the entire information of a given contact- Parameters:
contactClass
- The class of the contactcontactId
- The id of the contact- Returns:
- the contact
- Throws:
BusinessObjectNotFoundException
- If the contact could not be foundMetadataObjectNotFoundException
- If the contact class could not be foundInvalidArgumentException
- If the contact is malformed and the customer it should be related to does not exist
-
getContactsForCustomer
List<Contact> getContactsForCustomer(String customerClass, String customerId) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Retrieves the list of contacts associated to a customer- Parameters:
customerClass
- The class of the customer the contacts belong tocustomerId
- The id of the customer the contacts belong to- Returns:
- The list of contacts
- Throws:
BusinessObjectNotFoundException
- If the customer could not be foundMetadataObjectNotFoundException
- If the customer class could not be foundInvalidArgumentException
- If an error occurs while building the contact objects
-
searchForContacts
List<Contact> searchForContacts(String searchString, int maxResults) throws InvalidArgumentException
Searches in all the properties of a contact for a given string- Parameters:
searchString
- The string to be matchedmaxResults
- The max number of results. Use -1 to retrieve al results- Returns:
- The list of contacts that matches the search criteria
- Throws:
InvalidArgumentException
- If an error occurs while building the contact objects
-
getContacts
List<Contact> getContacts(int page, int limit, HashMap<String,Object> filters) throws InvalidArgumentException
Retrieves the list of contacts that matches the search criteria- Parameters:
page
- current pagelimit
- limit of results per page. -1 to retrieve them allfilters
- The response may be filtered by customer (use keycustomer
, value the customer name, a String) by type (use keytype
, value the type name, a String) by contact name (use keycontact_name
, value the contact name, a String) by contact email1 (use keycontact_email1
, value the contact email1, a String) by contact email2 (use keycontact_email2
, value the contact email2, a String)- Returns:
- The list of contacts that matches the search criteria
- Throws:
InvalidArgumentException
- If an error occurs while building the contact objects
-
relateObjectToContact
void relateObjectToContact(String objectClass, String objectId, String contactClass, String contactId, String userName) throws BusinessObjectNotFoundException, OperationNotPermittedException, MetadataObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Relates an inventory object to a contact.- Parameters:
objectClass
- The class of the object.objectId
- The id of the object.contactClass
- The class of the contact.contactId
- The id of the contact.userName
- The user name of the session.- Throws:
BusinessObjectNotFoundException
- If any of the objects can't be found.OperationNotPermittedException
- If any of the objects involved can't be connected (i.e. if it's not an inventory object).MetadataObjectNotFoundException
- If any of the classes provided can not be found.InvalidArgumentException
- If the a/b ObjectId are null.ApplicationObjectNotFoundException
- If the object activity log could not be found.
-
releaseObjectFromContact
void releaseObjectFromContact(String objectClass, String objectId, String contactClass, String contactId, String userName) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException, ApplicationObjectNotFoundException
Releases an inventory object from a contact.- Parameters:
objectClass
- The class of the object.objectId
- The id of the object.contactClass
- The class of the contact.contactId
- The id of the contact.userName
- The user name of the session.- Throws:
BusinessObjectNotFoundException
- If the object can not be found.MetadataObjectNotFoundException
- If the class can not be found.InvalidArgumentException
- If contactId or objectId are null.ApplicationObjectNotFoundException
- If the object activity log could no be found.
-
getContactResources
List<BusinessObjectLight> getContactResources(String contactClass, String contactId) throws BusinessObjectNotFoundException, MetadataObjectNotFoundException, InvalidArgumentException
Retrieves the list of resources (inventory objects) related to a contact.- Parameters:
contactClass
- The class of the contact.contactId
- The id of the contact.- Returns:
- List of related resources.
- Throws:
BusinessObjectNotFoundException
- If the contact can't be found.MetadataObjectNotFoundException
- If the contract class provided can't be found.InvalidArgumentException
- If the contact is not subclass of GenericContact.
-
getRootPools
List<InventoryObjectPool> getRootPools(String className, int type, boolean includeSubclasses) throws InvalidArgumentException
Retrieves the pools that don't have any parent and are normally intended to be managed by the Pool Manager- Parameters:
className
- The class name used to filter the results. Only the pools with a className attribute matching the provided value will be returned. Use null if you want to get alltype
- The type of pools that should be retrieved. Root pools can be for general purpose, or as roots in modelsincludeSubclasses
- Usetrue
if you want to get only the pools whoseclassName
property matches exactly the one provided, andfalse
if you want to also include the subclasses- Returns:
- A set of pools
- Throws:
InvalidArgumentException
- If a root pool does not have the uuid
-
getPoolsInObject
List<InventoryObjectPool> getPoolsInObject(String objectClassName, String objectId, String poolClass) throws BusinessObjectNotFoundException, InvalidArgumentException, MetadataObjectNotFoundException
Retrieves the pools associated to a particular object- Parameters:
objectClassName
- The parent object class nameobjectId
- The parent object idpoolClass
- The class name used to filter the results. Only the pools with a className attribute matching the provided value will be returned. Use null if you want to get all- Returns:
- A set of pools
- Throws:
BusinessObjectNotFoundException
- If the parent object can not be foundInvalidArgumentException
- If a pool does not have uuidMetadataObjectNotFoundException
- If the argument poolClass is not a valid class.
-
getPoolsInPool
List<InventoryObjectPool> getPoolsInPool(String parentPoolId, String poolClassName) throws ApplicationObjectNotFoundException, InvalidArgumentException
Retrieves the pools associated to a particular pool- Parameters:
parentPoolId
- The parent pool idpoolClassName
- The class name used to filter the results. Only the pools with a className attribute matching the provided value will be returned. Use null if you want to get allpage
- the page of the result to retrievelimit
- the limit of elements per page- Returns:
- A set of pools
- Throws:
ApplicationObjectNotFoundException
- If the parent object can not be foundInvalidArgumentException
- If any pool does no have uuid
-
getPoolsInPoolCount
long getPoolsInPoolCount(String parentPoolId, String poolClassName) throws ApplicationObjectNotFoundException, InvalidArgumentException
Retrieves the total count of pools associated to a particular pool- Parameters:
parentPoolId
- The parent pool idpoolClassName
- The class name used to filter the results. Only the pools with a className attribute matching the provided value will be returned. Use null if you want to get all- Returns:
- the total count of the pools
- Throws:
ApplicationObjectNotFoundException
- If the parent object can not be foundInvalidArgumentException
- If any pool does no have uuid
-
getPool
InventoryObjectPool getPool(String poolId) throws ApplicationObjectNotFoundException, InvalidArgumentException
Gets a pool by its id- Parameters:
poolId
- The pool's id- Returns:
- the pool as a Pool object
- Throws:
ApplicationObjectNotFoundException
- If the pool could not be foundInvalidArgumentException
- If the pool id is null or the result pool does not have uuid
-
getPoolItems
List<BusinessObjectLight> getPoolItems(String poolId, int limit) throws ApplicationObjectNotFoundException, InvalidArgumentException
Retrieves the list of objects from a pool- Parameters:
poolId
- Parent pool idlimit
- the results limit. per page 0 to avoid the limit- Returns:
- The list of items inside the pool
- Throws:
ApplicationObjectNotFoundException
- If the pool id provided is not validInvalidArgumentException
- If the pool item is an inventory object and it does not have the uuid
-
getPoolItemsByClassName
List<BusinessObjectLight> getPoolItemsByClassName(String poolId, String className, int page, int limit) throws ApplicationObjectNotFoundException, InvalidArgumentException
Retrieves the list of objects from a pool- Parameters:
poolId
- Parent pool idclassName
- a given className to retrieve a set of objects of that className form the pool used when the pool is a Generic class and could have objects of different classpage
- the number of values of the result to skip or the page 0 to avoidlimit
- the results limit. per page 0 to avoid the limit- Returns:
- The list of items inside the pool
- Throws:
ApplicationObjectNotFoundException
- If the pool id provided is not validInvalidArgumentException
- If the pool item is an inventory object and it does not have the uuid
-
getPoolItemsCount
long getPoolItemsCount(String poolId, String className) throws ApplicationObjectNotFoundException, InvalidArgumentException
Count the total of objects in a pool- Parameters:
poolId
- Parent pool idclassName
- a given className to retrieve a set of objects of that className form the pool used when the pool is a Generic class and could have objects of different class- Returns:
- The count of items inside the pool
- Throws:
ApplicationObjectNotFoundException
- If the pool id provided is not validInvalidArgumentException
- If the pool item is an inventory object and it does not have the uuid
-
createClassLevelReport
long createClassLevelReport(String className, String reportName, String reportDescription, String script, int outputType, boolean enabled) throws MetadataObjectNotFoundException
Creates a class level report (a report that will be available for all instances of a given class -and its subclasses-)- Parameters:
className
- Class this report is going to be related to. It can be ab abstract class and the report will be available for all its subclassesreportName
- Name of the report.reportDescription
- ReportMetadata description.script
- Script text.outputType
- What will be the default output of this report? See RemoteReportLight for possible valuesenabled
- If enabled, a report can be executed.- Returns:
- The id of the newly created report.
- Throws:
MetadataObjectNotFoundException
- If the class provided could not be found.
-
createInventoryLevelReport
long createInventoryLevelReport(String reportName, String reportDescription, String script, int outputType, boolean enabled, List<StringPair> parameters) throws ApplicationObjectNotFoundException, InvalidArgumentException
Creates an inventory level report (a report that is not tied to a particlar instance or class. In most cases, they also receive parameters)- Parameters:
reportName
- Name of the report.reportDescription
- ReportMetadata description.script
- Script text.outputType
- What will be the default output of this report? See InventoryLevelReportDescriptor for possible valuesenabled
- If enabled, a report can be executed.parameters
- Optional (it might be either null or an empty list). The list of the parameters that this report will support and optional default values. They will always be captured as strings, so it's up to the author of the report the sanitization and conversion of the inputs- Returns:
- The id of the newly created report.
- Throws:
ApplicationObjectNotFoundException
- If the dummy root could not be found, which is actually a severe problem.InvalidArgumentException
- If any of the parameter names is null or empty
-
deleteReport
ChangeDescriptor deleteReport(long reportId) throws ApplicationObjectNotFoundException
Deletes a report- Parameters:
reportId
- The id of the report.- Returns:
- The summary of the changes
- Throws:
ApplicationObjectNotFoundException
- If the report could not be found.
-
updateReport
ChangeDescriptor updateReport(long reportId, String reportName, String reportDescription, Boolean enabled, Integer type, String script) throws ApplicationObjectNotFoundException, InvalidArgumentException
Updates the properties of an existing class level report.- Parameters:
reportId
- Id of the report.reportName
- The name of the report. Null to leave it unchanged.reportDescription
- The description of the report. Null to leave it unchanged.enabled
- Is the report enabled? . Null to leave it unchanged.type
- Type of the output of the report. See LocalReportLight for possible valuesscript
- Text of the script.- Returns:
- The summary of the changes
- Throws:
ApplicationObjectNotFoundException
- If the report could not be found.InvalidArgumentException
- If any of the report properties has a wrong or unexpected format.
-
updateReportParameters
ChangeDescriptor updateReportParameters(long reportId, List<StringPair> parameters) throws ApplicationObjectNotFoundException, InvalidArgumentException
Updates the parameters of a report- Parameters:
reportId
- The id of the reportparameters
- The list of parameters and optional default values. Those with null values will be deleted and the ones that didn't exist previously will be created.- Returns:
- The summary of the changes
- Throws:
ApplicationObjectNotFoundException
- If the report was not found.InvalidArgumentException
- If the any of the parameters has an invalid name.
-
getClassLevelReports
List<ReportMetadataLight> getClassLevelReports(String className, boolean recursive, boolean includeDisabled) throws MetadataObjectNotFoundException
Gets the class level reports associated to the given class (or its superclasses)- Parameters:
className
- The class to extract the reports from.recursive
- False to get only the directly associated reports. True top get also the reports associate top its superclassesincludeDisabled
- True to also include the reports marked as disabled. False to return only the enabled ones.- Returns:
- The list of reports.
- Throws:
MetadataObjectNotFoundException
- If the class could not be found
-
getInventoryLevelReports
List<ReportMetadataLight> getInventoryLevelReports(boolean includeDisabled) throws ApplicationObjectNotFoundException
Gets the inventory class reports.- Parameters:
includeDisabled
- True to also include the reports marked as disabled. False to return only the enabled ones.- Returns:
- The list of reports.
- Throws:
ApplicationObjectNotFoundException
- f the dummy root could not be found, which is actually a severe problem.
-
getReport
ReportMetadata getReport(long reportId) throws ApplicationObjectNotFoundException
Gets the information related to a class level report.- Parameters:
reportId
- The id of the report.- Returns:
- The report.
- Throws:
ApplicationObjectNotFoundException
- If the report could not be found.
-
executeClassLevelReport
byte[] executeClassLevelReport(String objectClassName, String objectId, long reportId) throws MetadataObjectNotFoundException, ApplicationObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Executes a class level report and returns the result.- Parameters:
objectClassName
- The class of the instance that will be used as input for the report.objectId
- The id of the instance that will be used as input for the report.reportId
- The id of the report.- Returns:
- The result of the report execution.
- Throws:
MetadataObjectNotFoundException
- If the class could not be found.ApplicationObjectNotFoundException
- If the report could not be found.BusinessObjectNotFoundException
- If the inventory object could not be found.InvalidArgumentException
- If there's an error during the execution of the report.
-
executeInventoryLevelReport
byte[] executeInventoryLevelReport(long reportId, List<StringPair> parameters) throws ApplicationObjectNotFoundException, InvalidArgumentException
Executes an inventory level report and returns the result.- Parameters:
reportId
- The id of the report.parameters
- List of pairs param name - param value.- Returns:
- The result of the report execution.
- Throws:
ApplicationObjectNotFoundException
- If the report could not be found.InvalidArgumentException
- If the associated script exits with error.
-
getWarehousesInObject
List<BusinessObjectLight> getWarehousesInObject(String objectClassName, String objectId) throws MetadataObjectNotFoundException, InvalidArgumentException
Gets the warehouses in a object- Parameters:
objectClassName
- The class of the objectobjectId
- The id of the object- Returns:
- Gets the warehouses in a object
- Throws:
MetadataObjectNotFoundException
- If the specified class could not be found.InvalidArgumentException
-
getPhysicalNodeToObjectInWarehouse
BusinessObjectLight getPhysicalNodeToObjectInWarehouse(String objectClassName, String objectId) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Gets the physical node of a warehouse item- Parameters:
objectClassName
- The class of the objectobjectId
- The id of the object- Returns:
- Gets the physical node of a warehouse item
- Throws:
MetadataObjectNotFoundException
- If the specified class could not be found.BusinessObjectNotFoundException
- If the object provided could not be found.InvalidArgumentException
-
getWarehouseToObject
BusinessObjectLight getWarehouseToObject(String objectClassName, String objectId) throws MetadataObjectNotFoundException, BusinessObjectNotFoundException, InvalidArgumentException
Gets warehouse related to object- Parameters:
objectClassName
- The class of the objectobjectId
- The id of the object- Returns:
- Gets warehouse related to object.
- Throws:
MetadataObjectNotFoundException
- If the specified class could not be found.BusinessObjectNotFoundException
- If the object provided could not be found.InvalidArgumentException
-
getObjectChildrenCount
long getObjectChildrenCount(String className, String oid, HashMap<String,String> filters) throws InvalidArgumentException
Get the child count given the parent class name and id.- Parameters:
className
- Parent class nameoid
- Parent idfilters
- map of filters key: attribute name, value: attribute value- Returns:
- The count of child
- Throws:
InvalidArgumentException
- If the class name is null
-
getObjectChildren
List<BusinessObjectLight> getObjectChildren(String className, String oid, HashMap<String,String> filters, long skip, long limit) throws InvalidArgumentException
Get a set of children to the given the parent class name and id.- Parameters:
className
- Parent class nameoid
- Parent idfilters
- null for no filter, map of filters key: attribute name, value: attribute valueskip
- Skip indexlimit
- Max count of child- Returns:
- Set of children
- Throws:
InvalidArgumentException
- If the class name is null
-
getSuggestedObjectsWithFilterGroupedByClassName
HashMap<String,List<BusinessObjectLight>> getSuggestedObjectsWithFilterGroupedByClassName(List<String> classesNamesToFilter, String filter, long classesSkip, long classesLimit, long objectSkip, long objectLimit) throws InvalidArgumentException
Suggests a number of objects based on a search string. This search string will be case-insensitive-matched against the name of the objects and classes in the inventory attributes to filter.- Parameters:
List
-classesToFilter a list of classes to limit the search filter
- value to filter in the attribute name of every business object name or class name o class display nameskip
- Skip indexlimit
- Max count of child- Returns:
- Set of children
- Throws:
InvalidArgumentException
- If the class name, skip or limit are null
-
getSuggestedPoolsByName
HashMap<String,List<InventoryObjectPool>> getSuggestedPoolsByName(List<String> classesNamesToFilter, String nameTofilter, long poolSkip, long poolLimit, long objectSkip, long objectLimit) throws InvalidArgumentException
Suggests a number of pools based on a search string (the pool name). This search string will be case-insensitive-matched against the name of the objects and classes in the inventory attributes to filter.- Parameters:
List
-classesToFilter a list of classes to limit the search filter
- value to filter in the attribute name of every business object name or class name o class display nameskip
- Skip indexlimit
- Max count of child- Returns:
- Set of pools
- Throws:
InvalidArgumentException
- If the class name, skip or limit are null
-
-