List of usage examples for org.apache.commons.lang3 StringUtils upperCase
public static String upperCase(final String str)
Converts a String to upper case as per String#toUpperCase() .
A null input String returns null .
StringUtils.upperCase(null) = null StringUtils.upperCase("") = "" StringUtils.upperCase("aBc") = "ABC"
Note: As described in the documentation for String#toUpperCase() , the result of this method is affected by the current locale.
From source file:org.mitre.mpf.wfm.service.PipelineServiceImpl.java
private void validateMarkupPipeline(String pipelineName, List<TaskDefinitionRef> taskDefinitions, Set<StateDefinition> currentStates) { if (taskDefinitions.size() == 1) { // There's only one task in the pipeline, and we know it to be markup. boolean rValue = true; Set<StateDefinitionRef> requiredStates = requiredTaskStates .get(StringUtils.upperCase(taskDefinitions.get(0).getName())); if (!currentStates.containsAll(requiredStates)) { log.error("{}: The states for {} are not satisfied. Current: {}. Required: {}.", pipelineName, taskDefinitions.get(0).getName(), currentStates, requiredStates); throw new InvalidTaskWfmProcessingException(new StringBuilder().append(pipelineName) .append(": The states for ").append(taskDefinitions.get(0).getName()) .append(" are not satisfied. Current: ").append(currentStates).append(". Required: ") .append(requiredStates).append(".").toString()); }/* w w w . j a v a 2 s . c o m*/ } else { log.error("{}: No tasks may follow a markup task of {}.", pipelineName, taskDefinitions.get(0).getName()); throw new InvalidTaskWfmProcessingException( new StringBuilder().append(pipelineName).append(": No tasks may follow a markup task of ") .append(taskDefinitions.get(0).getName()).append(".").toString()); } }
From source file:org.mitre.mpf.wfm.util.TextUtils.java
/** Null-safe trim operation that returns the trimmed, uppercase input or {@literal null} if 1) the input is null, or 2) no characters remain after trimming. */ public static String trimAndUpper(String input) { return StringUtils.upperCase(StringUtils.trimToNull(input)); }
From source file:org.omnaest.utils.beans.adapter.source.SourcePropertyAccessorDecoratorPropertyAccessOption.java
protected String processPropertyNameWithTemplate(String propertyName) { ////from w w w. ja v a 2 s . c o m String retval = propertyName; // if (this.propertyAccessOption != null) { if (PropertyAccessOption.PROPERTY_LOWERCASE.equals(this.propertyAccessOption)) { retval = StringUtils.lowerCase(propertyName); } else if (PropertyAccessOption.PROPERTY_UPPERCASE.equals(this.propertyAccessOption)) { retval = StringUtils.upperCase(propertyName); } else if (PropertyAccessOption.PROPERTY_CAPITALIZED.equals(this.propertyAccessOption)) { retval = StringUtils.capitalize(propertyName); } } // return retval; }
From source file:org.opendaylight.genius.itm.cli.TepCommandHelper.java
public void configureTunnelType(String transportZoneName, String tunnelType) { LOG.debug("configureTunnelType {} for transportZone {}", tunnelType, transportZoneName); TransportZone transportZoneFromConfigDS = ItmUtils.getTransportZoneFromConfigDS(transportZoneName, dataBroker);/* w ww . j a v a 2 s . co m*/ Class<? extends TunnelTypeBase> tunType; validateTunnelType(transportZoneName, tunnelType, transportZoneFromConfigDS); if (transportZoneFromConfigDS != null) { if (!transportZoneName.equals(ITMConstants.DEFAULT_TRANSPORT_ZONE)) { LOG.debug("Transport zone {} with tunnel type {} already exists. No action required.", transportZoneName, tunnelType); return; } else { tunnelType = StringUtils.upperCase(tunnelType); tunType = ItmUtils.TUNNEL_TYPE_MAP.get(tunnelType); if (transportZoneFromConfigDS.getTunnelType().equals(tunType)) { // default-TZ already exists and tunnel-type is not changed during // controller restart, then nothing to do now. Just return. return; } } } // get tunnel-type tunnelType = StringUtils.upperCase(tunnelType); tunType = ItmUtils.TUNNEL_TYPE_MAP.get(tunnelType); TransportZones transportZones = null; List<TransportZone> tzList = null; InstanceIdentifier<TransportZones> path = InstanceIdentifier.builder(TransportZones.class).build(); Optional<TransportZones> tzones = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, dataBroker); TransportZone tzone = new TransportZoneBuilder().setKey(new TransportZoneKey(transportZoneName)) .setTunnelType(tunType).build(); if (tzones.isPresent()) { tzList = tzones.get().getTransportZone(); if (tzList == null || tzList.isEmpty()) { tzList = new ArrayList<>(); } } else { tzList = new ArrayList<>(); } tzList.add(tzone); transportZones = new TransportZonesBuilder().setTransportZone(tzList).build(); ItmUtils.syncWrite(LogicalDatastoreType.CONFIGURATION, path, transportZones, dataBroker); }
From source file:org.opendaylight.genius.itm.impl.ItmUtils.java
public static String validateTunnelType(String tunnelType) { if (tunnelType == null) { tunnelType = ITMConstants.TUNNEL_TYPE_VXLAN; } else {// ww w . j a va 2s. co m tunnelType = StringUtils.upperCase(tunnelType); String error = "Invalid tunnel type. Valid values: " + ITMConstants.TUNNEL_TYPE_VXLAN + " | " + ITMConstants.TUNNEL_TYPE_GRE; Preconditions.checkArgument(ITMConstants.TUNNEL_TYPE_VXLAN.equals(tunnelType) || ITMConstants.TUNNEL_TYPE_GRE.equals(tunnelType), error); } return tunnelType; }
From source file:org.opendaylight.genius.itm.listeners.VtepConfigSchemaListener.java
/** * Adds the vteps./* w ww .j a v a2 s.c om*/ * * @param schema * the schema * @param vtepIpPool * the vtep ip pool */ private void addVteps(VtepConfigSchema schema, VtepIpPool vtepIpPool) { if (schema.getDpnIds() == null || schema.getDpnIds().isEmpty()) { LOG.debug("DPN list is empty, skipping addVteps for schema: {}", schema); return; } String subnetCidr = ItmUtils.getSubnetCidrAsString(schema.getSubnet()); if (vtepIpPool == null) { LOG.error("VTEP config pool not found for subnetCidr {}. Failed to add VTEPs for schema {}", subnetCidr, schema); return; } TepCommandHelper tepCommandHelper = new TepCommandHelper(this.dataBroker, itmConfig); // Check this later String tunType; Class<? extends TunnelTypeBase> tunnelType = schema.getTunnelType(); if (tunnelType.equals(TunnelTypeVxlan.class)) { tunType = ITMConstants.TUNNEL_TYPE_VXLAN; } else { tunType = ITMConstants.TUNNEL_TYPE_GRE; } tepCommandHelper.configureTunnelType(schema.getTransportZoneName(), StringUtils.upperCase(tunType)); List<IpAddress> availableIps = vtepIpPool.getAvailableIpaddress(); List<IpAddress> newlyAllocatedIps = new ArrayList<>(); List<BigInteger> skippedDpnIds = new ArrayList<>(); String gatewayIp = handleGatewayIp(schema.getGatewayIp()); for (BigInteger dpnId : ItmUtils.getDpnIdList(schema.getDpnIds())) { IpAddress ipAddress = getAnAvailableIP(availableIps); if (ipAddress == null) { skippedDpnIds.add(dpnId); continue; } try { tepCommandHelper.createLocalCache(dpnId, schema.getPortName(), schema.getVlanId(), String.valueOf(ipAddress.getValue()), subnetCidr, gatewayIp, schema.getTransportZoneName(), null); } catch (TepException e) { LOG.error(e.getMessage()); } newlyAllocatedIps.add(ipAddress); } if (!skippedDpnIds.isEmpty()) { LOG.error( "No available IP addresses in the VTEP config pool {}, skipping VTEP configurations for DPN's {}", subnetCidr, skippedDpnIds); } if (!newlyAllocatedIps.isEmpty()) { LOG.debug("Delete OnCommit and buildTeps in NewlyAddedDpns"); tepCommandHelper.deleteOnCommit(); tepCommandHelper.buildTeps(); allocateIpAddresses(newlyAllocatedIps, vtepIpPool, subnetCidr); } }
From source file:org.opendaylight.vpnservice.itm.impl.ItmUtils.java
public static String validateTunnelType(String tunnelType) { if (tunnelType == null) { tunnelType = ITMConstants.TUNNEL_TYPE_VXLAN; } else {//from ww w. j a va 2s.c om tunnelType = StringUtils.upperCase(tunnelType); String error = new StringBuilder("Invalid tunnel type. Valid values: ") .append(ITMConstants.TUNNEL_TYPE_VXLAN).append(" | ").append(ITMConstants.TUNNEL_TYPE_GRE) .toString(); Preconditions.checkArgument(ITMConstants.TUNNEL_TYPE_VXLAN.equals(tunnelType) || ITMConstants.TUNNEL_TYPE_GRE.equals(tunnelType), error); } return tunnelType; }
From source file:org.opendaylight.vpnservice.itm.listeners.VtepConfigSchemaListener.java
/** * Adds the vteps./*from w w w .j av a2 s . co m*/ * * @param schema * the schema * @param vtepIpPool * the vtep ip pool */ private void addVteps(VtepConfigSchema schema, VtepIpPool vtepIpPool) { if (schema.getDpnIds() == null || schema.getDpnIds().isEmpty()) { LOG.debug("DPN list is empty, skipping addVteps for schema: {}", schema); return; } String subnetCidr = ItmUtils.getSubnetCidrAsString(schema.getSubnet()); if (vtepIpPool == null) { LOG.error("VTEP config pool not found for subnetCidr {}. Failed to add VTEPs for schema {}", subnetCidr, schema); return; } TepCommandHelper tepCommandHelper = new TepCommandHelper(this.dataBroker); // Check this later String tunType; Class<? extends TunnelTypeBase> tunnelType = schema.getTunnelType(); if (tunnelType.equals(TunnelTypeVxlan.class)) tunType = ITMConstants.TUNNEL_TYPE_VXLAN; else tunType = ITMConstants.TUNNEL_TYPE_GRE; tepCommandHelper.configureTunnelType(schema.getTransportZoneName(), StringUtils.upperCase(tunType)); List<IpAddress> availableIps = vtepIpPool.getAvailableIpaddress(); List<IpAddress> newlyAllocatedIps = new ArrayList<>(); List<BigInteger> skippedDpnIds = new ArrayList<>(); String gatewayIp = handleGatewayIp(schema.getGatewayIp()); for (BigInteger dpnId : ItmUtils.getDpnIdList(schema.getDpnIds())) { IpAddress ipAddress = getAnAvailableIP(availableIps); if (ipAddress == null) { skippedDpnIds.add(dpnId); continue; } tepCommandHelper.createLocalCache(dpnId, schema.getPortName(), schema.getVlanId(), String.valueOf(ipAddress.getValue()), subnetCidr, gatewayIp, schema.getTransportZoneName()); newlyAllocatedIps.add(ipAddress); } if (!skippedDpnIds.isEmpty()) { LOG.error( "No available IP addresses in the VTEP config pool {}, skipping VTEP configurations for DPN's {}", subnetCidr, skippedDpnIds); } if (!newlyAllocatedIps.isEmpty()) { LOG.debug("Delete OnCommit and buildTeps in NewlyAddedDpns"); tepCommandHelper.deleteOnCommit(); tepCommandHelper.buildTeps(); allocateIpAddresses(newlyAllocatedIps, vtepIpPool, subnetCidr); } }
From source file:org.pf4j.demo.welcome.WelcomePlugin.java
@Override public void start() { logger.info("WelcomePlugin.start()"); logger.info(StringUtils.upperCase("WelcomePlugin")); }
From source file:org.sifarish.etl.CountryStandardFormat.java
/** * @param item/* w w w. ja va 2s. c o m*/ * @param format * @return */ public String personNameFormat(String item) { String firstFull = null; String firstInitial = null; String middleFull = null; String middleInitial = null; String last = null; boolean matchFound = false; //first full, mid full, last Matcher matcher = fullNamePattern.matcher(item); if (matcher.matches()) { firstFull = matcher.group(1); middleFull = matcher.group(2); last = matcher.group(3); matchFound = true; } //first full, last if (!matchFound) { matcher = firstFullNamePattern.matcher(item); if (matcher.matches()) { firstFull = matcher.group(1); last = matcher.group(2); matchFound = true; } } //first full, middle initial,last if (!matchFound) { matcher = firstFullMidIntialNamePattern.matcher(item); if (matcher.matches()) { firstFull = matcher.group(1); middleInitial = matcher.group(2); last = matcher.group(3); matchFound = true; } } //first , middle initial,last if (!matchFound) { matcher = firstMidIntialNamePattern.matcher(item); if (matcher.matches()) { firstInitial = matcher.group(1); middleInitial = matcher.group(2); last = matcher.group(3); matchFound = true; } } //last , first initial if (!matchFound) { matcher = lastNameFirstFirstIntialNamePattern.matcher(item); if (matcher.matches()) { last = matcher.group(1); firstInitial = matcher.group(2); matchFound = true; } } //last , first if (!matchFound) { matcher = lastNameFirstFirstNamePattern.matcher(item); if (matcher.matches()) { last = matcher.group(1); firstFull = matcher.group(2); matchFound = true; } } //last , first initial, mid intial if (!matchFound) { matcher = lastNameFirstFirstMidIntialNamePattern.matcher(item); if (matcher.matches()) { last = matcher.group(1); firstInitial = matcher.group(2); middleInitial = matcher.group(3); matchFound = true; } } //last , first , mid if (!matchFound) { matcher = lastNameFirstFirstMidNamePattern.matcher(item); if (matcher.matches()) { last = matcher.group(1); firstFull = matcher.group(2); middleFull = matcher.group(3); matchFound = true; } } if (null != firstFull) { firstFull = StringUtils.capitalize(firstFull.toLowerCase()); } if (null != firstInitial) { firstInitial = StringUtils.upperCase(firstInitial); } if (null != middleFull) { middleFull = StringUtils.capitalize(middleFull.toLowerCase()); } if (null != middleInitial) { middleInitial = StringUtils.upperCase(middleInitial); } if (null != last) { last = StringUtils.capitalize(last.toLowerCase()); } StringBuilder stBld = new StringBuilder(); if (null != firstFull) { stBld.append(firstFull).append(" "); } else if (null != firstInitial) { stBld.append(firstInitial).append(" "); } if (null != middleFull) { stBld.append(middleFull).append(" "); } else if (null != middleInitial) { stBld.append(middleInitial).append(" "); } if (null != last) { stBld.append(last); } return stBld.toString(); }