Example usage for org.apache.commons.lang3 StringUtils equalsIgnoreCase

List of usage examples for org.apache.commons.lang3 StringUtils equalsIgnoreCase

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils equalsIgnoreCase.

Prototype

public static boolean equalsIgnoreCase(final CharSequence str1, final CharSequence str2) 

Source Link

Document

Compares two CharSequences, returning true if they represent equal sequences of characters, ignoring case.

null s are handled without exceptions.

Usage

From source file:com.willwinder.universalgcodesender.GrblUtils.java

public static boolean isOkResponse(String response) {
    return StringUtils.equalsIgnoreCase(response, "ok");
}

From source file:com.glaf.core.db.TransformTable.java

public void transformQueryToTable(String tableName, String queryId, String sourceSystemName) {
    TableDefinition tableDefinition = getTableDefinitionService().getTableDefinition(tableName);
    QueryDefinition queryDefinition = getQueryDefinitionService().getQueryDefinition(queryId);
    if (queryDefinition != null && tableDefinition != null
            && StringUtils.isNotEmpty(tableDefinition.getAggregationKeys())) {
        Map<String, Object> params = SystemConfig.getContextMap();
        List<ColumnDefinition> columns = DBUtils.getColumnDefinitions(tableName);
        Map<String, ColumnDefinition> columnMap = new java.util.HashMap<String, ColumnDefinition>();

        for (ColumnDefinition column : columns) {
            columnMap.put(column.getColumnName(), column);
            columnMap.put(column.getColumnName().toLowerCase(), column);
        }//from w  w w.  ja v a  2  s . co  m

        List<String> keys = StringTools.split(tableDefinition.getAggregationKeys());
        StringBuffer sb = new StringBuffer(1000);

        List<ColumnModel> cellModelList = new java.util.ArrayList<ColumnModel>();
        Map<String, TableModel> resultMap = new java.util.HashMap<String, TableModel>();

        if (queryDefinition.getSql() != null) {
            String sql = queryDefinition.getSql();
            sql = QueryUtils.replaceSQLVars(sql);
            sql = QueryUtils.replaceSQLParas(sql, params);
            logger.debug("sql=" + sql);
            String systemName = Environment.getCurrentSystemName();
            try {
                Environment.setCurrentSystemName(sourceSystemName);
                List<Map<String, Object>> rows = getTablePageService().getListData(sql, params);
                if (rows != null && !rows.isEmpty()) {
                    logger.debug(queryDefinition.getTitle() + " " + rows.size());
                    logger.debug("RotatingFlag:" + queryDefinition.getRotatingFlag());
                    logger.debug("RotatingColumn:" + queryDefinition.getRotatingColumn());
                    /**
                     * ????
                     */
                    if (StringUtils.equalsIgnoreCase(queryDefinition.getRotatingFlag(), "R2C")
                            && StringUtils.isNotEmpty(queryDefinition.getRotatingColumn())
                            && rows.size() == 1) {
                        Map<String, Object> dataMap = rows.get(0);
                        logger.debug("?dataMap?:" + dataMap);
                        ColumnDefinition idField = columnMap.get(keys.get(0).toLowerCase());
                        ColumnDefinition field = columnMap
                                .get(queryDefinition.getRotatingColumn().toLowerCase());
                        if (idField != null && field != null) {
                            String javaType = field.getJavaType();
                            List<TableModel> list = new ArrayList<TableModel>();
                            Set<Entry<String, Object>> entrySet = dataMap.entrySet();
                            for (Entry<String, Object> entry : entrySet) {
                                String key = entry.getKey();
                                Object value = entry.getValue();
                                if (key == null || value == null) {
                                    continue;
                                }
                                TableModel tableModel = new TableModel();
                                tableModel.setTableName(queryDefinition.getTargetTableName());
                                ColumnModel cell = new ColumnModel();
                                cell.setColumnName(queryDefinition.getRotatingColumn());
                                cell.setType(javaType);

                                // logger.debug(cell.getColumnName()+"->"+javaType);

                                if ("String".equals(javaType)) {
                                    cell.setStringValue(ParamUtils.getString(dataMap, key));
                                    cell.setValue(cell.getStringValue());
                                } else if ("Integer".equals(javaType)) {
                                    cell.setIntValue(ParamUtils.getInt(dataMap, key));
                                    cell.setValue(cell.getIntValue());
                                } else if ("Long".equals(javaType)) {
                                    cell.setLongValue(ParamUtils.getLong(dataMap, key));
                                    cell.setValue(cell.getLongValue());
                                } else if ("Double".equals(javaType)) {
                                    cell.setDoubleValue(ParamUtils.getDouble(dataMap, key));
                                    cell.setValue(cell.getDoubleValue());
                                } else if ("Date".equals(javaType)) {
                                    cell.setDateValue(ParamUtils.getDate(dataMap, key));
                                    cell.setValue(cell.getDateValue());
                                } else {
                                    cell.setValue(value);
                                }

                                tableModel.addColumn(cell);

                                ColumnModel idColumn = new ColumnModel();
                                idColumn.setColumnName(keys.get(0));
                                idColumn.setJavaType(idField.getJavaType());
                                idColumn.setValue(key);
                                tableModel.setIdColumn(idColumn);
                                list.add(tableModel);
                            }
                            logger.debug("update datalist:" + list);
                            Environment.setCurrentSystemName(systemName);
                            getTableDataService().updateTableData(list);
                        }
                    } else {
                        Set<String> cols = new HashSet<String>();
                        for (Map<String, Object> dataMap : rows) {
                            sb.delete(0, sb.length());
                            cols.clear();
                            cellModelList.clear();

                            Set<Entry<String, Object>> entrySet = dataMap.entrySet();
                            for (Entry<String, Object> entry : entrySet) {
                                String key = entry.getKey();
                                Object value = entry.getValue();
                                if (key == null || value == null) {
                                    continue;
                                }
                                /**
                                 * ????
                                 */
                                if (cols.contains(key.toLowerCase())) {
                                    continue;
                                }
                                if (columnMap.get(key.toLowerCase()) == null) {
                                    continue;
                                }

                                if (keys.contains(key)) {
                                    sb.append(value).append("_");
                                }

                                ColumnDefinition column = columnMap.get(key.toLowerCase());
                                String javaType = column.getJavaType();

                                ColumnModel cell = new ColumnModel();
                                cell.setColumnName(column.getColumnName());
                                cell.setType(javaType);

                                if ("String".equals(javaType)) {
                                    cell.setStringValue(ParamUtils.getString(dataMap, key));
                                    cell.setValue(cell.getStringValue());
                                } else if ("Integer".equals(javaType)) {
                                    cell.setIntValue(ParamUtils.getInt(dataMap, key));
                                    cell.setValue(cell.getIntValue());
                                } else if ("Long".equals(javaType)) {
                                    cell.setLongValue(ParamUtils.getLong(dataMap, key));
                                    cell.setValue(cell.getLongValue());
                                } else if ("Double".equals(javaType)) {
                                    cell.setDoubleValue(ParamUtils.getDouble(dataMap, key));
                                    cell.setValue(cell.getDoubleValue());
                                } else if ("Date".equals(javaType)) {
                                    cell.setDateValue(ParamUtils.getDate(dataMap, key));
                                    cell.setValue(cell.getDateValue());
                                } else {
                                    cell.setValue(value);
                                }

                                cellModelList.add(cell);
                                cols.add(cell.getColumnName());
                            }

                            /**
                             * ??
                             */
                            if (sb.toString().endsWith("_")) {
                                sb.delete(sb.length() - 1, sb.length());
                                String rowKey = sb.toString();
                                logger.debug("rowKey=" + rowKey);
                                TableModel rowModel = resultMap.get(rowKey);
                                if (rowModel == null) {
                                    rowModel = new TableModel();
                                    ColumnModel cell01 = new ColumnModel();
                                    cell01.setColumnName("ID");
                                    cell01.setType("String");
                                    cell01.setValueExpression(ExpressionConstants.ID_EXPRESSION);
                                    cols.add("ID");
                                    rowModel.addColumn(cell01);
                                    rowModel.setIdColumn(cell01);

                                    ColumnModel cell04 = new ColumnModel();
                                    cell04.setColumnName("AGGREGATIONKEY");
                                    cell04.setType("String");
                                    cols.add("AGGREGATIONKEY");
                                    rowModel.addColumn(cell04);

                                    resultMap.put(rowKey, rowModel);
                                }

                                for (ColumnModel cell : cellModelList) {
                                    /**
                                     * ??
                                     */
                                    if (columnMap.get(cell.getColumnName().toLowerCase()) != null) {
                                        rowModel.addColumn(cell);
                                    }
                                }
                            }
                        }
                    }
                }
            } catch (Exception ex) {
                ex.printStackTrace();
                throw new RuntimeException(ex);
            } finally {
                Environment.setCurrentSystemName(systemName);
            }
        }

        TableModel rowModel = new TableModel();
        rowModel.setTableName(tableName);
        rowModel.setAggregationKey(tableDefinition.getAggregationKeys());

        ColumnModel cell01 = new ColumnModel();
        cell01.setColumnName("ID");
        cell01.setType("String");
        cell01.setValueExpression(ExpressionConstants.ID_EXPRESSION);
        rowModel.addColumn(cell01);
        rowModel.setIdColumn(cell01);

        ColumnModel cell04 = new ColumnModel();
        cell04.setColumnName("AGGREGATIONKEY");
        cell04.setType("String");
        rowModel.addColumn(cell04);

        for (ColumnDefinition column : columns) {
            ColumnModel cell = new ColumnModel();
            cell.setColumnName(column.getColumnName());
            cell.setType(column.getJavaType());
            rowModel.addColumn(cell);
        }

        Collection<TableModel> rows = resultMap.values();
        logger.debug("fetch data list size:" + rows.size());
        if (rows.size() > 0) {
            String seqNo = rowModel.getTableName() + "-" + DateUtils.getDateTime(new Date());
            getTableDataService().saveAll(rowModel.getTableName(), seqNo, rows);
        }
    }
}

