Example usage for org.apache.commons.lang StringUtils trim

List of usage examples for org.apache.commons.lang StringUtils trim

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils trim.

Prototype

public static String trim(String str) 

Source Link

Document

Removes control characters (char <= 32) from both ends of this String, handling null by returning null.

Usage

From source file:edu.monash.merc.system.parser.GPMDbParser.java

public GPMDbBean parse(InputStream ins, String encoding, GPMDbType gpmDbType) {
    try {/*from  w  ww  .  j  a  v a 2  s .c  o m*/
        String defaultEncoding = "UTF-8";
        if (StringUtils.isNotBlank(encoding)) {
            defaultEncoding = encoding;
        }
        InputStreamReader insReader = new InputStreamReader(ins, Charset.forName(defaultEncoding));
        BufferedReader reader = new BufferedReader(insReader);

        //create a GPMDbBean
        GPMDbBean gpmDbBean = new GPMDbBean();
        //set the GPMDbType
        gpmDbBean.setGpmDbType(gpmDbType);

        List<GPMDbEntryBean> gpmDbEntryBeanList = new ArrayList<GPMDbEntryBean>();
        GPMDbEntryBean gpmDbEntryBean = null;

        String releaseDate = null;
        String nominalMass = null;
        String sequenceAssembly = null;
        String sequenceSource = null;
        String maximumLoge = null;
        String enspAccession = null;
        String ensgAccession = null;
        String enstAccession = null;
        String chromName = null;
        int chromStart = 0;
        int chromEnd = 0;
        String chromStrand = null;
        int modifiedPeptideObs = 0;
        int pos = 0;
        String res = null;
        int obs = 0;
        String line = null;
        int counterIndex = 0;
        while ((line = reader.readLine()) != null) {

            if (StringUtils.isNotBlank(line) && !StringUtils.startsWith(line, "#")) {
                //start to parse the head of psyt file from gpm
                if (StringUtils.startsWith(line, RELEASE_DATE)) {
                    String[] dateLineFields = DMUtil.splitByDelims(line, COLON_DELIM);
                    if (dateLineFields.length != 2) {
                        throw new DMFileException("Invalid gpm psyt file,  the release date is not specified");
                    }
                    //There are a total of 26 release dates, just add the first release date as a primary release date
                    if (StringUtils.isBlank(releaseDate)) {
                        releaseDate = dateLineFields[1];
                        gpmDbBean.setReleaseToken(releaseDate);
                    }
                }

                if (StringUtils.startsWith(line, NOMINAL_MASS)) {
                    String[] nominalMassLineFields = DMUtil.splitByDelims(line, COLON_DELIM);
                    if (nominalMassLineFields.length != 2) {
                        throw new DMFileException(
                                "Invalid gpm psyt file,  the nominal mass number is not specified");
                    }
                    if (StringUtils.isBlank(nominalMass)) {
                        nominalMass = nominalMassLineFields[1];
                        gpmDbBean.setNominalMass(nominalMass);
                    }
                }

                if (StringUtils.startsWith(line, SEQUENCE_ASEMBLY)
                        || StringUtils.startsWith(line, SEQUENCE_ASEMBLY)) {
                    String[] sequenceAssemblyLineFields = DMUtil.splitByDelims(line, COLON_DELIM);
                    if (sequenceAssemblyLineFields.length != 2) {
                        throw new DMFileException(
                                "Invalid gpm psyt file,  the sequence assembly version is not specified");
                    }
                    if (StringUtils.isBlank(sequenceAssembly)) {
                        sequenceAssembly = sequenceAssemblyLineFields[1];
                        gpmDbBean.setSequenceAssembly(sequenceAssembly);
                    }
                }

                if (StringUtils.startsWith(line, SEQUENCE_SOURCE)) {
                    String[] sequenceSourceLineFields = DMUtil.splitByDelims(line, COLON_DELIM);
                    if (sequenceSourceLineFields.length != 2) {
                        throw new DMFileException(
                                "Invalid gpm psyt file,  the sequence source number is not specified");
                    }
                    if (StringUtils.isBlank(sequenceSource)) {
                        sequenceSource = sequenceSourceLineFields[1];
                        gpmDbBean.setSequenceSource(sequenceSource);
                    }
                }

                if (StringUtils.startsWith(line, MAXIMUM_LOG_E)) {
                    String[] maxLogELineFields = DMUtil.splitByDelims(line, COLON_DELIM);
                    if (maxLogELineFields.length != 2) {
                        throw new DMFileException(
                                "Invalid gpm psyt file,  the maximum log(e) number is not specified");
                    }
                    if (StringUtils.isBlank(maximumLoge)) {
                        maximumLoge = maxLogELineFields[1];
                        gpmDbBean.setMaximumLoge(maximumLoge);
                    }
                }

                if (StringUtils.startsWith(line, PROTEIN)) {
                    gpmDbEntryBean = new GPMDbEntryBean();
                    //create the primary dbsource bean;
                    DBSourceBean gpmDbSourceBean = new DBSourceBean();
                    //all genes come from the gpm psty file as a datasource
                    if (gpmDbType.equals(GPMDbType.GPMDB_PSYT)) {
                        gpmDbSourceBean.setDbName(DbAcType.GPMPSYT.type());
                    }
                    if (gpmDbType.equals(GPMDbType.GPMDB_LYS)) {
                        gpmDbSourceBean.setDbName(DbAcType.GPMLYS.type());
                    }
                    if (gpmDbType.equals(GPMDbType.GPMDB_NTA)) {
                        gpmDbSourceBean.setDbName(DbAcType.GPMNTA.type());
                    }
                    gpmDbSourceBean.setPrimaryEvidences(true);
                    gpmDbEntryBean.setPrimaryDbSourceBean(gpmDbSourceBean);

                    //parse the protein accession
                    enspAccession = DMUtil.splitStrByDelim(line, COLON_DELIM)[1];
                    if (StringUtils.isBlank(enspAccession)) {
                        throw new DMFileException("The protein accession number not found");
                    } else {
                        //create an identified accession bean
                        AccessionBean identAccessionBean = createAcBean(enspAccession, DbAcType.Protein.type());
                        gpmDbEntryBean.setIdentifiedAccessionBean(identAccessionBean);
                    }
                }

                //parse gene accession
                if (StringUtils.startsWith(line, GENE)) {
                    ensgAccession = DMUtil.splitStrByDelim(line, COLON_DELIM)[1];
                }

                //parse transcript accession
                if (StringUtils.startsWith(line, TRANSCRIPT)) {
                    enstAccession = DMUtil.splitStrByDelim(line, COLON_DELIM)[1];
                }

                //chromosome fields
                if (StringUtils.startsWith(line, CHROMOSOME)) {
                    String[] chromLineFields = DMUtil.splitByDelims(line, "\t", "\r", "\n");
                    for (String chromField : chromLineFields) {
                        if (StringUtils.startsWith(chromField, CHROMOSOME)) {
                            String[] chromNameFileds = DMUtil.splitStrByDelim(chromField, COLON_DELIM);
                            if (chromNameFileds.length == 2) {
                                chromName = chromNameFileds[1].trim();
                            } else {
                                chromName = NameType.UNKNOWN.cn();
                            }
                        }
                        if (StringUtils.startsWith(chromField, CHROM_START)) {
                            String[] chromStartFields = DMUtil.splitStrByDelim(chromField, COLON_DELIM);
                            if (chromStartFields.length == 2) {
                                chromStart = Integer.valueOf(chromStartFields[1].trim());
                            }
                        }
                        if (StringUtils.startsWith(chromField, CHROM_END)) {
                            String[] chromEndFields = DMUtil.splitStrByDelim(chromField, COLON_DELIM);
                            if (chromEndFields.length == 2) {
                                chromEnd = Integer.valueOf(chromEndFields[1].trim());
                            }
                        }
                        if (StringUtils.startsWith(chromField, CHROM_STRAND)) {
                            String[] chromStrandFields = DMUtil.splitStrByDelim(chromField, COLON_DELIM);
                            if (chromStrandFields.length == 2) {
                                chromStrand = chromStrandFields[1].trim();
                            }
                        }
                    }
                    //create GeneBean
                    GeneBean geneBean = new GeneBean();
                    geneBean.setEnsgAccession(ensgAccession);
                    geneBean.setChromosome(chromName);
                    geneBean.setStartPosition(chromStart);
                    geneBean.setEndPosition(chromEnd);
                    geneBean.setStrand(chromStrand);
                    gpmDbEntryBean.setGeneBean(geneBean);
                }

                //Gene or Protein Desc
                if (StringUtils.startsWith(line, DES_ENSG_ENSP)) {
                    String[] desLineFields = DMUtil.splitByDelims(line, COLON_DELIM);
                    if (desLineFields.length == 2) {
                        String descValue = desLineFields[1];
                        String[] descValueFields = DMUtil.splitByDelims(descValue, ",", "\t");
                        String desc = "";
                        if (descValueFields.length >= 2) {
                            gpmDbEntryBean.getGeneBean().setDisplayName(descValueFields[0]);
                            for (int i = 1; i < descValueFields.length; i++) {
                                desc += descValueFields[i];
                            }
                        } else {
                            desc = descValueFields[0];
                        }
                        gpmDbEntryBean.getGeneBean().setDescription(StringUtils.trim(desc));
                    } else {
                        gpmDbEntryBean.getGeneBean().setDisplayName(NameType.UNKNOWN.cn());
                    }

                }

                //we add non evidence bean first once we meet the tag : modified_peptide_obs
                if (StringUtils.startsWith(line, MODIFIED_PEPTIDE_OBS)) {
                    //create dbsource and accession entry bean
                    List<DbSourceAcEntryBean> dbSourceAcEntryBeanList = parseDBSourceAcEntryBeans(enspAccession,
                            ensgAccession, enstAccession);
                    gpmDbEntryBean.setDbSourceAcEntryBeans(dbSourceAcEntryBeanList);

                    if (gpmDbType.equals(GPMDbType.GPMDB_PSYT)) {
                        //create a non phs s evidence bean
                        PTMEvidenceBean nonPhsSEvidenceBean = createNonEvidenceBean(enspAccession, nominalMass,
                                maximumLoge, GPMPTMSubType.PHS_S, gpmDbType);
                        gpmDbEntryBean.setPtmEvidenceBean(nonPhsSEvidenceBean, GPMPTMSubType.NON_PHS_S);
                        //create a non phs t evidence bean
                        PTMEvidenceBean nonPhsTEvidenceBean = createNonEvidenceBean(enspAccession, nominalMass,
                                maximumLoge, GPMPTMSubType.PHS_T, gpmDbType);
                        gpmDbEntryBean.setPtmEvidenceBean(nonPhsTEvidenceBean, GPMPTMSubType.NON_PHS_T);
                        //create a non phs y evidence bean
                        PTMEvidenceBean nonPhsYEvidenceBean = createNonEvidenceBean(enspAccession, nominalMass,
                                maximumLoge, GPMPTMSubType.PHS_Y, gpmDbType);
                        gpmDbEntryBean.setPtmEvidenceBean(nonPhsYEvidenceBean, GPMPTMSubType.NON_PHS_Y);

                    } else if (gpmDbType.equals(GPMDbType.GPMDB_LYS)) {
                        // Create Non LYS evidence bean first
                        PTMEvidenceBean nonLysEvidenceBean = createNonEvidenceBean(enspAccession, nominalMass,
                                maximumLoge, GPMPTMSubType.LYS, gpmDbType);
                        gpmDbEntryBean.setPtmEvidenceBean(nonLysEvidenceBean, GPMPTMSubType.NON_LYS);

                    } else if (gpmDbType.equals(GPMDbType.GPMDB_NTA)) {
                        //create non nta evidence bean first
                        PTMEvidenceBean nonNtaEvidenceBean = createNonEvidenceBean(enspAccession, nominalMass,
                                maximumLoge, GPMPTMSubType.NTA, gpmDbType);
                        gpmDbEntryBean.setPtmEvidenceBean(nonNtaEvidenceBean, GPMPTMSubType.NON_NTA);
                    }

                    gpmDbEntryBeanList.add(gpmDbEntryBean);
                    counterIndex = gpmDbEntryBeanList.size() - 1;
                }

                //parse the RES: S, T, Y or Others and POS and OBS
                if (StringUtils.startsWith(line, POS)) {
                    String[] posLineFields = DMUtil.splitByDelims(line, "\t", "\r", "\n");
                    for (String posLineField : posLineFields) {
                        if (StringUtils.startsWith(posLineField, POS)) {
                            String[] posFileds = DMUtil.splitByDelims(posLineField, COLON_DELIM);
                            if (posFileds.length == 2) {
                                pos = Integer.valueOf(posFileds[1]);
                            } else {
                                throw new DMFileException("The position value not found.");
                            }
                        }
                        if (StringUtils.startsWith(posLineField, RES)) {
                            String[] resFileds = DMUtil.splitByDelims(posLineField, COLON_DELIM);
                            if (resFileds.length == 2) {
                                res = resFileds[1];
                            } else {
                                throw new DMFileException("The res value not found.");
                            }
                        }
                        if (StringUtils.startsWith(posLineField, OBS)) {
                            String[] obsFileds = DMUtil.splitByDelims(posLineField, COLON_DELIM);
                            if (obsFileds.length == 2) {
                                obs = Integer.valueOf(obsFileds[1].trim());
                            } else {
                                throw new DMFileException("The obs value not found.");
                            }
                        }
                    }

                    PTMEvidenceBean ptmEvidenceBean = createPTMEvidenceBean(nominalMass, pos, res, obs,
                            enspAccession, maximumLoge, gpmDbType);

                    //Identify the type
                    GPMPTMSubType ptmSubType = GPMPTMSubType.PHS_S;

                    if (gpmDbType.equals(GPMDbType.GPMDB_PSYT)) {
                        ptmSubType = GPMPTMSubType.fromType(res);
                    } else if (gpmDbType.equals(GPMDbType.GPMDB_LYS)) {
                        ptmSubType = GPMPTMSubType.LYS;
                    } else if (gpmDbType.equals(GPMDbType.GPMDB_NTA)) {
                        ptmSubType = GPMPTMSubType.NTA;
                    }
                    //add the ptm evidence bean
                    gpmDbEntryBeanList.get(counterIndex).setPtmEvidenceBean(ptmEvidenceBean, ptmSubType);
                }
            }
        }
        logger.info("The total entry size of the " + gpmDbType.type() + " is :" + gpmDbEntryBeanList.size());
        gpmDbBean.setPgmDbEntryBeans(gpmDbEntryBeanList);
        return gpmDbBean;
    } catch (Exception ex) {
        logger.error(ex);
        throw new DMParserException(ex);
    } finally {
        if (ins != null) {
            try {
                ins.close();
            } catch (Exception e) {
                //ignore whatever caught.
            }
        }
    }
}

