Ejemplo n.º 1
0
  public void setScoringDefinition(Scoring scoring) {
    for (ScoringElement element : scoring.getElements()) {
      ParserHelper.resolveConditionType(definitionsService, element.getCondition());
    }
    for (ScoringElement element : scoring.getElements()) {
      if (scoring.getMetadata().isEnabled() && !scoring.getMetadata().isMissingPlugins()) {
        updateAutoGeneratedRules(scoring.getMetadata(), element.getCondition());
      }
    }
    // make sure we update the name and description metadata that might not match, so first we
    // remove the entry from the map
    persistenceService.save(scoring);

    persistenceService.createMapping(
        Profile.ITEM_TYPE,
        String.format(
            "{\n"
                + "    \"profile\": {\n"
                + "        \"properties\" : {\n"
                + "            \"scores\": {\n"
                + "                \"properties\": {\n"
                + "                    \"%s\": {\n"
                + "                        \"type\": \"long\"\n"
                + "                    }\n"
                + "                }\n"
                + "            }\n"
                + "        }\n"
                + "    }\n"
                + "}\n",
            scoring.getItemId()));

    updateExistingProfilesForScoring(scoring);
  }
Ejemplo n.º 2
0
 public Segment getSegmentDefinition(String segmentId) {
   Segment definition = persistenceService.load(segmentId, Segment.class);
   if (definition != null) {
     ParserHelper.resolveConditionType(definitionsService, definition.getCondition());
   }
   return definition;
 }
Ejemplo n.º 3
0
 private List<Segment> getAllSegmentDefinitions() {
   List<Segment> allItems = persistenceService.getAllItems(Segment.class);
   for (Segment segment : allItems) {
     ParserHelper.resolveConditionType(definitionsService, segment.getCondition());
   }
   return allItems;
 }
Ejemplo n.º 4
0
 public Scoring getScoringDefinition(String scoringId) {
   Scoring definition = persistenceService.load(scoringId, Scoring.class);
   if (definition != null) {
     for (ScoringElement element : definition.getElements()) {
       ParserHelper.resolveConditionType(definitionsService, element.getCondition());
     }
   }
   return definition;
 }
Ejemplo n.º 5
0
 private List<Scoring> getAllScoringDefinitions() {
   List<Scoring> allItems = persistenceService.getAllItems(Scoring.class);
   for (Scoring scoring : allItems) {
     for (ScoringElement element : scoring.getElements()) {
       ParserHelper.resolveConditionType(definitionsService, element.getCondition());
     }
   }
   return allItems;
 }
Ejemplo n.º 6
0
  public void setSegmentDefinition(Segment segment) {
    ParserHelper.resolveConditionType(definitionsService, segment.getCondition());
    if (segment.getMetadata().isEnabled() && !segment.getMetadata().isMissingPlugins()) {
      updateAutoGeneratedRules(segment.getMetadata(), segment.getCondition());
    }
    // make sure we update the name and description metadata that might not match, so first we
    // remove the entry from the map
    persistenceService.save(segment);

    updateExistingProfilesForSegment(segment);
  }