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


Java ObjectNode.set方法代码示例

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


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

示例1: getDatasetColumnByID

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
public static Result getDatasetColumnByID(int datasetId, int columnId)
{
    List<DatasetColumn> datasetColumnList = DatasetsDAO.getDatasetColumnByID(datasetId, columnId);

    ObjectNode result = Json.newObject();

    if (datasetColumnList != null && datasetColumnList.size() > 0)
    {
        result.put("status", "ok");
        result.set("columns", Json.toJson(datasetColumnList));
    }
    else
    {
        result.put("status", "error");
        result.put("message", "record not found");
    }

    return ok(result);
}
 
开发者ID:SirAeroWN,项目名称:premier-wherehows,代码行数:20,代码来源:Dataset.java

示例2: getState

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
public JsonNode getState(boolean includeGameState) {
	ObjectMapper mapper = new ObjectMapper();
	ObjectNode state = mapper.createObjectNode();

	state.put("name", this.getName());
	state.put("status", this.getStatus().toString());

	ArrayNode playerStates = state.putArray("players");
	for (GamePlayer player : this.players) {
		ObjectNode playerState = mapper.createObjectNode();
		playerState.put("name", player.getName());
		playerState.put("status", this.playerStatus.get(player).toString());
		playerStates.add(playerState);
	}

	if (includeGameState && this.game != null) {
		state.set("game", this.game.getState());
	}

	return state;
}
 
开发者ID:edwardxia,项目名称:board-server,代码行数:22,代码来源:GameRoom.java

示例3: addFulfillments

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
private static void addFulfillments(final ObjectNode transactionEnvelopeNode, final List<KeyPair> keyPairs) {
    final String canonicalString = JsonCanonicalizer.json2CanonicalString(transactionEnvelopeNode);
    Ed25519Fulfillment fulfillment =
            Ed25519Fulfillment.BuildFromSecrets(keyPairs.get(0), new MessagePayload(encodeUtf8(canonicalString)));
    final ObjectNode fulfillmentNode = jsonNodeFactory.objectNode();
    fulfillmentNode.set("fulfillment", jsonNodeFactory.textNode(fulfillment.toURI()));
    fulfillmentNode.set("fulfills", jsonNodeFactory.nullNode());
    final ArrayNode ownersBefore = jsonNodeFactory.arrayNode();
    ownersBefore.add(jsonNodeFactory.textNode(Base58.base58Encode(keyPairs.get(0).getPublic().getEncoded())));
    fulfillmentNode.set("owners_before", ownersBefore);

    JsonNode fulfillments = transactionEnvelopeNode.get("inputs");
    if (fulfillments == null || !fulfillments.isArray()) {
        throw new RuntimeException("Badly structured transaction does not contain \"inputs\": " + transactionEnvelopeNode);
    }
    ((ArrayNode) fulfillments).set(0, fulfillmentNode);
}
 
开发者ID:mgrand,项目名称:bigchaindb-java-driver,代码行数:18,代码来源:SignedBigchaindbTransactionFactory.java