From source file:com.iyonger.apm.web.controller.FileEntryController.java

/**
 * Save a fileEntry and return to the the path.
 *
 *
 * @param fileEntry            file to be saved
 * @param targetHosts          target host parameter
 * @param validated            validated the script or not, 1 is validated, 0 is not.
 * @param createLibAndResource true if lib and resources should be created as well.
 * @param model                model/*from   w  w  w . j a v a  2s.c  om*/
 * @return redirect:/script/list/${basePath}
 */
@RequestMapping(value = "/save/**", method = RequestMethod.POST)
public String save(FileEntry fileEntry, @RequestParam String targetHosts,
        @RequestParam(defaultValue = "0") String validated,
        @RequestParam(defaultValue = "false") boolean createLibAndResource, ModelMap model) {
    User user = getCurrentUser();
    if (fileEntry.getFileType().getFileCategory() == FileCategory.SCRIPT) {
        Map<String, String> map = Maps.newHashMap();
        map.put("validated", validated);
        map.put("targetHosts", StringUtils.trim(targetHosts));
        fileEntry.setProperties(map);
    }
    fileEntryService.save(user, fileEntry);

    String basePath = getPath(fileEntry.getPath());
    if (createLibAndResource) {
        fileEntryService.addFolder(user, basePath, "lib", getMessages("script.commit.libFolder"));
        fileEntryService.addFolder(user, basePath, "resources", getMessages("script.commit.resourceFolder"));
    }
    model.clear();
    //return "redirect:/script/list/" + basePath;
    return "redirect:/script/detail/" + fileEntry.getPath() + "?r=-1";
}

