Search in sources :

Example 6 with ObjectUtils.defaultIfNull

use of org.apache.commons.lang3.ObjectUtils.defaultIfNull in project nem2-sdk-java by nemtech.

the class RestrictionMosaicRepositoryOkHttpImpl method toMosaicGlobalRestriction.

private MosaicGlobalRestriction toMosaicGlobalRestriction(MosaicGlobalRestrictionDTO mosaicGlobalRestrictionDTO) {
    MosaicGlobalRestrictionEntryWrapperDTO dto = mosaicGlobalRestrictionDTO.getMosaicRestrictionEntry();
    Map<BigInteger, MosaicGlobalRestrictionItem> restrictions = dto.getRestrictions().stream().collect(Collectors.toMap(e -> new BigInteger(e.getKey()), e -> toMosaicGlobalRestrictionItem(e.getRestriction()), (x, y) -> y, LinkedHashMap::new));
    return new MosaicGlobalRestriction(mosaicGlobalRestrictionDTO.getId(), ObjectUtils.defaultIfNull(mosaicGlobalRestrictionDTO.getMosaicRestrictionEntry().getVersion(), 1), dto.getCompositeHash(), MosaicRestrictionEntryType.rawValueOf(dto.getEntryType().getValue()), MapperUtils.toMosaicId(dto.getMosaicId()), restrictions);
}
Also used : MosaicAddressRestrictionDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicAddressRestrictionDTO) RestrictionMosaicRepository(io.nem.symbol.sdk.api.RestrictionMosaicRepository) Callable(java.util.concurrent.Callable) MosaicAddressRestrictionEntryWrapperDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicAddressRestrictionEntryWrapperDTO) RestrictionMosaicRoutesApi(io.nem.symbol.sdk.openapi.okhttp_gson.api.RestrictionMosaicRoutesApi) LinkedHashMap(java.util.LinkedHashMap) MosaicRestrictionSearchCriteria(io.nem.symbol.sdk.api.MosaicRestrictionSearchCriteria) MosaicRestriction(io.nem.symbol.sdk.model.restriction.MosaicRestriction) MosaicRestrictionType(io.nem.symbol.sdk.model.transaction.MosaicRestrictionType) ObjectUtils(org.apache.commons.lang3.ObjectUtils) Map(java.util.Map) MerkleStateInfo(io.nem.symbol.sdk.model.blockchain.MerkleStateInfo) Observable(io.reactivex.Observable) BigInteger(java.math.BigInteger) MosaicGlobalRestrictionDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicGlobalRestrictionDTO) MosaicGlobalRestrictionEntryRestrictionDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicGlobalRestrictionEntryRestrictionDTO) MosaicRestrictionEntryTypeEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicRestrictionEntryTypeEnum) MapperUtils(io.nem.symbol.core.utils.MapperUtils) ApiClient(io.nem.symbol.sdk.openapi.okhttp_gson.invoker.ApiClient) MosaicGlobalRestriction(io.nem.symbol.sdk.model.restriction.MosaicGlobalRestriction) MosaicRestrictionEntryType(io.nem.symbol.sdk.model.restriction.MosaicRestrictionEntryType) Collectors(java.util.stream.Collectors) Order(io.nem.symbol.sdk.openapi.okhttp_gson.model.Order) MosaicGlobalRestrictionItem(io.nem.symbol.sdk.model.restriction.MosaicGlobalRestrictionItem) MosaicGlobalRestrictionEntryWrapperDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicGlobalRestrictionEntryWrapperDTO) Page(io.nem.symbol.sdk.api.Page) MosaicAddressRestriction(io.nem.symbol.sdk.model.restriction.MosaicAddressRestriction) MosaicRestrictionsPage(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicRestrictionsPage) MosaicGlobalRestrictionItem(io.nem.symbol.sdk.model.restriction.MosaicGlobalRestrictionItem) BigInteger(java.math.BigInteger) MosaicGlobalRestrictionEntryWrapperDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicGlobalRestrictionEntryWrapperDTO) MosaicGlobalRestriction(io.nem.symbol.sdk.model.restriction.MosaicGlobalRestriction)

Example 7 with ObjectUtils.defaultIfNull

use of org.apache.commons.lang3.ObjectUtils.defaultIfNull in project nem2-sdk-java by nemtech.

the class RestrictionMosaicRepositoryOkHttpImpl method toMosaicAddressRestriction.

private MosaicAddressRestriction toMosaicAddressRestriction(MosaicAddressRestrictionDTO mosaicAddressRestrictionDTO) {
    MosaicAddressRestrictionEntryWrapperDTO dto = mosaicAddressRestrictionDTO.getMosaicRestrictionEntry();
    Map<BigInteger, BigInteger> restrictions = dto.getRestrictions().stream().collect(Collectors.toMap(e -> new BigInteger(e.getKey()), e -> toBigInteger(e.getValue())));
    return new MosaicAddressRestriction(mosaicAddressRestrictionDTO.getId(), ObjectUtils.defaultIfNull(dto.getVersion(), 1), dto.getCompositeHash(), MosaicRestrictionEntryType.rawValueOf(dto.getEntryType().getValue()), MapperUtils.toMosaicId(dto.getMosaicId()), MapperUtils.toAddress(dto.getTargetAddress()), restrictions);
}
Also used : MosaicAddressRestrictionDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicAddressRestrictionDTO) RestrictionMosaicRepository(io.nem.symbol.sdk.api.RestrictionMosaicRepository) Callable(java.util.concurrent.Callable) MosaicAddressRestrictionEntryWrapperDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicAddressRestrictionEntryWrapperDTO) RestrictionMosaicRoutesApi(io.nem.symbol.sdk.openapi.okhttp_gson.api.RestrictionMosaicRoutesApi) LinkedHashMap(java.util.LinkedHashMap) MosaicRestrictionSearchCriteria(io.nem.symbol.sdk.api.MosaicRestrictionSearchCriteria) MosaicRestriction(io.nem.symbol.sdk.model.restriction.MosaicRestriction) MosaicRestrictionType(io.nem.symbol.sdk.model.transaction.MosaicRestrictionType) ObjectUtils(org.apache.commons.lang3.ObjectUtils) Map(java.util.Map) MerkleStateInfo(io.nem.symbol.sdk.model.blockchain.MerkleStateInfo) Observable(io.reactivex.Observable) BigInteger(java.math.BigInteger) MosaicGlobalRestrictionDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicGlobalRestrictionDTO) MosaicGlobalRestrictionEntryRestrictionDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicGlobalRestrictionEntryRestrictionDTO) MosaicRestrictionEntryTypeEnum(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicRestrictionEntryTypeEnum) MapperUtils(io.nem.symbol.core.utils.MapperUtils) ApiClient(io.nem.symbol.sdk.openapi.okhttp_gson.invoker.ApiClient) MosaicGlobalRestriction(io.nem.symbol.sdk.model.restriction.MosaicGlobalRestriction) MosaicRestrictionEntryType(io.nem.symbol.sdk.model.restriction.MosaicRestrictionEntryType) Collectors(java.util.stream.Collectors) Order(io.nem.symbol.sdk.openapi.okhttp_gson.model.Order) MosaicGlobalRestrictionItem(io.nem.symbol.sdk.model.restriction.MosaicGlobalRestrictionItem) MosaicGlobalRestrictionEntryWrapperDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicGlobalRestrictionEntryWrapperDTO) Page(io.nem.symbol.sdk.api.Page) MosaicAddressRestriction(io.nem.symbol.sdk.model.restriction.MosaicAddressRestriction) MosaicRestrictionsPage(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicRestrictionsPage) MosaicAddressRestriction(io.nem.symbol.sdk.model.restriction.MosaicAddressRestriction) BigInteger(java.math.BigInteger) MosaicAddressRestrictionEntryWrapperDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MosaicAddressRestrictionEntryWrapperDTO)

Example 8 with ObjectUtils.defaultIfNull

use of org.apache.commons.lang3.ObjectUtils.defaultIfNull in project nem2-sdk-java by nemtech.

the class RestrictionMosaicRepositoryVertxImpl method toMosaicGlobalRestriction.

private MosaicGlobalRestriction toMosaicGlobalRestriction(MosaicGlobalRestrictionDTO mosaicGlobalRestrictionDTO) {
    MosaicGlobalRestrictionEntryWrapperDTO dto = mosaicGlobalRestrictionDTO.getMosaicRestrictionEntry();
    Map<BigInteger, MosaicGlobalRestrictionItem> restrictions = dto.getRestrictions().stream().collect(Collectors.toMap(e -> new BigInteger(e.getKey()), e -> toMosaicGlobalRestrictionItem(e.getRestriction()), (x, y) -> y, LinkedHashMap::new));
    return new MosaicGlobalRestriction(mosaicGlobalRestrictionDTO.getId(), ObjectUtils.defaultIfNull(mosaicGlobalRestrictionDTO.getMosaicRestrictionEntry().getVersion(), 1), dto.getCompositeHash(), MosaicRestrictionEntryType.rawValueOf(dto.getEntryType().getValue()), MapperUtils.toMosaicId(dto.getMosaicId()), restrictions);
}
Also used : MosaicAddressRestrictionEntryWrapperDTO(io.nem.symbol.sdk.openapi.vertx.model.MosaicAddressRestrictionEntryWrapperDTO) RestrictionMosaicRepository(io.nem.symbol.sdk.api.RestrictionMosaicRepository) RestrictionMosaicRoutesApi(io.nem.symbol.sdk.openapi.vertx.api.RestrictionMosaicRoutesApi) MosaicRestrictionEntryTypeEnum(io.nem.symbol.sdk.openapi.vertx.model.MosaicRestrictionEntryTypeEnum) MosaicRestrictionsPage(io.nem.symbol.sdk.openapi.vertx.model.MosaicRestrictionsPage) LinkedHashMap(java.util.LinkedHashMap) MosaicGlobalRestrictionEntryWrapperDTO(io.nem.symbol.sdk.openapi.vertx.model.MosaicGlobalRestrictionEntryWrapperDTO) MosaicRestrictionSearchCriteria(io.nem.symbol.sdk.api.MosaicRestrictionSearchCriteria) MosaicRestriction(io.nem.symbol.sdk.model.restriction.MosaicRestriction) Order(io.nem.symbol.sdk.openapi.vertx.model.Order) MosaicRestrictionType(io.nem.symbol.sdk.model.transaction.MosaicRestrictionType) ObjectUtils(org.apache.commons.lang3.ObjectUtils) Map(java.util.Map) MerkleStateInfo(io.nem.symbol.sdk.model.blockchain.MerkleStateInfo) MosaicGlobalRestrictionEntryRestrictionDTO(io.nem.symbol.sdk.openapi.vertx.model.MosaicGlobalRestrictionEntryRestrictionDTO) Observable(io.reactivex.Observable) BigInteger(java.math.BigInteger) AsyncResult(io.vertx.core.AsyncResult) MosaicGlobalRestrictionDTO(io.nem.symbol.sdk.openapi.vertx.model.MosaicGlobalRestrictionDTO) MapperUtils(io.nem.symbol.core.utils.MapperUtils) ApiClient(io.nem.symbol.sdk.openapi.vertx.invoker.ApiClient) MosaicAddressRestrictionDTO(io.nem.symbol.sdk.openapi.vertx.model.MosaicAddressRestrictionDTO) RestrictionMosaicRoutesApiImpl(io.nem.symbol.sdk.openapi.vertx.api.RestrictionMosaicRoutesApiImpl) MosaicGlobalRestriction(io.nem.symbol.sdk.model.restriction.MosaicGlobalRestriction) MosaicRestrictionEntryType(io.nem.symbol.sdk.model.restriction.MosaicRestrictionEntryType) Collectors(java.util.stream.Collectors) Consumer(java.util.function.Consumer) MosaicGlobalRestrictionItem(io.nem.symbol.sdk.model.restriction.MosaicGlobalRestrictionItem) Handler(io.vertx.core.Handler) Page(io.nem.symbol.sdk.api.Page) MosaicAddressRestriction(io.nem.symbol.sdk.model.restriction.MosaicAddressRestriction) MosaicGlobalRestrictionItem(io.nem.symbol.sdk.model.restriction.MosaicGlobalRestrictionItem) BigInteger(java.math.BigInteger) MosaicGlobalRestrictionEntryWrapperDTO(io.nem.symbol.sdk.openapi.vertx.model.MosaicGlobalRestrictionEntryWrapperDTO) MosaicGlobalRestriction(io.nem.symbol.sdk.model.restriction.MosaicGlobalRestriction)

Example 9 with ObjectUtils.defaultIfNull

use of org.apache.commons.lang3.ObjectUtils.defaultIfNull in project netvirt by opendaylight.

the class NeutronPortChangeListener method handleRouterInterfaceRemoved.

