mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 08:57:12 +02:00
Add visibleInWhoisAsAbuse field in RegistrarContact
Also added corresponding getters and setters for the new field. Note that nothing has changed on the RDAP front for now, as the CL&D only concerns WHOIS. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=155116134
This commit is contained in:
parent
354e1fb8b2
commit
7a3852b5a5
6 changed files with 145 additions and 83 deletions
|
@ -123,15 +123,22 @@ public class RegistrarContact extends ImmutableObject implements Jsonifiable {
|
|||
String gaeUserId;
|
||||
|
||||
/**
|
||||
* Whether this contact is publicly visible in WHOIS results as an Admin contact.
|
||||
* Whether this contact is publicly visible in WHOIS registrar query results as an Admin contact.
|
||||
*/
|
||||
boolean visibleInWhoisAsAdmin = false;
|
||||
|
||||
/**
|
||||
* Whether this contact is publicly visible in WHOIS results as a Technical contact.
|
||||
* Whether this contact is publicly visible in WHOIS registrar query results as a Technical
|
||||
* contact.
|
||||
*/
|
||||
boolean visibleInWhoisAsTech = false;
|
||||
|
||||
/**
|
||||
* Whether this contact's phone number and email address is publicly visible in WHOIS domain query
|
||||
* results as registrar abuse contact info.
|
||||
*/
|
||||
boolean visibleInDomainWhoisAsAbuse = false;
|
||||
|
||||
public static ImmutableSet<Type> typesFromCSV(String csv) {
|
||||
return typesFromStrings(Arrays.asList(csv.split(",")));
|
||||
}
|
||||
|
@ -193,6 +200,10 @@ public class RegistrarContact extends ImmutableObject implements Jsonifiable {
|
|||
return visibleInWhoisAsTech;
|
||||
}
|
||||
|
||||
public boolean getVisibleInDomainWhoisAsAbuse() {
|
||||
return visibleInDomainWhoisAsAbuse;
|
||||
}
|
||||
|
||||
public String getGaeUserId() {
|
||||
return gaeUserId;
|
||||
}
|
||||
|
@ -225,12 +236,20 @@ public class RegistrarContact extends ImmutableObject implements Jsonifiable {
|
|||
result.append("Fax: ").append(getFaxNumber()).append('\n');
|
||||
}
|
||||
result.append("Types: ").append(getTypes()).append('\n');
|
||||
result.append("Visible in WHOIS as Admin contact: ")
|
||||
result
|
||||
.append("Visible in registrar WHOIS query as Admin contact: ")
|
||||
.append(getVisibleInWhoisAsAdmin() ? "Yes" : "No")
|
||||
.append("\n");
|
||||
result.append("Visible in WHOIS as Technical contact: ")
|
||||
result
|
||||
.append("Visible in registrar WHOIS query as Technical contact: ")
|
||||
.append(getVisibleInWhoisAsTech() ? "Yes" : "No")
|
||||
.append("\n");
|
||||
result
|
||||
.append(
|
||||
"Phone number and email visible in domain WHOIS query as "
|
||||
+ "Registrar Abuse contact info: ")
|
||||
.append(getVisibleInDomainWhoisAsAbuse() ? "Yes" : "No")
|
||||
.append("\n");
|
||||
if (getGaeUserId() != null) {
|
||||
result.append("GAE-UserID: ").append(getGaeUserId()).append('\n');
|
||||
}
|
||||
|
@ -247,6 +266,7 @@ public class RegistrarContact extends ImmutableObject implements Jsonifiable {
|
|||
.put("types", Joiner.on(',').join(transform(getTypes(), toStringFunction())))
|
||||
.put("visibleInWhoisAsAdmin", visibleInWhoisAsAdmin)
|
||||
.put("visibleInWhoisAsTech", visibleInWhoisAsTech)
|
||||
.put("visibleInDomainWhoisAsAbuse", visibleInDomainWhoisAsAbuse)
|
||||
.put("gaeUserId", gaeUserId)
|
||||
.build();
|
||||
}
|
||||
|
@ -311,6 +331,11 @@ public class RegistrarContact extends ImmutableObject implements Jsonifiable {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder setVisibleInDomainWhoisAsAbuse(boolean visible) {
|
||||
getInstance().visibleInDomainWhoisAsAbuse = visible;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setGaeUserId(String gaeUserId) {
|
||||
getInstance().gaeUserId = gaeUserId;
|
||||
return this;
|
||||
|
|
|
@ -208,6 +208,10 @@ public final class RegistrarFormFields {
|
|||
FormField.named("visibleInWhoisAsTech", Boolean.class)
|
||||
.build();
|
||||
|
||||
public static final FormField<Boolean, Boolean>
|
||||
PHONE_AND_EMAIL_VISIBLE_IN_DOMAIN_WHOIS_AS_ABUSE_FIELD =
|
||||
FormField.named("visibleInDomainWhoisAsAbuse", Boolean.class).build();
|
||||
|
||||
public static final FormField<String, String> CONTACT_PHONE_NUMBER_FIELD =
|
||||
FormFields.PHONE_NUMBER.asBuilder()
|
||||
.build();
|
||||
|
@ -228,42 +232,50 @@ public final class RegistrarFormFields {
|
|||
.build();
|
||||
|
||||
public static final Function<Map<String, ?>, RegistrarContact.Builder>
|
||||
REGISTRAR_CONTACT_TRANSFORM = new Function<Map<String, ?>, RegistrarContact.Builder>() {
|
||||
@Nullable
|
||||
@Override
|
||||
public RegistrarContact.Builder apply(@Nullable Map<String, ?> args) {
|
||||
if (args == null) {
|
||||
return null;
|
||||
}
|
||||
RegistrarContact.Builder builder = new RegistrarContact.Builder();
|
||||
for (String name : CONTACT_NAME_FIELD.extractUntyped(args).asSet()) {
|
||||
builder.setName(name);
|
||||
}
|
||||
for (String emailAddress : CONTACT_EMAIL_ADDRESS_FIELD.extractUntyped(args).asSet()) {
|
||||
builder.setEmailAddress(emailAddress);
|
||||
}
|
||||
for (Boolean visible :
|
||||
CONTACT_VISIBLE_IN_WHOIS_AS_ADMIN_FIELD.extractUntyped(args).asSet()) {
|
||||
builder.setVisibleInWhoisAsAdmin(visible);
|
||||
}
|
||||
for (Boolean visible :
|
||||
CONTACT_VISIBLE_IN_WHOIS_AS_TECH_FIELD.extractUntyped(args).asSet()) {
|
||||
builder.setVisibleInWhoisAsTech(visible);
|
||||
}
|
||||
for (String phoneNumber : CONTACT_PHONE_NUMBER_FIELD.extractUntyped(args).asSet()) {
|
||||
builder.setPhoneNumber(phoneNumber);
|
||||
}
|
||||
for (String faxNumber : CONTACT_FAX_NUMBER_FIELD.extractUntyped(args).asSet()) {
|
||||
builder.setFaxNumber(faxNumber);
|
||||
}
|
||||
for (Set<RegistrarContact.Type> types : CONTACT_TYPES.extractUntyped(args).asSet()) {
|
||||
builder.setTypes(types);
|
||||
}
|
||||
for (String gaeUserId : CONTACT_GAE_USER_ID_FIELD.extractUntyped(args).asSet()) {
|
||||
builder.setGaeUserId(gaeUserId);
|
||||
}
|
||||
return builder;
|
||||
}};
|
||||
REGISTRAR_CONTACT_TRANSFORM =
|
||||
new Function<Map<String, ?>, RegistrarContact.Builder>() {
|
||||
@Nullable
|
||||
@Override
|
||||
public RegistrarContact.Builder apply(@Nullable Map<String, ?> args) {
|
||||
if (args == null) {
|
||||
return null;
|
||||
}
|
||||
RegistrarContact.Builder builder = new RegistrarContact.Builder();
|
||||
for (String name : CONTACT_NAME_FIELD.extractUntyped(args).asSet()) {
|
||||
builder.setName(name);
|
||||
}
|
||||
for (String emailAddress : CONTACT_EMAIL_ADDRESS_FIELD.extractUntyped(args).asSet()) {
|
||||
builder.setEmailAddress(emailAddress);
|
||||
}
|
||||
for (Boolean visible :
|
||||
CONTACT_VISIBLE_IN_WHOIS_AS_ADMIN_FIELD.extractUntyped(args).asSet()) {
|
||||
builder.setVisibleInWhoisAsAdmin(visible);
|
||||
}
|
||||
for (Boolean visible :
|
||||
CONTACT_VISIBLE_IN_WHOIS_AS_TECH_FIELD.extractUntyped(args).asSet()) {
|
||||
builder.setVisibleInWhoisAsTech(visible);
|
||||
}
|
||||
for (Boolean visible :
|
||||
PHONE_AND_EMAIL_VISIBLE_IN_DOMAIN_WHOIS_AS_ABUSE_FIELD
|
||||
.extractUntyped(args)
|
||||
.asSet()) {
|
||||
builder.setVisibleInDomainWhoisAsAbuse(visible);
|
||||
}
|
||||
for (String phoneNumber : CONTACT_PHONE_NUMBER_FIELD.extractUntyped(args).asSet()) {
|
||||
builder.setPhoneNumber(phoneNumber);
|
||||
}
|
||||
for (String faxNumber : CONTACT_FAX_NUMBER_FIELD.extractUntyped(args).asSet()) {
|
||||
builder.setFaxNumber(faxNumber);
|
||||
}
|
||||
for (Set<RegistrarContact.Type> types : CONTACT_TYPES.extractUntyped(args).asSet()) {
|
||||
builder.setTypes(types);
|
||||
}
|
||||
for (String gaeUserId : CONTACT_GAE_USER_ID_FIELD.extractUntyped(args).asSet()) {
|
||||
builder.setGaeUserId(gaeUserId);
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
|
||||
public static final FormField<List<Map<String, ?>>, List<RegistrarContact.Builder>>
|
||||
CONTACTS_FIELD = FormField.mapNamed("contacts")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue