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:com.sonicle.webtop.core.CoreManager.java
public void updateMyAutosaveData(String webtopClientId, String serviceId, String context, String key, String value) {/* w w w .ja v a 2 s . c om*/ UserProfileId targetPid = getTargetProfileId(); Connection con = null; try { con = WT.getCoreConnection(); AutosaveDAO asdao = AutosaveDAO.getInstance(); OAutosave data = asdao.select(con, targetPid.getDomainId(), targetPid.getUserId(), webtopClientId, serviceId, context, key); if (data != null) { data.setValue(value); asdao.update(con, data); } else { data = new OAutosave(); data.setDomainId(targetPid.getDomainId()); data.setUserId(targetPid.getUserId()); data.setWebtopClientId(webtopClientId); data.setServiceId(serviceId); data.setContext(context); data.setKey(StringUtils.upperCase(key)); data.setValue(value); asdao.insert(con, data); } } catch (SQLException | DAOException ex) { logger.error("Error adding autosave entry [{}, {}, {}, {}]", targetPid, serviceId, context, key, ex); } finally { DbUtils.closeQuietly(con); } }
From source file:nl.sidn.dnslib.types.OpcodeType.java
public static OpcodeType fromString(String name) { return types.get(StringUtils.upperCase(name)); }
From source file:nl.sidn.dnslib.types.ResourceRecordClass.java
public static ResourceRecordClass fromString(String name) { return classes.get(StringUtils.upperCase(name)); }
From source file:nl.sidn.dnslib.types.ResourceRecordType.java
public static ResourceRecordType fromString(String name) { return types.get(StringUtils.upperCase(name)); }
From source file:nl.sidn.pcap.parquet.DNSParquetPacketWriter.java
@Override public void writeMetrics() { for (Integer key : rcodes.keySet()) { Integer value = rcodes.get(key); if (key.intValue() == -1) { //pseudo rcode -1 means no reponse, not an official rcode metricManager.send(MetricManager.METRIC_IMPORT_DNS_RCODE + ".NO_RESPONSE.count", value.intValue()); } else {//from ww w. j a v a 2 s .c om RcodeType type = RcodeType.fromValue(key.intValue()); metricManager.send( MetricManager.METRIC_IMPORT_DNS_RCODE + StringUtils.upperCase("." + type.name()) + ".count", value.intValue()); } } metricManager.send(MetricManager.METRIC_IMPORT_IP_COUNT, geo_ip_cache.size()); metricManager.send(MetricManager.METRIC_IMPORT_COUNTRY_COUNT, countries.size()); metricManager.send(MetricManager.METRIC_IMPORT_ASN_COUNT, asn_cache.size()); metricManager.send(MetricManager.METRIC_IMPORT_DNS_DOMAINNAME_COUNT, domainnames.size()); if (responseBytes > 0) { metricManager.send(MetricManager.METRIC_IMPORT_DNS_RESPONSE_BYTES_SIZE, (int) (responseBytes / 1024)); } else { metricManager.send(MetricManager.METRIC_IMPORT_DNS_RESPONSE_BYTES_SIZE, 0); } if (requestBytes > 0) { metricManager.send(MetricManager.METRIC_IMPORT_DNS_QUERY_BYTES_SIZE, (int) (requestBytes / 1024)); } else { metricManager.send(MetricManager.METRIC_IMPORT_DNS_QUERY_BYTES_SIZE, 0); } for (Integer key : qtypes.keySet()) { Integer value = qtypes.get(key); ResourceRecordType type = ResourceRecordType.fromValue(key.intValue()); metricManager.send( MetricManager.METRIC_IMPORT_DNS_QTYPE + StringUtils.upperCase("." + type.name()) + ".count", value.intValue()); } for (Integer key : opcodes.keySet()) { Integer value = opcodes.get(key); OpcodeType type = OpcodeType.fromValue(key.intValue()); metricManager.send( MetricManager.METRIC_IMPORT_DNS_OPCODE + StringUtils.upperCase("." + type.name()) + ".count", value.intValue()); } metricManager.send(MetricManager.METRIC_IMPORT_UDP_REQUEST_FRAGMENTED_COUNT, requestUDPFragmentedCount); metricManager.send(MetricManager.METRIC_IMPORT_TCP_REQUEST_FRAGMENTED_COUNT, requestTCPFragmentedCount); metricManager.send(MetricManager.METRIC_IMPORT_UDP_RESPONSE_FRAGMENTED_COUNT, responseUDPFragmentedCount); metricManager.send(MetricManager.METRIC_IMPORT_TCP_RESPONSE_FRAGMENTED_COUNT, responseTCPFragmentedCount); metricManager.send(MetricManager.METRIC_IMPORT_IP_VERSION_4_COUNT, ipv4QueryCount); metricManager.send(MetricManager.METRIC_IMPORT_IP_VERSION_6_COUNT, ipv6QueryCount); }
From source file:org.ambraproject.rhino.rest.controller.ArticleCrudController.java
@Transactional(readOnly = true) @RequestMapping(value = "/articles/page/{pageNumber}", method = RequestMethod.GET) public ResponseEntity<?> listDois(@PathVariable(value = "pageNumber") int pageNumber, @RequestParam(value = "pageSize", required = false, defaultValue = "100") int pageSize, @RequestParam(value = "orderBy", required = false, defaultValue = "newest") String orderBy, @RequestParam(value = "since", required = false, defaultValue = "") String sinceRule) throws IOException { final ArticleCrudService.SortOrder sortOrder = ArticleCrudService.SortOrder .valueOf(StringUtils.upperCase(StringUtils.defaultString(orderBy, "newest" /* defaultStr */))); final Map<String, LocalDateTime> dateRange = calculateDateRange(sinceRule); final Optional<LocalDateTime> fromDate = Optional.ofNullable(dateRange.getOrDefault(FROM_DATE, null)); final Optional<LocalDateTime> toDate = Optional.ofNullable(dateRange.getOrDefault(TO_DATE, null)); final Collection<String> articleDois = articleCrudService.getArticleDoisForDateRange(pageNumber, pageSize, sortOrder, fromDate, toDate); return ServiceResponse.serveView(articleDois).asJsonResponse(entityGson); }
From source file:org.apache.metron.profiler.spark.reader.TelemetryReaders.java
/** * Returns a {@link TelemetryReader} based on a property value. * * @param propertyValue The property value. * @return A {@link TelemetryReader}//from w w w .j a va 2 s .c o m * @throws IllegalArgumentException If the property value is invalid. */ public static TelemetryReader create(String propertyValue) { LOG.debug("Creating telemetry reader: telemetryReader={}", propertyValue); TelemetryReader reader = null; try { String key = StringUtils.upperCase(propertyValue); TelemetryReaders strategy = TelemetryReaders.valueOf(key); reader = strategy.supplier.get(); } catch (IllegalArgumentException e) { LOG.error("Unexpected telemetry reader: telemetryReader=" + propertyValue, e); throw e; } return reader; }
From source file:org.blocks4j.reconf.client.elements.FullPropertyElement.java
public static String from(String product, String component, String name) { return StringUtils.upperCase(StringUtils.defaultString(product)) + "/" + StringUtils.upperCase(StringUtils.defaultString(component)) + "/" + StringUtils.upperCase(StringUtils.defaultString(name)); }
From source file:org.blocks4j.reconf.client.setup.DatabaseManager.java
public String get(String fullProperty, Method method) { Connection conn = null;/*from w w w . j a v a 2 s . co m*/ PreparedStatement stmt = null; ResultSet rs = null; try { conn = getConnection(); stmt = conn.prepareStatement("SELECT VALUE " + "FROM PUBLIC.CLS_METHOD_PROP_VALUE " + "WHERE FULL_PROP = ? " + "AND NAM_CLASS = ? " + "AND NAM_METHOD = ? "); stmt.setString(1, StringUtils.upperCase(fullProperty)); stmt.setString(2, method.getDeclaringClass().getName()); stmt.setString(3, method.getName()); rs = stmt.executeQuery(); if (rs.next()) { return rs.getClob(1) == null ? null : rs.getClob(1).getCharacterStream() == null ? null : IOUtils.toString(rs.getClob(1).getCharacterStream()); } return null; } catch (Exception e) { LoggerHolder.getLog().warn(msg.format("error.db", "get"), e); throw new RuntimeException(e); } finally { close(rs); close(stmt); close(conn); } }
From source file:org.blocks4j.reconf.client.setup.DatabaseManager.java
public boolean temporaryUpsert(String fullProperty, Method method, String value) { Connection conn = null;//from ww w . j a v a2 s. c o m PreparedStatement stmt = null; try { conn = getConnection(); if (needToInsert(fullProperty, method)) { stmt = conn.prepareStatement(TEMPORARY_INSERT); stmt.setString(1, method.getDeclaringClass().getName()); stmt.setString(2, method.getName()); stmt.setString(3, StringUtils.upperCase(fullProperty)); stmt.setString(4, value); stmt.setTimestamp(5, new Timestamp(System.currentTimeMillis())); } else { stmt = conn.prepareStatement(TEMPORARY_UPDATE); stmt.setString(1, value); stmt.setTimestamp(2, new Timestamp(System.currentTimeMillis())); stmt.setString(3, StringUtils.upperCase(fullProperty)); stmt.setString(4, method.getDeclaringClass().getName()); stmt.setString(5, method.getName()); stmt.setString(6, value); } boolean result = 0 != stmt.executeUpdate(); return result; } catch (Exception e) { LoggerHolder.getLog().warn(msg.format("error.db", ("temporaryUpsert")), e); throw new RuntimeException(e); } finally { close(stmt); close(conn); } }