當前位置: 首頁>>代碼示例>>Java>>正文


Java StringEscapeUtils.escapeCsv方法代碼示例

本文整理匯總了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, ',');
}
 
開發者ID:BriData,項目名稱:DBus,代碼行數:21,代碼來源:DBConfiguration.java

示例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);
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:24,代碼來源:UserExportHandler.java

示例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);
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:21,代碼來源:PeerreviewServiceImpl.java

示例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);
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:PeerreviewServiceImpl.java

示例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;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:19,代碼來源:PeerreviewServiceImpl.java

示例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;
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:29,代碼來源:MessageLogExportHandler.java

示例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;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:PeerreviewServiceImpl.java

示例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;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:PeerreviewServiceImpl.java

示例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;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:18,代碼來源:LamsSecurityUtil.java


注:本文中的org.apache.commons.lang.StringEscapeUtils.escapeCsv方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。