Java Code Examples for org.apache.commons.lang3.StringUtils.deleteWhitespace()

The following are Jave code examples for showing how to use deleteWhitespace() of the org.apache.commons.lang3.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: gitplex-mit   File: MarkdownEditor.java   View Source Code Vote up 6 votes
@Override
public void renderHead(IHeaderResponse response) {
	super.renderHead(response);
	response.render(JavaScriptHeaderItem.forReference(new MarkdownResourceReference()));
	
	String encodedAttachmentSupport;
	if (getAttachmentSupport() != null) {
		encodedAttachmentSupport = Base64.encodeBase64String(SerializationUtils.serialize(getAttachmentSupport()));
		encodedAttachmentSupport = StringUtils.deleteWhitespace(encodedAttachmentSupport);
		encodedAttachmentSupport = StringEscapeUtils.escapeEcmaScript(encodedAttachmentSupport);
		encodedAttachmentSupport = "'" + encodedAttachmentSupport + "'";
	} else {
		encodedAttachmentSupport = "undefined";
	}
	String callback = ajaxBehavior.getCallbackFunction(explicit("action"), explicit("param1"), explicit("param2"), 
			explicit("param3")).toString();
	
	String autosaveKey = getAutosaveKey();
	if (autosaveKey != null)
		autosaveKey = "'" + JavaScriptEscape.escapeJavaScript(autosaveKey) + "'";
	else
		autosaveKey = "undefined";
	
	String script = String.format("gitplex.server.markdown.onDomReady('%s', %s, %d, %s, %d, %b, %b, %s);", 
			container.getMarkupId(), 
			callback, 
			ATWHO_LIMIT, 
			encodedAttachmentSupport, 
			getAttachmentSupport()!=null?getAttachmentSupport().getAttachmentMaxSize():0,
			getUserMentionSupport() != null,
			getPullRequestReferenceSupport() != null, 
			autosaveKey);
	response.render(OnDomReadyHeaderItem.forScript(script));
	
	script = String.format("gitplex.server.markdown.onWindowLoad('%s');", container.getMarkupId());
	response.render(OnLoadHeaderItem.forScript(script));
}
 
Example 2
Project: jwala   File: JvmCommandFactory.java   View Source Code Vote up 6 votes
/**
 * Generate parameters for JVM Heap dump
 *
 * @param scriptName
 * @param jvm
 * @return
 */
private ExecCommand getExecCommandForHeapDump(String scriptName, Jvm jvm) {
    final String trimmedJvmName = StringUtils.deleteWhitespace(jvm.getJvmName());

    final String jvmRootDir = Paths.get(jvm.getTomcatMedia().getRemoteDir().toString() + '/' + trimmedJvmName + '/' +
            jvm.getTomcatMedia().getRootDir()).normalize().toString();

    final DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyyMMdd.HHmmss");
    final String dumpFile = "heapDump." + trimmedJvmName + "." + formatter.print(DateTime.now());

    final String dumpLiveStr = ApplicationProperties.getAsBoolean(PropertyKeys.JMAP_DUMP_LIVE_ENABLED.name()) ? "live," : "\"\"";

    final String heapDumpDir = jvm.getTomcatMedia().getRemoteDir().normalize().toString() + "/" + jvm.getJvmName();

    return new ExecCommand(getFullPathScript(jvm, scriptName), jvm.getJavaHome(), heapDumpDir, dumpFile,
                           dumpLiveStr , jvmRootDir, jvm.getJvmName());
}
 
Example 3
Project: HL7Receiver   File: AddressConverter.java   View Source Code Vote up 5 votes
public static String formatPostcode(String postcode) {
    String formattedPostcode = StringUtils.deleteWhitespace(postcode.toUpperCase());

    if ((formattedPostcode.length() >= 5) && (formattedPostcode.length() <= 7)) {
        formattedPostcode =
                StringUtils.substring(formattedPostcode, 0, formattedPostcode.length() - 3)
                        + " "
                        + StringUtils.substring(formattedPostcode, formattedPostcode.length() - 3);
    }

    return formattedPostcode;
}
 
Example 4
Project: jwala   File: JvmCommandFactory.java   View Source Code Vote up 5 votes
/**
 * Method to generate remote command for extracting jar for jvm
 *
 * @param jvm
 * @return
 */
private ExecCommand getExecCommandForDeploy(Jvm jvm) {
    final String remoteScriptDir = ApplicationProperties.getRequired(PropertyKeys.REMOTE_SCRIPT_DIR);

    final String trimmedJvmName = StringUtils.deleteWhitespace(jvm.getJvmName());
    final String archivePath = Paths.get(remoteScriptDir + '/' + trimmedJvmName + '/'
            + DEPLOY_CONFIG_ARCHIVE_SCRIPT_NAME).normalize().toString();
    final String jvmJarFile = Paths.get(remoteScriptDir + '/' + trimmedJvmName + ".jar").normalize().toString();
    final String jvmInstanceDir = Paths.get(jvm.getTomcatMedia().getRemoteDir().toString() + '/' + trimmedJvmName)
            .normalize().toString();
    final String jdkJarDir = Paths.get(jvm.getJavaHome() + "/bin/jar").normalize().toString();

    return new ExecCommand(archivePath, jvmJarFile, jvmInstanceDir, jdkJarDir);
}
 
Example 5
Project: hashsdn-controller   File: DatastoreContextIntrospector.java   View Source Code Vote up 5 votes
private static String convertToCamelCase(final String inString) {
    String str = inString.trim();
    if (StringUtils.contains(str, '-') || StringUtils.contains(str, ' ')) {
        str = inString.replace('-', ' ');
        str = WordUtils.capitalizeFully(str);
        str = StringUtils.deleteWhitespace(str);
    }

    return StringUtils.uncapitalize(str);
}
 
Example 6
Project: gitplex-mit   File: PullRequest.java   View Source Code Vote up 4 votes
public void setTitle(String title) {
	this.title = title;
	noSpaceTitle = StringUtils.deleteWhitespace(title);
}
 
Example 7
Project: HL7Receiver   File: HL7KeyFields.java   View Source Code Vote up 4 votes
private static String formatPid(String pid) {
    if (pid == null)
        return null;

    return StringUtils.deleteWhitespace(pid);
}
 
Example 8
Project: vscrawler   File: DeleteWhitespace.java   View Source Code Vote up 4 votes
@Override
protected String handleSingleStr(String input) {
    return StringUtils.deleteWhitespace(input);
}
 
Example 9
Project: HL7Receiver   File: DateParser.java   View Source Code Vote up 3 votes
public static LocalDateTime parse(String dateTime) throws ParseException {
        Validate.notNull(dateTime);

        dateTime = StringUtils.deleteWhitespace(dateTime);

        dateTime = removeSecondComponent(dateTime);

        if (dateTime == "")
            return null;

        if (!isValidTs(dateTime))
            throw new ParseException("Invalid date/time");

//        String timeZone = getTimeZone(dateTime);
        dateTime = removeTimeZone(dateTime);

        if (dateTime.length() < 8)
            dateTime = handleShortDates(dateTime);

        String pattern = getPattern(dateTime);
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);

        if (dateTime.length() == 8)
            return LocalDate.parse(dateTime, formatter).atStartOfDay();

        return LocalDateTime.parse(dateTime, formatter);
    }