Class BaseController

    • Constructor Detail

      • BaseController

        public BaseController()
    • Method Detail

      • getBaseEnvLinkURL

        protected String getBaseEnvLinkURL()
      • getEhrUuid

        protected UUID getEhrUuid​(String ehrIdString)
        Helper to allow string UUID input from controllers, which throws an ObjectNotFound exception when no UUID representation can be created. This case is equal to no matching object.
        Parameters:
        ehrIdString - Input String representation of the ehrId
        Returns:
        UUID representation of the ehrId
        Throws:
        ObjectNotFoundException - when no UUID can't be created from input
      • getCompositionVersionedObjectUidString

        protected UUID getCompositionVersionedObjectUidString​(String compositionVersionedObjectUidString)
        Helper to allow string UUID input from controllers, which throws an ObjectNotFound exception when no UUID representation can be created. This case is equal to no matching object.
        Parameters:
        compositionVersionedObjectUidString - Input String representation
        Returns:
        UUID representation
        Throws:
        ObjectNotFoundException - when no UUID can't be created from input
      • getContributionVersionedObjectUidString

        protected UUID getContributionVersionedObjectUidString​(String compositionVersionedObjectUidString)
        Helper to allow string UUID input from controllers, which throws an ObjectNotFound exception when no UUID representation can be created. This case is equal to no matching object.
        Parameters:
        compositionVersionedObjectUidString - Input String representation
        Returns:
        UUID representation
        Throws:
        ObjectNotFoundException - when no UUID can't be created from input
      • extractCompositionFormat

        protected org.ehrbase.response.ehrscape.CompositionFormat extractCompositionFormat​(String contentType)
        Extracts the CompositionFormat from the REST request's input MediaType style content type header string.
        Parameters:
        contentType - String representation of REST request's input MediaType style content type header
        Returns:
        CompositionFormat expressing the content type
        Throws:
        NotAcceptableException - when content type is not supported or input is invalid
      • encodePath

        public String encodePath​(String path)
        Convenience helper to encode path strings to URI-safe strings
        Parameters:
        path - input
        Returns:
        URI-safe escaped string
        Throws:
        InternalServerException - when encoding failed
      • extractVersionedObjectUidFromVersionUid

        protected UUID extractVersionedObjectUidFromVersionUid​(String versionUid)
        Extracts the UUID base from a versioned UID. Or, if
        Parameters:
        versionUid -
        Returns:
      • extractVersionFromVersionUid

        protected int extractVersionFromVersionUid​(String versionUid)
      • enrichRequestAttribute

        protected void enrichRequestAttribute​(String attributeName,
                                              Object value)
        Add attribute to the current request.
        Parameters:
        attributeName -
        value -
      • resolveContentType

        protected org.springframework.http.MediaType resolveContentType​(String acceptHeader)
        Resolves the Content-Type based on Accept header.
        Parameters:
        acceptHeader - Accept header value
        Returns:
        Content-Type of the response
      • resolveContentType

        protected org.springframework.http.MediaType resolveContentType​(String acceptHeader,
                                                                        org.springframework.http.MediaType defaultMediaType)
        Resolves the Content-Type based on Accept header.
        Parameters:
        acceptHeader - Accept header value
        defaultMediaType - Default Content-Type
        Returns:
        Content-Type of the response