From source file:com.nridge.core.base.doc.Document.java

/**
 * Returns <i>true</i> if the feature was previously
 * added and its value matches the one provided as a
 * parameter./*  www.  j a  v  a 2s . c  o  m*/
 *
 * @param aName Feature name.
 * @param aValue Feature value to match.
 *
 * @return <i>true</i> or <i>false</i>
 */
public boolean isFeatureEqual(String aName, String aValue) {
    String featureValue = getFeature(aName);
    return StringUtils.equalsIgnoreCase(featureValue, aValue);
}

From source file:gob.dp.simco.analisis.controller.AnalisisController.java

public boolean saveTema() {
    for (Tema t : temas) {
        if (StringUtils.equalsIgnoreCase(tema.getDetalle(), t.getDetalle())) {
            msg.messageAlert("El tema ingresado ya se encuentra registrado", null);
            tema = new Tema();
            return false;
        }//  w ww .  j a  v a2  s .  co  m
    }
    tema.setCaso(caso);
    temaService.temaInsertar(tema);
    listarTemas(caso.getId());
    tema = new Tema();
    msg.messageInfo("Se registro un nuevo tema para el analisis", null);
    return true;
}

From source file:ec.edu.chyc.manejopersonal.managebean.GestorArticulo.java

/**
 * Lee el archivo bibtex y llena los campos del artculo segn exista en el bibtex
 * @param pathBibtex Ruta del archivo bibtex
 *///from   w  ww . j a v a 2  s .c  o  m
public void leerBibtex(Path pathBibtex) {
    try {
        BibTeXParser bibtexParser = new BibTeXParser();

        String stringUnida = unirStringBibtex(pathBibtex);
        if (stringUnida.indexOf("\0") >= 0) {
            try {
                stringUnida = stringUnida.replace("\0", "");
                String decoded = new String(stringUnida.getBytes("ISO-8859-1"), "UTF-8");
                stringUnida = decoded;
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(GestorArticulo.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        //stringUnida = stringUnida.replace("\0", "");
        StringReader stringReader = new StringReader(stringUnida);

        BibTeXDatabase database = bibtexParser.parse(stringReader);

        Map<Key, BibTeXEntry> entryMap = database.getEntries();
        BibTeXEntry firstEntry = null;
        for (Map.Entry<Key, BibTeXEntry> entry : entryMap.entrySet()) {
            if (firstEntry == null) {
                firstEntry = entry.getValue();
                break;
            }
            //break;
            //System.out.println(entry.getKey() + "/" + entry.getValue());
        }
        if (firstEntry != null) {
            Value valTitulo = firstEntry.getField(BibTeXEntry.KEY_TITLE);
            Value valRevista = firstEntry.getField(BibTeXEntry.KEY_JOURNAL);
            Value valPublicado = firstEntry.getField(BibTeXEntry.KEY_YEAR);
            Value valAutores = firstEntry.getField(BibTeXEntry.KEY_AUTHOR);
            //Value valAutores = firstEntry.getField(BibTeXEntry.KEY_ADDRESS)
            Key keyAbstract = new Key("abstract");
            Value valAbstract = firstEntry.getField(keyAbstract);

            Key keyUrl = new Key("url");
            Value valUrl = firstEntry.getField(keyUrl);

            if (firstEntry.getType().equals(BibTeXEntry.TYPE_ARTICLE)) {
                articulo.setTipo(TipoArticulo.SCOPUS);
            } else if (firstEntry.getType().equals(BibTeXEntry.TYPE_BOOK)) {
                articulo.setTipo(TipoArticulo.LIBRO);
            } else if (firstEntry.getType().equals(BibTeXEntry.TYPE_TECHREPORT)) {
                articulo.setTipo(TipoArticulo.NOTA_TECNICA);
            } else if (firstEntry.getType().equals(BibTeXEntry.TYPE_MASTERSTHESIS)) {
                articulo.setTipo(TipoArticulo.TESIS);
            }
            articulo.setNombre(BeansUtils.value2String(valTitulo));
            articulo.setRevista(BeansUtils.value2String(valRevista));
            articulo.setResumen(BeansUtils.value2String(valAbstract));
            articulo.setEnlace(BeansUtils.value2String(valUrl));
            String strAutoresBibtex = BeansUtils.value2String(valAutores);

            if (valPublicado != null) {
                int anio = Integer.parseInt(valPublicado.toUserString());
                articulo.setAnioPublicacion(anio);
            }
            if (valAutores != null) {
                Persona personaVacia = personaController.obtenerPersonaVacia();
                String autores[] = strAutoresBibtex.split(" and ");
                Arrays.stream(autores).forEach(autor -> System.out.println("Autor: " + autor));
                List<String> firmasAutores = Arrays.asList(autores);
                try {
                    //List<Firma> listaFirmasExistentes = personaController.findFirmas(firmasAutores);
                    //buscar personas que lleven las firmas indicadas en el bibtex
                    List<Persona> listaPersonasConFirmaExistentes = personaController
                            .findPersonaConFirma(firmasAutores);

                    for (String strFirmaBibtex : firmasAutores) {
                        boolean encontrado = false;//valdr true al encontrar la persona que tenga la firma que est en el bibtex
                        for (Persona per : listaPersonasConFirmaExistentes) {
                            for (PersonaFirma perFirma : per.getPersonaFirmasCollection()) {
                                if (StringUtils.equalsIgnoreCase(perFirma.getFirma().getNombre(),
                                        strFirmaBibtex)) {
                                    encontrado = true;
                                    if (per.getId().equals(personaVacia.getId())) {//si la firma pertenece al id=1 (general), agregar sin colocar datos de autor
                                        agregarFirmaSinAutor(personaVacia, strFirmaBibtex);
                                    } else { //agregar los datos del autor
                                        agregarNuevoAutor(per, strFirmaBibtex);
                                    }
                                    break;
                                }

                            }
                        }

                        if (!encontrado) {
                            //cuando no se encontro la firma del bibtex en la base de datos, por lo tanto es una firma de 
                            // un desconocido (persona externa al departamento)

                            agregarFirmaSinAutor(personaVacia, strFirmaBibtex);
                        }
                    }

                } catch (Exception ex) {
                    Logger.getLogger(GestorArticulo.class.getName()).log(Level.SEVERE, null, ex);
                }
            }

        }
    } catch (ParseException | TokenMgrException | FileNotFoundException ex) {
        Logger.getLogger(GestorArticulo.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.glaf.dts.web.rest.MxTableResource.java

@POST
@Path("/transformQueryToTable")
@ResponseBody/*from w  w  w  . j  ava  2s  .  c om*/
@Produces({ MediaType.APPLICATION_OCTET_STREAM })
public byte[] transformQueryToTable(@Context HttpServletRequest request) {
    String queryId = request.getParameter("queryId");
    String tableName = request.getParameter("tableName");
    String tableName_enc = request.getParameter("tableName_enc");

    if (StringUtils.isNotEmpty(tableName_enc)) {
        tableName = RequestUtils.decodeString(tableName_enc);
    }
    if (StringUtils.isNotEmpty(tableName) && StringUtils.isNotEmpty(queryId)) {
        tableName = tableName.toLowerCase();
        if (StringUtils.startsWith(tableName, "mx_") || StringUtils.startsWith(tableName, "sys_")
                || StringUtils.startsWith(tableName, "act_") || StringUtils.startsWith(tableName, "jbpm_")) {
            return ResponseUtils.responseJsonResult(false, "??");
        }
        MxTransformManager manager = new MxTransformManager();
        TableDefinition tableDefinition = null;
        try {
            QueryDefinition queryDefinition = null;

            if (StringUtils.isNotEmpty(queryId)) {
                queryDefinition = queryDefinitionService.getQueryDefinition(queryId);
            }

            if (queryDefinition == null) {
                queryDefinition = new QueryDefinition();
            }

            Map<String, Object> params = RequestUtils.getParameterMap(request);
            Tools.populate(queryDefinition, params);
            queryDefinition.setTargetTableName(tableName);

            tableDefinition = manager.toTableDefinition(queryDefinition);
            tableDefinition.setTableName(tableName);
            tableDefinition.setType("DTS");
            tableDefinition.setNodeId(queryDefinition.getNodeId());

            if (!StringUtils.equalsIgnoreCase(queryDefinition.getRotatingFlag(), "R2C")) {
                TransformTable tbl = new TransformTable();
                tbl.createOrAlterTable(tableDefinition);
            }

        } catch (Exception ex) {
            ex.printStackTrace();
            return ResponseUtils.responseJsonResult(false, "SQL???");
        }

        Long databaseId = RequestUtils.getLong(request, "databaseId");
        TransformTable transformTable = new TransformTable();
        try {
            Database db = databaseService.getDatabaseById(databaseId);
            if (db != null) {
                transformTable.transformQueryToTable(tableName, queryId, db.getName());
            } else {
                transformTable.transformQueryToTable(tableName, queryId, Environment.DEFAULT_SYSTEM_NAME);
            }
            return ResponseUtils.responseJsonResult(true);
        } catch (Exception ex) {
            ex.printStackTrace();
            return ResponseUtils.responseJsonResult(false);
        }
    }
    return ResponseUtils.responseJsonResult(false);
}

From source file:com.dgtlrepublic.anitomyj.ParserNumber.java

/**
 * Searches for the last number token in a list of {@code tokens}.
 *
 * @param tokens the list of tokens//from  w  w  w .  j a  v  a2  s  . c om
 * @return true if the last number token was found
 */
public boolean searchForLastNumber(List<Result> tokens) {
    for (int i = tokens.size() - 1; i >= 0; i--) {
        Result it = tokens.get(i);

        // Assuming that episode number always comes after the title, first token
        // cannot be what we're looking for
        if (it.pos == 0)
            continue;

        if (it.token.isEnclosed())
            continue;

        // Ignore if it's the first non-enclosed, non-delimiter token
        if (parser.getTokens().subList(0, it.pos).stream()
                .allMatch(r -> r.isEnclosed() || r.getCategory() == kDelimiter)) {
            continue;
        }

        // Ignore if the previous token is "Movie" or "Part"
        Result previousToken = Token.findPrevToken(parser.getTokens(), it, TokenFlag.kFlagNotDelimiter);
        if (ParserHelper.isTokenCategory(previousToken, kUnknown)) {
            if (StringUtils.equalsIgnoreCase(previousToken.token.getContent(), "Movie")
                    || StringUtils.equalsIgnoreCase(previousToken.token.getContent(), "Part")) {
                continue;
            }
        }

        // We'll use this number after all
        if (setEpisodeNumber(it.token.getContent(), it.token, true))
            return true;
    }

    return false;
}

From source file:chibi.gemmaanalysis.LinkEvalCli.java

@Override
protected void processOptions() {
    super.processOptions();
    initBeans();//ww w  .ja  va  2 s.c om
    String commonName = getOptionValue('t');
    if (StringUtils.isBlank(commonName)) {
        System.out.println("MUST enter a valid taxon!");
        System.exit(0);
    }
    if (!StringUtils.equalsIgnoreCase("mouse", commonName) && !StringUtils.equalsIgnoreCase("rat", commonName)
            && !StringUtils.equalsIgnoreCase("human", commonName)) {
        System.out.println("MUST enter a valid taxon!");
        System.exit(0);
    }

    this.taxon = taxonService.findByCommonName(commonName);
    if (taxon == null) {
        System.out.println("Taxon " + commonName + " not found.");
        System.exit(0);
    }
    String input = getOptionValue('d');
    if (StringUtils.isBlank(input)) {
        System.out.println("You MUST enter a valid filename OR size of dataset");
        System.exit(0);
    }
    this.adShortName = getOptionValue("array");
    if (StringUtils.isBlank(this.adShortName)) {
        System.out.println("You MUST enter the shortname for the associated platform");
        System.exit(0);
    }
    if (StringUtils.isNumeric(input)) {// set size entered
        if (this.adShortName.equals("n/a")) {
            this.randomFromTaxon = true;
        } else {
            this.randomFromArray = true;
        }

        SET_SIZE = Integer.parseInt(input);
        if (SET_SIZE < 1) {
            System.out.println("Random set size must be a positive integer");
            System.exit(0);
        }
        System.out.println("Will create a set of " + SET_SIZE + " random gene pairs!");
        if (this.hasOption("runs")) {
            String runs = getOptionValue("runs");
            if (StringUtils.isNumeric(runs)) {
                numberOfRandomRuns = Integer.parseInt(runs);
                if (numberOfRandomRuns < 1) {
                    System.out.println("Number of random runs must be a positive integer");
                    System.exit(0);
                }
            } else {
                System.out.println("Number of random runs must be a numeric value");
                System.exit(0);
            }
        }
    } else {// path to input file entered
        File f = new File(input);
        if (f.canRead()) {
            this.file_path = input;
            if (this.hasOption("subset")) {
                String size = getOptionValue("subset");
                if (StringUtils.isNumeric(size)) {
                    this.subsetSize = Double.parseDouble(size);
                    this.selectSubset = true;
                    log.info("Approximate subset of scores desired");
                } else {
                    System.out.println("Subset size must be a numeric value");
                    System.exit(0);
                }
            }
        } else {
            System.out.println(
                    input + "is NOT a valid filename! You MUST enter a valid filename OR size of dataset");
            System.exit(0);
        }
    }
    if (hasOption('x')) {
        String maxs = getOptionValue('x');
        if (maxs.equalsIgnoreCase("MAX"))
            this.max = true;
        else
            this.max = false;
    }

    if (hasOption('w')) {
        String weights = getOptionValue('w');
        if (weights.equalsIgnoreCase("weight"))
            this.weight = true;
        else
            this.weight = false;
    }

    if (hasOption("termsout")) {
        this.termsOutPath = getOptionValue("termsout");
        log.info("GO mapping will be saved as tabbed text to " + this.termsOutPath);
    }

    if (hasOption('m')) {
        String metricName = getOptionValue('m');
        if (metricName.equalsIgnoreCase("resnik"))
            this.metric = GoMetric.Metric.resnik;
        else if (metricName.equalsIgnoreCase("lin"))
            this.metric = GoMetric.Metric.lin;
        else if (metricName.equalsIgnoreCase("jiang"))
            this.metric = GoMetric.Metric.jiang;
        else if (metricName.equalsIgnoreCase("percent"))
            this.metric = GoMetric.Metric.percent;
        else if (metricName.equalsIgnoreCase("cosine"))
            this.metric = GoMetric.Metric.cosine;
        else if (metricName.equalsIgnoreCase("kappa"))
            this.metric = GoMetric.Metric.kappa;
        else {
            this.metric = GoMetric.Metric.simple;
            this.max = false;
        }
    }

    if (this.hasOption("g1col")) {
        this.firstProbeColumn = getIntegerOptionValue("g1col");
    }

    if (this.hasOption("g2col")) {
        this.secondProbeColumn = getIntegerOptionValue("g2col");
    }

    if (this.hasOption("noZeroGo")) {
        this.noZeros = true;
    }

    if (this.hasOption("print")) {
        this.printRandomLinks = true;
        this.outRandLinksFile = getOptionValue("print");
        if (StringUtils.isBlank(outRandLinksFile)) {
            System.out.println("You must enter an output file path for printing random probe pairs");
            System.exit(0);
        }
    }

    if (this.hasOption("probenames")) {
        this.randomFromSubset = true;
        this.probenames_file_path = getOptionValue("probenames");
    }

    if (this.hasOption("aspect")) {
        String aspect = getOptionValue("aspect");
        if (aspect.equals("mf")) {
            this.goAspectToUse = GOAspect.MOLECULAR_FUNCTION;
        } else if (aspect.equals("bp")) {
            this.goAspectToUse = GOAspect.BIOLOGICAL_PROCESS;
        } else if (aspect.equals("cc")) {
            this.goAspectToUse = GOAspect.CELLULAR_COMPONENT;

        } else {
            System.out.println("Aspect must be one of bp, mf or cc");
            System.exit(0);
        }
    }

    outFile = getOptionValue('o');
    initGO();
}

From source file:com.glaf.core.web.springmvc.MxSystemDbTableController.java

@RequestMapping("/resultList")
public ModelAndView resultList(HttpServletRequest request, ModelMap modelMap) {
    String jx_view = request.getParameter("jx_view");
    RequestUtils.setRequestParameterToAttribute(request);
    String tableName = request.getParameter("tableName_enc");
    if (StringUtils.isNotEmpty(tableName)) {
        tableName = RequestUtils.decodeString(tableName);
    } else {/*from ww  w .j a  v  a 2s .  c  om*/
        tableName = request.getParameter("tableName");
    }
    List<ColumnDefinition> columns = null;
    try {
        if (StringUtils.isNotEmpty(tableName)) {
            columns = DBUtils.getColumnDefinitions(tableName);
            modelMap.put("columns", columns);
            modelMap.put("tableName_enc", RequestUtils.encodeString(tableName));
            List<String> pks = DBUtils.getPrimaryKeys(tableName);
            if (pks != null && !pks.isEmpty()) {
                if (pks.size() == 1) {
                    modelMap.put("primaryKey", pks.get(0));
                    for (ColumnDefinition column : columns) {
                        if (StringUtils.equalsIgnoreCase(pks.get(0), column.getColumnName())) {
                            modelMap.put("idColumn", column);
                            break;
                        }
                    }
                }
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
        logger.error(ex);
    }

    if (StringUtils.isNotEmpty(jx_view)) {
        return new ModelAndView(jx_view, modelMap);
    }

    String x_view = ViewProperties.getString("sys_table.resultList");
    if (StringUtils.isNotEmpty(x_view)) {
        return new ModelAndView(x_view, modelMap);
    }
    return new ModelAndView("/modules/sys/table/resultList", modelMap);
}

From source file:com.glaf.core.util.DBUtils.java

/**
 * ?//  w  w  w.  j a  v  a  2s  . c  o m
 * 
 * @param connection
 *            JDBC
 * @param tableDefinition
 *            
 */
public static void dropTable(Connection connection, String tableName) {
    logger.info("check table:" + tableName);
    if (tableExists(connection, tableName)) {
        /**
         * ????
         */
        String dbType = DBConnectionFactory.getDatabaseType(connection);
        if (System.getProperty("devMode") != null || StringUtils.equalsIgnoreCase(dbType, "sqlite")
                || StringUtils.equalsIgnoreCase(dbType, "h2")) {
            Statement statement = null;
            try {
                statement = connection.createStatement();
                logger.info("drop table " + tableName);
                statement.executeUpdate(" drop table " + tableName);
                JdbcUtils.close(statement);
            } catch (Exception ex) {
                ex.printStackTrace();
                throw new RuntimeException(ex);
            } finally {
                JdbcUtils.close(statement);
            }
        }
    }
}