Example usage for java.lang String toLowerCase

List of usage examples for java.lang String toLowerCase

Introduction

In this page you can find the example usage for java.lang String toLowerCase.

Prototype

public String toLowerCase() 

Source Link

Document

Converts all of the characters in this String to lower case using the rules of the default locale.

Usage

From source file:oracle.custom.ui.oauth.vo.OpenIdConfiguration.java

public static OpenIdConfiguration getInstance(String tenantName) throws Exception {
    if (configMap.containsKey(tenantName.toLowerCase())) {
        return configMap.get(tenantName.toLowerCase());
    }//from w  w  w . j  av a2  s  .c o m
    String url = ServerUtils.getIDCSBaseURL(tenantName) + endpoint;
    System.out.println("URL for tenant '" + tenantName + "' is '" + url + "'");
    HttpClient client = ServerUtils.getClient(tenantName);
    URI uri = new URI(url);
    HttpGet get = new HttpGet(uri);
    HttpHost host = new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme());
    HttpResponse response = client.execute(host, get);
    try {
        HttpEntity entity2 = response.getEntity();
        String res = EntityUtils.toString(entity2);
        EntityUtils.consume(entity2);
        ObjectMapper mapper = new ObjectMapper();
        //res = res.replaceAll("secureoracle.idcs.internal.oracle.com:443", "oc-140-86-12-131.compute.oraclecloud.com");
        OpenIdConfiguration openIdConfigInstance = mapper.readValue(res, OpenIdConfiguration.class);

        configMap.put(tenantName.toLowerCase(), openIdConfigInstance);
        return openIdConfigInstance;
    } finally {
        if (response instanceof CloseableHttpResponse) {
            ((CloseableHttpResponse) response).close();
        }
    }
}

From source file:com.cognifide.aet.executor.xmlparser.xml.utils.ValidationUtils.java

public static String validateLowerCase(String string, String warnMessage) {
    String fixedString = string.toLowerCase();
    if (!StringUtils.equals(string, fixedString)) {
        LOGGER.warn(warnMessage);/*from  w w  w . j  av  a  2s.c om*/
    }
    return fixedString;
}

From source file:com.thoughtworks.go.util.TriState.java

public static TriState from(String booleanLike) {
    if (StringUtils.isBlank(booleanLike)) {
        return UNSET;
    }//ww  w  . j av a  2s .  c o  m
    if (booleanLike.toLowerCase().equals("false")) {
        return FALSE;
    }
    if (booleanLike.toLowerCase().equals("true")) {
        return TRUE;
    }
    throw new IllegalArgumentException(
            String.format("The string '%s' does not look like a boolean.", booleanLike));
}

From source file:edu.pitt.dbmi.ipm.service.EnterpriseAnalytics.java

/**
 * //from ww w. j ava2  s .co m
 * @param diseaseAbbr
 *            - example: "brca", "ov", "hnsc"
 * @param tssName
 *            - name of tissue source site for ex.
 *            "University of Pittsburgh"
 * @return number of patients for a particular disease and tss as JsonObject
 * @throws QueryException
 */
public static JSONObject countPatientsByTSS(String diseaseAbbr, String tssName) throws QueryException {
    initParams();

    String q = count_patients_by_tss_Q.replace("<diseaseAbbr>", diseaseAbbr.toLowerCase());
    q = q.replace("<tssName>", tssName);
    try {
        return StorageFactory.getStorage().getJSONResult(StorageFactory.getStorage().getSparqlURL(), q);
    } catch (QueryException e) {
        throw e;
    }

}

From source file:Main.java

/**
 * Makes an absolute URI from the relative id. If the given
 * id is already an URI, it will be returned unchanged.
 * /*from   w  ww  .j  a  va  2 s  . c  o m*/
 * @param id A relative id
 * @param resType For example <em>track</em> (without namespace!)
 * 
 * @return An absolute URI
 */
public static String convertIdToURI(String id, String resType) {
    URI absolute;
    try {
        absolute = new URI(id);
    } catch (URISyntaxException e) {
        return "http://musicbrainz.org/" + resType.toLowerCase() + "/" + id;
    }
    if (absolute.getScheme() == null) {
        return "http://musicbrainz.org/" + resType.toLowerCase() + "/" + id;
    }

    // may be already an absolute URI
    return id;
}

From source file:de.bund.bfr.knime.pmm.common.chart.ChartUtilities.java

