当前位置: 首页>>代码示例>>Java>>正文


Java JsonArray.toList方法代码示例

本文整理汇总了Java中org.vertx.java.core.json.JsonArray.toList方法的典型用法代码示例。如果您正苦于以下问题:Java JsonArray.toList方法的具体用法?Java JsonArray.toList怎么用?Java JsonArray.toList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.vertx.java.core.json.JsonArray的用法示例。


在下文中一共展示了JsonArray.toList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: formatSearchResult

import org.vertx.java.core.json.JsonArray; //导入方法依赖的package包/类
private JsonArray formatSearchResult(final JsonArray results, final JsonArray columnsHeader, final String locale) {
	final List<String> aHeader = columnsHeader.toList();
	final JsonArray traity = new JsonArray();

	for (int i=0;i<results.size();i++) {
		final JsonObject j = results.get(i);
		final JsonObject jr = new JsonObject();
		if (j != null) {
			jr.putString(aHeader.get(0), j.getString("fileNameLabel"));
			jr.putString(aHeader.get(1), j.getString("description", ""));
			jr.putObject(aHeader.get(2), j.getObject("modified"));
			jr.putString(aHeader.get(3), j.getObject("owner").getString("displayName"));
			jr.putString(aHeader.get(4), j.getObject("owner").getString("userId"));
			jr.putString(aHeader.get(5), "/sharebigfiles#/view/" + j.getString("_id"));
			traity.add(jr);
		}
	}
	return traity;
}
 
开发者ID:OPEN-ENT-NG,项目名称:share-big-files,代码行数:20,代码来源:ShareBigFilesSearchingEvents.java

示例2: formatSearchResult

import org.vertx.java.core.json.JsonArray; //导入方法依赖的package包/类
private JsonArray formatSearchResult(final JsonArray results, final JsonArray columnsHeader, final String userId) {
	final List<String> aHeader = columnsHeader.toList();
	final JsonArray traity = new JsonArray();

	for (int i=0;i<results.size();i++) {
		final JsonObject j = results.get(i);
		//Only published (status == 3) or owner
		if (j != null && (j.getInteger("status", 0).equals(3) || j.getString("owner", "").equals(userId))) {
			final JsonObject jr = new JsonObject();
			jr.putString(aHeader.get(0), j.getString("title"));
			jr.putString(aHeader.get(1), j.getString("content"));
			jr.putObject(aHeader.get(2), new JsonObject().putValue("$date",
					DatatypeConverter.parseDateTime(j.getString("modified")).getTime().getTime()));
			jr.putString(aHeader.get(3), j.getString("username"));
			jr.putString(aHeader.get(4), j.getString("owner"));
			jr.putString(aHeader.get(5), "/actualites#/view/thread/"+
					j.getNumber("thread_id",0) + "/info/"+j.getNumber("id",0));
			traity.add(jr);
		}
	}
	return traity;
}
 
开发者ID:OPEN-ENT-NG,项目名称:actualites,代码行数:23,代码来源:ActualitesSearchingEvents.java

示例3: formatSearchResult

import org.vertx.java.core.json.JsonArray; //导入方法依赖的package包/类
private void formatSearchResult(final JsonArray results, final JsonArray columnsHeader, final Handler<Either<String, JsonArray>> handler) {
	final List<String> aHeader = columnsHeader.toList();
	final JsonArray traity = new JsonArray();

	if (results.size() == 0) {
		handler.handle(new Right<String, JsonArray>(traity));
	} else {
		for (int i = 0; i < results.size(); i++) {
			final JsonObject j = results.get(i);
			final JsonObject jr = new JsonObject();
			if (j != null) {
				jr.putString(aHeader.get(0), j.getString("name"));
				jr.putString(aHeader.get(1), j.getString("description", ""));
				jr.putObject(aHeader.get(2), j.getObject("modified"));
				jr.putString(aHeader.get(3), j.getObject("owner").getString("displayName"));
				jr.putString(aHeader.get(4), j.getObject("owner").getString("userId"));
				jr.putString(aHeader.get(5), "/collaborativeeditor#/view/" + j.getString("_id"));
				traity.add(jr);
			}
		}
		handler.handle(new Right<String, JsonArray>(traity));
	}
}
 
开发者ID:OPEN-ENT-NG,项目名称:collaborative-editor,代码行数:24,代码来源:CollaborativeEditorSearchingEvents.java

示例4: formatSearchResult