From source file:com.myGengo.alfresco.translate.MyGengoTranslationServiceImpl.java

@Override
public void refreshTranslationComments(NodeRef jobRef, MyGengoAccount accountInfo)
        throws MyGengoServiceException {
    MyGengoClient myGengo = new MyGengoClient(accountInfo.getPublicKey(), accountInfo.getPrivateKey(),
            this.useSandbox);
    try {/*from w w w  . j  a  v  a2 s.c  o m*/
        Integer jobId = Integer.valueOf((String) nodeService.getProperty(jobRef, MyGengoModel.PROP_JOBID));
        List<ChildAssociationRef> comments = getComments(jobRef);
        List<CommentData> repoComments = new ArrayList<CommentData>(comments.size());
        for (ChildAssociationRef childAssociationRef : comments) {
            NodeRef commentRef = childAssociationRef.getChildRef();
            String contentString = contentService.getReader(commentRef, ContentModel.PROP_CONTENT)
                    .getContentString();
            //remove html tags because myGengo only uses text/plain comments
            contentString = HtmlToText.htmlToPlainText(StringUtils.trim(contentString));
            long timestamp = 0;
            if (nodeService.hasAspect(commentRef, MyGengoModel.ASPECT_COMMENT)) {
                timestamp = (Long) nodeService.getProperty(commentRef, MyGengoModel.PROP_COMMENTMODIFIEDTIME);
            }
            repoComments.add(new CommentData(contentString, timestamp, commentRef));
        }

        JSONObject response = myGengo.getTranslationJobComments(jobId);
        if (response.has("response")) {
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("comment job: " + response.toString());
            }
            JSONArray jsonThread = response.getJSONObject("response").getJSONArray("thread");
            List<CommentData> addComments = new ArrayList<CommentData>();
            for (int i = 0; i < jsonThread.length(); i++) {
                JSONObject jsonComment = jsonThread.getJSONObject(i);
                String commentText = jsonComment.getString("body");
                long timestamp = jsonComment.getLong("ctime");
                CommentData jsonCommentData = new CommentData(
                        HtmlToText.htmlToPlainText(StringUtils.trim(commentText)), timestamp);
                boolean add = true;
                for (CommentData commentData : repoComments) {
                    if (!commentData.equals(jsonCommentData)) {
                        //comment not in sync
                        if (commentData.comment.equalsIgnoreCase(commentText)) {
                            //comment text known, timestamp needs to be updated
                            Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>(1,
                                    1.0f);
                            aspectProperties.put(MyGengoModel.PROP_COMMENTMODIFIEDTIME, timestamp);
                            nodeService.addAspect(commentData.commentRef, MyGengoModel.ASPECT_COMMENT,
                                    aspectProperties);
                            add = false;
                        }
                    } else {
                        add = false;
                    }
                }
                if (add) {
                    addComments.add(jsonCommentData);
                }
            }

            for (CommentData addComment : addComments) {
                // text & timestamp unknown
                NodeRef commentsFolder = getOrCreateCommentsFolder(jobRef);
                String name = GUID.generate();
                ChildAssociationRef createdNode = nodeService.createNode(commentsFolder,
                        ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
                                QName.createValidLocalName(name)),
                        ForumModel.TYPE_POST);
                ContentWriter writer = contentService.getWriter(createdNode.getChildRef(),
                        ContentModel.PROP_CONTENT, true);
                writer.setMimetype("text/plain");
                writer.putContent(addComment.comment);
                Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>(1, 1.0f);
                aspectProperties.put(MyGengoModel.PROP_COMMENTMODIFIEDTIME, addComment.timestamp);
                nodeService.addAspect(createdNode.getChildRef(), MyGengoModel.ASPECT_COMMENT, aspectProperties);
            }
        }
    } catch (Exception e) {
        LOGGER.error("refreshJobComments failed", e);
        throw new MyGengoServiceException("refreshJobComments failed", e);
    }
}

From source file:io.cloudslang.lang.systemtests.BindingScopeTest.java

@Test
public void testFlowContextInStepPublishSection() throws Exception {
    URL resource = getClass().getResource("/yaml/binding_scope_flow_context_in_step_publish.sl");
    URI operation = getClass().getResource("/yaml/binding_scope_op.sl").toURI();
    Set<SlangSource> path = Sets.newHashSet(SlangSource.fromFile(operation));

    // pre-validation - step expression uses flow var name
    SlangSource flowSource = SlangSource.fromFile(resource.toURI());
    Executable flowExecutable = slangCompiler.preCompile(flowSource);
    String flowVarName = "flow_var";
    assertEquals("Input name should be: " + flowVarName, flowVarName,
            flowExecutable.getInputs().get(0).getName());
    @SuppressWarnings("unchecked")
    List<Output> stepPublishValues = (List<Output>) ((Flow) flowExecutable).getWorkflow().getSteps().getFirst()
            .getPostStepActionData().get(SlangTextualKeys.PUBLISH_KEY);
    assertEquals("Step expression should contain: " + flowVarName, flowVarName,
            StringUtils.trim(ExpressionUtils.extractExpression(stepPublishValues.get(0).getValue().get())));

    final CompilationArtifact compilationArtifact = slang.compile(flowSource, path);

    final Map<String, Value> userInputs = Collections.emptyMap();
    final Set<SystemProperty> systemProperties = Collections.emptySet();

    exception.expect(RuntimeException.class);
    exception.expectMessage("flow_var");
    exception.expectMessage("not defined");

    // trigger ExecutionPlan
    triggerWithData(compilationArtifact, userInputs, systemProperties);
}

From source file:gtu._work.ui.ObnfInsertCreaterUI.java

private void executeBtnAction() {
    try {//w  w w.  j  a v  a2  s .co m
        tableName = StringUtils.trimToEmpty(tableNameText.getText());
        String obnfStr = obnfArea.getText();
        if (StringUtils.isBlank(tableName)) {
            JCommonUtil._jOptionPane_showMessageDialog_error("tableName");
            return;
        }
        if (StringUtils.isBlank(obnfStr)) {
            JCommonUtil._jOptionPane_showMessageDialog_error("obnfStr");
            return;
        }

        Map<String, String> columnMap = new HashMap<String, String>();
        Map<String, String> pkMap = new HashMap<String, String>();

        Pattern objPattern2 = Pattern.compile("(\\w+)\\s*\\=\\s*'([^']*)'");
        Matcher matcher = objPattern2.matcher(obnfStr);
        while (matcher.find()) {
            String dbField = StringUtils.trim(matcher.group(1)).toLowerCase();
            String value = StringUtils.defaultString(matcher.group(2));
            System.out.println("SQL:[" + dbField + "] = [" + value + "]");
            this.addToColumnMap(dbField, value, columnMap, pkMap);
        }

        Pattern objPattern = Pattern.compile("(\\w+)\\=([^\\,\\{\\}\\[\\]]*)");
        matcher = objPattern.matcher(obnfStr);
        while (matcher.find()) {
            String g1 = StringUtils.trim(matcher.group(1));
            if (g1.indexOf("_") != -1) {
                continue;
            }
            String dbField = StringUtils.trim(StringUtilForDb.javaToDbField(g1)).toLowerCase();
            String value = StringUtils.defaultString(matcher.group(2));
            String tmpVal = StringUtils.trimToEmpty(value);
            if (tmpVal.startsWith("'") && tmpVal.endsWith("'")) {
                continue;
            }
            System.out.println("JAVA:[" + dbField + "] = [" + value + "]");
            this.addToColumnMap(dbField, value, columnMap, pkMap);
        }

        this.putToDbFieldList(pkMap, columnMap);
    } catch (Exception ex) {
        JCommonUtil.handleException(ex);
    }
}

From source file:io.ecarf.core.utils.LogParser.java

/**
 * Dictionary//w w w. j  av  a  2 s  .  c o m
 * @param dStats
 * @param line
 */
private void extractDictionaryStats(DictionaryStats dStats, String line) {

    if (line.contains(MEM_USE)) {
        double[] values = this.extractAndGetMemoryDictionaryItems(line);
        double memory = values[0];
        dStats.memoryFootprint.add(memory);

        if (values[1] > 0) {
            dStats.memoryUsage.add(new MemUsage((int) values[1], memory));
        }

    } else if (line.contains(DIC_SIZE)) {
        int size = this.extractDictionarySize(line);

        dStats.memoryUsage.add(new MemUsage(size, dStats.getLatestMemoryUsage()));

    }

    if (line.contains(DIC_ASSEMBLE)) {
        //Successfully assembled dictionary with size: 53550116, max resourceId: 54291281, memory usage: 14.449545934796333GB, timer: 5.010 min
        dStats.items = Integer.parseInt(StringUtils.substringBetween(line, DIC_ASSEMBLE, MAX_RES_ID));
        dStats.maxResourceId = Integer.parseInt(StringUtils.substringBetween(line, MAX_RES_ID, MEM_USE));
        dStats.assemble = this.extractAndGetTimer(line, TIMER_PREFIX);
    }

    /**
     * term.dictionary.TermDictionaryConcurrent - Creating non concurrent dictionary, memory usage: 11.166048146784306
       term.dictionary.TermDictionaryConcurrent - #TIMER finished creating non concurrent dictionary, memory usage: 13.966991074383259GB, timer: 1.577 min
       processor.dictionary.AssembleDictionaryTask - Successfully created non concurrent dictionary for serialization, memory usage: 13.966991074383259GB, timer: 6.992 min
       core.utils.Utils - Serializing object of class: class io.ecarf.core.term.dictionary.TermDictionaryCore to file: /tmp/dbpedia_dictionary_8c.kryo.gz, with compress = true
       term.dictionary.TermDictionary - TIMER# serialized dictionary to file: /tmp/dbpedia_dictionary_8c.kryo.gz, in: 3.274 min
       processor.dictionary.AssembleDictionaryTask - Successfully serialized dictionary with size: 53550116, memory usage: 13.964397609233856GB, timer: 10.27 min
     */

    if (line.contains(NON_CON_TIMER)) {
        dStats.nonConcurrent = this.extractAndGetTimer(line, TIMER_PREFIX);

    } else if (line.contains(TERM_DIC_TIMER)) {
        dStats.serialize = this.extractAndGetTimer(line, " in:");

    } else if (line.contains(SCHEMA_TERMS)) {
        //processor.dictionary.AssembleDictionaryTask - Schema terms added to the dictionary, final size: 53550784 , memory usage: 14.449545934796333GB
        dStats.itemsAfterSchema = Integer
                .parseInt(StringUtils.trim(StringUtils.substringBetween(line, SCHEMA_TERMS, MEM_USE)));
    }
    //processor.dictionary.AssembleDictionarySubTask - Processing: 1718527 term parts , memory usage: 17.80723436176777GB, timer: 4.839 s
    if (line.contains(TERM_PARTS)) {
        dStats.parts += Integer
                .parseInt(StringUtils.trim(StringUtils.substringBetween(line, PROCESSING, TERM_PARTS)));
    }

}

From source file:net.rim.ejde.internal.ui.editors.model.AlternateEntryPointDetails.java

private void updateAepTitle() {
    List<String> aepTitles = _fMasterSection.getAepTitles();
    String aepTitle = StringUtils.trim(_titleField.getText());
    if (!StringUtils.isBlank(aepTitle) && !aepTitles.contains(aepTitle)) {
        _aep.setTitle(aepTitle);/*from   www . ja  v  a  2 s .  com*/
    }
}

From source file:gov.nih.nci.cabig.caaers.service.ProxyWebServiceFacade.java

private String syncStudy(String operationName, String sponsorIdentifierValue) {
    try {//from  w  w  w  .ja v a 2  s  .  co m
        //invoke the webservice
        Map<String, String> criteriaMap = new HashMap<String, String>();
        criteriaMap.put("nciDocumentNumber", sponsorIdentifierValue);

        String correlationId = RandomStringUtils.randomAlphanumeric(15);

        String message = buildMessage(correlationId, "adeers", "study", operationName, "async", criteriaMap);
        String xmlStudyDetails = simpleSendAndReceive(message);
        if (log.isDebugEnabled())
            log.debug("result for getStudyDetails : for (" + sponsorIdentifierValue + ") :" + xmlStudyDetails);
        String studyDbId = xsltTransformer.toText(xmlStudyDetails, "xslt/c2a_generic_response.xslt");
        studyDbId = StringUtils.trim(studyDbId);
        if (log.isInfoEnabled())
            log.info("Got study details : Study DB ID :" + studyDbId);
        return studyDbId;
    } catch (Exception e) {
        log.error("Error occurred while invoking ServiceMix Study Details : " + e.getMessage(), e);
        return "Import study failed:" + e.getMessage();
    }

}

