List of usage examples for org.apache.commons.lang3 StringUtils lowerCase
public static String lowerCase(final String str)
Converts a String to lower case as per String#toLowerCase() .
A null input String returns null .
StringUtils.lowerCase(null) = null StringUtils.lowerCase("") = "" StringUtils.lowerCase("aBc") = "abc"
Note: As described in the documentation for String#toLowerCase() , the result of this method is affected by the current locale.
From source file:it.larusba.integration.neo4j.jsonloader.transformer.DomainDrivenJsonTransformer.java
/** * The method builds the label of the node. * //from w w w. j ava 2 s . c o m * @param documentType * the type of document * @param documentMap * the document's map * @param objectDescriptorHelper * the descriptor helper * @return the label of the node */ private String buildNodeLabel(String documentType, Map<String, Object> documentMap, JsonObjectDescriptorHelper objectDescriptorHelper) { String typeAttribute = (String) documentMap.get(objectDescriptorHelper.getTypeAttribute(documentType)); if (StringUtils.isBlank(typeAttribute)) { typeAttribute = StringUtils.lowerCase(documentType); } return StringUtils.capitalize(typeAttribute); }
From source file:com.ottogroup.bi.asap.resman.node.ProcessingNodeManager.java
/** * Instantiates a pipeline on remote processing nodes * @param deploymentProfile provides information on what and how to distribute the pipeline within the cluster * @return/*from ww w . j a v a 2 s . co m*/ * @throws RequiredInputMissingException */ public PipelineDeploymentProfile instantiatePipeline(final PipelineDeploymentProfile deploymentProfile) throws RequiredInputMissingException { /////////////////////////////////////////////////////// // validate input if (deploymentProfile == null) throw new RequiredInputMissingException("Missing required deployment profile"); // /////////////////////////////////////////////////////// for (final ProcessingNode pn : this.processingNodes.values()) { try { pn.instantiatePipeline(deploymentProfile.getConfiguration()); deploymentProfile.addProcessingNode(StringUtils.lowerCase(StringUtils.trim(pn.getId()))); } catch (RemoteClientConnectionFailedException | IOException e) { logger.error("Failed to deploy pipeline '" + deploymentProfile.getId() + "' on processing node '" + pn.getId() + "'. Error: " + e.getMessage()); } } return deploymentProfile; }
From source file:fr.scc.elo.controller.PlayerController.java
@GET @Path("/setelo/name/{n}/elo/{e}/type/{t}/save/{s}") @ApiOperation(value = "affecte un elo a un joueur", notes = "save=true -> cree le joueur au besoin", response = Player.class) public Response setEloToPlayer(@BeanParam PlayerRequest request, @Context HttpServletRequest http) throws EloException { try {/*from ww w .j a v a 2 s .c o m*/ if (!connectionService.acceptIPUpdate(http.getRemoteAddr())) { throw new EloException("Unauthorized IP: " + http.getRemoteAddr()); } return Response .ok().entity(eloManager.setEloToPlayer(StringUtils.lowerCase(request.getName()), request.getElo(), request.getTypeMatch(), request.getCreatePlayers()).toString()) .build(); } catch (Exception e) { return Response.serverError().entity(e.getMessage()).build(); } }
From source file:com.ottogroup.bi.spqr.pipeline.MicroPipelineManager.java
/** * Returns true if a {@link MicroPipeline} for the given identifier exists otherwise * it returns false/*from www . ja va 2 s .com*/ * @param pipelineId * @return */ public boolean hasPipeline(final String pipelineId) { return this.pipelines.containsKey(StringUtils.lowerCase(StringUtils.trim(pipelineId))); }
From source file:com.yiji.openapi.sdk.util.Servlets.java
public static String getHeaderValue(HttpServletRequest request, String name) { String value = request.getHeader(name); if (StringUtils.isBlank(value)) { value = request.getHeader(StringUtils.lowerCase(name)); }/*from w w w. j ava 2s . co m*/ return value; }
From source file:com.buildabrand.gsb.util.URLUtils.java
public String canonicalizeHost(String host) { if (StringUtils.isEmpty(host)) { return null; }//from w ww . j av a 2 s . com host = escape(StringUtils.lowerCase(host)); String ip = canonicalizeIp(host); if (ip != null) { return ip; } else { // Host is a normal hostname. // Skip trailing, leading and consecutive dots. String[] hostSplit = StringUtils.split(host, '.'); if (hostSplit.length < 2) { return null; } else { return StringUtils.join(hostSplit, '.'); } } }
From source file:com.ottogroup.bi.spqr.pipeline.MicroPipelineValidator.java
/** * Validates a single {@link MicroPipelineComponentConfiguration} * @param componentCfg//from ww w .j a v a 2 s.c o m * @param queueIdentifiers previously extracted queue identifiers * @param componentIdentifiers previously extracted component identifiers * @return */ protected MicroPipelineValidationResult validateComponent( final MicroPipelineComponentConfiguration componentCfg, final Set<String> queueIdentifiers, final Set<String> componentIdentifiers) { /////////////////////////////////////////////////////////////////////////////////// // component and its id, name, version and type for neither being null empty if (componentCfg == null) return MicroPipelineValidationResult.MISSING_COMPONENT_CONFIGURATION; if (StringUtils.isBlank(componentCfg.getId())) return MicroPipelineValidationResult.MISSING_COMPONENT_ID; if (StringUtils.isBlank(componentCfg.getName())) return MicroPipelineValidationResult.MISSING_COMPONENT_NAME; if (StringUtils.isBlank(componentCfg.getVersion())) return MicroPipelineValidationResult.MISSING_COMPONENT_VERSION; if (componentCfg.getType() == null) return MicroPipelineValidationResult.MISSING_COMPONENT_TYPE; // /////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////// // convert id to trimmed lower-case representation and check if it is unique String tempId = StringUtils.lowerCase(StringUtils.trim(componentCfg.getId())); if (componentIdentifiers.contains(tempId)) return MicroPipelineValidationResult.NON_UNIQUE_COMPONENT_ID; // /////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////// // validate queue settings for specific component types if (componentCfg.getType() == MicroPipelineComponentType.SOURCE) { // source component must reference a destination queue only - source queue references are not permitted if (StringUtils.isNotBlank(componentCfg.getFromQueue())) return MicroPipelineValidationResult.NOT_PERMITTED_SOURCE_QUEUE_REF; // the identifier of the destination queue must neither be null nor empty if (StringUtils.isBlank(componentCfg.getToQueue())) return MicroPipelineValidationResult.MISSING_DESTINATION_QUEUE; // the identifier of the destination queue must reference an existing queue String destinationQueueId = StringUtils.lowerCase(StringUtils.trim(componentCfg.getToQueue())); if (!queueIdentifiers.contains(destinationQueueId)) return MicroPipelineValidationResult.UNKNOWN_DESTINATION_QUEUE; } else if (componentCfg.getType() == MicroPipelineComponentType.DIRECT_RESPONSE_OPERATOR || componentCfg.getType() == MicroPipelineComponentType.DELAYED_RESPONSE_OPERATOR) { // operators must reference source and destination queues alike - both variable values must not be empty if (StringUtils.isBlank(componentCfg.getFromQueue())) return MicroPipelineValidationResult.MISSING_SOURCE_QUEUE; if (StringUtils.isBlank(componentCfg.getToQueue())) return MicroPipelineValidationResult.MISSING_DESTINATION_QUEUE; // the identifier of the source queue must reference an existing queue String sourceQueueId = StringUtils.lowerCase(StringUtils.trim(componentCfg.getFromQueue())); if (!queueIdentifiers.contains(sourceQueueId)) return MicroPipelineValidationResult.UNKNOWN_SOURCE_QUEUE; // the identifier of the destination queue must reference an existing queue String destinationQueueId = StringUtils.lowerCase(StringUtils.trim(componentCfg.getToQueue())); if (!queueIdentifiers.contains(destinationQueueId)) return MicroPipelineValidationResult.UNKNOWN_DESTINATION_QUEUE; } else if (componentCfg.getType() == MicroPipelineComponentType.EMITTER) { // emitter component must reference a source queue only - destination queue references are not permitted if (StringUtils.isNotBlank(componentCfg.getToQueue())) return MicroPipelineValidationResult.NOT_PERMITTED_DESTINATION_QUEUE_REF; // the identifier of the source queue must neither be null nor empty if (StringUtils.isBlank(componentCfg.getFromQueue())) return MicroPipelineValidationResult.MISSING_SOURCE_QUEUE; // the identifier of the destination queue must reference an existing queue String destinationQueueId = StringUtils.lowerCase(StringUtils.trim(componentCfg.getFromQueue())); if (!queueIdentifiers.contains(destinationQueueId)) return MicroPipelineValidationResult.UNKNOWN_SOURCE_QUEUE; } // return true if no error could be derived from component configuration return MicroPipelineValidationResult.OK; }
From source file:com.ottogroup.bi.asap.pipeline.MicroPipelineManager.java
/** * Shuts down the referenced pipeline/* w w w .j a v a 2s . c o m*/ * @param pipelineId * @throws RequiredInputMissingException */ public String shutdownPipeline(final String pipelineId) throws RequiredInputMissingException { ////////////////////////////////////////////////////////////// // validate input if (StringUtils.isBlank(pipelineId)) throw new RequiredInputMissingException("Missing required pipeline identifier"); // ////////////////////////////////////////////////////////////// String pid = StringUtils.lowerCase(StringUtils.trim(pipelineId)); if (this.microPipelines.containsKey(pid)) { MicroPipeline pipeline = this.microPipelines.remove(pid); if (pipeline != null) { pipeline.shutdown(); if (logger.isDebugEnabled()) logger.debug("Pipeline '" + pipelineId + "' successfully shut down"); } } return pid; }
From source file:com.ottogroup.bi.asap.operator.json.aggregator.JsonContentAggregatorResult.java
/** * Evaluates the referenced aggregated value against the provided value and saves the larger one * @param field/*w w w.j ava2 s . c o m*/ * @param fieldValue * @param value * @throws RequiredInputMissingException */ public void evalMaxAggregatedValue(final String field, final String fieldValue, final long value) throws RequiredInputMissingException { /////////////////////////////////////////////////////////////////////////////////////////// // validate provided input if (StringUtils.isBlank(field)) throw new RequiredInputMissingException("Missing required input for parameter 'field'"); if (StringUtils.isBlank(fieldValue)) throw new RequiredInputMissingException("Missing required input for parameter 'fieldValue'"); // /////////////////////////////////////////////////////////////////////////////////////////// String fieldKey = StringUtils.lowerCase(StringUtils.trim(field)); String fieldValueKey = StringUtils.lowerCase(StringUtils.trim(fieldValue)); Map<String, Long> fieldAggregationValues = this.aggregatedValues.get(fieldKey); if (fieldAggregationValues == null) fieldAggregationValues = new HashMap<>(); long aggregationValue = (fieldAggregationValues.containsKey(fieldValueKey) ? fieldAggregationValues.get(fieldValueKey) : Integer.MIN_VALUE); if (value > aggregationValue) { fieldAggregationValues.put(fieldValue, value); this.aggregatedValues.put(fieldKey, fieldAggregationValues); } }
From source file:com.ottogroup.bi.spqr.metrics.MetricsHandler.java
/** * Registers a new {@link ScheduledReporter} * @param id//from w w w . java 2 s .co m * @param reporterInstance reporter instance (must have been started) * @throws RequiredInputMissingException */ public void addScheduledReporter(final String id, final ScheduledReporter reporterInstance) throws RequiredInputMissingException { //////////////////////////////////////////////////////////////// // input validation if (StringUtils.isBlank(id)) throw new RequiredInputMissingException("Missing required reporter identifier"); if (reporterInstance == null) throw new RequiredInputMissingException("Missing required reporter instance"); //////////////////////////////////////////////////////////////// this.scheduledReporters.put(StringUtils.lowerCase(StringUtils.trim(id)), reporterInstance); }