示例4: dumpState

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@SuppressWarnings("uncheked")
public static void dumpState(ObjectNode statesNode, String address, AccountState state, ContractDetails details) {

    List<DataWord> storageKeys = new ArrayList<>(details.getStorage().keySet());
    Collections.sort(storageKeys);

    ObjectNode account = statesNode.objectNode();
    ObjectNode storage = statesNode.objectNode();

    for (DataWord key : storageKeys) {
        storage.put("0x" + Hex.toHexString(key.getData()),
                "0x" + Hex.toHexString(details.getStorage().get(key).getNoLeadZeroesData()));
    }

    if (state == null) {
        state = AccountState.EMPTY;
    }

    account.put("balance", state.getBalance() == null ? "0" : state.getBalance().toString());
    account.put("code", details.getCode() == null ? "0x" : "0x" + Hex.toHexString(details.getCode()));
    account.put("nonce", state.getNonce() == null ? "0" : state.getNonce().toString());
    account.set("storage", storage);
    account.put("storage_root", state.getStateRoot() == null ? "" : Hex.toHexString(state.getStateRoot()));

    statesNode.set(address, account);
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:27,代码来源:JSONHelper.java

示例5: doPost

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) {
    ObjectNode reservation = Json.newObject();
    DateTime soon = DateTime.now().plusHours(1);
    reservation.put("start", ISODateTimeFormat.dateTime().print(soon));
    reservation.put("end", ISODateTimeFormat.dateTime().print(soon.plusHours(1)));
    reservation.put("id", RESERVATION_REF);
    reservation.put("externalUserRef", "[email protected]");
    ObjectNode machine = Json.newObject();
    machine.put("name", "Machine 1");
    ObjectNode room = Json.newObject();
    room.put("name", "Room 1");
    room.put("roomCode", "R1");
    room.put("localTimezone", "Europe/Helsinki");
    room.put("roomInstructionEN", "information in English here");
    room.put("buildingName", "B1");
    ObjectNode addressNode = Json.newObject();
    addressNode.put("city", "Paris");
    addressNode.put("street", "123 Rue Monet");
    addressNode.put("zip", "1684");
    room.set("mailAddress", addressNode);
    machine.set("room", room);
    reservation.set("machine", machine);

    RemoteServerHelper.writeJsonResponse(response, reservation, HttpServletResponse.SC_CREATED);
}
 
开发者ID:CSCfi,项目名称:exam,代码行数:27,代码来源:ExternalCalendarInterfaceTest.java