public static void saveChartAs(JFreeChart chart, String fileName, int width, int height) {
    if (fileName.toLowerCase().endsWith(".png")) {
        try {//  ww  w .  j a  v a  2s.  co  m
            org.jfree.chart.ChartUtilities.writeChartAsPNG(new FileOutputStream(fileName), chart, width,
                    height);
        } catch (IOException e) {
            e.printStackTrace();
        }
    } else if (fileName.toLowerCase().endsWith(".svg")) {
        try {
            DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation();
            Document document = domImpl.createDocument(null, "svg", null);
            SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
            Writer outsvg = new OutputStreamWriter(new FileOutputStream(fileName), StandardCharsets.UTF_8);

            chart.draw(svgGenerator, new Rectangle2D.Double(0, 0, width, height));
            svgGenerator.stream(outsvg, true);
            outsvg.close();
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (SVGGraphics2DIOException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

From source file:com.hangum.tadpole.rdb.core.editors.main.utils.plan.CubridExecutePlanUtils.java

/**
 * cubrid execute plan//  w  w w  .j av a2s  . c  o m
 * 
 * @param userDB
 * @param reqQuery
 * @return
 * @throws Exception
 */
public static String plan(UserDBDAO userDB, final RequestQuery reqQuery) throws Exception {
    String sql = reqQuery.getSql();
    if (!sql.toLowerCase().startsWith("select")) {
        logger.error("[cubrid execute plan ]" + sql);
        throw new Exception("This statment not select. please check.");
    }
    Connection conn = null;
    ResultSet rs = null;
    PreparedStatement pstmt = null;

    try {
        conn = TadpoleSQLManager.getInstance(userDB).getDataSource().getConnection();
        conn.setAutoCommit(false); //     auto commit? false  .

        sql = StringUtils.trim(sql).substring(6);
        if (logger.isDebugEnabled())
            logger.debug("[qubrid modifying query]" + sql);
        sql = "select " + RECOMPILE + sql;

        pstmt = conn.prepareStatement(sql);
        if (reqQuery.getSqlStatementType() == SQL_STATEMENT_TYPE.PREPARED_STATEMENT) {
            final Object[] statementParameter = reqQuery.getStatementParameter();
            for (int i = 1; i <= statementParameter.length; i++) {
                pstmt.setObject(i, statementParameter[i - 1]);
            }
        }
        ((CUBRIDStatement) pstmt).setQueryInfo(true);
        rs = pstmt.executeQuery();

        String plan = ((CUBRIDStatement) pstmt).getQueryplan(); //  ?    .
        if (logger.isDebugEnabled())
            logger.debug("cubrid plan text : " + plan);

        return plan;
    } finally {
        if (rs != null)
            rs.close();
        if (pstmt != null)
            pstmt.close();
        if (conn != null)
            conn.close();
    }
}

From source file:Main.java

/**
 * /*from  w ww.  ja  v a 2 s .  c  om*/
 * Judge current name of menu whether is same to menuType
 * 
 * @param menuStr is the name of the menu
 * @param menuType is the type which we think it should be
 * @return return true if menuStr is adapt to menuType, else return false
 */
public static boolean judgeMenuType(String menuStr, int menuType) {
    if (menuStr == null) {
        return false;
    }
    switch (menuType) {
    case MENU_VALUE_TYPE:
        return menuStr.toLowerCase().indexOf("values") > -1;//$NON-NLS-1$
    case MENU_VALID_TYPE:
        return menuStr.toLowerCase().indexOf("valid") > -1;//$NON-NLS-1$
    case MENU_INVALID_TYPE:
        return menuStr.toLowerCase().indexOf("invalid") > -1;//$NON-NLS-1$
    default:
        return false;
    }
}

From source file:com.rmn.qa.AutomationUtils.java

/**
 * Returns true if the strings are lower case equal
 * @param string1 First string to compare
 * @param string2 Second string to compare
 * @return//  w ww .  jav  a  2s.c  o  m
 */
public static boolean lowerCaseMatch(String string1, String string2) {
    string2 = string2.toLowerCase().replace(" ", "");
    return string2.equals(string1.toLowerCase().replace(" ", ""));
}

From source file:Main.java

public static String getMimeType(String filePath) {
    if (TextUtils.isEmpty(filePath)) {
        return "";
    }//from w  ww .  j a  v a 2  s  .c  o  m
    String type = null;
    String extension = getExtensionName(filePath.toLowerCase());
    if (!TextUtils.isEmpty(extension)) {
        MimeTypeMap mime = MimeTypeMap.getSingleton();
        type = mime.getMimeTypeFromExtension(extension);
    }
    Log.i(TAG, "url:" + filePath + " " + "type:" + type);

    // FIXME
    if (TextUtils.isEmpty(type) && filePath.endsWith("aac")) {
        type = "audio/aac";
    }

    return type;
}