mirror of
https://github.com/google/nomulus.git
synced 2025-06-27 14:54:51 +02:00
Add XjcToDomainResourceConverter for RDE import
With some code cleanup/refactoring/formatting by Ben McIlwain. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=141199855
This commit is contained in:
parent
fbbcf41503
commit
f2faf49d58
19 changed files with 1008 additions and 1 deletions
|
@ -14,8 +14,17 @@
|
|||
|
||||
package google.registry.model.domain.rgp;
|
||||
|
||||
import static com.google.common.base.Predicates.equalTo;
|
||||
import static com.google.common.base.Predicates.not;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
import google.registry.model.translators.EnumToAttributeAdapter;
|
||||
import google.registry.model.translators.EnumToAttributeAdapter.EppEnum;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
|
@ -90,6 +99,18 @@ public enum GracePeriodStatus implements EppEnum {
|
|||
*/
|
||||
TRANSFER("transferPeriod");
|
||||
|
||||
/** Provide a quick lookup of GracePeriodStatus from XML name. */
|
||||
private static final Map<String, GracePeriodStatus> XML_NAME_TO_GRACE_PERIOD_STATUS =
|
||||
Maps.uniqueIndex(
|
||||
// SUNRUSH_ADD isn't a real grace period type visible in EPP XML, so exclude it.
|
||||
Iterables.filter(asList(GracePeriodStatus.values()), not(equalTo(SUNRUSH_ADD))),
|
||||
new Function<GracePeriodStatus, String>() {
|
||||
@Override
|
||||
public String apply(GracePeriodStatus gracePeriodStatus) {
|
||||
return gracePeriodStatus.xmlName;
|
||||
}
|
||||
});
|
||||
|
||||
@XmlAttribute(name = "s")
|
||||
private final String xmlName;
|
||||
|
||||
|
@ -101,4 +122,14 @@ public enum GracePeriodStatus implements EppEnum {
|
|||
public String getXmlName() {
|
||||
return xmlName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps from xmlName to {@link GracePeriodStatus}.
|
||||
*
|
||||
* If no match is found for xmlName, null is returned.
|
||||
*/
|
||||
@Nullable
|
||||
public static GracePeriodStatus fromXmlName(String xmlName) {
|
||||
return XML_NAME_TO_GRACE_PERIOD_STATUS.get(xmlName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ public abstract class ForeignKeyIndex<E extends EppResource> extends BackupGroup
|
|||
/**
|
||||
* Loads a {@link Key} to an {@link EppResource} from the datastore by foreign key.
|
||||
*
|
||||
* <p>Returns absent if no foreign key index with this foreign key was ever created, or if the
|
||||
* <p>Returns null if no foreign key index with this foreign key was ever created, or if the
|
||||
* most recently created foreign key index was deleted before time "now". This method does not
|
||||
* actually check that the referenced resource actually exists. However, for normal epp resources,
|
||||
* it is safe to assume that the referenced resource exists if the foreign key index does.
|
||||
|
|
|
@ -62,6 +62,8 @@ public class HistoryEntry extends ImmutableObject implements Buildable {
|
|||
HOST_DELETE_FAILURE,
|
||||
HOST_PENDING_DELETE,
|
||||
HOST_UPDATE,
|
||||
/** Resource was created by an escrow file import. */
|
||||
RDE_IMPORT,
|
||||
/**
|
||||
* A synthetic history entry created by a tool or back-end migration script outside of the scope
|
||||
* of usual EPP flows. These are sometimes needed to serve as parents for billing events or poll
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue