mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Centralize PARAM_YEAR_MONTH into RequestParameters
Overall this ends up being nicer. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=181782569
This commit is contained in:
parent
264b4be966
commit
635edd0fb9
5 changed files with 11 additions and 6 deletions
|
@ -43,7 +43,6 @@ public final class BillingModule {
|
|||
public static final String INVOICES_DIRECTORY = "invoices";
|
||||
|
||||
static final String PARAM_JOB_ID = "jobId";
|
||||
static final String PARAM_YEAR_MONTH = "yearMonth";
|
||||
static final String BILLING_QUEUE = "billing";
|
||||
static final String CRON_QUEUE = "retryable-cron-tasks";
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
package google.registry.billing;
|
||||
|
||||
import static google.registry.request.Action.Method.POST;
|
||||
import static google.registry.request.RequestParameters.PARAM_YEAR_MONTH;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_OK;
|
||||
|
||||
|
@ -120,7 +121,7 @@ public class GenerateInvoicesAction implements Runnable {
|
|||
.countdownMillis(Duration.standardMinutes(10).getMillis())
|
||||
.param(BillingModule.PARAM_JOB_ID, jobId)
|
||||
// Need to pass this through to ensure transitive yearMonth dependencies are satisfied.
|
||||
.param(BillingModule.PARAM_YEAR_MONTH, yearMonth.toString());
|
||||
.param(PARAM_YEAR_MONTH, yearMonth.toString());
|
||||
QueueFactory.getQueue(BillingModule.BILLING_QUEUE).add(publishTask);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
package google.registry.billing;
|
||||
|
||||
import static google.registry.request.Action.Method.POST;
|
||||
import static google.registry.request.RequestParameters.PARAM_YEAR_MONTH;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_NOT_MODIFIED;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_NO_CONTENT;
|
||||
|
@ -112,7 +113,7 @@ public class PublishInvoicesAction implements Runnable {
|
|||
TaskOptions copyDetailTask =
|
||||
TaskOptions.Builder.withUrl(CopyDetailReportsAction.PATH)
|
||||
.method(TaskOptions.Method.POST)
|
||||
.param(BillingModule.PARAM_YEAR_MONTH, yearMonth.toString());
|
||||
.param(PARAM_YEAR_MONTH, yearMonth.toString());
|
||||
QueueFactory.getQueue(BillingModule.CRON_QUEUE).add(copyDetailTask);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ package google.registry.module.backend;
|
|||
|
||||
import static google.registry.model.registry.Registries.assertTldExists;
|
||||
import static google.registry.model.registry.Registries.assertTldsExist;
|
||||
import static google.registry.request.RequestParameters.PARAM_YEAR_MONTH;
|
||||
import static google.registry.request.RequestParameters.extractOptionalDatetimeParameter;
|
||||
import static google.registry.request.RequestParameters.extractOptionalParameter;
|
||||
import static google.registry.request.RequestParameters.extractRequiredParameter;
|
||||
|
@ -42,8 +43,6 @@ import org.joda.time.format.DateTimeFormatter;
|
|||
@Module
|
||||
public class BackendModule {
|
||||
|
||||
private static final String PARAM_YEAR_MONTH = "yearMonth";
|
||||
|
||||
@Provides
|
||||
@Parameter(RequestParameters.PARAM_TLD)
|
||||
static String provideTld(HttpServletRequest req) {
|
||||
|
|
|
@ -29,9 +29,14 @@ import org.joda.time.DateTime;
|
|||
/** Utilities for extracting parameters from HTTP requests. */
|
||||
public final class RequestParameters {
|
||||
|
||||
/** The standardized request parameter name used by any servlet that takes a tld parameter. */
|
||||
/** The standardized request parameter name used by any action that takes a tld parameter. */
|
||||
public static final String PARAM_TLD = "tld";
|
||||
|
||||
/**
|
||||
* The standardized request parameter name used by any action that takes a year/month parameter.
|
||||
*/
|
||||
public static final String PARAM_YEAR_MONTH = "yearMonth";
|
||||
|
||||
/**
|
||||
* Returns first GET or POST parameter associated with {@code name}.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue