org.apache.commons.lang3.StringUtils#deleteWhitespace ( )源码实例Demo

下面列出了org.apache.commons.lang3.StringUtils#deleteWhitespace ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: o2oa   文件: ActionCrawlWorkCompleted.java
private String attachment(Business business, WorkCompleted workCompleted) throws Exception {
	StringBuffer buffer = new StringBuffer();
	for (Attachment o : business.entityManagerContainer().listEqual(Attachment.class, WorkCompleted.job_FIELDNAME,
			workCompleted.getJob())) {
		if ((!Config.query().getCrawlWorkCompleted().getExcludeAttachment().contains(o.getName()))
				&& (!Config.query().getCrawlWorkCompleted().getExcludeSite().contains(o.getSite()))
				&& (!StringUtils.equalsIgnoreCase(o.getName(),
						Config.processPlatform().getDocToWordDefaultFileName()))
				&& (!StringUtils.equalsIgnoreCase(o.getSite(),
						Config.processPlatform().getDocToWordDefaultSite()))) {
			if (StringUtils.isNotEmpty(o.getText())) {
				buffer.append(o.getText());
			} else {
				buffer.append(this.storageObjectToText(o));
			}
		}
	}
	return StringUtils.deleteWhitespace(buffer.toString());
}
 
源代码2 项目: o2oa   文件: ActionCrawlWork.java
private String attachment(Business business, Work work) throws Exception {
	StringBuffer buffer = new StringBuffer();
	for (Attachment o : business.entityManagerContainer().listEqual(Attachment.class, Work.job_FIELDNAME,
			work.getJob())) {
		if ((!Config.query().getCrawlWork().getExcludeAttachment().contains(o.getName()))
				&& (!Config.query().getCrawlWork().getExcludeSite().contains(o.getSite()))
				&& (!StringUtils.equalsIgnoreCase(o.getName(),
						Config.processPlatform().getDocToWordDefaultFileName()))
				&& (!StringUtils.equalsIgnoreCase(o.getSite(),
						Config.processPlatform().getDocToWordDefaultSite()))) {
			if (StringUtils.isNotEmpty(o.getText())) {
				buffer.append(o.getText());
			} else {
				buffer.append(this.storageObjectToText(o));
			}
		}
	}
	return StringUtils.deleteWhitespace(buffer.toString());
}
 
源代码3 项目: bisq   文件: InteracETransferValidator.java
private ValidationResult validatePhoneNumber(String input) {
    // check for correct format and strip +, space and -
    if (input.matches("\\+?1[ -]?\\d{3}[ -]?\\d{3}[ -]?\\d{4}")) {
        input = input.replace("+", "");
        input = StringUtils.deleteWhitespace(input);
        input = input.replace("-", "");

        String inputAreaCode = input.substring(1, 4);
        for (String s : NPAS) {
            // check area code agains list and return if valid
            if (inputAreaCode.compareTo(s) == 0)
                return new ValidationResult(true);
        }
        return new ValidationResult(false, Res.get("validation.interacETransfer.invalidAreaCode"));
    } else {
        return new ValidationResult(false, Res.get("validation.interacETransfer.invalidPhone"));
    }
}
 
源代码4 项目: o2oa   文件: ActionCrawlWork.java
private String attachment(Business business, Work work) throws Exception {
	StringBuffer buffer = new StringBuffer();
	for (Attachment o : business.entityManagerContainer().listEqual(Attachment.class, Work.job_FIELDNAME,
			work.getJob())) {
		if ((!Config.query().getCrawlWork().getExcludeAttachment().contains(o.getName()))
				&& (!Config.query().getCrawlWork().getExcludeSite().contains(o.getSite()))
				&& (!StringUtils.equalsIgnoreCase(o.getName(),
						Config.processPlatform().getDocToWordDefaultFileName()))
				&& (!StringUtils.equalsIgnoreCase(o.getSite(),
						Config.processPlatform().getDocToWordDefaultSite()))) {
			if (StringUtils.isNotEmpty(o.getText())) {
				buffer.append(o.getText());
			} else {
				buffer.append(this.storageObjectToText(o));
			}
		}
	}
	return StringUtils.deleteWhitespace(buffer.toString());
}
 