import org.vertx.java.core.json.JsonArray; //导入方法依赖的package包/类
private JsonArray formatSearchResult(final JsonArray results, final JsonArray columnsHeader, String locale) {
	final List<String> aHeader = columnsHeader.toList();
	final JsonArray traity = new JsonArray();

	final String dateFormat = "EEEEE dd MMMMM yyyy " + i18n.translate("rbs.search.date.to", I18n.DEFAULT_DOMAIN, locale) + " HH:mm";
	final DateFormat dateFormatFromDB = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");

	for (int i=0;i<results.size();i++) {
		final JsonObject j = results.get(i);
		final JsonObject jr = new JsonObject();
		if (j != null) {
			Long start = 0L;
			Long end = 0L;
			try {
				start = dateFormatFromDB.parse(j.getString("start_date")).getTime();
				end = dateFormatFromDB.parse(j.getString("end_date")).getTime();
			} catch (ParseException e) {
				log.error("Can't parse date form RBS DB", e);
			}
			jr.putString(aHeader.get(0), formatTitle(j, start, end, dateFormat, locale));
			jr.putString(aHeader.get(1), j.getString("booking_reason"));
			jr.putObject(aHeader.get(2), new JsonObject().putValue("$date",
					DatatypeConverter.parseDateTime(j.getString("modified")).getTime().getTime()));
			jr.putString(aHeader.get(3), j.getString("owner_name"));
			jr.putString(aHeader.get(4), j.getString("owner"));
			jr.putString(aHeader.get(5), formatUrl(j.getNumber("id",0), start));
			traity.add(jr);
		}
	}
	return traity;
}
 
开发者ID:OPEN-ENT-NG,项目名称:rbs,代码行数:32,代码来源:RbsSearchingEvents.java

示例5: searchResource

import org.vertx.java.core.json.JsonArray; //导入方法依赖的package包/类
@Override
public void searchResource(List<String> appFilters, String userId, JsonArray groupIds, JsonArray searchWords, Integer page, Integer limit, final JsonArray columnsHeader,
						   final String locale, final Handler<Either<String, JsonArray>> handler) {
	if (appFilters.contains(RbsSearchingEvents.class.getSimpleName())) {

		final List<String> idsUsers = new ArrayList<String>(groupIds.toList());
		idsUsers.add(userId);

		final StringBuilder query = new StringBuilder();

		final String iLikeTemplate = "ILIKE ALL " + Sql.arrayPrepared(searchWords.toArray(), true);
		final List<String> searchFields = new ArrayList<String>();
		searchFields.add("r.name");
		searchFields.add("t.name");
		searchFields.add("b.booking_reason");
		final String searchWhere = "b.parent_booking_id IS NULL AND (" + searchWherePrepared(searchFields, iLikeTemplate) + ")";
		//find all booking without slots
		query.append("SELECT b.id, b.start_date, b.end_date, b.booking_reason, b.modified, b.owner, r.name as resource_name, t.name as resource_type, u.username AS owner_name")
				.append(" FROM rbs.booking AS b")
				.append(" INNER JOIN rbs.resource AS r ON r.id = b.resource_id")
				.append(" INNER JOIN rbs.resource_type AS t ON r.type_id = t.id")
				.append(" LEFT JOIN rbs.resource_type_shares AS rs ON rs.resource_id = r.type_id")
				.append(" LEFT JOIN rbs.users AS u ON u.id = b.owner")
				.append(" WHERE (").append(searchWhere).append(") AND (rs.member_id IN ").append(Sql.listPrepared(idsUsers.toArray()))
				.append(" OR t.owner = ?");
		// fixme it is important for search : A local administrator of a given school can see all resources of the school's types, even if he is not owner or manager of these types or resources
		// if necessary modify common to add userinfos.getFunctions
		/*List<String> scope = getLocalAdminScope(user);
		if (scope!=null && !scope.isEmpty()) {
			query.append(" OR t.school_id IN ").append(Sql.listPrepared(scope.toArray()));
			for (String schoolId : scope) {
				values.addString(schoolId);
			}
		}
		*/
		query.append(")  GROUP BY b.id, u.username, r.name, t.name ORDER BY modified DESC LIMIT ? OFFSET ?");
		final JsonArray values = new JsonArray();
		final List<String> valuesWildcard = searchValuesWildcard(searchWords.toList());
		for (int i=0;i<searchFields.size();i++) {
			for (final String value : valuesWildcard) {
				values.addString(value);
			}
		}

		for (String groupOruser : idsUsers) {
			values.addString(groupOruser);
		}

		values.addString(userId);

		final int offset = page * limit;
		values.add(limit).add(offset);

		Sql.getInstance().prepared(query.toString(), values, new Handler<Message<JsonObject>>() {
			@Override
			public void handle(Message<JsonObject> event) {
				final Either<String, JsonArray> ei = validResult(event);
				if (ei.isRight()) {
					final JsonArray res = formatSearchResult(ei.right().getValue(), columnsHeader, locale);
					handler.handle(new Right<String, JsonArray>(res));
				} else {
					handler.handle(new Either.Left<String, JsonArray>(ei.left().getValue()));
				}
				if (log.isDebugEnabled()) {
					log.debug("[RbsSearchingEvents][searchResource] The resources searched by user are finded");
				}
			}
		});
	} else {
		handler.handle(new Right<String, JsonArray>(new JsonArray()));
	}
}
 
开发者ID:OPEN-ENT-NG,项目名称:rbs,代码行数:73,代码来源:RbsSearchingEvents.java


注:本文中的org.vertx.java.core.json.JsonArray.toList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。