Class RatingHandler<B>


  • public class RatingHandler<B>
    extends OpenMetadataAPIGenericHandler<B>
    RatingHandler manages the Rating entity. The Rating entity describes the star rating and review text type of feedback. Ratings do not support effectivity dates and are always anchored to a referenceable.
    • Constructor Detail

      • RatingHandler

        public RatingHandler​(OpenMetadataAPIGenericConverter<B> converter,
                             Class<B> beanClass,
                             String serviceName,
                             String serverName,
                             InvalidParameterHandler invalidParameterHandler,
                             RepositoryHandler repositoryHandler,
                             OMRSRepositoryHelper repositoryHelper,
                             String localServerUserId,
                             OpenMetadataServerSecurityVerifier securityVerifier,
                             List<String> supportedZones,
                             List<String> defaultZones,
                             List<String> publishZones,
                             AuditLog auditLog)
        Construct the handler information needed to interact with the repository services
        Parameters:
        converter - specific converter for this bean class
        beanClass - name of bean class that is represented by the generic class B
        serviceName - name of this service
        serverName - name of the local server
        invalidParameterHandler - handler for managing parameter errors
        repositoryHandler - manages calls to the repository services
        repositoryHelper - provides utilities for manipulating the repository services objects
        localServerUserId - userId for this server
        securityVerifier - open metadata security services verifier
        supportedZones - list of zones that the access service is allowed to serve Asset instances from.
        defaultZones - list of zones that the access service should set in all new Asset instances.
        publishZones - list of zones that the access service sets up in published Asset instances.
        auditLog - destination for audit log events.
    • Method Detail

      • getRatings

        public List<B> getRatings​(String userId,
                                  String elementGUID,
                                  String elementGUIDParameterName,
                                  String elementTypeName,
                                  List<String> serviceSupportedZones,
                                  int startingFrom,
                                  int pageSize,
                                  String methodName)
                           throws InvalidParameterException,
                                  PropertyServerException,
                                  UserNotAuthorizedException
        Return the Ratings attached to a supplied entity.
        Parameters:
        userId - calling user
        elementGUID - identifier for the entity that the feedback is attached to
        elementGUIDParameterName - name of parameter supplying the GUID
        elementTypeName - name of the type of object being attached to
        serviceSupportedZones - supported zones for calling service
        startingFrom - where to start from in the list
        pageSize - maximum number of results that can be returned
        methodName - calling method
        Returns:
        list of objects or null if none found
        Throws:
        InvalidParameterException - the input properties are invalid
        UserNotAuthorizedException - user not authorized to issue this request
        PropertyServerException - problem accessing the property server
      • saveRating

        public String saveRating​(String userId,
                                 String externalSourceGUID,
                                 String externalSourceName,
                                 String elementGUID,
                                 String elementGUIDParameterName,
                                 int starRating,
                                 String review,
                                 boolean isPublic,
                                 String methodName)
                          throws InvalidParameterException,
                                 PropertyServerException,
                                 UserNotAuthorizedException
        Add or replace an existing Rating for this user.
        Parameters:
        userId - userId of user making request.
        externalSourceGUID - guid of the software server capability entity that represented the external source - null for local
        externalSourceName - name of the software server capability entity that represented the external source
        elementGUID - unique identifier for the connected entity (Referenceable).
        elementGUIDParameterName - parameter supplying the elementGUID
        starRating - StarRating ordinal for enumeration for not recommended, one to five stars.
        review - user review of asset. This can be null.
        isPublic - indicates whether the feedback should be shared or only be visible to the originating user
        methodName - calling method
        Returns:
        unique identifier of the rating
        Throws:
        InvalidParameterException - the endpoint bean properties are invalid
        UserNotAuthorizedException - user not authorized to issue this request
        PropertyServerException - problem accessing the property server
      • removeRating

        public void removeRating​(String userId,
                                 String externalSourceGUID,
                                 String externalSourceName,
                                 String elementGUID,
                                 String elementGUIDParameterName,
                                 String methodName)
                          throws InvalidParameterException,
                                 PropertyServerException,
                                 UserNotAuthorizedException
        Remove the requested rating.
        Parameters:
        userId - calling user
        externalSourceGUID - guid of the software server capability entity that represented the external source - null for local
        externalSourceName - name of the software server capability entity that represented the external source
        elementGUID - unique identifier for the connected entity (Referenceable).
        elementGUIDParameterName - parameter supplying the elementGUID
        methodName - calling method
        Throws:
        InvalidParameterException - one of the parameters is null or invalid.
        UserNotAuthorizedException - user not authorized to issue this request
        PropertyServerException - problem accessing the property server