List of usage examples for org.apache.commons.lang StringUtils lowerCase
public static String lowerCase(String str)
Converts a String to lower case as per String#toLowerCase() .
From source file:org.nekorp.workflow.backend.security.controller.imp.UsuarioClienteWebControllerImp.java
/**{@inheritDoc}*/ @Override/*from www .j a v a2 s. co m*/ @RequestMapping(value = "/{alias}", method = RequestMethod.POST) public void actualizar(@PathVariable final String alias, @Valid @RequestBody final UsuarioClienteWeb datos, final HttpServletResponse response) { datos.setAlias(alias); datos.setAlias(StringUtils.lowerCase(datos.getAlias())); UsuarioClienteWeb resultado = usuarioClienteWebDAO.consultar(datos.getAlias()); if (resultado == null) { response.setStatus(HttpStatus.NOT_FOUND.value()); return; } Cliente cliente = clienteDao.consultar(datos.getIdCliente()); if (cliente == null) { response.setStatus(HttpStatus.BAD_REQUEST.value()); return; } usuarioClienteWebDAO.guardar(datos); }
From source file:org.nekorp.workflow.backend.security.controller.imp.UsuarioClienteWebControllerImp.java
/**{@inheritDoc}*/ @Override// ww w . j a v a 2s . c om @RequestMapping(value = "/{alias}", method = RequestMethod.DELETE) public void borrar(@PathVariable final String alias, final HttpServletResponse response) { String buscar = StringUtils.lowerCase(alias); UsuarioClienteWeb resultado = usuarioClienteWebDAO.consultar(buscar); if (resultado == null) { response.setStatus(HttpStatus.NO_CONTENT.value()); return; } usuarioClienteWebDAO.borrar(resultado); //se acepto la peticion de borrado, no quiere decir que sucede de inmediato. response.setStatus(HttpStatus.ACCEPTED.value()); }
From source file:org.nekorp.workflow.desktop.servicio.reporte.orden.servicio.OrdenServicioDataFactory.java
private String buscaFechaRecepcionAuto() { SimpleDateFormat f = new SimpleDateFormat(dateFormat); for (EventoVB x : this.servicio.getBitacora().getEventos()) { if (x instanceof EventoGeneralVB) { EventoGeneralVB y = (EventoGeneralVB) x; if (StringUtils.equalsIgnoreCase(y.getEtiquetas(), "cotizacin") || StringUtils.equalsIgnoreCase(y.getEtiquetas(), "cotizacion")) { return StringUtils.lowerCase(f.format(y.getFechaEvento())); }//from w ww . j av a 2 s .c o m } } for (EventoVB x : this.servicio.getBitacora().getEventos()) { if (x instanceof EventoEntregaVB) { EventoEntregaVB y = (EventoEntregaVB) x; if (StringUtils.equals(y.getNombreEvento(), "Entrada de Auto")) { return StringUtils.lowerCase(f.format(y.getFecha())); } } } Date inicioServicio = this.servicio.getFechaInicio(); return StringUtils.lowerCase(f.format(inicioServicio)); }
From source file:org.ngrinder.perftest.repository.TagSpecification.java
/** * Get the {@link Specification} to get the {@link Tag} whose value starts with given query. * * @param queryString matching tag value * @return {@link Specification}/*from ww w. ja v a 2 s .co m*/ */ public static Specification<Tag> isStartWith(final String queryString) { return new Specification<Tag>() { @Override public Predicate toPredicate(Root<Tag> root, CriteriaQuery<?> query, CriteriaBuilder cb) { String replacedQueryString = StringUtils.replace(queryString, "%", "\\%"); return cb.like(cb.lower(root.get("tagValue").as(String.class)), StringUtils.lowerCase(replacedQueryString) + "%"); } }; }
From source file:org.openbravo.common.datasource.ReturnToVendorPickAndEditDataSource.java
private String getWhereComboClause(String propertyName, String jsonString) { StringBuffer whereClause = new StringBuffer(); try {//from ww w . java 2 s.co m JSONArray jsonArray = new JSONArray(jsonString); if (jsonArray.length() > 0) { whereClause.append(" and ("); for (int j = 0; j < jsonArray.length(); j++) { String value = jsonArray.getJSONObject(j).getString("value"); String comparator = " like "; String clause = new StringBuffer().append(propertyName).append(comparator).append("'%") .append(value).append("%'").toString(); if (jsonArray.getJSONObject(j).has("operator") && "iContains".equals(jsonArray.getJSONObject(j).getString("operator"))) { value = StringUtils.lowerCase(value); clause = new StringBuffer().append("lower(").append(propertyName).append(")") .append(comparator).append("'%").append(value).append("%'").toString(); } if (j == 0) { whereClause.append(clause); } else { whereClause.append(" or ").append(clause); } } whereClause.append(")"); } } catch (JSONException e) { log4j.error("RTV: error parsing criteria", e); } return whereClause.toString(); }
From source file:org.openhab.binding.miele.internal.discovery.MieleApplianceDiscoveryService.java
private ThingUID getThingUID(HomeDevice appliance) { ThingUID bridgeUID = mieleBridgeHandler.getThing().getUID(); String modelID = null;/*from w ww . ja v a 2 s.c om*/ for (JsonElement dc : appliance.DeviceClasses) { if (dc.getAsString().contains("com.miele.xgw3000.gateway.hdm.deviceclasses.Miele") && !dc.getAsString().equals("com.miele.xgw3000.gateway.hdm.deviceclasses.MieleAppliance")) { modelID = StringUtils.right(dc.getAsString(), dc.getAsString().length() - new String("com.miele.xgw3000.gateway.hdm.deviceclasses.Miele").length()); break; } } if (modelID != null) { ThingTypeUID thingTypeUID = new ThingTypeUID(BINDING_ID, StringUtils.lowerCase(modelID.replaceAll("[^a-zA-Z0-9_]", "_"))); if (getSupportedThingTypes().contains(thingTypeUID)) { ThingUID thingUID = new ThingUID(thingTypeUID, bridgeUID, getId(appliance)); return thingUID; } else { return null; } } else { return null; } }
From source file:org.openhab.binding.unifi.internal.api.util.UniFiTidyLowerCaseStringDeserializer.java
@Override public String deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException { String s = json.getAsJsonPrimitive().getAsString(); return StringUtils.lowerCase(StringUtils.strip(s)); }
From source file:org.openhab.binding.unifi.internal.UniFiClientThingConfig.java
public UniFiClientThingConfig tidy() { cid = StringUtils.lowerCase(StringUtils.strip(cid)); site = StringUtils.lowerCase(StringUtils.strip(site)); return this; }
From source file:org.openhab.io.neeo.internal.servletservices.NeeoBrainSearchService.java
/** * Handles the get request. If the path is "/db/search", will do a search via * {@link #doSearch(String, HttpServletResponse)}. Otherwise we assume it's a request for device details (via * {@link #doQuery(String, HttpServletResponse)} * * As of 52.15 - "/db/adapterdefinition/{id}" get's the latest device details * * @see DefaultServletService#handleGet(HttpServletRequest, String[], HttpServletResponse) *//* w w w . ja v a 2 s. c o m*/ @Override public void handleGet(HttpServletRequest req, String[] paths, HttpServletResponse resp) throws IOException { Objects.requireNonNull(req, "req cannot be null"); Objects.requireNonNull(paths, "paths cannot be null"); Objects.requireNonNull(resp, "resp cannot be null"); if (paths.length < 2) { throw new IllegalArgumentException("paths must have atleast 2 elements: " + StringUtils.join(paths)); } final String path = StringUtils.lowerCase(paths[1]); if (StringUtils.equalsIgnoreCase(path, "search")) { doSearch(req.getQueryString(), resp); } else if (StringUtils.equalsIgnoreCase(path, "adapterdefinition") && paths.length >= 3) { doAdapterDefinition(paths[2], resp); } else { doQuery(path, resp); } }
From source file:org.openhab.io.neeo.internal.servletservices.NeeoBrainService.java
@Override public void handleGet(HttpServletRequest req, String[] paths, HttpServletResponse resp) throws IOException { Objects.requireNonNull(req, "req cannot be null"); Objects.requireNonNull(paths, "paths cannot be null"); Objects.requireNonNull(resp, "resp cannot be null"); if (paths.length == 0) { throw new IllegalArgumentException("paths cannot be empty"); }// ww w.j a va 2 s.c o m // Paths handled specially // 1. See PATHINFO for various /device/* keys (except for the next) // 2. New subscribe path: /device/{thingUID}/subscribe/default/{devicekey} // 3. New unsubscribe path: /device/{thingUID}/unsubscribe/default // 4. Old subscribe path: /{thingUID}/subscribe or unsubscribe/{deviceid}/{devicekey} // 4. Old unsubscribe path: /{thingUID}/subscribe or unsubscribe/{deviceid} final boolean hasDeviceStart = StringUtils.equalsIgnoreCase(paths[0], "device"); if (hasDeviceStart && (paths.length >= 3 && !StringUtils.equalsIgnoreCase(paths[2], "subscribe") && !StringUtils.equalsIgnoreCase(paths[2], "unsubscribe"))) { try { final PathInfo pathInfo = new PathInfo(paths); if (StringUtils.isEmpty(pathInfo.getActionValue())) { handleGetValue(resp, pathInfo); } else { handleSetValue(resp, pathInfo); } } catch (IllegalArgumentException e) { logger.debug("Bad path: {} - {}", StringUtils.join(paths), e.getMessage(), e); } } else { int idx = hasDeviceStart ? 1 : 0; if (idx + 2 < paths.length) { final String adapterName = paths[idx++]; final String action = StringUtils.lowerCase(paths[idx++]); idx++; // deviceId/default - not used switch (action) { case "subscribe": if (idx < paths.length) { final String deviceKey = paths[idx++]; handleSubscribe(resp, adapterName, deviceKey); } else { logger.debug("No device key set for a subscribe action: {}", StringUtils.join(paths, '/')); } break; case "unsubscribe": handleUnsubscribe(resp, adapterName); break; default: logger.debug("Unknown action: {}", action); } } else { logger.debug("Unknown/unhandled brain service route (GET): {}", StringUtils.join(paths, '/')); } } }