Class ScoringServiceEndPoint


  • @Produces("application/json")
    @Consumes("application/json")
    @Path("/scoring")
    public class ScoringServiceEndPoint
    extends Object
    A JAX-RS endpoint to manage Scorings
    • Constructor Detail

      • ScoringServiceEndPoint

        public ScoringServiceEndPoint()
    • Method Detail

      • setSegmentService

        public void setSegmentService​(SegmentService segmentService)
      • getScoringMetadatas

        @GET
        @Path("/")
        public List<Metadata> getScoringMetadatas​(@QueryParam("offset") @DefaultValue("0")
                                                  int offset,
                                                  @QueryParam("size") @DefaultValue("50")
                                                  int size,
                                                  @QueryParam("sort")
                                                  String sortBy)
        Retrieves the set of all scoring metadata.
        Parameters:
        offset - zero or a positive integer specifying the position of the first element in the total ordered collection of matching elements
        size - a positive integer specifying how many matching elements should be retrieved or -1 if all of them should be retrieved
        sortBy - an optional (null if no sorting is required) String of comma (,) separated property names on which ordering should be performed, ordering elements according to the property order in the String, considering each in turn and moving on to the next one in case of equality of all preceding ones. Each property name is optionally followed by a column (:) and an order specifier: asc or desc.
        Returns:
        the set of all scoring metadata
      • getScoringMetadatas

        @POST
        @Path("/query")
        public PartialList<Metadata> getScoringMetadatas​(Query query)
        Retrieves the set of scoring metadata for scorings matching the specified query.
        Parameters:
        query - the query the scorings must match for their metadata to be retrieved
        Returns:
        the set of scoring metadata for scorings matching the specified query
      • getScoringDefinition

        @GET
        @Path("/{scoringID}")
        public Scoring getScoringDefinition​(@PathParam("scoringID")
                                            String scoringId)
        Retrieves the scoring identified by the specified identifier.
        Parameters:
        scoringId - the identifier of the scoring to be retrieved
        Returns:
        the scoring identified by the specified identifier or null if no such scoring exists
      • setScoringDefinition

        @POST
        @Path("/")
        public void setScoringDefinition​(Scoring scoring)
        Persists the specified scoring in the context server.
        Parameters:
        scoring - the scoring to be persisted
      • createScoringDefinition

        @PUT
        @Path("/{scope}/{scoringID}")
        @Consumes("application/x-www-form-urlencoded")
        public void createScoringDefinition​(@PathParam("scope")
                                            String scope,
                                            @PathParam("scoringID")
                                            String scoringId,
                                            @FormParam("scoringName")
                                            String scoringName,
                                            @FormParam("scoringDescription")
                                            String scoringDescription)
        Creates a scoring with the specified scope, identifier, name and description from form-encoded data.
        Parameters:
        scope - the scope for the new scoring
        scoringId - the identifier for the new scoring
        scoringName - the name of the new scoring
        scoringDescription - the description of the new scoring
        See Also:
        Item's description for a discussion of scope
      • removeScoringDefinition

        @DELETE
        @Path("/{scoringID}")
        public DependentMetadata removeScoringDefinition​(@PathParam("scoringID")
                                                         String scoringId,
                                                         @QueryParam("validate")
                                                         boolean validate)
        Removes the scoring definition identified by the specified identifier. We can specify that we want the operation to be validated beforehand so that we can know if any other segment that might use the segment we're trying to delete as a condition might be impacted. If validate is set to false, no validation is performed. If set to true, we will first check if any segment or scoring depends on the scoring we're trying to delete and if so we will not delete the scoring but rather return the list of the metadata of the impacted items. If no dependents are found, then we properly delete the scoring.
        Parameters:
        scoringId - the identifier of the scoring we want to delete
        validate - whether or not to perform validation
        Returns:
        a list of impacted items metadata if any or an empty list if none were found or validation was skipped
      • getScoringDependentMetadata

        @GET
        @Path("/{scoringID}/impacted")
        public DependentMetadata getScoringDependentMetadata​(@PathParam("scoringID")
                                                             String scoringId)
        Retrieves the list of Segment and Scoring metadata depending on the specified scoring. A segment or scoring is depending on a segment if it includes a scoringCondition with a test on this scoring.
        Parameters:
        scoringId - the segment identifier
        Returns:
        a list of Segment/Scoring Metadata depending on the specified scoring
      • resetQueries

        @Deprecated
        @GET
        @Path("/resetQueries")
        public void resetQueries()
        Deprecated.
        As of version 1.1.0-incubating, not needed anymore
        TODO: remove