List of usage examples for org.apache.commons.lang StringUtils startsWithIgnoreCase
public static boolean startsWithIgnoreCase(String str, String prefix)
Case insensitive check if a String starts with a specified prefix.
From source file:com.hangum.tadpole.rdb.core.editors.main.composite.plandetail.OraclePlanComposite.java
/** * ? F4 ??? ?? ? ? .//from ww w .j a v a2s . com * @param selElement */ private void openInformationDialog(OraclePlanDAO selElement) { if (StringUtils.equalsIgnoreCase("TABLE", selElement.getObjectType())) { TableDAO tableDao = new TableDAO(); String temp = selElement.getName(); String object[] = StringUtils.split(temp, '.'); if (object.length > 1) { tableDao.setSchema_name(object[0]); String obj = object[1]; String tbl[] = StringUtils.split(obj, '('); if (tbl.length > 1) { tableDao.setSysName(tbl[0]); tableDao.setTable_name(tbl[0]); } else { tableDao.setSysName(obj); tableDao.setTable_name(obj); } } else { tableDao.setSysName(temp); tableDao.setTable_name(temp); } new TableInformationDialog(getShell(), false, getRsDAO().getUserDB(), tableDao).open(); } else if (StringUtils.startsWithIgnoreCase(selElement.getObjectType(), "INDEX")) { InformationSchemaDAO indexDao = new InformationSchemaDAO(); String temp = selElement.getName(); String object[] = StringUtils.split(temp, '.'); if (object.length > 1) { indexDao.setTABLE_SCHEMA(object[0]); String obj = object[1]; String tbl[] = StringUtils.split(obj, '('); if (tbl.length > 1) { indexDao.setINDEX_NAME(tbl[0]); } else { indexDao.setINDEX_NAME(obj); } } else { indexDao.setINDEX_NAME(temp); } new IndexInformationDialog(getShell(), false, getRsDAO().getUserDB(), indexDao).open(); } }
From source file:com.sfs.whichdoctor.beans.AddressVerificationBean.java
/** * Checks if this verification record is processed. * * @return true, if is processed//from w w w . ja v a 2 s . c om */ public final boolean isProcessed() { boolean processed = true; if (StringUtils.startsWithIgnoreCase(this.getProcessStatus(), "Pending")) { processed = false; } return processed; }
From source file:com.hangum.tadpole.rdb.core.dialog.table.mysql.MySQLTaableCreateDialog.java
/** * initialize UI//from www. j a v a 2 s.c om */ private void initUI() { try { /* * default collation SHOW VARIABLES LIKE 'collation_database' */ String strDefaultCollation = ""; QueryExecuteResultDTO showCollationDatabase = QueryUtils.executeQuery(userDB, "SHOW VARIABLES LIKE 'collation_database'", 0, 10); for (Map<Integer, Object> columnData : showCollationDatabase.getDataList().getData()) { strDefaultCollation = "" + columnData.get(1); } // comboTableEncoding ? . QueryExecuteResultDTO showCharacterSet = QueryUtils.executeQuery(userDB, "SELECT * FROM information_schema.character_sets ORDER BY character_set_name ASC", 0, 100); for (Map<Integer, Object> columnData : showCharacterSet.getDataList().getData()) { String strViewData = String.format("%s (%s)", columnData.get(2), columnData.get(1)); if (StringUtils.startsWithIgnoreCase("" + columnData.get(1), strDefaultCollation)) { strDefaultCollation = strViewData; } comboTableEncoding.add(strViewData); comboTableEncoding.setData(strViewData, columnData); } comboTableEncoding.setText(strDefaultCollation); // default database encoding changeEncoding(); /* * default engine */ TadpoleResultSet tdbEngine = QueryUtils.executeQuery(userDB, "SELECT engine, support, comment FROM information_schema.engines WHERE support IN ('DEFAULT', 'YES')", 0, 20).getDataList(); String strDefaultEngine = ""; for (Map<Integer, Object> mapColumnData : tdbEngine.getData()) { String strViewData = "" + mapColumnData.get(1); if (StringUtils.startsWithIgnoreCase(strViewData, "default")) { strViewData = String.format("%s (%s)", mapColumnData.get(1), mapColumnData.get(0)); strDefaultEngine = strViewData; } else { strViewData = "" + mapColumnData.get(0); } comboTableType.add(strViewData); comboTableType.setData(strViewData, "" + mapColumnData.get(0)); } comboTableType.setText(strDefaultEngine); } catch (Exception e) { logger.error("init table create ui", e); } textTableName.setFocus(); }
From source file:com.nridge.ds.solr.SolrParentChild.java
private DataField pcExpansionField(String aValue) { String fieldName;//from w w w . j a v a2 s . c o m if (StringUtils.startsWithIgnoreCase(aValue, Solr.PC_EXPANSION_BOTH)) fieldName = Solr.PC_EXPANSION_BOTH; else if (StringUtils.startsWithIgnoreCase(aValue, Solr.PC_EXPANSION_CHILD)) fieldName = Solr.PC_EXPANSION_CHILD; else if (StringUtils.equalsIgnoreCase(aValue, Solr.PC_EXPANSION_PARENT)) fieldName = Solr.PC_EXPANSION_PARENT; else fieldName = Solr.PC_EXPANSION_NONE; DataField expansionField = new DataIntegerField(fieldName, Field.nameToTitle(fieldName)); expansionField.setMultiValueFlag(true); expansionField.addValue(extractOffset(aValue)); expansionField.addValue(extractLimit(aValue)); return expansionField; }
From source file:com.tesora.dve.sql.util.DBHelperConnectionResource.java
@Override public ExceptionClassification classifyException(Throwable t) { if (t.getMessage() == null) return null; String m = t.getMessage().trim(); if (StringUtils.containsIgnoreCase(m, "Table") && StringUtils.endsWithIgnoreCase(m, "doesn't exist")) return ExceptionClassification.DNE; if (StringUtils.containsIgnoreCase(m, "Unknown table") || StringUtils.containsIgnoreCase(m, "Unknown column")) return ExceptionClassification.DNE; if (StringUtils.containsIgnoreCase(m, "Every derived table must have its own alias")) return ExceptionClassification.DNE; if (StringUtils.containsIgnoreCase(m, "Field") && StringUtils.endsWithIgnoreCase(m, "doesn't have a default value")) return ExceptionClassification.DNE; if (StringUtils.containsIgnoreCase(m, "SAVEPOINT") && StringUtils.endsWithIgnoreCase(m, "does not exist")) return ExceptionClassification.DNE; if (StringUtils.containsIgnoreCase(m, "Data Truncation:")) return ExceptionClassification.OUT_OF_RANGE; if (StringUtils.containsIgnoreCase(m, "You have an error in your SQL syntax")) return ExceptionClassification.SYNTAX; if (StringUtils.containsIgnoreCase(m, "Duplicate entry")) return ExceptionClassification.DUPLICATE; if (StringUtils.containsIgnoreCase(m, "option not supported")) return ExceptionClassification.UNSUPPORTED_OPERATION; if (StringUtils.startsWithIgnoreCase(m, "File") && StringUtils.containsIgnoreCase(m, "not found")) return ExceptionClassification.FILE_NOT_FOUND; if (StringUtils.startsWithIgnoreCase(m, "Table") && StringUtils.endsWithIgnoreCase(m, "already exists")) return ExceptionClassification.DUPLICATE; return null;// w w w . j av a 2s .co m }
From source file:ddf.catalog.source.opensearch.OpenSearchConnection.java
/** * Creates a new DDF REST {@link org.apache.cxf.jaxrs.client.Client} based on an OpenSearch * String URL.// w ww . j a va 2 s .co m * @param url - OpenSearch URL * @param query - Query to be performed * @param metacardId - MetacardId to search for * @param retrieveResource - true if this is a resource request * @return {@link org.apache.cxf.jaxrs.client.Client} */ public Client newRestClient(String url, Query query, String metacardId, boolean retrieveResource) { if (query != null) { url = createRestUrl(query, url, retrieveResource); } else { RestUrl restUrl = newRestUrl(url); if (restUrl != null) { if (StringUtils.isNotEmpty(metacardId)) { restUrl.setId(metacardId); } restUrl.setRetrieveResource(retrieveResource); url = restUrl.buildUrl(); } } Client tmp = null; if (url != null) { RESTService proxy = JAXRSClientFactory.create(url, RESTService.class); tmp = WebClient.client(proxy); if (StringUtils.startsWithIgnoreCase(url, "https")) { setTLSOptions(tmp); } } return tmp; }
From source file:jp.primecloud.auto.process.DnsProcess.java
public void stopDns(Platform platform, Long instanceNo) { Instance instance = instanceDao.read(instanceNo); // TODO CLOUD BRANCHING if (PCCConstant.PLATFORM_TYPE_CLOUDSTACK.equals(platform.getPlatformType())) { stopDnsNormal(instanceNo);//from www. j a v a2 s. c om } else if (PCCConstant.PLATFORM_TYPE_VCLOUD.equals(platform.getPlatformType())) { stopDnsNormal(instanceNo); } else if (PCCConstant.PLATFORM_TYPE_AZURE.equals(platform.getPlatformType())) { stopDnsNormal(instanceNo); } else if (PCCConstant.PLATFORM_TYPE_OPENSTACK.equals(platform.getPlatformType())) { stopDnsNormal(instanceNo); } else if (PCCConstant.PLATFORM_TYPE_AWS.equals(platform.getPlatformType())) { PlatformAws platformAws = platformAwsDao.read(platform.getPlatformNo()); if (platform.getInternal()) { // ??? if (BooleanUtils.isTrue(platformAws.getEuca())) { // Eucalyptus?? log.debug("DnsProcess:stopDnsNormalEuca[internal=true, vpc=euca]"); stopDnsNormal(instanceNo); } else { if (BooleanUtils.isTrue(platformAws.getVpc())) { // VPC???? log.debug("DnsProcess:stopDnsVpc[internal=true, vpc=true]"); stopDnsNormal(instanceNo); } else { // VPC???? log.debug("DnsProcess:stopDnsNormalEc2[internal=true, vpc=false]"); stopDnsNormalEc2(instanceNo); } } } else { // ??? // Windows???VPN??? Image image = imageDao.read(instance.getImageNo()); if (StringUtils.startsWithIgnoreCase(image.getOs(), PCCConstant.OS_NAME_WIN)) { log.debug("DnsProcess:stopDnsNormalEc2[internal=false, os=windows]"); stopDnsNormalEc2(instanceNo); } else { // VPN???? log.debug("DnsProcess:stopDnsVpn[internal=false, os=linux]VPC+VPN"); stopDnsNormal(instanceNo); } } } // processLogger.writeLogSupport(ProcessLogger.LOG_DEBUG, null, instance, "DnsUnregist", new Object[] { instance.getFqdn(), instance.getPublicIp() }); }
From source file:mediathekplugin.Database.java
public ArrayList<MediathekProgramItem> getMediathekPrograms(final Program program) { ArrayList<MediathekProgramItem> result = new ArrayList<MediathekProgramItem>(); String channelName = unifyChannelName(program.getChannel().getName()); HashMap<Long, ArrayList<Integer>> programsMap = mChannelItems.get(channelName); // search parts in brackets like for ARD if (programsMap == null && channelName.contains("(")) { String bracketPart = StringUtils.substringBetween(channelName, "(", ")"); programsMap = mChannelItems.get(bracketPart); }//from w w w . j a v a 2 s. c o m // search for partial name, if full name is not found if (programsMap == null && channelName.contains(" ")) { String firstPart = StringUtils.substringBefore(channelName, " "); programsMap = mChannelItems.get(firstPart); } if (programsMap == null) { for (Entry<String, HashMap<Long, ArrayList<Integer>>> entry : mChannelItems.entrySet()) { if (StringUtils.startsWithIgnoreCase(channelName, entry.getKey())) { programsMap = entry.getValue(); break; } } } if (programsMap == null) { return result; } String title = program.getTitle(); ArrayList<Integer> programs = programsMap.get(getKey(title)); if (programs == null && title.endsWith(")") && title.contains("(")) { String newTitle = StringUtils.substringBeforeLast(title, "(").trim(); programs = programsMap.get(getKey(newTitle)); } if (programs == null && title.endsWith("...")) { String newTitle = title.substring(0, title.length() - 3).trim(); programs = programsMap.get(getKey(newTitle)); } if (programs == null) { return result; } try { RandomAccessFile file = new RandomAccessFile(new File(mFileName), "r"); for (Integer byteOffset : programs) { file.seek(byteOffset); String lineEncoded = file.readLine(); String line = new String(lineEncoded.getBytes(), "UTF-8"); Matcher itemMatcher = ITEM_PATTERN.matcher(line); if (itemMatcher.find()) { String itemTitle = itemMatcher.group(3).trim(); String itemUrl = itemMatcher.group(4).trim(); result.add(new MediathekProgramItem(itemTitle, itemUrl, null)); } } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return result; }
From source file:com.alibaba.otter.manager.web.home.module.action.CanalAction.java
/** * canal// w w w . ja v a 2s . c o m */ public void doEdit(@FormGroup("canalInfo") Group canalInfo, @FormGroup("canalParameterInfo") Group canalParameterInfo, @FormField(name = "formCanalError", group = "canalInfo") CustomErrors err, @FormField(name = "formHeartBeatError", group = "canalParameterInfo") CustomErrors heartBeatErr, Navigator nav) throws Exception { Canal canal = new Canal(); CanalParameter parameter = new CanalParameter(); canalInfo.setProperties(canal); canalParameterInfo.setProperties(parameter); String zkClustersString = canalParameterInfo.getField("zkClusters").getStringValue(); String[] zkClusters = StringUtils.split(zkClustersString, ";"); parameter.setZkClusters(Arrays.asList(zkClusters)); Long zkClusterId = canalParameterInfo.getField("autoKeeperClusterId").getLongValue(); parameter.setZkClusterId(zkClusterId); String dbAddressesString = canalParameterInfo.getField("groupDbAddresses").getStringValue(); if (StringUtils.isNotEmpty(dbAddressesString)) { List<List<DataSourcing>> dbSocketAddress = new ArrayList<List<DataSourcing>>(); String[] dbAddresses = StringUtils.split(dbAddressesString, ";"); for (String dbAddressString : dbAddresses) { List<DataSourcing> groupDbSocketAddress = new ArrayList<DataSourcing>(); String[] groupDbAddresses = StringUtils.split(dbAddressString, ","); for (String groupDbAddress : groupDbAddresses) { String strs[] = StringUtils.split(groupDbAddress, ":"); InetSocketAddress address = new InetSocketAddress(strs[0].trim(), Integer.valueOf(strs[1])); SourcingType type = parameter.getSourcingType(); if (strs.length > 2) { type = SourcingType.valueOf(strs[2]); } groupDbSocketAddress.add(new DataSourcing(type, address)); } dbSocketAddress.add(groupDbSocketAddress); } parameter.setGroupDbAddresses(dbSocketAddress); } String positionsString = canalParameterInfo.getField("positions").getStringValue(); if (StringUtils.isNotEmpty(positionsString)) { String positions[] = StringUtils.split(positionsString, ";"); parameter.setPositions(Arrays.asList(positions)); } if (parameter.getDetectingEnable() && StringUtils.startsWithIgnoreCase(parameter.getDetectingSQL(), "select")) { heartBeatErr.setMessage("invaliedHeartBeat"); return; } canal.setCanalParameter(parameter); try { canalService.modify(canal); } catch (RepeatConfigureException rce) { err.setMessage("invalidCanal"); return; } nav.redirectToLocation("canalList.htm"); }
From source file:io.apiman.plugins.keycloak_oauth_policy.KeycloakOauthPolicy.java
private String getRawAuthToken(ApiRequest request) { String rawToken = StringUtils.strip(request.getHeaders().get(AUTHORIZATION_KEY)); if (rawToken != null && StringUtils.startsWithIgnoreCase(rawToken, BEARER)) { rawToken = StringUtils.removeStartIgnoreCase(rawToken, BEARER); } else {/* w w w . j ava2s . co m*/ rawToken = request.getQueryParams().get(ACCESS_TOKEN_QUERY_KEY); } return rawToken; }