List of usage examples for org.apache.commons.lang StringUtils upperCase
public static String upperCase(String str)
Converts a String to upper case as per String#toUpperCase() .
From source file:gov.nih.nci.firebird.nes.common.NesTranslatorHelperUtils.java
private static boolean useUsPhoneFormat(String value, String countryCode) { return Lists.newArrayList(US_COUNTRY_CODE, CANADA_COUNTRY_CODE).contains(StringUtils.upperCase(countryCode)) && isValidUsPhoneNumberLength(value); }
From source file:io.mycat.server.ServerConnection.java
public void routeEndExecuteSQL(String sql, int type, SchemaConfig schema) { // //from w ww . ja va 2 s. c o m RouteResultset rrs = null; try { rrs = MycatServer.getInstance().getRouterservice().route( MycatServer.getInstance().getConfig().getSystem(), schema, type, sql, this.charset, this); } catch (Exception e) { StringBuilder s = new StringBuilder(); LOGGER.warn(s.append(this).append(sql).toString() + " err:" + e.toString(), e); String msg = e.getMessage(); writeErrMessage(ErrorCode.ER_PARSE_ERROR, msg == null ? e.getClass().getSimpleName() : msg); return; } if (rrs != null) { // session session.execute(rrs, type); String stmt = StringUtils.upperCase(rrs.getStatement()); if (StringUtils.startsWith(stmt, "DROP")) { TableService tableService = new TableServiceImpl(); String tableName = tableService.getTableName(stmt); tableService.deleteTable(tableName, schema.getName()); } } }
From source file:com.daimler.spm.storefront.controllers.pages.CartPageController.java
@RequestMapping(value = "/checkout/select-flow", method = RequestMethod.GET) @RequireHardLogIn/*from w w w . jav a 2s . c om*/ public String initCheck(@RequestParam(value = "flow", required = false) final String flow, @RequestParam(value = "pci", required = false) final String pci) throws CommerceCartModificationException { SessionOverrideCheckoutFlowFacade.resetSessionOverrides(); if (!getCartFacade().hasEntries()) { LOG.info("Missing or empty cart"); // No session cart or empty session cart. Bounce back to the cart page. return REDIRECT_CART_URL; } // Override the Checkout Flow setting in the session if (StringUtils.isNotBlank(flow)) { final CheckoutFlowEnum checkoutFlow = enumerationService.getEnumerationValue(CheckoutFlowEnum.class, StringUtils.upperCase(flow)); SessionOverrideCheckoutFlowFacade.setSessionOverrideCheckoutFlow(checkoutFlow); } // Override the Checkout PCI setting in the session if (StringUtils.isNotBlank(pci)) { final CheckoutPciOptionEnum checkoutPci = enumerationService .getEnumerationValue(CheckoutPciOptionEnum.class, StringUtils.upperCase(pci)); SessionOverrideCheckoutFlowFacade.setSessionOverrideSubscriptionPciOption(checkoutPci); } // Redirect to the start of the checkout flow to begin the checkout process // We just redirect to the generic '/checkout' page which will actually select the checkout flow // to use. The customer is not necessarily logged in on this request, but will be forced to login // when they arrive on the '/checkout' page. return REDIRECT_PREFIX + "/checkout"; }
From source file:net.kamhon.ieagle.dao.HibernateDao.java
private QueryParams translateExampleToQueryParams(Object example, String... orderBy) { Object newObj = example;//w w w. j a va 2s .c o m Entity className = ((Entity) newObj.getClass().getAnnotation(Entity.class)); if (className == null) throw new DataException(newObj.getClass().getSimpleName() + " class is not valid JPA annotated bean"); String aliasName = StringUtils.isBlank(className.name()) ? "obj" : className.name(); String hql = "SELECT " + aliasName + " FROM "; List<Object> params = new ArrayList<Object>(); BeanWrapper beanO1 = new BeanWrapperImpl(newObj); PropertyDescriptor[] proDescriptorsO1 = beanO1.getPropertyDescriptors(); int propertyLength = proDescriptorsO1.length; if (newObj != null) { hql += aliasName; hql += " IN " + example.getClass(); } if (example instanceof VoBase) { VoBase voBase = (VoBase) example; for (String key : voBase.getJoinTables().keySet()) { if (StringUtils.isNotBlank(key)) { hql += " JOIN " + key + " " + voBase.getJoinTables().get(key); } } } hql += " WHERE 1=1"; for (int i = 0; i < propertyLength; i++) { try { Object propertyValueO1 = beanO1.getPropertyValue(proDescriptorsO1[i].getName()); if ((propertyValueO1 instanceof String && StringUtils.isNotBlank((String) propertyValueO1)) || propertyValueO1 instanceof Long || propertyValueO1 instanceof Double || propertyValueO1 instanceof Integer || propertyValueO1 instanceof Boolean || propertyValueO1 instanceof Date || propertyValueO1.getClass().isPrimitive()) { Field field = null; try { field = example.getClass().getDeclaredField(proDescriptorsO1[i].getName()); } catch (NoSuchFieldException e) { if (propertyValueO1 instanceof Boolean || propertyValueO1.getClass().isPrimitive()) { String fieldName = "is" + StringUtils.upperCase(proDescriptorsO1[i].getName().substring(0, 1)) + proDescriptorsO1[i].getName().substring(1); field = example.getClass().getDeclaredField(fieldName); } } if (proDescriptorsO1[i].getName() != null && field != null && !field.isAnnotationPresent(Transient.class)) { if (!Arrays.asList(VoBase.propertiesVer).contains(proDescriptorsO1[i].getName())) { hql += " AND " + aliasName + "." + field.getName() + " = ?"; params.add(propertyValueO1); } } } else if (propertyValueO1 != null) { Field field = example.getClass().getDeclaredField(proDescriptorsO1[i].getName()); if (field.isAnnotationPresent(javax.persistence.Id.class) || field.isAnnotationPresent(javax.persistence.EmbeddedId.class)) { BeanWrapper bean = new BeanWrapperImpl(propertyValueO1); PropertyDescriptor[] proDescriptors = bean.getPropertyDescriptors(); for (PropertyDescriptor propertyDescriptor : proDescriptors) { Object propertyValueId = bean.getPropertyValue(propertyDescriptor.getName()); if (propertyValueId != null && ReflectionUtil.isJavaDataType(propertyValueId)) { hql += " AND " + aliasName + "." + proDescriptorsO1[i].getName() + "." + propertyDescriptor.getName() + " = ?"; params.add(bean.getPropertyValue(propertyDescriptor.getName())); } } } } } catch (Exception e) { } } // not condition if (example instanceof VoBase) { VoBase voBase = (VoBase) example; for (String key : voBase.getNotConditions().keySet()) { if (StringUtils.isNotBlank(key)) { hql += " AND " + aliasName + "." + key + "!=? "; params.add(voBase.getNotConditions().get(key)); } } } // like condition if (example instanceof VoBase) { VoBase voBase = (VoBase) example; for (String key : voBase.getLikeConditions().keySet()) { if (StringUtils.isNotBlank(key)) { hql += " AND " + aliasName + "." + key + " LIKE ? "; params.add(voBase.getLikeConditions().get(key)); } } } if (orderBy != null && orderBy.length != 0) { hql += " ORDER BY "; long count = 1; for (String orderByStr : orderBy) { if (count != 1) hql += ","; hql += aliasName + "." + orderByStr; count += 1; } } log.debug("hql = " + hql); return new QueryParams(hql, params); }
From source file:net.sourceforge.fenixedu.util.UniqueAcronymCreator.java
private static boolean isValidNumeration(String string) { if (numerationSet.contains(StringUtils.upperCase(string))) { if (logger.isDebugEnabled()) { logger.info("isValidNumeration, true -> " + string); }// www . j av a 2 s. c om return true; } if (logger.isDebugEnabled()) { logger.info("isValidNumeration, false -> " + string); } return false; }
From source file:com.hangum.tadpole.rdb.core.editors.main.utils.ExtMakeContentAssistUtil.java
/** * List of assist table column name//from w ww . j a va2 s .com * * @param userDB * @param tableName * @return */ public String getAssistColumnList(final UserDBDAO userDB, final String tableName) { String strColumnlist = ""; //$NON-NLS-1$ String strSchemaName = ""; String strTableName = tableName; if (userDB.getDBDefine() != DBDefine.ALTIBASE_DEFAULT) { if (StringUtils.contains(tableName, '.')) { String[] arrTblInfo = StringUtils.split(tableName, "."); strSchemaName = arrTblInfo[0]; strTableName = arrTblInfo[1]; } } // ? ? ?? ? ? ? . TadpoleMetaData tadpoleMetaData = TadpoleSQLManager.getDbMetadata(userDB); if (tadpoleMetaData.getSTORE_TYPE() == TadpoleMetaData.STORES_FIELD_TYPE.LOWCASE_BLANK) { strSchemaName = StringUtils.upperCase(strSchemaName); strTableName = StringUtils.upperCase(strTableName); } else if (tadpoleMetaData.getSTORE_TYPE() == TadpoleMetaData.STORES_FIELD_TYPE.UPPERCASE_BLANK) { strSchemaName = StringUtils.lowerCase(strSchemaName); strTableName = StringUtils.lowerCase(strTableName); } try { TableDAO table = new TableDAO(strTableName, ""); table.setSysName(strTableName); table.setSchema_name(strSchemaName); table.setName(strTableName); List<TableColumnDAO> showTableColumns = TadpoleObjectQuery.getTableColumns(userDB, table); for (TableColumnDAO tableDao : showTableColumns) { strColumnlist += tableDao.getSysName() + _PRE_DEFAULT + tableDao.getType() + _PRE_GROUP; //$NON-NLS-1$ } strColumnlist = StringUtils.removeEnd(strColumnlist, _PRE_GROUP); //$NON-NLS-1$ } catch (Exception e) { logger.error("MainEditor get the table column list", e); //$NON-NLS-1$ } return strColumnlist; }
From source file:com.adobe.acs.commons.users.impl.EnsureServiceUser.java
@Activate protected void activate(final Map<String, Object> config) { boolean ensureImmediately = PropertiesUtil.toBoolean(config.get(PROP_ENSURE_IMMEDIATELY), DEFAULT_ENSURE_IMMEDIATELY); String operationStr = StringUtils .upperCase(PropertiesUtil.toString(config.get(PROP_OPERATION), DEFAULT_OPERATION)); try {/*from www . ja v a 2 s . c om*/ this.operation = Operation.valueOf(operationStr); // Parse OSGi Configuration into Service User object this.serviceUser = new ServiceUser(config); if (ensureImmediately) { // Ensure ensure(operation, getAuthorizable()); } else { log.info( "This Service User is configured to NOT ensure immediately. Please ensure this Service User via the JMX MBean."); } } catch (EnsureAuthorizableException e) { log.error("Unable to ensure Service User [ {} ]", PropertiesUtil .toString(config.get(PROP_PRINCIPAL_NAME), "Undefined Service User Principal Name"), e); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Unknown Ensure Service User operation [ " + operationStr + " ]", e); } }
From source file:jp.co.tis.gsp.tools.dba.dialect.OracleDialect.java
@Override public String normalizeUserName(String userName) { return StringUtils.upperCase(userName); }
From source file:jp.co.tis.gsp.tools.dba.dialect.OracleDialect.java
@Override public String normalizeSchemaName(String schemaName) { return StringUtils.upperCase(schemaName); }
From source file:com.example.app.support.address.AddressStandardizer.java
/** * Normalize the input parsedAddr map into a standardize format * * @param parsedAddr the parsed address. * * @return normalized address in a map/*from w ww . ja va 2s.c o m*/ */ public static Map<AddressComponent, String> normalizeParsedAddress(Map<AddressComponent, String> parsedAddr) { Map<AddressComponent, String> ret = new EnumMap<>(AddressComponent.class); //just take the digits from the number component for (Map.Entry<AddressComponent, String> e : parsedAddr.entrySet()) { String v = StringUtils.upperCase(e.getValue()); switch (e.getKey()) { case PREDIR: ret.put(PREDIR, normalizeDir(v)); break; case POSTDIR: ret.put(POSTDIR, normalizeDir(v)); break; case TYPE: ret.put(TYPE, normalizeStreetType(v)); break; case PREDIR2: ret.put(PREDIR2, normalizeDir(v)); break; case POSTDIR2: ret.put(POSTDIR2, normalizeDir(v)); break; case TYPE2: ret.put(TYPE2, normalizeStreetType(v)); break; case NUMBER: ret.put(NUMBER, normalizeNum(v)); break; case STATE: ret.put(STATE, normalizeState(v)); break; case ZIP: ret.put(ZIP, normalizeZip(v)); break; case LINE2: ret.put(LINE2, normalizeLine2(v)); break; case CITY: ret.put(CITY, saintAbbrExpansion(v)); break; case STREET: ret.put(STREET, normalizeOrdinal(saintAbbrExpansion(v))); break; case STREET2: ret.put(STREET2, normalizeOrdinal(saintAbbrExpansion(v))); break; default: ret.put(e.getKey(), v); break; } } ret.put(CITY, resolveCityAlias(ret.get(CITY), ret.get(STATE))); return ret; }