mirror of
https://github.com/google/nomulus
synced 2026-01-10 07:57:58 +00:00
Allow RdeStagingAction to be invoked manually
RdeStagingAction always processed all RDE and BRDA deposits currently outstanding, updating the cursors appropriately and kicking off the upload job. Sometimes we don't want all that. We just want to create a specific deposit by hand, without modifying the cursors or uploading. This CL adds parameters to support that. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=152415959
This commit is contained in:
@@ -175,6 +175,33 @@ public final class RequestParameters {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all GET or POST date parameters associated with {@code name}, or an empty set if none.
|
||||
*
|
||||
* <p>Dates are parsed as an <a href="https://goo.gl/pk5Q2k">ISO 8601</a> timestamp, e.g. {@code
|
||||
* 1984-12-18TZ}, {@code 2000-01-01T16:20:00Z}.
|
||||
*
|
||||
* @throws BadRequestException if one of the parameter values is not a valid {@link DateTime}.
|
||||
*/
|
||||
public static ImmutableSet<DateTime> extractSetOfDatetimeParameters(
|
||||
HttpServletRequest req, String name) {
|
||||
String[] stringParams = req.getParameterValues(name);
|
||||
if (stringParams == null) {
|
||||
return ImmutableSet.<DateTime>of();
|
||||
}
|
||||
ImmutableSet.Builder<DateTime> datesBuilder = new ImmutableSet.Builder<>();
|
||||
for (String stringParam : stringParams) {
|
||||
try {
|
||||
if (!isNullOrEmpty(stringParam)) {
|
||||
datesBuilder.add(DateTime.parse(stringParam));
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BadRequestException("Bad ISO 8601 timestamp: " + name);
|
||||
}
|
||||
}
|
||||
return datesBuilder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns first request parameter associated with {@code name} parsed as an optional
|
||||
* {@link InetAddress} (which might be IPv6).
|
||||
|
||||
Reference in New Issue
Block a user