private void deleteDeprecatedEvents(Project project, SensorContext context) {
   String version = project.getAnalysisVersion();
   for (Iterator<Event> it = context.getEvents(project).iterator(); it.hasNext(); ) {
     Event event = it.next();
     if (event.isVersionCategory() && version.equals(event.getName())) {
       it.remove();
       context.deleteEvent(event);
     }
   }
 }
示例#2
0
  @Override
  public Event addEvent(
      Resource resource, String name, String description, String category, Date date) {
    Event event = new Event(name, description, category);
    event.setDate(date);
    event.setCreatedAt(new Date());

    persistence.saveEvent(resource, event);
    return null;
  }
示例#3
0
  @Override
  public Event addEvent(
      Resource resource, String name, String description, String category, @Nullable Date date) {
    Event event = new Event(name, description, category);
    if (date != null) {
      event.setDate(date);
    }

    if (eventPersister != null) {
      eventPersister.saveEvent(resource, event);
    }
    return null;
  }