private void handleRouterInterfaceRemoved(Port routerPort) {
    if (routerPort.getDeviceId() != null) {
        Uuid routerId = new Uuid(routerPort.getDeviceId());
        Uuid infNetworkId = routerPort.getNetworkId();
        elanService.removeKnownL3DmacAddress(routerPort.getMacAddress().getValue(), infNetworkId.getValue());
        Uuid vpnId = ObjectUtils.defaultIfNull(neutronvpnUtils.getVpnForRouter(routerId, true), routerId);
        Map<FixedIpsKey, FixedIps> keyFixedIpsMap = routerPort.nonnullFixedIps();
        boolean vpnInstanceInternetIpVersionRemoved = false;
        Uuid vpnInstanceInternetUuid = null;
        for (FixedIps portIP : keyFixedIpsMap.values()) {
            // Internet VPN : flush InternetVPN first
            Uuid subnetId = portIP.getSubnetId();
            Subnetmap sn = neutronvpnUtils.getSubnetmap(subnetId);
            if (sn != null && sn.getInternetVpnId() != null) {
                if (neutronvpnUtils.shouldVpnHandleIpVersionChangeToRemove(sn, sn.getInternetVpnId())) {
                    vpnInstanceInternetIpVersionRemoved = true;
                    vpnInstanceInternetUuid = sn.getInternetVpnId();
                }
                nvpnManager.updateVpnInternetForSubnet(sn, sn.getInternetVpnId(), false);
            }
        }
        /* Remove ping responder for router interfaces
             *  A router interface reference in a VPN will have to be removed before the host interface references
             * for that subnet in the VPN are removed. This is to ensure that the FIB Entry of the router interface
             *  is not the last entry to be removed for that subnet in the VPN.
             *  If router interface FIB entry is the last to be removed for a subnet in a VPN , then all the host
             *  interface references in the vpn will already have been cleared, which will cause failures in
             *  cleanup of router interface flows*/
        nvpnManager.deleteVpnInterface(routerPort.getUuid().getValue(), null, /* vpn-id */
        null);
        // update RouterInterfaces map
        LoggingFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, confTx -> {
            IpVersionChoice ipVersion = IpVersionChoice.UNDEFINED;
            for (FixedIps portIP : keyFixedIpsMap.values()) {
                Subnetmap sn = neutronvpnUtils.getSubnetmap(portIP.getSubnetId());
                if (null == sn) {
                    LOG.error("Subnetmap for subnet {} not found", portIP.getSubnetId().getValue());
                    continue;
                }
                // router Port have either IPv4 or IPv6, never both
                ipVersion = neutronvpnUtils.getIpVersionFromString(sn.getSubnetIp());
                String ipValue = portIP.getIpAddress().stringValue();
                neutronvpnUtils.removeVpnPortFixedIpToPort(vpnId.getValue(), ipValue, confTx);
                // NOTE:  Please donot change the order of calls to removeSubnetFromVpn and
                // and updateSubnetNodeWithFixedIP
                nvpnManager.removeSubnetFromVpn(vpnId, sn, sn.getInternetVpnId());
                nvpnManager.updateSubnetNodeWithFixedIp(portIP.getSubnetId(), null, null, null, null, null);
            }
            nvpnManager.removeFromNeutronRouterInterfacesMap(routerId, routerPort.getUuid().getValue());
            deleteElanInterface(routerPort.getUuid().getValue(), confTx);
            deleteOfPortInterface(routerPort, confTx);
            jobCoordinator.enqueueJob(routerId.toString(), () -> {
                nvpnNatManager.handleSubnetsForExternalRouter(routerId);
                return Collections.emptyList();
            });
            if (neutronvpnUtils.shouldVpnHandleIpVersionChoiceChange(ipVersion, routerId, false)) {
                LOG.debug("vpnInstanceOpDataEntry is getting update with ip address family {} for VPN {}", ipVersion, vpnId.getValue());
                neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnId.getValue(), ipVersion, false);
            }
        }), LOG, "Error handling interface removal");
        if (vpnInstanceInternetIpVersionRemoved) {
            neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnInstanceInternetUuid.getValue(), IpVersionChoice.IPV6, false);
            neutronvpnUtils.updateVpnInstanceWithFallback(routerId, vpnInstanceInternetUuid, false);
        }
    }
}
Also used : CONFIGURATION(org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION) ReadFailedException(org.opendaylight.mdsal.common.api.ReadFailedException) Ports(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.Ports) JsonObject(com.google.gson.JsonObject) SingleTransactionDataBroker(org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker) LoggerFactory(org.slf4j.LoggerFactory) InterfaceAcl(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.InterfaceAcl) PortBindingExtension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.PortBindingExtension) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) RoutersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.RoutersBuilder) FixedIps(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps) Neutron(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron) IfL2vlanBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlanBuilder) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) NeutronvpnConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.config.rev160806.NeutronvpnConfig) PreDestroy(javax.annotation.PreDestroy) NeutronConstants(org.opendaylight.netvirt.neutronvpn.api.utils.NeutronConstants) AllowedAddressPairs(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs) Nullable(org.eclipse.jdt.annotation.Nullable) Gson(com.google.gson.Gson) Locale(java.util.Locale) DataTreeEventCallbackRegistrar(org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar) Subnetmap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap) Hostconfig(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.hostconfig.rev150712.hostconfig.attributes.hostconfigs.Hostconfig) Duration(java.time.Duration) Map(java.util.Map) Datastore(org.opendaylight.mdsal.binding.util.Datastore) LoggingFutures(org.opendaylight.infrautils.utils.concurrent.LoggingFutures) MDSALUtil(org.opendaylight.genius.mdsalutil.MDSALUtil) Routers(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers) PortIdToSubport(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.neutron.vpn.port.id.subport.data.PortIdToSubport) NeutronUtils(org.opendaylight.netvirt.neutronvpn.api.utils.NeutronUtils) Set(java.util.Set) Collectors(java.util.stream.Collectors) FixedIpsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIpsKey) Objects(java.util.Objects) JsonArray(com.google.gson.JsonArray) List(java.util.List) ParentRefsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefsBuilder) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network) ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl) TypedWriteTransaction(org.opendaylight.mdsal.binding.util.TypedWriteTransaction) Optional(java.util.Optional) Router(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.Router) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) SplitHorizon(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.SplitHorizon) Executors(org.opendaylight.infrautils.utils.concurrent.Executors) ManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner) HashMap(java.util.HashMap) IElanService(org.opendaylight.netvirt.elanmanager.api.IElanService) Singleton(javax.inject.Singleton) IfL2vlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan) ArrayList(java.util.ArrayList) JsonElement(com.google.gson.JsonElement) HashSet(java.util.HashSet) Inject(javax.inject.Inject) Strings(com.google.common.base.Strings) ObjectUtils(org.apache.commons.lang3.ObjectUtils) SplitHorizonBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.SplitHorizonBuilder) ElanInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder) Logger(org.slf4j.Logger) ElanInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey) StaticMacEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries) InterfaceAclBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.InterfaceAclBuilder) FloatingIpIdToPortMappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.port.info.FloatingIpIdToPortMappingBuilder) AbstractAsyncDataTreeChangeListener(org.opendaylight.serviceutils.tools.listener.AbstractAsyncDataTreeChangeListener) JobCoordinator(org.opendaylight.infrautils.jobcoordinator.JobCoordinator) ExecutionException(java.util.concurrent.ExecutionException) Port(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port) IpVersionChoice(org.opendaylight.netvirt.neutronvpn.api.enums.IpVersionChoice) InterfaceBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder) L2vlan(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.L2vlan) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) ElanInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInterfaces) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) VlanId(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId) FloatingIpIdToPortMappingKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.port.info.FloatingIpIdToPortMappingKey) Collections(java.util.Collections) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) FixedIpsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIpsKey) Subnetmap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap) FixedIps(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps) IpVersionChoice(org.opendaylight.netvirt.neutronvpn.api.enums.IpVersionChoice)