From source file:jp.co.opentone.bsol.linkbinder.view.action.control.CorresponPageElementControl.java

/**
 * ??????./*from   ww  w .  ja  va2  s . c  o m*/
 * <ul>
 * <li>??</li>
 * <li></li>
 * <li>?REQUEST_FOR_CHECK.UNDER_CONSIDERATION.REQUEST_FOR_APPROVAL</li>
 * <li>?</li>
 * </ul>
 */
private void setSystemAdminRequestingWorkflowPattern() {
    // ?1???None??Checker/Approver???
    workFlowLink = false;
    List<Workflow> workflow = correspon.getWorkflows();
    if (SystemConfig.getValue(KEY_PATTERN_1)
            .equals(StringUtils.trim(correspon.getCorresponType().getWorkflowPattern().getWorkflowCd()))) {
        for (Workflow w : workflow) {
            WorkflowProcessStatus processStatus = w.getWorkflowProcessStatus();
            if (WorkflowProcessStatus.NONE == processStatus) {
                workFlowLink = true;
            }
        }
    } else if (SystemConfig.getValue(KEY_PATTERN_2)
            .equals(StringUtils.trim(correspon.getCorresponType().getWorkflowPattern().getWorkflowCd()))) {
        workFlowLink = isApproverProcessStatusNone(workflow);
    }
}

From source file:com.bluexml.xforms.actions.AbstractWorkflowAction.java

/**
 * Tells whether the current user is a legitimate actor for this task.
 * //  w  ww.  j av  a  2  s.c o  m
 * @param taskBean
 * @param properties
 * @return true if the user is the actorId or belongs to the pooled actors
 */
protected boolean validateCurrentUser(WorkflowTaskInfoBean taskBean, HashMap<QName, Serializable> properties) {
    String actorIds = taskBean.getActorId();
    if (actorIds != null) {
        // #1514: support for multiple groups/users via comma-separated list
        String[] actors = StringUtils.split(actorIds, ",");
        for (String anActor : actors) {
            anActor = resolveActorId(StringUtils.trim(anActor), properties);
            if (anActor.equals("initiator")) { // #1531
                return true;
            }
            if (anActor.startsWith("#{")) {
                // oups Xform can't interpret this variable we hope that current user can execute this transition
                return true;
            }
            if (StringUtils.equals(anActor, userName)) {
                return true;
            }
        }
    }

    String pooledActors = taskBean.getPooledActors();
    if (pooledActors == null) {
        return false;
    }

    String[] actors = StringUtils.split(pooledActors, ",");
    for (String anActor : actors) {
        anActor = StringUtils.trim(anActor);
        // search the registered task groups amongst the user's groups
        Set<String> userGroups = controller.systemGetContainingGroups(transaction, userName);
        if (userGroups != null) { // <-- can this ever not be so ?
            String authorizedGroup = PermissionService.GROUP_PREFIX + anActor;
            for (String aUserGroup : userGroups) {
                if (StringUtils.equals(aUserGroup, authorizedGroup)) {
                    return true;
                }
            }
        }
    }
    return false;
}