示例6: getDatasetAccess

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
public static Result getDatasetAccess(Long datasetId)
{
    ObjectNode result = Json.newObject();
    result.put("status", "ok");
    result.set("access", Json.toJson(DatasetsDAO.getDatasetAccessibilty(datasetId)));
    return ok(result);
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:8,代码来源:Dataset.java

示例7: createConditionContextNode

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
static ObjectNode createConditionContextNode(final int index,
                                             final UnsignedBigchaindbTransaction unsignedTransaction,
                                             final List<KeyPair> keyPairs) {
    final ObjectNode conditionContextNode = jsonNodeFactory.objectNode();
    //noinspection unchecked
    final ConditionContext conditionContext
            = ((List<ConditionContext>) unsignedTransaction.getConditionContexts()).get(index);
    conditionContextNode.set("amount", jsonNodeFactory.numberNode(conditionContext.getAssetQuantity()));
    conditionContextNode.set("public_keys", createOwnersAfterArray(conditionContext.getOwnersAfter()));
    conditionContextNode.set("condition", createConditionNode(unsignedTransaction, keyPairs));
    return conditionContextNode;
}
 
开发者ID:mgrand,项目名称:bigchaindb-java-driver,代码行数:13,代码来源:SignedBigchaindbTransactionFactory.java

示例8: getDatasetTableNames

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
public static Result getDatasetTableNames()
{
    Logger.trace("Entering AdvSearch.java:getDatasetTableNames()");
    ObjectNode result = Json.newObject();
    String scopes = request().getQueryString("scopes");
    result.put("status", "ok");
    result.set("tables", Json.toJson(AdvSearchDAO.getTableNames(scopes)));

    return ok(result);
}
 
开发者ID:SirAeroWN,项目名称:premier-wherehows,代码行数:11,代码来源:AdvSearch.java

示例9: process

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Override
public void process(long sid, ObjectNode payload) {
    String name = string(payload, NAME);
    ObjectNode root = objectNode();
    root.set(DATA, get(SpriteService.class).get(name));
    sendMessage(SPRITE_DATA_RESPONSE, sid, root);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:TopologyViewMessageHandler.java

示例10: getAllGroups

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
public static Result getAllGroups()
{
    ObjectNode result = Json.newObject();

    result.put("status", "ok");
    result.set("groups", Json.toJson(UserDAO.getAllGroups()));
    return ok(result);
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:9,代码来源:User.java

示例11: getDatasetOwnerTypes

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
public static Result getDatasetOwnerTypes()
{
    ObjectNode result = Json.newObject();

    result.put("status", "ok");
    result.set("ownerTypes", Json.toJson(DatasetsDAO.getDatasetOwnerTypes()));
    return ok(result);
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:9,代码来源:Dataset.java

示例12: killRemoteRequests

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
public ObjectNode killRemoteRequests (	String auditUserid,
										List<String> services, List<String> hosts,
										String clean, String keepLogs,
										String apiUserid,
										String apiPass ) {
	ObjectNode resultJson = jacksonMapper.createObjectNode();

	ArrayNode servicesArray = resultJson.putArray( "services" );
	services.forEach( servicesArray::add );
	ArrayNode hostsArray = resultJson.putArray( "hosts" );
	hosts.forEach( hostsArray::add );

	if ( !Application.isJvmInManagerMode() ) {
		resultJson
			.put( "error",
				"refer to /api/deploy/host/* to deploy on hosts" );
	} else if ( hosts.size() == 0 || services.size() == 0 ) {
		resultJson
			.put( "error",
				"missing cluster parameter" );

	} else {
		MultiValueMap<String, String> stopParameters = new LinkedMultiValueMap<String, String>();
		stopParameters.set( "auditUserid", auditUserid );
		stopParameters.put( "services", services );
		stopParameters.put( "hosts", hosts );
		;
		if ( isPresent( clean ) ) {
			stopParameters.set( "clean", clean );
		}
		if ( isPresent( keepLogs ) ) {
			stopParameters.set( "keepLogs", keepLogs );
		}

		logger.debug( "* Stopping to: {}, params: {}", Arrays.asList( hosts ), stopParameters );

		ObjectNode clusterResponse = serviceOsManager.remoteAgentsApi(
			apiUserid,
			apiPass,
			hosts,
			CsapCoreService.API_AGENT_URL + AgentApi.KILL_SERVICES_URL,
			stopParameters );

		logger.debug( "Results: {}", clusterResponse );

		resultJson.set( "clusteredResults", clusterResponse );
		
		csapApp.getHostStatusManager().refreshAndWaitForComplete( null);

	}
	return resultJson;
}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:53,代码来源:ServiceCommands.java

示例13: uploadMetrics

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
protected String uploadMetrics ( int iterationsBetweenUploads ) {

		String result = "FAILED";

		try {
			allowPsDebug = 0;

			ObjectNode metricSample = getCSVdata( true, null, iterationsBetweenUploads, 0 );

			// new Event publisher - it checks if publish is enabled. First time
			// full attributes, then only sub attributes
			if ( vmCorrellationAttributes == null ) {
				vmCorrellationAttributes = jacksonMapper.createObjectNode();
				vmCorrellationAttributes.put( "id", "resource_" + collectionIntervalSeconds );
				vmCorrellationAttributes.put( "source", VM_METRICS_EVENT + collectionIntervalSeconds );
				vmCorrellationAttributes.put( "hostName", Application.getHOST_NAME() );

				// full upload. We could make call to event service to see if
				// they match...for now we do on restarts
				logger.info( "Uploading VM attributes, count: {}", iterationsBetweenUploads );

				csapApplication.getEventClient().publishEvent( VM_METRICS_EVENT + collectionIntervalSeconds + "/attributes", "Modified",
					null,
					attributeJson );
			}

			// Send normalized data
			metricSample.set( "attributes", vmCorrellationAttributes );

			csapApplication.getEventClient().publishEvent( VM_METRICS_EVENT + collectionIntervalSeconds + "/data", "Upload", null,
				metricSample );

			publishSummaryReport( "host" );

		} catch (Exception e) {
			logger.error( "Failed upload", e );
			result = "Failed, Exception:"
					+ CSAP.getCsapFilteredStackTrace( e );
		}

		return result;
	}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:43,代码来源:OsSharedResourcesCollector.java

示例14: getDatasetDependentsByUri

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
public static Result getDatasetDependentsByUri(String datasetUri)
    throws SQLException {
  /* expect
   * hive:///db_name.table_name
   * hive:///db_name/table_name
   * dalids:///db_name.table_name
   * dalids:///db_name/table_name
   * hdfs:///dir1/dir2/dir3/dir4
   * teradata:///db_name/table_name
   */
  ObjectNode resultJson = Json.newObject();
  String[] uri_parts = datasetUri.split(":");
  if (uri_parts.length != 2) {
    resultJson.put("return_code", 400);
    resultJson.put("error_message", "Invalid dataset URI");
    return ok(resultJson);
  }
  String dataset_type = uri_parts[0];
  String dataset_path = uri_parts[1].substring(2);  // start from the 3rd slash
  if (dataset_path.indexOf(".") > 0) {
    dataset_path.replace(".", "/");
  }

  if (dataset_path != null) {
    try {
      List<Map<String, Object>> dependents = DatasetDao.getDatasetDependents(dataset_type, dataset_path);
      resultJson.put("return_code", 200);
      resultJson.set("dependents", Json.toJson(dependents));
    } catch (EmptyResultDataAccessException e) {
      e.printStackTrace();
      resultJson.put("return_code", 404);
      resultJson.put("error_message", "No dependent dataset can be found!");
    }
    return ok(resultJson);
  }

  // if no parameter, return an error message
  resultJson.put("return_code", 400);
  resultJson.put("error_message", "No parameter provided");
  return ok(resultJson);
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:42,代码来源:DatasetController.java

示例15: uploadApplicationCollection

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
private String uploadApplicationCollection ( int iterationsBetweenAuditUploads )
		throws JsonProcessingException {
	// Now do custom metrics - each service uploaded independently

	_lastCustomServiceSummary = jacksonMapper.createObjectNode();

	for ( String serviceName_port : customResultsCache.keySet() ) {

		String[] idsForCustomServices = { serviceName_port };

		ObjectNode customSamplesToUpload = getCSVdata( true,
			idsForCustomServices, iterationsBetweenAuditUploads, 0, "jmxCustom" );

		String customBaseCategory = APPLICATION_METRICS_EVENT + serviceName_port + "/" + collectionIntervalSeconds + "/";

		// new Event publisher - it checks if publish is enabled. If
		// services have been updated, then attributes are uploaded again
		if ( customCacheJson.has( serviceName_port ) && !customCacheJson
			.get( serviceName_port )
			.has( "published" ) ) {
			ObjectNode itemInCache = (ObjectNode) customCacheJson.get( serviceName_port );
			itemInCache.put( "published", "true" );
			// full upload. We could make call to event service to see if
			// they match...for now we do on restarts
			csapApplication
				.getEventClient()
				.publishEvent( customBaseCategory + "attributes", "Modified", null,
					itemInCache.get( "attributes" ) );
		}
		ServiceInstance serviceInstance = csapApplication
			.getServiceInstanceCurrentHost( serviceName_port );

		if ( serviceInstance == null ) {
			logger.warn( "Service not found in cluster, assuming deleted and removing from cutom collection keys: "
					+ serviceName_port );
			// jmxCustomResultsCache.remove(serviceName_port) ;
			continue;
		}
		ObjectNode correlationAttributes = jacksonMapper.createObjectNode();
		correlationAttributes.put( "id", "jmx" + serviceInstance.getServiceName() + "_" + collectionIntervalSeconds );
		correlationAttributes.put( "hostName", Application.getHOST_NAME() );

		// Send normalized data
		customSamplesToUpload.set( "attributes", correlationAttributes );

		// new Event publisher - it checks if publish is enabled
		csapApplication
			.getEventClient()
			.publishEvent( customBaseCategory + "data",
				"Upload", null, customSamplesToUpload );

	}

	logger.debug( "Adding summary: ", _lastCustomServiceSummary );

	addApplicationSummary( _lastCustomServiceSummary, true );

	publishSummaryReport( "jmxCustom", true );
	return "PASSED";
}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:61,代码来源:ServiceCollector.java


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