2424import static com .google .common .collect .Sets .intersection ;
2525import static com .google .common .collect .Sets .union ;
2626import static google .registry .bsa .persistence .BsaLabelUtils .isLabelBlocked ;
27- import static google .registry .model .common .FeatureFlag .FeatureName .MINIMUM_DATASET_CONTACTS_OPTIONAL ;
28- import static google .registry .model .common .FeatureFlag .FeatureName .MINIMUM_DATASET_CONTACTS_PROHIBITED ;
2927import static google .registry .model .domain .Domain .MAX_REGISTRATION_YEARS ;
3028import static google .registry .model .domain .token .AllocationToken .TokenType .REGISTER_BSA ;
3129import static google .registry .model .tld .Tld .TldState .GENERAL_AVAILABILITY ;
8179import google .registry .model .billing .BillingBase .Flag ;
8280import google .registry .model .billing .BillingBase .Reason ;
8381import google .registry .model .billing .BillingRecurrence ;
84- import google .registry .model .common .FeatureFlag ;
8582import google .registry .model .contact .Contact ;
8683import google .registry .model .domain .DesignatedContact ;
8784import google .registry .model .domain .DesignatedContact .Type ;
138135import java .math .BigDecimal ;
139136import java .util .Collection ;
140137import java .util .Comparator ;
141- import java .util .HashSet ;
142138import java .util .List ;
143139import java .util .Map ;
144140import java .util .Map .Entry ;
@@ -486,31 +482,12 @@ static void validateNoDuplicateContacts(Set<DesignatedContact> contacts)
486482 */
487483 static void validateCreateContactData (
488484 Optional <VKey <Contact >> registrant , Set <DesignatedContact > contacts )
489- throws RequiredParameterMissingException , ParameterValuePolicyErrorException {
490- // TODO(b/353347632): Change these flag checks to a registry config check once minimum data set
491- // migration is completed.
492- if (FeatureFlag .isActiveNow (MINIMUM_DATASET_CONTACTS_PROHIBITED )) {
493- if (registrant .isPresent ()) {
494- throw new RegistrantProhibitedException ();
495- }
496- if (!contacts .isEmpty ()) {
497- throw new ContactsProhibitedException ();
498- }
499- } else if (!FeatureFlag .isActiveNow (MINIMUM_DATASET_CONTACTS_OPTIONAL )) {
500- if (registrant .isEmpty ()) {
501- throw new MissingRegistrantException ();
502- }
503-
504- Set <Type > roles = new HashSet <>();
505- for (DesignatedContact contact : contacts ) {
506- roles .add (contact .getType ());
507- }
508- if (!roles .contains (Type .ADMIN )) {
509- throw new MissingAdminContactException ();
510- }
511- if (!roles .contains (Type .TECH )) {
512- throw new MissingTechnicalContactException ();
513- }
485+ throws ParameterValuePolicyErrorException {
486+ if (registrant .isPresent ()) {
487+ throw new RegistrantProhibitedException ();
488+ }
489+ if (!contacts .isEmpty ()) {
490+ throw new ContactsProhibitedException ();
514491 }
515492 }
516493
@@ -523,33 +500,14 @@ static void validateUpdateContactData(
523500 Optional <VKey <Contact >> newRegistrant ,
524501 Set <DesignatedContact > existingContacts ,
525502 Set <DesignatedContact > newContacts )
526- throws RequiredParameterMissingException , ParameterValuePolicyErrorException {
527- // TODO(b/353347632): Change these flag checks to a registry config check once minimum data set
528- // migration is completed.
529- if (FeatureFlag .isActiveNow (MINIMUM_DATASET_CONTACTS_PROHIBITED )) {
530- // Throw if the update specifies a new registrant that is different from the existing one.
531- if (newRegistrant .isPresent () && !newRegistrant .equals (existingRegistrant )) {
532- throw new RegistrantProhibitedException ();
533- }
534- // Throw if the update specifies any new contacts that weren't already present on the domain.
535- if (!Sets .difference (newContacts , existingContacts ).isEmpty ()) {
536- throw new ContactsProhibitedException ();
537- }
538- } else if (!FeatureFlag .isActiveNow (MINIMUM_DATASET_CONTACTS_OPTIONAL )) {
539- // Throw if the update empties out a registrant that had been present.
540- if (newRegistrant .isEmpty () && existingRegistrant .isPresent ()) {
541- throw new MissingRegistrantException ();
542- }
543- // Throw if the update contains no admin contact when one had been present.
544- if (existingContacts .stream ().anyMatch (c -> c .getType ().equals (Type .ADMIN ))
545- && newContacts .stream ().noneMatch (c -> c .getType ().equals (Type .ADMIN ))) {
546- throw new MissingAdminContactException ();
547- }
548- // Throw if the update contains no tech contact when one had been present.
549- if (existingContacts .stream ().anyMatch (c -> c .getType ().equals (Type .TECH ))
550- && newContacts .stream ().noneMatch (c -> c .getType ().equals (Type .TECH ))) {
551- throw new MissingTechnicalContactException ();
552- }
503+ throws ParameterValuePolicyErrorException {
504+ // Throw if the update specifies a new registrant that is different from the existing one.
505+ if (newRegistrant .isPresent () && !newRegistrant .equals (existingRegistrant )) {
506+ throw new RegistrantProhibitedException ();
507+ }
508+ // Throw if the update specifies any new contacts that weren't already present on the domain.
509+ if (!Sets .difference (newContacts , existingContacts ).isEmpty ()) {
510+ throw new ContactsProhibitedException ();
553511 }
554512 }
555513
@@ -1398,34 +1356,13 @@ public InvalidIdnDomainLabelException() {
13981356 }
13991357 }
14001358
1401- /** Registrant is required. */
1402- static class MissingRegistrantException extends RequiredParameterMissingException {
1403- public MissingRegistrantException () {
1404- super ("Registrant is required" );
1405- }
1406- }
1407-
14081359 /** Having a registrant is prohibited by registry policy. */
14091360 static class RegistrantProhibitedException extends ParameterValuePolicyErrorException {
14101361 public RegistrantProhibitedException () {
14111362 super ("Having a registrant is prohibited by registry policy" );
14121363 }
14131364 }
14141365
1415- /** Admin contact is required. */
1416- static class MissingAdminContactException extends RequiredParameterMissingException {
1417- public MissingAdminContactException () {
1418- super ("Admin contact is required" );
1419- }
1420- }
1421-
1422- /** Technical contact is required. */
1423- static class MissingTechnicalContactException extends RequiredParameterMissingException {
1424- public MissingTechnicalContactException () {
1425- super ("Technical contact is required" );
1426- }
1427- }
1428-
14291366 /** Too many nameservers set on this domain. */
14301367 static class TooManyNameserversException extends ParameterValuePolicyErrorException {
14311368 public TooManyNameserversException (String message ) {
0 commit comments