@Override
public void comment(CommentNode node) {
    String code = StringUtils.deleteWhitespace(node.getCode());
    if(isConditionalComment(code)){
        getExpressions(code).stream()
                .filter(expression -> !expression.containsOption(Syntax.CONTEXT_OPTION))
                .forEach(expression -> createViolation(node.getStartLinePosition(), RULE_MESSAGE));
    }

}
 
源代码6 项目: jwala   文件: JvmCommandFactory.java
/**
 * 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);
}
 
源代码7 项目: amforeas   文件: OrderParam.java
public OrderParam(String col, String dir) {
    if (StringUtils.isBlank(dir) || StringUtils.isBlank(col))
        throw new IllegalArgumentException("Invalid order parameters");

    if (ASC.equalsIgnoreCase(dir)) {
        this.direction = ASC;
    } else if (DESC.equalsIgnoreCase(dir)) {
        this.direction = DESC;
    } else {
        throw new IllegalArgumentException("Invalid direction parameter");
    }
    this.column = StringUtils.deleteWhitespace(col);
}
 
源代码8 项目: livingdoc-core   文件: AbstractJarMojo.java
protected static File getJarFile(File basedir, String finalName, String classifier) {

        if (StringUtils.isBlank(classifier)) {
            return new File(basedir, finalName + ".jar");
        }

        String modifiedClassifier = StringUtils.deleteWhitespace(classifier);
        if (modifiedClassifier.charAt(0) != '-') {
            modifiedClassifier = '-' + modifiedClassifier;
        }

        return new File(basedir, finalName + modifiedClassifier + ".jar");
    }
 
源代码9 项目: o2oa   文件: ActionCrawlWorkCompleted.java
private String body(Business business, WorkCompleted workCompleted) throws Exception {
	String value = converter.text(
			business.entityManagerContainer().listEqualAndEqual(Item.class, Item.itemCategory_FIELDNAME,
					ItemCategory.pp, Item.bundle_FIELDNAME, workCompleted.getJob()),
			true, true, true, true, true, ",");
	return StringUtils.deleteWhitespace(value);
}
 
源代码10 项目: o2oa   文件: ActionCrawlCms.java
private String attachment(Business business, Document document) throws Exception {
	StringBuffer buffer = new StringBuffer();
	for (FileInfo o : business.entityManagerContainer().listEqual(FileInfo.class, FileInfo.documentId_FIELDNAME,
			document.getId())) {
		if (!Config.query().getCrawlCms().getExcludeAttachment().contains(o.getName())) {
			buffer.append(this.storageObjectToText(o));
		}
	}
	return StringUtils.deleteWhitespace(buffer.toString());
}
 
源代码11 项目: o2oa   文件: ActionCrawlCms.java
private String body(Business business, Document document) throws Exception {
	String value = converter.text(business.entityManagerContainer().listEqualAndEqual(Item.class,
			Item.itemCategory_FIELDNAME, ItemCategory.cms, Item.bundle_FIELDNAME, document.getId()), true, true,
			true, true, true, ",");
	return StringUtils.deleteWhitespace(value);
}
 
@Override
public Authentication authenticate( Authentication auth )
    throws AuthenticationException
{
    log.info( String.format( "Login attempt: %s", auth.getName() ) );

    String username = auth.getName();

    UserCredentials userCredentials = userService.getUserCredentialsWithEagerFetchAuthorities( username );

    if ( userCredentials == null )
    {
        throw new BadCredentialsException( "Invalid username or password" );
    }

    // Initialize all required properties of user credentials since these will become detached

    userCredentials.getAllAuthorities();

    // -------------------------------------------------------------------------
    // Check two-factor authentication
    // -------------------------------------------------------------------------

    if ( userCredentials.isTwoFA() )
    {
        TwoFactorWebAuthenticationDetails authDetails =
            (TwoFactorWebAuthenticationDetails) auth.getDetails();

        // -------------------------------------------------------------------------
        // Check whether account is locked due to multiple failed login attempts
        // -------------------------------------------------------------------------

        if ( authDetails == null )
        {
            log.info( "Missing authentication details in authentication request." );
            throw new PreAuthenticatedCredentialsNotFoundException( "Missing authentication details in authentication request." );
        }

        String ip = authDetails.getIp();
        String code = StringUtils.deleteWhitespace( authDetails.getCode() );

        if ( securityService.isLocked( username ) )
        {
            log.info( String.format( "Temporary lockout for user: %s and IP: %s", username, ip ) );

            throw new LockedException( String.format( "IP is temporarily locked: %s", ip ) );
        }

        if ( !LongValidator.getInstance().isValid( code ) || !SecurityUtils.verify( userCredentials, code ) )
        {
            log.info( String.format( "Two-factor authentication failure for user: %s", userCredentials.getUsername() ) );

            throw new BadCredentialsException( "Invalid verification code" );
        }
    }

    // -------------------------------------------------------------------------
    // Delegate authentication downstream, using UserCredentials as principal
    // -------------------------------------------------------------------------

    Authentication result = super.authenticate( auth );

    // Put detached state of the user credentials into the session as user
    // credentials must not be updated during session execution

    userCredentials = SerializationUtils.clone( userCredentials );

    // Initialize cached authorities

    userCredentials.isSuper();
    userCredentials.getAllAuthorities();

    return new UsernamePasswordAuthenticationToken( userCredentials, result.getCredentials(), result.getAuthorities() );
}
 
源代码13 项目: o2oa   文件: ActionCrawlWorkCompleted.java
private String title(WorkCompleted workCompleted) {
	return StringUtils.deleteWhitespace(workCompleted.getTitle());
}
 
源代码14 项目: o2oa   文件: BaseAction.java
protected void setSummary(Entry entry, String body, String attachment) {
	String summary = StringUtils.join(HanLP.extractSummary(body + attachment, 10), ",");
	summary = StringUtils.deleteWhitespace(summary);
	entry.setSummary(StringTools.utf8SubString(summary, JpaObject.length_255B));
}
 
源代码15 项目: o2oa   文件: ActionCrawlCms.java
private String title(Document document) {
	return StringUtils.deleteWhitespace(document.getTitle());
}
 
源代码16 项目: o2oa   文件: ActionCrawlCms.java
private String title(Document document) {
	return StringUtils.deleteWhitespace(document.getTitle());
}
 
源代码17 项目: o2oa   文件: ActionCrawlCms.java
private String body(Business business, Document document) throws Exception {
	String value = converter.text(business.entityManagerContainer().listEqualAndEqual(Item.class,
			Item.itemCategory_FIELDNAME, ItemCategory.cms, Item.bundle_FIELDNAME, document.getId()), true, true,
			true, true, true, ",");
	return StringUtils.deleteWhitespace(value);
}
 
源代码18 项目: o2oa   文件: ActionCrawlWork.java
private String body(Business business, Work work) throws Exception {
	String value = converter.text(business.entityManagerContainer().listEqualAndEqual(Item.class,
			Item.itemCategory_FIELDNAME, ItemCategory.pp, Item.bundle_FIELDNAME, work.getJob()), true, true, true,
			true, true, ",");
	return StringUtils.deleteWhitespace(value);
}
 
源代码19 项目: o2oa   文件: ActionCrawlWorkCompleted.java
private String title(WorkCompleted workCompleted) {
	return StringUtils.deleteWhitespace(workCompleted.getTitle());
}
 
@Test
public void remove_all_whitespace_apache_commons () {
	
	String madJug = "Madison Java User Group";
	
	String removeAllSpaces = StringUtils.deleteWhitespace(madJug);
	
	assertEquals("MadisonJavaUserGroup", removeAllSpaces);
}
 
 同类方法