Skip to content
Snippets Groups Projects

feat: Create reports for tracked private projects

7 unresolved threads

Relates to #81 (closed)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
25 import org.eclipsefoundation.git.eca.service.ReportsService;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
28
29 @Path("/reports")
30 public class ReportsResource {
31 private static final Logger LOGGER = LoggerFactory.getLogger(ReportsResource.class);
32
33 private static final DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd");
34
35 @Inject
36 ReportsService reportsService;
37
38 @GET
39 @Path("/webhooks/gitlab/system")
40 public Response getPrivateProjectEvents(@QueryParam("status") String status, @QueryParam("since") String since,
  • added 1 commit

    • 3bfe9e22 - feat: Update URL and add converter service

    Compare with previous version

  • 29 import org.eclipsefoundation.persistence.model.RDBMSQuery;
    30 import org.eclipsefoundation.persistence.service.FilterService;
    31 import org.jboss.resteasy.specimpl.MultivaluedMapImpl;
    32 import org.slf4j.Logger;
    33 import org.slf4j.LoggerFactory;
    34
    35 @ApplicationScoped
    36 public class DefaultReportsService implements ReportsService {
    37
    38 private static final Logger LOGGER = LoggerFactory.getLogger(DefaultReportsService.class);
    39
    40 @Inject
    41 PersistenceDao dao;
    42
    43 @Inject
    44 RequestWrapper wrap;
  • 19 import javax.ws.rs.Path;
    20 import javax.ws.rs.QueryParam;
    21 import javax.ws.rs.core.Response;
    22 import javax.ws.rs.ext.ParamConverter;
    23
    24 import org.apache.commons.lang3.StringUtils;
    25 import org.eclipsefoundation.git.eca.namespace.GitEcaParameterNames;
    26 import org.eclipsefoundation.git.eca.service.ReportsService;
    27
    28 @Path("/reports")
    29 public class ReportsResource {
    30
    31 @Inject
    32 ReportsService reportsService;
    33 @Inject
    34 ParamConverter<LocalDate> dateConverter;
    • That's not how you use param converters. Param converter providers are picked up on launch and registered. These would then be iterated over and allow you to do @QueryParam("date") LocalDate date as an example and have it automatically convert from the string value for you. The ParamConverter is not a service, it is a disposable instance that can be quickly created and discarded if needed. The implementation in the given link is the pattern you should use.

    • Zachary Sabourin changed this line in version 10 of the diff

      changed this line in version 10 of the diff

    • Please register or sign in to reply
  • 6 * which is available at https://www.eclipse.org/legal/epl-2.0/
    7 *
    8 * Author: Zachary Sabourin <zachary.sabourin@eclipse-foundation.org>
    9 *
    10 * SPDX-License-Identifier: EPL-2.0
    11 **********************************************************************/
    12 package org.eclipsefoundation.git.eca.service.impl;
    13
    14 import java.time.LocalDate;
    15 import java.time.format.DateTimeFormatter;
    16
    17 import javax.enterprise.context.ApplicationScoped;
    18 import javax.ws.rs.BadRequestException;
    19 import javax.ws.rs.ext.ParamConverter;
    20
    21 @ApplicationScoped
  • 9 *
    10 * SPDX-License-Identifier: EPL-2.0
    11 **********************************************************************/
    12 package org.eclipsefoundation.git.eca.service.impl;
    13
    14 import java.time.LocalDate;
    15 import java.time.format.DateTimeFormatter;
    16
    17 import javax.enterprise.context.ApplicationScoped;
    18 import javax.ws.rs.BadRequestException;
    19 import javax.ws.rs.ext.ParamConverter;
    20
    21 @ApplicationScoped
    22 public class LocalDateParamConverter implements ParamConverter<LocalDate> {
    23
    24 private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
  • 1 /*********************************************************************
  • 93 93 500:
    94 94 description: Error while processing data
    95 95
    96 /reports/webhooks/gitlab/system:
  • added 1 commit

    • 04ea3985 - fix: Fix use of param converter

    Compare with previous version

  • Martin Lowe approved this merge request

    approved this merge request

  • Martin Lowe mentioned in commit 127895b9

    mentioned in commit 127895b9

  • merged

  • Please register or sign in to reply
    Loading