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


Java ObjectNode.withArray方法代码示例

本文整理汇总了Java中com.fasterxml.jackson.databind.node.ObjectNode.withArray方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectNode.withArray方法的具体用法?Java ObjectNode.withArray怎么用?Java ObjectNode.withArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.fasterxml.jackson.databind.node.ObjectNode的用法示例。


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

示例1: exportFromEquellaPerItem

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
/**
 * The EQUELLA version of exportFrom
 * 
 * @param offset
 * @param itemsDir
 * @param perItem
 * @return
 * @throws Exception
 */
protected Integer[] exportFromEquellaPerItem(int offset, File itemsDir, Function<ObjectNode, Void> perItem)
	throws Exception
{
	ImmutableMap<String, ?> params = ImmutableMap.of("start", offset, "info", "export", "length", 50, "showall",
		true);
	ObjectNode results = searchRequests.search(searchRequests.searchRequest("", "modified").parameters(params));
	int available = results.get("available").asInt();
	int length = results.get("length").asInt();
	for( JsonNode entityJson : results.withArray("results") )
	{
		ObjectNode entity = (ObjectNode) entityJson;
		perItem.apply(entity);
	}
	return new Integer[]{offset + length, available};
}
 
开发者ID:equella,项目名称:Equella,代码行数:25,代码来源:SaveInstitutionToFile.java

示例2: exportFrom

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
/**
 * The EPS version of exportFrom
 * 
 * @param offset
 * @param itemsDir
 * @param perItem
 * @return
 * @throws Exception
 */
protected String exportFrom(String offset, File itemsDir, Function<ObjectNode, Void> perItem) throws Exception
{
	ImmutableMap<String, ?> params = ImmutableMap.of("info", "export", "scrollid", offset);
	ObjectNode results = searchRequests.scan(searchRequests.successfulRequest().parameters(params));
	if( !results.withArray("results").has(0) )
	{
		return null;
	}
	for( JsonNode entityJson : results.withArray("results") )
	{
		ObjectNode entity = (ObjectNode) entityJson;
		perItem.apply(entity);
	}
	return results.has("scrollId") ? results.get("scrollId").asText() : null;
}
 
开发者ID:equella,项目名称:Equella,代码行数:25,代码来源:SaveInstitutionToFile.java

示例3: saveFiles

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
protected void saveFiles(final ItemId itemId, File filesDir) throws IOException
{
	ObjectNode files = itemRequests.listFiles(itemId);
	ArrayNode fileList = files.withArray("files");
	if( fileList.size() > 0 )
	{
		filesDir.mkdirs();
		for( JsonNode file : fileList )
		{
			final String name = file.get("name").asText();
			ByteSource src = new ByteSource()
			{
				@Override
				public InputStream openStream() throws IOException
				{
					return itemRequests.file(itemRequests.successfulRequest(), itemId, name).body().asInputStream();
				}
			};
			File destFile = new File(filesDir, name);
			destFile.getParentFile().mkdirs();
			src.copyTo(Files.asByteSink(destFile));
		}
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:25,代码来源:SaveInstitutionToFile.java

示例4: importTaskStatus

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
public static ObjectNode importTaskStatus(String uuid, char status, Date started, Date due,
	Collection<String> accepted)
{
	ObjectNode ns = importStatus(uuid, status);
	ns.put("started", ISO8601Utils.format(started));
	ns.put("due", due != null ? ISO8601Utils.format(due) : null);
	ArrayNode users = ns.withArray("acceptedUsers");
	for( String user : accepted )
	{
		users.add(user);
	}
	return ns;
}
 
开发者ID:equella,项目名称:Equella,代码行数:14,代码来源:Items.java

示例5: exportGroups

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
private void exportGroups() throws Exception
{
	File groupsDir = getGroupDir();
	groupsDir.mkdirs();
	ObjectNode results = groupRequests.export();
	for( JsonNode userJson : results.withArray("results") )
	{
		File userFile = new File(groupsDir, userJson.get("id").asText() + ".json");
		MAPPER.writeValue(userFile, userJson);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:12,代码来源:SaveInstitutionToFile.java

示例6: exportRoles

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
private void exportRoles() throws Exception
{
	File rolesDir = getRoleDir();
	rolesDir.mkdirs();
	ObjectNode results = roleRequests.export();
	for( JsonNode userJson : results.withArray("results") )
	{
		File userFile = new File(rolesDir, userJson.get("id").asText() + ".json");
		MAPPER.writeValue(userFile, userJson);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:12,代码来源:SaveInstitutionToFile.java

示例7: exportEntities

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
private void exportEntities(String name, BaseEntityRequests req) throws Exception
{
	File entityDir = new File(baseDir, name);
	entityDir.mkdirs();
	ObjectNode results = req.listForExport();
	for( JsonNode entityJson : results.withArray("results") )
	{
		ObjectNode entity = (ObjectNode) entityJson;
		String id = req.getId(entity);
		File file = new File(entityDir, id + ".json");
		MAPPER.writeValue(file, entity);
	}
	ObjectNode acls = req.listAcls();
	MAPPER.writeValue(getEntityAclsFile(entityDir), acls);
}
 
开发者ID:equella,项目名称:Equella,代码行数:16,代码来源:SaveInstitutionToFile.java

示例8: exportUsers

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
private void exportUsers() throws Exception
{
	File usersDir = getUserDir();
	usersDir.mkdirs();
	ObjectNode results = userRequests.export();
	for( JsonNode userJson : results.withArray("results") )
	{
		File userFile = new File(usersDir, userJson.get("id").asText() + ".json");
		MAPPER.writeValue(userFile, userJson);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:12,代码来源:SaveInstitutionToFile.java


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