Package com.hp.ucmdb.api.view
Interface ViewService
public interface ViewService
Provides viewing system services.
- Since:
- 8.0
-
Method Summary
Modifier and TypeMethodDescriptioncreateViewStub
(String viewName) Creates a View - a "stub" that holds the view name and allows retrieval of the view definition.boolean
deleteView
(String viewName) Deletes a view identified byviewName
from the UCMDB.executeView
(View view) Executes the given view and returns the result.executeView
(View view, ViewExecutionOptions options) Executes the given view and returns the result.executeView
(String viewName) Executes a view identified in the UCMDB by the view name and returns the result.executeView
(String viewName, ViewExecutionOptions options) Executes a view identified in the UCMDB by the view name and returns the result.executeViewDefinition
(ViewDefinition viewDefinition, ExecutableQuery query) Executes the given view definition and returns the result.executeViewDefinition
(ViewDefinition viewDefinition, ExecutableQuery query, ViewExecutionOptions options) Executes the given view definition and returns the result.Returns a map between each view name to a collection of its bundles.Returns a map between each bundle name that contains views to a collection of its bundled views.getBundleNamesToViewsWithoutPermission
(Collection<String> bundleNames) Returns a map from name of bundle to the collection of its bundled without permissions.Returns the sub service regarding folder management.Queries the whole views tree organized in folder structure.boolean
hasChanges
(String viewName, ViewResultVersion viewResultVersion) Returns true if the results of the query under the given view were changed since the result version was created, if the view definition creating this view was changed, or if the query definition under the view definition was changed.boolean
hasChanges
(String viewName, String viewResultVersionAsString) Same ashasChanges(String, ViewResultVersion)
, but accepts the result of {ViewResultVersion#asString()}.hasChanges
(Map<String, ViewResultVersion> views2check) Returns a set of view names for which: the results of the query under it were changed since the result version was created, the view definition creating it was changed, or the query definition under it was changed.registerViewDependenciesChangeListener
(ViewDependenciesChangeListener listener, ViewManagementListenerFilter filter) Registers a listener to be called when a change occurs in view dependenciesregisterViewDependenciesChangeListener
(ViewDependenciesChangeListener listener, ViewManagementListenerFilter filter, int port) Registers a listener to be called when a change occurs in view dependenciesregisterViewManagementListener
(ViewManagementListener listener, ViewManagementListenerFilter filter) Registers a listener to be called when view management change occurs.registerViewManagementListener
(ViewManagementListener listener, ViewManagementListenerFilter filter, int port) Registers a listener to be called when view management change occurs.void
saveView
(ViewDefinition viewDefinition) Saves the view definition to the server, updating an existing view by the same name if such exists.Given a string created byviewDefinitionToString(com.hp.ucmdb.api.view.ViewDefinition)
, this methods returns a copy of the original ViewDefinition.void
unregisterViewDependenciesChangeListener
(String listenerId) Unregisters the specified view dependencies change listener.void
unregisterViewDependenciesChangeListener
(String listenerId, int port) Unregisters the specified view dependencies change listener.void
unregisterViewManagementListener
(String listenerId) Unregisters the specified view management listener.void
unregisterViewManagementListener
(String listenerId, int port) Unregisters the specified view management listener.void
viewDefinitionToString
(ViewDefinition viewDefinition) Given aViewDefinition
this method returns the view's string representation.whoDependsOn
(String viewName)
-
Method Details
-
getFactory
ViewFactory getFactory() -
createViewStub
Creates a View - a "stub" that holds the view name and allows retrieval of the view definition. It is possible to create View stubs for non-existent views. However, further operations on those stubs fail. This method does not communicate with the UCMDB server. However, operations from the stub object do communicate with the UCMDB server. They fetch the view definition and related information. SeeView
for details. -
getViewTree
ViewFolder getViewTree()Queries the whole views tree organized in folder structure.- Returns:
- the root folder
-
executeView
Executes a view identified in the UCMDB by the view name and returns the result. The view must not have non-assigned query parameters. The view is executed with a default options object. SeeViewExecutionOptions
for details.- Returns:
- the view result.
-
executeView
Executes a view identified in the UCMDB by the view name and returns the result. The view must not have non-assigned query parameters. This method uses the options object passed to it.- Returns:
- the view result.
-
executeView
Executes the given view and returns the result. The view must not have non-assigned query parameters. The view is executed with a default options object. SeeViewExecutionOptions
for details.- Returns:
- the view result.
-
executeView
Executes the given view and returns the result. The view must not have non-assigned query parameters. This method uses the options object passed to it.- Returns:
- the view result.
-
executeViewDefinition
Executes the given view definition and returns the result. The given executable query is used instead of the view query name. If a null query is supplied, the view is executed over the query name specified in the view definition. The view must not have non-assigned query parameters. The view is executed with a default options object. SeeViewExecutionOptions
for details. If a PerspectiveBasedViewReferenceDefinition is passed, the specified ExecutableQuery is ignored.- Returns:
- the view result.
-
executeViewDefinition
@NotFinalAPI ViewResult executeViewDefinition(ViewDefinition viewDefinition, ExecutableQuery query, ViewExecutionOptions options) Executes the given view definition and returns the result. The given executable query is used instead of the view query name. If a null query is supplied, the view is executed over the query name specified in the view definition. The view must not have non-assigned query parameters. This method uses the options object passed to it. If a PerspectiveBasedViewReferenceDefinition is passed, the specified ExecutableQuery is ignored.- Returns:
- the view result.
-
saveView
Saves the view definition to the server, updating an existing view by the same name if such exists. If a view by the same name exists, it is overwritten. If that view is attached to a folder, its position remains the same. Otherwise, the view is created in the root folder. If the view is a perspective based view, additional queries may be created (auto-generated) to represent the perspective hierarhcy.- Parameters:
viewDefinition
- the definition to save.
-
deleteView
Deletes a view identified byviewName
from the UCMDB. If the view is a perspective based view, the entire (auto-generated) perspective instances hierarhcy is deleted.- Returns:
- true if a view was deleted, false if it was not found.
-
getViewsFoldersSubService
Returns the sub service regarding folder management.- Returns:
- the sub service regarding folder management.
-
getBundleNamesToViews
Returns a map between each bundle name that contains views to a collection of its bundled views. -
getBundleNamesToViewsWithoutPermission
@NotFinalAPI Map<String,Collection<String>> getBundleNamesToViewsWithoutPermission(Collection<String> bundleNames) Returns a map from name of bundle to the collection of its bundled without permissions. -
getAllViewsBundleNames
Returns a map between each view name to a collection of its bundles. -
registerViewManagementListener
@NotFinalAPI String registerViewManagementListener(ViewManagementListener listener, ViewManagementListenerFilter filter) Registers a listener to be called when view management change occurs.- Parameters:
listener
- a listener to be called when a view management change occursfilter
- filters view management changes- Returns:
- registration ID
-
registerViewManagementListener
@NotFinalAPI String registerViewManagementListener(ViewManagementListener listener, ViewManagementListenerFilter filter, int port) Registers a listener to be called when view management change occurs.- Parameters:
listener
- a listener to be called when a view management change occursfilter
- filters view management changesport
- port number- Returns:
- registration ID
-
unregisterViewManagementListener
Unregisters the specified view management listener.- Parameters:
listenerId
- registration ID of the listener
-
unregisterViewManagementListener
Unregisters the specified view management listener.- Parameters:
listenerId
- registration ID of the listenerport
- port number
-
registerViewDependenciesChangeListener
@NotFinalAPI String registerViewDependenciesChangeListener(ViewDependenciesChangeListener listener, ViewManagementListenerFilter filter) Registers a listener to be called when a change occurs in view dependencies- Parameters:
listener
- a listener to be called when a view management change occursfilter
- filters the changes by name and/or bundles of a root view (dependent)- Returns:
- registration ID
-
registerViewDependenciesChangeListener
@NotFinalAPI String registerViewDependenciesChangeListener(ViewDependenciesChangeListener listener, ViewManagementListenerFilter filter, int port) Registers a listener to be called when a change occurs in view dependencies- Parameters:
listener
- a listener to be called when a view management change occursfilter
- filters the changes by name and/or bundles of a root view (dependent)port
- port number- Returns:
- registration ID
-
unregisterViewDependenciesChangeListener
Unregisters the specified view dependencies change listener.- Parameters:
listenerId
- registration ID of the listener
-
unregisterViewDependenciesChangeListener
Unregisters the specified view dependencies change listener.- Parameters:
listenerId
- registration ID of the listenerport
- port number
-
hasChanges
Returns true if the results of the query under the given view were changed since the result version was created, if the view definition creating this view was changed, or if the query definition under the view definition was changed. This API is similar toTopologyQueryService.hasChanges(java.lang.String, com.hp.ucmdb.api.topology.QueryResultVersion)
However, this method:- resolves the correct query name from the view name internally, saving a roundtrip to the UCMDB server
- returns true if the view definition was changed.
TopologyQueryService.hasChanges
apply to this method.- Parameters:
viewName
- the view whose query is to be checked.viewResultVersion
- the version to check changes from.- Returns:
- true if there were any changes in the query results. false if no changes or if the query does not support changes.
-
hasChanges
Returns a set of view names for which: the results of the query under it were changed since the result version was created, the view definition creating it was changed, or the query definition under it was changed. The restrictions and notes forTopologyQueryService.hasChanges
apply to this method.- Parameters:
views2check
- view names whose query is to be checked.- Returns:
- the set of changed views.
-
hasChanges
Same ashasChanges(String, ViewResultVersion)
, but accepts the result of {ViewResultVersion#asString()}.- Parameters:
viewName
- the view whose query is to be checked.viewResultVersionAsString
- the asString() result of the version to check changes from.- Returns:
- true if there were any changes in the query results, false if no or if the query does not support changes.
- See Also:
-
whoDependsOn
-
validateBulk
-
viewDefinitionToString
Given aViewDefinition
this method returns the view's string representation. The conversion fromViewDefinition
to string is done in the server, requiring a server request. This string representation is not guaranteed to be version compatible and should not be serialized for long term storage.- Parameters:
viewDefinition
- - the view definition to convert- Returns:
- String representation of the given view definition
- Throws:
UcmdbException
-
stringToViewDefinition
Given a string created byviewDefinitionToString(com.hp.ucmdb.api.view.ViewDefinition)
, this methods returns a copy of the original ViewDefinition. The actual conversion from string toViewDefinition
is done in the server, requiring a server request.- Parameters:
str
- - view's string representation- Returns:
- query definition represented by the given str
- Throws:
UcmdbException
-
getViewsNames
Collection<String> getViewsNames()- Returns:
- a collection of Strings that represents the view names for all UCMDB views the user has permission
-
getViewsDefinitions
Collection<ViewDefinition> getViewsDefinitions()- Returns:
- a collection of
ViewDefinition
objects that represents all UCMDB views the user has permission
-
getViewsDetails
Collection<View> getViewsDetails()- Returns:
- a collection of
View
objects that represents all UCMDB views the user has permission
-