Example 10 with ObjectUtils.defaultIfNull

use of org.apache.commons.lang3.ObjectUtils.defaultIfNull in project commons-lang by apache.

the class ObjectUtilsTest method testIsNull.

// -----------------------------------------------------------------------
@Test
public void testIsNull() {
    final Object o = FOO;
    final Object dflt = BAR;
    assertSame("dflt was not returned when o was null", dflt, ObjectUtils.defaultIfNull(null, dflt));
    assertSame("dflt was returned when o was not null", o, ObjectUtils.defaultIfNull(o, dflt));
}
Also used : MutableObject(org.apache.commons.lang3.mutable.MutableObject) Test(org.junit.Test)

Aggregations

ObjectUtils (org.apache.commons.lang3.ObjectUtils)13 Map (java.util.Map)10 Collectors (java.util.stream.Collectors)9 Objects (java.util.Objects)6 Optional (java.util.Optional)6 HashMap (java.util.HashMap)5 List (java.util.List)5 Function (java.util.function.Function)5 Transactional (javax.transaction.Transactional)5 Consumes (javax.ws.rs.Consumes)5 POST (javax.ws.rs.POST)5 Path (javax.ws.rs.Path)5 PathParam (javax.ws.rs.PathParam)5 Produces (javax.ws.rs.Produces)5 MediaType (javax.ws.rs.core.MediaType)5 StringUtils (org.apache.commons.lang3.StringUtils)4 MapperUtils (io.nem.symbol.core.utils.MapperUtils)3 MosaicRestrictionSearchCriteria (io.nem.symbol.sdk.api.MosaicRestrictionSearchCriteria)3 Page (io.nem.symbol.sdk.api.Page)3 RestrictionMosaicRepository (io.nem.symbol.sdk.api.RestrictionMosaicRepository)3