List of usage examples for com.liferay.portal.util PropsValues DL_CHAR_LAST_BLACKLIST
String[] DL_CHAR_LAST_BLACKLIST
To view the source code for com.liferay.portal.util PropsValues DL_CHAR_LAST_BLACKLIST.
Click Source Link
From source file:com.liferay.document.library.internal.util.DLValidatorImpl.java
License:Open Source License
@Override public boolean isValidName(String name) { if (Validator.isNull(name)) { return false; }/*w ww. j ava 2 s. c om*/ for (String blacklistChar : PropsValues.DL_CHAR_BLACKLIST) { if (name.contains(blacklistChar)) { return false; } } for (String blacklistLastChar : PropsValues.DL_CHAR_LAST_BLACKLIST) { if (blacklistLastChar.startsWith(UnicodeFormatter.UNICODE_PREFIX)) { blacklistLastChar = UnicodeFormatter.parseString(blacklistLastChar); } if (name.endsWith(blacklistLastChar)) { return false; } } String nameWithoutExtension = FileUtil.stripExtension(name); for (String blacklistName : PropsValues.DL_NAME_BLACKLIST) { if (StringUtil.equalsIgnoreCase(nameWithoutExtension, blacklistName)) { return false; } } return true; }
From source file:com.liferay.document.library.internal.util.DLValidatorImpl.java
License:Open Source License
protected String replaceDLCharLastBlacklist(String title) { String previousTitle = null;/*from ww w .j a v a 2 s. c o m*/ while (!title.equals(previousTitle)) { previousTitle = title; for (String blacklistLastChar : PropsValues.DL_CHAR_LAST_BLACKLIST) { if (blacklistLastChar.startsWith(UnicodeFormatter.UNICODE_PREFIX)) { blacklistLastChar = UnicodeFormatter.parseString(blacklistLastChar); } if (title.endsWith(blacklistLastChar)) { title = StringUtil.replaceLast(title, blacklistLastChar, StringPool.BLANK); } } } return title; }