mirror of
https://github.com/google/nomulus.git
synced 2025-07-24 03:30:46 +02:00
RDAP: Implement entity name search
Adds the ability to search for entities (contacts and registrars) by name. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=130305930
This commit is contained in:
parent
64abebec82
commit
160266f37a
8 changed files with 368 additions and 66 deletions
|
@ -24,6 +24,7 @@ import com.google.common.collect.Lists;
|
|||
import com.googlecode.objectify.annotation.Cache;
|
||||
import com.googlecode.objectify.annotation.Entity;
|
||||
import com.googlecode.objectify.annotation.IgnoreSave;
|
||||
import com.googlecode.objectify.annotation.Index;
|
||||
import com.googlecode.objectify.condition.IfNull;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.EppResource.ForeignKeyedEppResource;
|
||||
|
@ -85,6 +86,15 @@ public class ContactResource extends EppResource implements ForeignKeyedEppResou
|
|||
@XmlTransient
|
||||
PostalInfo internationalizedPostalInfo;
|
||||
|
||||
/**
|
||||
* Contact name used for name searches. This is set automatically to be the internationalized
|
||||
* postal name, or if null, the localized postal name, or if that is null as well, null. Personal
|
||||
* info; cleared by wipeOut().
|
||||
*/
|
||||
@Index
|
||||
@XmlTransient
|
||||
String searchName;
|
||||
|
||||
/** Contact’s voice number. Personal info; cleared by wipeOut(). */
|
||||
@IgnoreSave(IfNull.class)
|
||||
ContactPhoneNumber voice;
|
||||
|
@ -250,6 +260,16 @@ public class ContactResource extends EppResource implements ForeignKeyedEppResou
|
|||
|
||||
@Override
|
||||
public ContactResource build() {
|
||||
// Set the searchName using the internationalized and localized postal info names.
|
||||
if ((getInstance().internationalizedPostalInfo != null)
|
||||
&& (getInstance().internationalizedPostalInfo.getName() != null)) {
|
||||
getInstance().searchName = getInstance().internationalizedPostalInfo.getName();
|
||||
} else if ((getInstance().localizedPostalInfo != null)
|
||||
&& (getInstance().localizedPostalInfo.getName() != null)) {
|
||||
getInstance().searchName = getInstance().localizedPostalInfo.getName();
|
||||
} else {
|
||||
getInstance().searchName = null;
|
||||
}
|
||||
return super.build();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue