mirror of
https://github.com/google/nomulus.git
synced 2025-05-19 18:59:35 +02:00
Run automatic Java 8 conversion over codebase
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=171174380
This commit is contained in:
parent
44df5da771
commit
5edb7935ed
190 changed files with 2312 additions and 3096 deletions
|
@ -89,26 +89,30 @@ class EscrowTaskRunner {
|
|||
Duration timeout,
|
||||
final CursorType cursorType,
|
||||
final Duration interval) {
|
||||
Callable<Void> lockRunner = new Callable<Void>() {
|
||||
@Override
|
||||
public Void call() throws Exception {
|
||||
logger.info("tld=" + registry.getTld());
|
||||
DateTime startOfToday = clock.nowUtc().withTimeAtStartOfDay();
|
||||
Cursor cursor = ofy().load().key(Cursor.createKey(cursorType, registry)).now();
|
||||
final DateTime nextRequiredRun = (cursor == null ? startOfToday : cursor.getCursorTime());
|
||||
if (nextRequiredRun.isAfter(startOfToday)) {
|
||||
throw new NoContentException("Already completed");
|
||||
}
|
||||
logger.info("cursor=" + nextRequiredRun);
|
||||
task.runWithLock(nextRequiredRun);
|
||||
ofy().transact(new VoidWork() {
|
||||
@Override
|
||||
public void vrun() {
|
||||
ofy().save().entity(
|
||||
Cursor.create(cursorType, nextRequiredRun.plus(interval), registry));
|
||||
}});
|
||||
return null;
|
||||
}};
|
||||
Callable<Void> lockRunner =
|
||||
() -> {
|
||||
logger.info("tld=" + registry.getTld());
|
||||
DateTime startOfToday = clock.nowUtc().withTimeAtStartOfDay();
|
||||
Cursor cursor = ofy().load().key(Cursor.createKey(cursorType, registry)).now();
|
||||
final DateTime nextRequiredRun = (cursor == null ? startOfToday : cursor.getCursorTime());
|
||||
if (nextRequiredRun.isAfter(startOfToday)) {
|
||||
throw new NoContentException("Already completed");
|
||||
}
|
||||
logger.info("cursor=" + nextRequiredRun);
|
||||
task.runWithLock(nextRequiredRun);
|
||||
ofy()
|
||||
.transact(
|
||||
new VoidWork() {
|
||||
@Override
|
||||
public void vrun() {
|
||||
ofy()
|
||||
.save()
|
||||
.entity(
|
||||
Cursor.create(cursorType, nextRequiredRun.plus(interval), registry));
|
||||
}
|
||||
});
|
||||
return null;
|
||||
};
|
||||
String lockName = String.format("%s %s", task.getClass().getSimpleName(), registry.getTld());
|
||||
if (!lockHandler.executeWithLocks(lockRunner, tld, timeout, lockName)) {
|
||||
// This will happen if either: a) the task is double-executed; b) the task takes a long time
|
||||
|
|
|
@ -23,7 +23,6 @@ import static javax.servlet.http.HttpServletResponse.SC_NO_CONTENT;
|
|||
|
||||
import com.google.common.base.Ascii;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSetMultimap;
|
||||
|
@ -262,16 +261,14 @@ public final class RdeStagingAction implements Runnable {
|
|||
return ImmutableSetMultimap.copyOf(
|
||||
Multimaps.filterValues(
|
||||
pendingDepositChecker.getTldsAndWatermarksPendingDepositForRdeAndBrda(),
|
||||
new Predicate<PendingDeposit>() {
|
||||
@Override
|
||||
public boolean apply(PendingDeposit pending) {
|
||||
if (clock.nowUtc().isBefore(pending.watermark().plus(transactionCooldown))) {
|
||||
logger.infofmt("Ignoring within %s cooldown: %s", transactionCooldown, pending);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}}));
|
||||
pending -> {
|
||||
if (clock.nowUtc().isBefore(pending.watermark().plus(transactionCooldown))) {
|
||||
logger.infofmt("Ignoring within %s cooldown: %s", transactionCooldown, pending);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private ImmutableSetMultimap<String, PendingDeposit> getManualPendingDeposits() {
|
||||
|
|
|
@ -15,18 +15,18 @@
|
|||
package google.registry.rde;
|
||||
|
||||
import static com.google.common.base.Strings.nullToEmpty;
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static google.registry.model.EppResourceUtils.loadAtPointInTime;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
|
||||
import com.google.appengine.tools.mapreduce.Mapper;
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSetMultimap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Streams;
|
||||
import com.googlecode.objectify.Result;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
|
@ -96,25 +96,16 @@ public final class RdeStagingMapper extends Mapper<EppResource, PendingDeposit,
|
|||
|
||||
// Get the set of all point-in-time watermarks we need, to minimize rewinding.
|
||||
ImmutableSet<DateTime> dates =
|
||||
FluentIterable
|
||||
.from(shouldEmitOnAllTlds
|
||||
? pendings.values()
|
||||
: pendings.get(((DomainResource) resource).getTld()))
|
||||
.transform(new Function<PendingDeposit, DateTime>() {
|
||||
@Override
|
||||
public DateTime apply(PendingDeposit pending) {
|
||||
return pending.watermark();
|
||||
}})
|
||||
.toSet();
|
||||
Streams.stream(
|
||||
shouldEmitOnAllTlds
|
||||
? pendings.values()
|
||||
: pendings.get(((DomainResource) resource).getTld()))
|
||||
.map(PendingDeposit::watermark)
|
||||
.collect(toImmutableSet());
|
||||
|
||||
// Launch asynchronous fetches of point-in-time representations of resource.
|
||||
ImmutableMap<DateTime, Result<EppResource>> resourceAtTimes =
|
||||
ImmutableMap.copyOf(Maps.asMap(dates,
|
||||
new Function<DateTime, Result<EppResource>>() {
|
||||
@Override
|
||||
public Result<EppResource> apply(DateTime input) {
|
||||
return loadAtPointInTime(resource, input);
|
||||
}}));
|
||||
ImmutableMap.copyOf(Maps.asMap(dates, input -> loadAtPointInTime(resource, input)));
|
||||
|
||||
// Convert resource to an XML fragment for each watermark/mode pair lazily and cache the result.
|
||||
Fragmenter fragmenter = new Fragmenter(resourceAtTimes);
|
||||
|
|
|
@ -101,12 +101,11 @@ public final class RdeStagingReducer extends Reducer<PendingDeposit, DepositFrag
|
|||
|
||||
@Override
|
||||
public void reduce(final PendingDeposit key, final ReducerInput<DepositFragment> fragments) {
|
||||
Callable<Void> lockRunner = new Callable<Void>() {
|
||||
@Override
|
||||
public Void call() throws Exception {
|
||||
reduceWithLock(key, fragments);
|
||||
return null;
|
||||
}};
|
||||
Callable<Void> lockRunner =
|
||||
() -> {
|
||||
reduceWithLock(key, fragments);
|
||||
return null;
|
||||
};
|
||||
String lockName = String.format("RdeStaging %s %s", key.tld(), key.mode());
|
||||
if (!lockHandler.executeWithLocks(lockRunner, null, lockTimeout, lockName)) {
|
||||
logger.warningfmt("Lock in use: %s", lockName);
|
||||
|
|
|
@ -59,7 +59,6 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.Callable;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import org.bouncycastle.openpgp.PGPKeyPair;
|
||||
|
@ -157,12 +156,10 @@ public final class RdeUploadAction implements Runnable, EscrowTask {
|
|||
verifyFileExists(reportFilename);
|
||||
final long xmlLength = readXmlLength(xmlLengthFilename);
|
||||
retrier.callWithRetry(
|
||||
new Callable<Void>() {
|
||||
@Override
|
||||
public Void call() throws Exception {
|
||||
upload(xmlFilename, xmlLength, watermark, name);
|
||||
return null;
|
||||
}},
|
||||
() -> {
|
||||
upload(xmlFilename, xmlLength, watermark, name);
|
||||
return null;
|
||||
},
|
||||
JSchException.class);
|
||||
ofy().transact(new VoidWork() {
|
||||
@Override
|
||||
|
|
|
@ -20,12 +20,11 @@ import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
|||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.model.registry.Registries.findTldForName;
|
||||
import static google.registry.util.PipelineUtils.createJobPath;
|
||||
import static java.util.stream.Collectors.joining;
|
||||
|
||||
import com.google.appengine.tools.mapreduce.Mapper;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.InternetDomainName;
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.Work;
|
||||
|
@ -196,10 +195,11 @@ public class RdeHostLinkAction implements Runnable {
|
|||
}
|
||||
// This is a subordinate host
|
||||
String domainName =
|
||||
Joiner.on('.')
|
||||
.join(
|
||||
Iterables.skip(
|
||||
hostName.parts(), hostName.parts().size() - (tld.get().parts().size() + 1)));
|
||||
hostName
|
||||
.parts()
|
||||
.stream()
|
||||
.skip(hostName.parts().size() - (tld.get().parts().size() + 1))
|
||||
.collect(joining("."));
|
||||
DomainResource superordinateDomain = loadByForeignKey(DomainResource.class, domainName, now);
|
||||
// Hosts can't be linked if domains import hasn't been run
|
||||
checkState(
|
||||
|
|
|
@ -16,13 +16,12 @@ package google.registry.rde.imports;
|
|||
|
||||
import static com.google.common.base.Predicates.equalTo;
|
||||
import static com.google.common.base.Predicates.not;
|
||||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.rde.imports.RdeImportUtils.generateTridForImport;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.model.contact.ContactAddress;
|
||||
import google.registry.model.contact.ContactPhoneNumber;
|
||||
|
@ -54,23 +53,6 @@ final class XjcToContactResourceConverter extends XjcToEppResourceConverter {
|
|||
XmlToEnumMapper.create(PostalInfo.Type.values());
|
||||
private static final XmlToEnumMapper<TransferStatus> TRANSFER_STATUS_MAPPER =
|
||||
XmlToEnumMapper.create(TransferStatus.values());
|
||||
|
||||
private static final Function<XjcContactIntLocType, PostalInfoChoice> choiceConverter =
|
||||
new Function<XjcContactIntLocType, PostalInfoChoice>() {
|
||||
@Override
|
||||
public PostalInfoChoice apply(XjcContactIntLocType choice) {
|
||||
return convertPostalInfoChoice(choice);
|
||||
}
|
||||
};
|
||||
|
||||
private static final Function<XjcContactStatusType, StatusValue> STATUS_VALUE_CONVERTER =
|
||||
new Function<XjcContactStatusType, StatusValue>() {
|
||||
@Override
|
||||
public StatusValue apply(XjcContactStatusType status) {
|
||||
return convertStatusValue(status);
|
||||
}
|
||||
};
|
||||
|
||||
/** Converts {@link XjcRdeContact} to {@link ContactResource}. */
|
||||
static ContactResource convertContact(XjcRdeContact contact) {
|
||||
ofy().save().entity(
|
||||
|
@ -88,11 +70,12 @@ final class XjcToContactResourceConverter extends XjcToEppResourceConverter {
|
|||
return new ContactResource.Builder()
|
||||
.setRepoId(contact.getRoid())
|
||||
.setStatusValues(
|
||||
FluentIterable.from(contact.getStatuses())
|
||||
.transform(STATUS_VALUE_CONVERTER)
|
||||
// LINKED is implicit and should not be imported onto the new contact.
|
||||
contact
|
||||
.getStatuses()
|
||||
.stream()
|
||||
.map(XjcToContactResourceConverter::convertStatusValue)
|
||||
.filter(not(equalTo(StatusValue.LINKED)))
|
||||
.toSet())
|
||||
.collect(toImmutableSet()))
|
||||
.setLocalizedPostalInfo(
|
||||
getPostalInfoOfType(contact.getPostalInfos(), XjcContactPostalInfoEnumType.LOC))
|
||||
.setInternationalizedPostalInfo(
|
||||
|
@ -160,9 +143,24 @@ final class XjcToContactResourceConverter extends XjcToEppResourceConverter {
|
|||
}
|
||||
return new Disclose.Builder()
|
||||
.setFlag(disclose.isFlag())
|
||||
.setNames(ImmutableList.copyOf(Lists.transform(disclose.getNames(), choiceConverter)))
|
||||
.setOrgs(ImmutableList.copyOf(Lists.transform(disclose.getOrgs(), choiceConverter)))
|
||||
.setAddrs(ImmutableList.copyOf(Lists.transform(disclose.getAddrs(), choiceConverter)))
|
||||
.setNames(
|
||||
disclose
|
||||
.getNames()
|
||||
.stream()
|
||||
.map(XjcToContactResourceConverter::convertPostalInfoChoice)
|
||||
.collect(toImmutableList()))
|
||||
.setOrgs(
|
||||
disclose
|
||||
.getOrgs()
|
||||
.stream()
|
||||
.map(XjcToContactResourceConverter::convertPostalInfoChoice)
|
||||
.collect(toImmutableList()))
|
||||
.setAddrs(
|
||||
disclose
|
||||
.getAddrs()
|
||||
.stream()
|
||||
.map(XjcToContactResourceConverter::convertPostalInfoChoice)
|
||||
.collect(toImmutableList()))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.rde.imports;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static google.registry.util.DomainNameUtils.canonicalizeDomainName;
|
||||
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
@ -24,7 +24,6 @@ import static org.joda.time.DateTimeZone.UTC;
|
|||
import com.google.common.base.Ascii;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.InternetDomainName;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.model.billing.BillingEvent;
|
||||
|
@ -80,44 +79,17 @@ final class XjcToDomainResourceConverter extends XjcToEppResourceConverter {
|
|||
private static final XmlToEnumMapper<TransferStatus> TRANSFER_STATUS_MAPPER =
|
||||
XmlToEnumMapper.create(TransferStatus.values());
|
||||
|
||||
private static final Function<XjcDomainStatusType, StatusValue> STATUS_CONVERTER =
|
||||
new Function<XjcDomainStatusType, StatusValue>() {
|
||||
@Override
|
||||
public StatusValue apply(XjcDomainStatusType status) {
|
||||
return convertStatusType(status);
|
||||
}
|
||||
};
|
||||
|
||||
private static final Function<String, Key<HostResource>> HOST_OBJ_CONVERTER =
|
||||
new Function<String, Key<HostResource>>() {
|
||||
@Override
|
||||
public Key<HostResource> apply(String fullyQualifiedHostName) {
|
||||
// host names are always lower case
|
||||
fullyQualifiedHostName = canonicalizeDomainName(fullyQualifiedHostName);
|
||||
Key<HostResource> key =
|
||||
ForeignKeyIndex.loadAndGetKey(
|
||||
HostResource.class, fullyQualifiedHostName, DateTime.now(UTC));
|
||||
checkState(
|
||||
key != null,
|
||||
String.format("HostResource not found with name '%s'", fullyQualifiedHostName));
|
||||
return key;
|
||||
}
|
||||
};
|
||||
|
||||
private static final Function<XjcDomainContactType, DesignatedContact> CONTACT_CONVERTER =
|
||||
new Function<XjcDomainContactType, DesignatedContact>() {
|
||||
@Override
|
||||
public DesignatedContact apply(XjcDomainContactType contact) {
|
||||
return convertContactType(contact);
|
||||
}
|
||||
};
|
||||
|
||||
private static final Function<XjcSecdnsDsDataType, DelegationSignerData> SECDNS_CONVERTER =
|
||||
new Function<XjcSecdnsDsDataType, DelegationSignerData>() {
|
||||
@Override
|
||||
public DelegationSignerData apply(XjcSecdnsDsDataType secdns) {
|
||||
return convertSecdnsDsDataType(secdns);
|
||||
}
|
||||
fullyQualifiedHostName -> {
|
||||
// host names are always lower case
|
||||
fullyQualifiedHostName = canonicalizeDomainName(fullyQualifiedHostName);
|
||||
Key<HostResource> key =
|
||||
ForeignKeyIndex.loadAndGetKey(
|
||||
HostResource.class, fullyQualifiedHostName, DateTime.now(UTC));
|
||||
checkState(
|
||||
key != null,
|
||||
String.format("HostResource not found with name '%s'", fullyQualifiedHostName));
|
||||
return key;
|
||||
};
|
||||
|
||||
/** Converts {@link XjcRgpStatusType} to {@link GracePeriod} */
|
||||
|
@ -198,21 +170,40 @@ final class XjcToDomainResourceConverter extends XjcToEppResourceConverter {
|
|||
.setLastEppUpdateTime(domain.getUpDate())
|
||||
.setLastEppUpdateClientId(domain.getUpRr() == null ? null : domain.getUpRr().getValue())
|
||||
.setLastTransferTime(domain.getTrDate())
|
||||
.setStatusValues(ImmutableSet.copyOf(transform(domain.getStatuses(), STATUS_CONVERTER)))
|
||||
.setStatusValues(
|
||||
domain
|
||||
.getStatuses()
|
||||
.stream()
|
||||
.map(XjcToDomainResourceConverter::convertStatusType)
|
||||
.collect(toImmutableSet()))
|
||||
.setNameservers(convertNameservers(domain.getNs()))
|
||||
.setGracePeriods(
|
||||
ImmutableSet.copyOf(transform(domain.getRgpStatuses(), gracePeriodConverter)))
|
||||
.setContacts(ImmutableSet.copyOf(transform(domain.getContacts(), CONTACT_CONVERTER)))
|
||||
domain
|
||||
.getRgpStatuses()
|
||||
.stream()
|
||||
.map(gracePeriodConverter)
|
||||
.collect(toImmutableSet()))
|
||||
.setContacts(
|
||||
domain
|
||||
.getContacts()
|
||||
.stream()
|
||||
.map(XjcToDomainResourceConverter::convertContactType)
|
||||
.collect(toImmutableSet()))
|
||||
.setDsData(
|
||||
domain.getSecDNS() == null
|
||||
? ImmutableSet.<DelegationSignerData>of()
|
||||
: ImmutableSet.copyOf(
|
||||
transform(domain.getSecDNS().getDsDatas(), SECDNS_CONVERTER)))
|
||||
: domain
|
||||
.getSecDNS()
|
||||
.getDsDatas()
|
||||
.stream()
|
||||
.map(XjcToDomainResourceConverter::convertSecdnsDsDataType)
|
||||
.collect(toImmutableSet()))
|
||||
.setTransferData(convertDomainTransferData(domain.getTrnData()))
|
||||
// authInfo pw must be a token between 6 and 16 characters in length
|
||||
// generate a token of 16 characters as the default authInfo pw
|
||||
.setAuthInfo(DomainAuthInfo
|
||||
.create(PasswordAuth.create(stringGenerator.createString(16), domain.getRoid())));
|
||||
.setAuthInfo(
|
||||
DomainAuthInfo.create(
|
||||
PasswordAuth.create(stringGenerator.createString(16), domain.getRoid())));
|
||||
checkArgumentNotNull(
|
||||
domain.getRegistrant(), "Registrant is missing for domain '%s'", domain.getName());
|
||||
builder = builder.setRegistrant(convertRegistrant(domain.getRegistrant()));
|
||||
|
@ -237,7 +228,7 @@ final class XjcToDomainResourceConverter extends XjcToEppResourceConverter {
|
|||
checkArgument(
|
||||
ns.getHostAttrs() == null || ns.getHostAttrs().isEmpty(),
|
||||
"Host attributes are not yet supported");
|
||||
return ImmutableSet.copyOf(Iterables.transform(ns.getHostObjs(), HOST_OBJ_CONVERTER));
|
||||
return ns.getHostObjs().stream().map(HOST_OBJ_CONVERTER).collect(toImmutableSet());
|
||||
}
|
||||
|
||||
/** Converts {@link XjcRdeDomainTransferDataType} to {@link TransferData}. */
|
||||
|
|
|
@ -16,14 +16,12 @@ package google.registry.rde.imports;
|
|||
|
||||
import static com.google.common.base.Predicates.in;
|
||||
import static com.google.common.base.Predicates.not;
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.rde.imports.RdeImportUtils.generateTridForImport;
|
||||
import static google.registry.util.DomainNameUtils.canonicalizeDomainName;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.net.InetAddresses;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
|
@ -37,23 +35,6 @@ import java.net.InetAddress;
|
|||
|
||||
/** Utility class that converts an {@link XjcRdeHost} into a {@link HostResource}. */
|
||||
public class XjcToHostResourceConverter extends XjcToEppResourceConverter {
|
||||
|
||||
private static final Function<XjcHostStatusType, StatusValue> STATUS_VALUE_CONVERTER =
|
||||
new Function<XjcHostStatusType, StatusValue>() {
|
||||
@Override
|
||||
public StatusValue apply(XjcHostStatusType status) {
|
||||
return convertStatusType(status);
|
||||
}
|
||||
};
|
||||
|
||||
private static final Function<XjcHostAddrType, InetAddress> ADDR_CONVERTER =
|
||||
new Function<XjcHostAddrType, InetAddress>() {
|
||||
@Override
|
||||
public InetAddress apply(XjcHostAddrType addr) {
|
||||
return convertAddrType(addr);
|
||||
}
|
||||
};
|
||||
|
||||
static HostResource convert(XjcRdeHost host) {
|
||||
// TODO(b/35384052): Handle subordinate hosts correctly by setting superordinateDomaina and
|
||||
// lastSuperordinateChange fields.
|
||||
|
@ -81,13 +62,16 @@ public class XjcToHostResourceConverter extends XjcToEppResourceConverter {
|
|||
.setCreationClientId(host.getCrRr().getValue())
|
||||
.setLastEppUpdateClientId(host.getUpRr() == null ? null : host.getUpRr().getValue())
|
||||
.setStatusValues(
|
||||
FluentIterable.from(host.getStatuses())
|
||||
.transform(STATUS_VALUE_CONVERTER)
|
||||
// LINKED is implicit and should not be imported onto the new host.
|
||||
// PENDING_TRANSFER is a property of the superordinate host.
|
||||
host.getStatuses()
|
||||
.stream()
|
||||
.map(XjcToHostResourceConverter::convertStatusType)
|
||||
.filter(not(in(ImmutableSet.of(StatusValue.LINKED, StatusValue.PENDING_TRANSFER))))
|
||||
.toSet())
|
||||
.setInetAddresses(ImmutableSet.copyOf(Lists.transform(host.getAddrs(), ADDR_CONVERTER)))
|
||||
.collect(toImmutableSet()))
|
||||
.setInetAddresses(
|
||||
host.getAddrs()
|
||||
.stream()
|
||||
.map(XjcToHostResourceConverter::convertAddrType)
|
||||
.collect(toImmutableSet()))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue