Interface ViewService


public interface ViewService
Provides viewing system services.
Since:
8.0
  • Method Details

    • getFactory

      ViewFactory getFactory()
    • createViewStub

      View createViewStub(String viewName)
      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. See View for details.

    • getViewTree

      ViewFolder getViewTree()
      Queries the whole views tree organized in folder structure.
      Returns:
      the root folder
    • executeView

      ViewResult executeView(String viewName)
      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. See ViewExecutionOptions for details.

      Returns:
      the view result.
    • executeView

      ViewResult executeView(String viewName, ViewExecutionOptions options)
      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

      @NotFinalAPI ViewResult executeView(View view)
      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. See ViewExecutionOptions for details.

      Returns:
      the view result.
    • executeView

      @NotFinalAPI ViewResult executeView(View view, ViewExecutionOptions options)
      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

      @NotFinalAPI ViewResult executeViewDefinition(ViewDefinition viewDefinition, ExecutableQuery query)
      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. See ViewExecutionOptions 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

      @NotFinalAPI void saveView(ViewDefinition viewDefinition)
      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

      @NotFinalAPI boolean deleteView(String viewName)
      Deletes a view identified by viewName 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

      @NotFinalAPI Map<String,Collection<String>> 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

      @NotFinalAPI Map<String,Collection<String>> 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 occurs
      filter - 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 occurs
      filter - filters view management changes
      port - port number
      Returns:
      registration ID
    • unregisterViewManagementListener

      @NotFinalAPI void unregisterViewManagementListener(String listenerId)
      Unregisters the specified view management listener.
      Parameters:
      listenerId - registration ID of the listener
    • unregisterViewManagementListener

      @NotFinalAPI void unregisterViewManagementListener(String listenerId, int port)
      Unregisters the specified view management listener.
      Parameters:
      listenerId - registration ID of the listener
      port - 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 occurs
      filter - 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 occurs
      filter - filters the changes by name and/or bundles of a root view (dependent)
      port - port number
      Returns:
      registration ID
    • unregisterViewDependenciesChangeListener

      @NotFinalAPI void unregisterViewDependenciesChangeListener(String listenerId)
      Unregisters the specified view dependencies change listener.
      Parameters:
      listenerId - registration ID of the listener
    • unregisterViewDependenciesChangeListener

      @NotFinalAPI void unregisterViewDependenciesChangeListener(String listenerId, int port)
      Unregisters the specified view dependencies change listener.
      Parameters:
      listenerId - registration ID of the listener
      port - port number
    • hasChanges

      @NotFinalAPI 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.

      This API is similar to TopologyQueryService.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.
      The restrictions and notes for 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

      @NotFinalAPI Set<String> 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.

      The restrictions and notes for TopologyQueryService.hasChanges apply to this method.

      Parameters:
      views2check - view names whose query is to be checked.
      Returns:
      the set of changed views.
    • hasChanges

      @NotFinalAPI boolean hasChanges(String viewName, String viewResultVersionAsString)
      Same as hasChanges(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

      @NotFinalAPI DependsOnView whoDependsOn(String viewName)
    • validateBulk

      @NotFinalAPI void validateBulk(ViewValidationBulk bulk)
    • viewDefinitionToString

      String viewDefinitionToString(ViewDefinition viewDefinition) throws UcmdbException
      Given a ViewDefinition this method returns the view's string representation.

      The conversion from ViewDefinition 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

      ViewDefinition stringToViewDefinition(String str) throws UcmdbException
      Given a string created by viewDefinitionToString(com.hp.ucmdb.api.view.ViewDefinition), this methods returns a copy of the original ViewDefinition.

      The actual conversion from string to ViewDefinition 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