Move RDAP boilerplate from remarks to notices

This is in response to decisions made by the RDAP working group regarding the
Operational Profile document:

https://docs.google.com/document/d/1h1E99GLY-8I0PfYBuANzVc3iJD1R38E6xayDYGK0pCw/edit?usp=sharing

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195251639
This commit is contained in:
mountford 2018-05-03 07:56:38 -07:00 committed by jianglai
parent d3bb808c5f
commit 3eb82ad647
27 changed files with 152 additions and 202 deletions

View file

@ -26,7 +26,7 @@ import com.google.common.collect.ImmutableMap;
public class RdapIcannStandardInformation {
/** Required by ICANN RDAP Profile section 1.4.10. */
private static final ImmutableMap<String, Object> CONFORMANCE_REMARK =
private static final ImmutableMap<String, Object> CONFORMANCE_NOTICE =
ImmutableMap.of(
"description",
ImmutableList.of(
@ -34,7 +34,7 @@ public class RdapIcannStandardInformation {
+ " Registrars version 1.0"));
/** Required by ICANN RDAP Profile section 1.5.18. */
private static final ImmutableMap<String, Object> DOMAIN_STATUS_CODES_REMARK =
private static final ImmutableMap<String, Object> DOMAIN_STATUS_CODES_NOTICE =
ImmutableMap.of(
"title",
"EPP Status Codes",
@ -50,7 +50,7 @@ public class RdapIcannStandardInformation {
"type", "text/html")));
/** Required by ICANN RDAP Profile section 1.5.20. */
private static final ImmutableMap<String, Object> INACCURACY_COMPLAINT_FORM_REMARK =
private static final ImmutableMap<String, Object> INACCURACY_COMPLAINT_FORM_NOTICE =
ImmutableMap.of(
"description",
ImmutableList.of(
@ -63,14 +63,14 @@ public class RdapIcannStandardInformation {
"href", "https://www.icann.org/wicf",
"type", "text/html")));
/** Boilerplate remarks required by domain responses. */
static final ImmutableList<ImmutableMap<String, Object>> domainBoilerplateRemarks =
/** Boilerplate notices required by domain responses. */
static final ImmutableList<ImmutableMap<String, Object>> domainBoilerplateNotices =
ImmutableList.of(
CONFORMANCE_REMARK, DOMAIN_STATUS_CODES_REMARK, INACCURACY_COMPLAINT_FORM_REMARK);
CONFORMANCE_NOTICE, DOMAIN_STATUS_CODES_NOTICE, INACCURACY_COMPLAINT_FORM_NOTICE);
/** Boilerplate remarks required by nameserver and entity responses. */
static final ImmutableList<ImmutableMap<String, Object>> nameserverAndEntityBoilerplateRemarks =
ImmutableList.of(CONFORMANCE_REMARK);
static final ImmutableList<ImmutableMap<String, Object>> nameserverAndEntityBoilerplateNotices =
ImmutableList.of(CONFORMANCE_NOTICE);
/**
* Required by ICANN RDAP Profile section 1.4.9, as corrected by Gustavo Lozano of ICANN.

View file

@ -321,7 +321,7 @@ public class RdapJsonFormatter {
* mandates extra boilerplate for domain objects
* @param notices a list of notices to be inserted before the boilerplate notices. If the TOS
* notice is in this list, the method avoids adding a second copy.
* @param remarks a list of remarks to be inserted before the boilerplate notices.
* @param remarks a list of remarks to be inserted.
* @param rdapLinkBase the base for link URLs
*/
void addTopLevelEntries(
@ -347,24 +347,20 @@ public class RdapJsonFormatter {
if (!tosNoticeFound) {
noticesBuilder.add(tosNotice);
}
jsonBuilder.put(NOTICES, noticesBuilder.build());
ImmutableList.Builder<ImmutableMap<String, Object>> remarksBuilder =
new ImmutableList.Builder<>();
remarksBuilder.addAll(remarks);
switch (boilerplateType) {
case DOMAIN:
remarksBuilder.addAll(RdapIcannStandardInformation.domainBoilerplateRemarks);
noticesBuilder.addAll(RdapIcannStandardInformation.domainBoilerplateNotices);
break;
case NAMESERVER:
case ENTITY:
remarksBuilder.addAll(RdapIcannStandardInformation.nameserverAndEntityBoilerplateRemarks);
noticesBuilder.addAll(RdapIcannStandardInformation.nameserverAndEntityBoilerplateNotices);
break;
default: // things other than domains, nameservers and entities cannot contain remarks
default: // things other than domains, nameservers and entities do not yet have boilerplate
break;
}
ImmutableList<ImmutableMap<String, Object>> remarksToAdd = remarksBuilder.build();
if (!remarksToAdd.isEmpty()) {
jsonBuilder.put(REMARKS, remarksToAdd);
jsonBuilder.put(NOTICES, noticesBuilder.build());
if (!remarks.isEmpty()) {
jsonBuilder.put(REMARKS, remarks);
}
}