本文整理汇总了Java中org.apache.commons.lang.StringEscapeUtils.escapeCsv方法的典型用法代码示例。如果您正苦于以下问题:Java StringEscapeUtils.escapeCsv方法的具体用法?Java StringEscapeUtils.escapeCsv怎么用?Java StringEscapeUtils.escapeCsv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang.StringEscapeUtils
的用法示例。
在下文中一共展示了StringEscapeUtils.escapeCsv方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: propertiesToString
import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
/**
* Converts connection properties to a String to be passed to the mappers.
* @param properties JDBC connection parameters
* @return String to be passed to configuration
*/
protected static String propertiesToString(Properties properties) {
List<String> propertiesList = new ArrayList<String>(properties.size());
for(Entry<Object, Object> property : properties.entrySet()) {
String key = StringEscapeUtils.escapeCsv(property.getKey().toString());
if (key.equals(property.getKey().toString()) && key.contains("=")) {
key = "\"" + key + "\"";
}
String val = StringEscapeUtils.escapeCsv(property.getValue().toString());
if (val.equals(property.getValue().toString()) && val.contains("=")) {
val = "\"" + val + "\"";
}
propertiesList.add(StringEscapeUtils.escapeCsv(key + "=" + val));
}
return StringUtils.join(propertiesList, ',');
}
示例2: getAppVersion
import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
private String getAppVersion (Integer lgsrc, String appver, Locale locale) {
ResourceBundle bundle = Resources.get().getBundle("Messages", locale);
String res = CharacterConstants.EMPTY;
if (lgsrc != null) {
if (lgsrc.intValue() == 2) {
res = bundle.getString("mob");
} else if (lgsrc.intValue() == 5) {
res = bundle.getString("mob.mma");
}
}
if (StringUtils.isEmpty(res)) {
if (appver != null) {
res = appver;
} else {
return res;
}
} else {
if (appver != null) {
res = res + CharacterConstants.O_SBRACKET + appver + CharacterConstants.C_SBRACKET;
}
}
return StringEscapeUtils.escapeCsv(res);
}
示例3: getUsersRatingsCommentsByCriteriaIdDTO
import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
@Override
public StyledCriteriaRatingDTO getUsersRatingsCommentsByCriteriaIdDTO(Long toolContentId, Long toolSessionId,
RatingCriteria criteria, Long currentUserId, boolean skipRatings, int sorting, String searchString,
boolean getAllUsers, boolean getByUser) {
if (skipRatings) {
return ratingService.convertToStyledDTO(criteria, currentUserId, getAllUsers, null);
}
List<Object[]> rawData = peerreviewUserDao.getRatingsComments(toolContentId, toolSessionId, criteria,
currentUserId, null, null, sorting, searchString, getByUser, ratingService,
userManagementService);
for (Object[] raw : rawData) {
raw[raw.length - 2] = (Object) StringEscapeUtils.escapeCsv((String)raw[raw.length - 2]);
}
// if !getByUser -> is get current user's ratings from other users ->
// convertToStyledJSON.getAllUsers needs to be true otherwise current user (the only one in the set!) is dropped
return ratingService.convertToStyledDTO(criteria, currentUserId, !getByUser || getAllUsers, rawData);
}
示例4: getUsersRatingsCommentsByCriteriaIdJSON
import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
@Override
public JSONArray getUsersRatingsCommentsByCriteriaIdJSON(Long toolContentId, Long toolSessionId,
RatingCriteria criteria, Long currentUserId, Integer page, Integer size, int sorting, String searchString,
boolean getAllUsers, boolean getByUser, boolean needRatesPerUser) throws JSONException {
List<Object[]> rawData = peerreviewUserDao.getRatingsComments(toolContentId, toolSessionId, criteria,
currentUserId, page, size, sorting, searchString, getByUser, ratingService, userManagementService);
for (Object[] raw : rawData) {
raw[raw.length - 2] = (Object) StringEscapeUtils.escapeCsv((String)raw[raw.length - 2]);
}
// if !getByUser -> is get current user's ratings from other users ->
// convertToStyledJSON.getAllUsers needs to be true otherwise current user (the only one in the set!) is dropped
return ratingService.convertToStyledJSON(criteria, toolSessionId, currentUserId, !getByUser || getAllUsers, rawData,
needRatesPerUser);
}
示例5: getDetailedRatingsComments
import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
@Override
public List<Object[]> getDetailedRatingsComments(Long toolContentId, Long toolSessionId, Long criteriaId,
Long itemId) {
NumberFormat numberFormat = NumberFormat.getInstance(Locale.US);
numberFormat.setMaximumFractionDigits(1);
// raw data: user_id, comment, rating, first_name, last_name
List<Object[]> rawData = peerreviewUserDao.getDetailedRatingsComments(toolContentId, toolSessionId, criteriaId,
itemId);
for (Object[] raw : rawData) {
raw[2] = (raw[2] == null ? null : numberFormat.format((Float) raw[2])); // format rating
// format name
StringBuilder description = new StringBuilder((String) raw[3]).append(" ").append((String) raw[4]);
raw[4] = (Object) StringEscapeUtils.escapeCsv(description.toString());
}
return rawData;
}
示例6: toCSV
import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
@Override
public String toCSV(Locale locale, String timezone, DomainConfig dc, String type) {
String str = "";
String status = "";
String name;
String ph;
try {
UsersService as = Services.getService(UsersServiceImpl.class, locale);
try {
IUserAccount u = as.getUserAccount(messageLog.getUserId());
MessageService smsService = MessageService.getInstance(MessageService.SMS, u.getCountry());
name = u.getFullName();
ph = u.getMobilePhoneNumber();
status = smsService.getStatusMessage(messageLog.getStatus(), locale);
} catch (ObjectNotFoundException e) {
name = messageLog.getUserId() + "(" + "User deleted" + ")";
ph = "";
}
str += name + ",";
str += ph + ",";
str += messageLog.getEventType() + "," + StringEscapeUtils.escapeCsv( messageLog.getMessage()) + ",";
str += status + ",";
str += LocalDateUtil.format(messageLog.getTimestamp(), locale, timezone);
} catch (MessageHandlingException ignored) {
// ignore
}
return str;
}
示例7: getCommentsCounts
import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
@Override
public List<Object[]> getCommentsCounts(Long toolContentId, Long toolSessionId, RatingCriteria criteria,
Integer page, Integer size, int sorting, String searchString) {
List<Object[]> rawData = peerreviewUserDao.getCommentsCounts(toolContentId, toolSessionId, criteria, page, size,
sorting, searchString, userManagementService);
// raw data: user_id, comment_count, first_name last_name, portrait id
for (Object[] raw : rawData) {
raw[2] = (Object) StringEscapeUtils.escapeCsv((String)raw[2]);
}
return rawData;
}
示例8: getUserNotebookEntriesForTablesorter
import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
@Override
public List<Object[]> getUserNotebookEntriesForTablesorter(Long toolSessionId, int page, int size, int sorting,
String searchString) {
List<Object[]> rawData = peerreviewUserDao.getUserNotebookEntriesForTablesorter(toolSessionId, page, size,
sorting, searchString, coreNotebookService);
for (Object[] raw : rawData) {
StringBuilder description = new StringBuilder((String) raw[1]).append(" ").append((String) raw[2]);
raw[2] = (Object) StringEscapeUtils.escapeCsv(description.toString());
}
return rawData;
}
示例9: escapeValue
import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
/**
* Takes care about blank values. Besides, escapes CSV sensitive symbols (commas, quotes, etc) and then encodes it to be sent as a URL parameter.
*
* @param value
* @param CSV
* @return
* @throws UnsupportedEncodingException
*/
private static String escapeValue(String value) throws UnsupportedEncodingException {
final String DUMMY_VALUE = "-";
String notBlankValue = StringUtils.isBlank(value) ? DUMMY_VALUE : value;
String escapedCsv = StringEscapeUtils.escapeCsv(notBlankValue);
String encodedValue = URLEncoder.encode(escapedCsv, "utf8");
return encodedValue;
}