Add XjcToContactResourceConverter

XjcToContactResourceConverter is, as it name suggests, an inverse of
ContactResourceToXjcConverter. This utility class is designed to
support the TLD data import feature.

EXTERNAL_REVIEW_URL=https://github.com/google/domain-registry/pull/19
GIT_AUTHOR=Wolfgang Meyers <wolfgang@donuts.co>
(With some minor changes by Ben McIlwain.)
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=125985714
This commit is contained in:
Wolfgang Meyers 2016-06-27 12:30:07 -07:00 committed by Ben McIlwain
parent 9eeb0c43a1
commit bdfa97b0ae
5 changed files with 492 additions and 0 deletions

View file

@ -14,6 +14,7 @@
package google.registry.model;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.Sets.difference;
import static com.google.common.collect.Sets.union;
import static google.registry.util.CollectionUtils.difference;
@ -211,6 +212,19 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable,
super(instance);
}
/**
* Set the time this resource was created.
*
* <p>Note: This can only be used if the creation time hasn't already been set, which it is in
* normal EPP flows.
*/
public B setCreationTime(DateTime creationTime) {
checkState(getInstance().creationTime.timestamp == null,
"creationTime can only be set once for EppResource.");
getInstance().creationTime = CreateAutoTimestamp.create(creationTime);
return thisCastToDerived();
}
/** Set the time this resource was created. Should only be used in tests. */
@VisibleForTesting
public B setCreationTimeForTest(DateTime creationTime) {