Package org.apache.unomi.rest.endpoints
Class ScoringServiceEndPoint
- java.lang.Object
-
- org.apache.unomi.rest.endpoints.ScoringServiceEndPoint
-
-
Constructor Summary
Constructors Constructor Description ScoringServiceEndPoint()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
createScoringDefinition(String scope, String scoringId, String scoringName, String scoringDescription)
Creates a scoring with the specified scope, identifier, name and description from form-encoded data.Scoring
getScoringDefinition(String scoringId)
Retrieves the scoring identified by the specified identifier.DependentMetadata
getScoringDependentMetadata(String scoringId)
Retrieves the list of Segment and Scoring metadata depending on the specified scoring.List<Metadata>
getScoringMetadatas(int offset, int size, String sortBy)
Retrieves the set of all scoring metadata.PartialList<Metadata>
getScoringMetadatas(Query query)
Retrieves the set of scoring metadata for scorings matching the specified query.DependentMetadata
removeScoringDefinition(String scoringId, boolean validate)
Removes the scoring definition identified by the specified identifier.void
resetQueries()
Deprecated.As of version 1.1.0-incubating, not needed anymorevoid
setScoringDefinition(Scoring scoring)
Persists the specified scoring in the context server.void
setSegmentService(SegmentService segmentService)
-
-
-
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 elementssize
- a positive integer specifying how many matching elements should be retrieved or-1
if all of them should be retrievedsortBy
- 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
ordesc
.- 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 scoringscoringId
- the identifier for the new scoringscoringName
- the name of the new scoringscoringDescription
- 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. Ifvalidate
is set tofalse
, no validation is performed. If set totrue
, 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 deletevalidate
- 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 anymoreTODO: remove
-
-