mirror of
https://github.com/google/nomulus.git
synced 2025-05-21 03:39:36 +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
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue