mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Add registration type response extension to info commands
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=123323993
This commit is contained in:
parent
041b2c4116
commit
6355ef5922
4 changed files with 52 additions and 2 deletions
|
@ -24,10 +24,13 @@ import google.registry.model.domain.DomainResource;
|
|||
import google.registry.model.domain.DomainResource.Builder;
|
||||
import google.registry.model.domain.fee.FeeInfoExtension;
|
||||
import google.registry.model.domain.fee.FeeInfoResponseExtension;
|
||||
import google.registry.model.domain.regtype.RegTypeInfoResponseExtension;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.domain.rgp.RgpInfoExtension;
|
||||
import google.registry.model.eppoutput.Response.ResponseExtension;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* An EPP flow that reads a domain.
|
||||
*
|
||||
|
@ -40,9 +43,12 @@ import google.registry.model.eppoutput.Response.ResponseExtension;
|
|||
*/
|
||||
public class DomainInfoFlow extends BaseDomainInfoFlow<DomainResource, Builder> {
|
||||
|
||||
protected List<String> registrationTypes;
|
||||
|
||||
@Override
|
||||
protected void initSingleResourceFlow() throws EppException {
|
||||
registerExtensions(FeeInfoExtension.class);
|
||||
registrationTypes = ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -92,6 +98,9 @@ public class DomainInfoFlow extends BaseDomainInfoFlow<DomainResource, Builder>
|
|||
feeInfo, builder, getTargetId(), existingResource.getTld(), getClientId(), now);
|
||||
extensions.add(builder.build());
|
||||
}
|
||||
if (!registrationTypes.isEmpty()) {
|
||||
extensions.add(RegTypeInfoResponseExtension.create(registrationTypes));
|
||||
}
|
||||
return extensions.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,10 +32,10 @@ public class BaseRegTypeCommand extends ImmutableObject {
|
|||
|
||||
/** The registration type (which may be a comma-delimited list of values). */
|
||||
@XmlElement(name = "type")
|
||||
String type;
|
||||
String regType;
|
||||
|
||||
public List<String> getRegistrationTypes() {
|
||||
return Splitter.on(',').splitToList(type);
|
||||
return Splitter.on(',').splitToList(regType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.model.domain.regtype;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
import google.registry.model.eppoutput.Response.ResponseExtension;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* An XML data object that represents a registration type extension that may be present on the
|
||||
* response to EPP domain info EPP commands.
|
||||
*/
|
||||
@XmlRootElement(name = "infData")
|
||||
public class RegTypeInfoResponseExtension extends BaseRegTypeCommand implements ResponseExtension {
|
||||
|
||||
public static RegTypeInfoResponseExtension create(List<String> registrationTypes) {
|
||||
RegTypeInfoResponseExtension instance = new RegTypeInfoResponseExtension();
|
||||
instance.regType = Joiner.on(",").join(registrationTypes);
|
||||
return instance;
|
||||
}
|
||||
|
||||
private RegTypeInfoResponseExtension() {}
|
||||
}
|
|
@ -32,6 +32,7 @@ import google.registry.model.domain.fee.FeeUpdateResponseExtension;
|
|||
import google.registry.model.domain.launch.LaunchCheckResponseExtension;
|
||||
import google.registry.model.domain.launch.LaunchCreateResponseExtension;
|
||||
import google.registry.model.domain.launch.LaunchInfoResponseExtension;
|
||||
import google.registry.model.domain.regtype.RegTypeInfoResponseExtension;
|
||||
import google.registry.model.domain.rgp.RgpInfoExtension;
|
||||
import google.registry.model.domain.secdns.SecDnsInfoExtension;
|
||||
import google.registry.model.eppcommon.Trid;
|
||||
|
@ -132,6 +133,7 @@ public class Response extends ImmutableObject implements ResponseOrGreeting {
|
|||
@XmlElementRef(type = LaunchCheckResponseExtension.class),
|
||||
@XmlElementRef(type = LaunchCreateResponseExtension.class),
|
||||
@XmlElementRef(type = LaunchInfoResponseExtension.class),
|
||||
@XmlElementRef(type = RegTypeInfoResponseExtension.class),
|
||||
@XmlElementRef(type = RgpInfoExtension.class),
|
||||
@XmlElementRef(type = SecDnsInfoExtension.class) })
|
||||
@XmlElementWrapper(name = "extension")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue