com.googlecode.fascinator.common.JsonObject类的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中com.googlecode.fascinator.common.JsonObject类的一些代码示例,展示了JsonObject类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonObject类的具体详情如下:
包路径:com.googlecode.fascinator.common.JsonObject
类名称:JsonObject

JsonObject介绍

[英]This class is and all code is a direct copy of the org.json.simple.JSONObject implementation found here: http://json-simple.googlecode.com/svn/trunk/src/org /json/simple/JSONObject.java

It has been duplicated for the sole purpose of moving to a LinkedHashMap to preserve order. All credit must go to the original authors.

Because JSONValue.escape() is inaccessible from outside the original package it needed to be added to the end of the class as well.
A JSON object. Key value pairs are unordered. JSONObject supports java.util.Map interface.
[中]该类是,所有代码都是组织的直接副本。json。易于理解的可在此处找到JSONObject实现:http://json-simple.googlecode.com/svn/trunk/src/org/json/simple/JSONObject。JAVA
复制它的唯一目的是移动到LinkedHashMap以保持秩序。所有的功劳都必须归于原作者。
因为JSONValue。escape()无法从原始包外部访问,还需要将其添加到类的末尾。
一个JSON对象。键值对是无序的。JSONObject支持java。util。地图界面。

代码示例

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common

private void processJsonObjectToProperties(JsonObject jsonObject,
      String parentKey, Properties properties) {
    for (Object o : jsonObject.keySet()) {
      String key = (String) o;
      Object value = jsonObject.get(key);
      if (value instanceof String) {
        properties.put(parentKey + "." + key, value);
      } else if (value instanceof JsonObject) {
        processJsonObjectToProperties((JsonObject) value, parentKey
            + "." + key, properties);
      }
    }

  }
}

代码示例来源:origin: com.googlecode.the-fascinator.plugins/plugin-indexer-solr

/**
 * Add a new document into the buffer, and check if submission is required
 * 
 * @param document : The Solr document to add to the buffer.
 */
private void addToBuffer(String index, String document) {
  JsonObject message = new JsonObject();
  message.put("event", "index");
  message.put("index", index);
  message.put("document", document);
  sendToIndex(message.toString());
}

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common

public boolean delete(String id) {
  JsonObject toRemove = getWritableParent(id);
  // Confirm validity of request
  if (toRemove == null) {
    return false;
  }
  toRemove.remove(id);
  return true;
}

代码示例来源:origin: com.googlecode.redbox-mint/redbox-web-service

protected JsonObject getSuccessResponse(String oid) {
  JsonObject jsonObject = new JsonObject();
  jsonObject.put("code", 200);
  if (oid != null) {
    jsonObject.put("oid", oid);
  }
  return jsonObject;
}

代码示例来源:origin: com.googlecode.redbox-mint/plugin-transaction-curation-mint

/**
 * Generate an order to send an email to the intended recipient
 * 
 * @param response The response to add an order to
 * @param message The message we want to send
 */
private void email(JsonSimple response, String oid, String text) {
  JsonObject object = newMessage(response,
      EmailNotificationConsumer.LISTENER_ID);
  JsonObject message = (JsonObject) object.get("message");
  message.put("to", emailAddress);
  message.put("body", text);
  message.put("oid", oid);
}

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common

Object movedNode = toRemove.get(id);
toRemove.remove(id);
JsonObject newMap = new JsonObject();
for (Object objKey : toMove.keySet()) {
  String key = (String) objKey;
  if (key.equals(destination)) {
    newMap.put(objKey, toMove.get(objKey));
    newMap.put(id, movedNode);
  } else {
    newMap.put(objKey, toMove.get(objKey));
toMove.clear();
toMove.putAll(newMap);

代码示例来源:origin: com.googlecode.redbox-mint/plugin-transaction-curation-redbox

order.put("forceCommit", true);
  if (quickIndex) {
    JsonObject order = newIndex(response, oid);
    order.put("forceCommit", true);
  JsonObject audit = (JsonObject) order.get("message");
  audit.putAll(message.getJsonObject());
  JsonObject audit = (JsonObject) order.get("message");
  audit.putAll(message.getJsonObject());
    order.put("forceCommit", true);
    return response;
      message.getJsonObject().put("oid", oid);

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-core

Object mOid = message.get("oid");
if (mOid == null) {
  message.put("oid", oid);
  log.warn("Message object missing OID, adding before send");
} else {
  messaging.queueMessage(target, message.toString());
  return true;
} catch (Exception ex) {

代码示例来源:origin: com.googlecode.redbox-mint/redbox-reports

private String getLabel(String key, JsonObject labelConfig) {
    if (labelConfig.get(key) == null) {
      return key;
    }
    return (String)labelConfig.get(key);
  }
}

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common

/**
 * Set the description for this manifest
 *
 * @param description : The new description
 */
public void setDescription(String description) {
  getJsonObject().put("description", description);
}

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common

public boolean move(String id, String destination) {
  // Find our nodes
  JsonObject toRemove = getWritableParent(id);
  JsonObject toMove = getWritableNode(destination);
  // Confirm validity of request
  if (toRemove == null || toMove == null) {
    return false;
  }
  // Now actually move it
  toMove.put(id, toRemove.get(id));
  toRemove.remove(id);
  // Update metadata
  getNode(id).setParentKey(destination);
  return true;
}

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common

/**
 * <p>
 * Take all of the JsonObjects found in a JsonObject, wrap them in
 * JsonSimple objects, then add to a Java Map and return.
 * </p>
 *
 * All entries found that are not JsonObjects are ignored.
 *
 * @return String : The JSON String
 */
public static Map<String, JsonSimple> toJavaMap(JsonObject object) {
  Map<String, JsonSimple> response = new LinkedHashMap<String, JsonSimple>();
  if (object != null && !object.isEmpty()) {
    for (Object key : object.keySet()) {
      Object child = object.get(key);
      if (child != null && child instanceof JsonObject) {
        response.put((String) key,
            new JsonSimple((JsonObject) child));
      }
    }
  }
  return response;
}

代码示例来源:origin: com.googlecode.redbox-mint/plugin-transaction-curation-mint

/**
 * Generate orders for the list of normal transformers scheduled to execute
 * on the tool chain
 * 
 * @param message The incoming message, which contains the tool chain config
 * for this object
 * @param response The response to edit
 * @param oid The object to schedule for clearing
 */
private void scheduleTransformers(JsonSimple message, JsonSimple response) {
  String oid = message.getString(null, "oid");
  List<String> list = message.getStringList(
      "transformer", "metadata");
  if (list != null && !list.isEmpty()) {
    for (String id : list) {
      JsonObject order = newTransform(response, id, oid);
      // Add item config to message... if it exists
      JsonObject itemConfig = message.getObject(
          "transformerOverrides", id);
      if (itemConfig != null) {
        JsonObject config = (JsonObject) order.get("config");
        config.putAll(itemConfig);
      }
    }
  }
}

代码示例来源:origin: com.googlecode.redbox-mint/plugin-transaction-curation-redbox

((JsonObject) relation).put("oid", relatedOid);
  saveData = true;
if (curatedPid != null && (updatingById || updatingByOid)) {
  log.debug("Updating...");
  ((JsonObject) relation).put("isCurated", true);
  ((JsonObject) relation).put("curatedPid", curatedPid);
  saveData = true;
      task.remove("oid");
      task.put("identifier", relatedId);
      task.put("task", "curation-request");
      JsonObject relObject = new JsonObject();
      relObject.put("identifier", thisPid);
      relObject.put("curatedPid", thisPid);
      relObject.put("broker", brokerUrl);
      relObject.put("isCurated", true);
      relObject.put("relationship", reverseRelationship);
        relObject.put("oid", thisOid);
      task.put("relationships", newRelations);
    JsonObject msgResponse = new JsonObject();
    msgResponse.put("broker", brokerUrl);
    msgResponse.put("oid", thisOid);
    msgResponse.put("task", "curation-pending");

代码示例来源:origin: com.googlecode.the-fascinator.plugins/plugin-harvester-csv

JsonObject data = new JsonObject();
for (int index = 0; index < columns.length; index++) {
  String field = dataFields.get(index);
          data.put(field, list);
        data.put(field, value);
log.debug(data.toJSONString());
JsonObject meta = new JsonObject();
meta.put("dc.identifier", idPrefix + recordId);

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-core

/**
 * To delete object processing from queue
 *
 * @param oid Object id
 * @param jsonFile Configuration file
 * @throws MessagingException if the message could not be sent
 */
private void queueDelete(String oid, File jsonFile)
    throws MessagingException {
  try {
    JsonObject json = new JsonSimple(jsonFile).getJsonObject();
    json.put("oid", oid);
    json.put("deleted", "true");
    messaging.queueMessage(toolChainEntry, json.toString());
  } catch (IOException ioe) {
    log.error("Failed to parse message: {}", ioe.getMessage());
    throw new MessagingException(ioe);
  }
}

代码示例来源:origin: com.googlecode.redbox-mint/redbox-web-service

@SuppressWarnings("unchecked")
@ApiOperation(value = "get information about the ReDBox instance", tags = "info")
@ApiResponses({
  @ApiResponse(code = 200, message = "The datastreams are listed"),
  @ApiResponse(code = 500, message = "Server configuration not found", response = IOException.class)
})
@Get("json")
public String getServerInformation() throws IOException{
  JsonObject responseObject = getSuccessResponse(null);
  JsonSimpleConfig config = new JsonSimpleConfig();
  responseObject.put("institution", config.getString(null, "identity","institution"));
  responseObject.put("applicationVersion", config.getString(null, "redbox.version.string"));
  JSONArray packageTypes = new JSONArray();
  if ("mint".equals(config.getString(null, "system"))) {
    packageTypes.addAll(getPackageTypesFromFileSystem());
  } else {
    JsonObject packageTypesObject = config.getObject("portal", "packageTypes");
    packageTypes.addAll(packageTypesObject.keySet());
  }
  
  
  responseObject.put("packageTypes", packageTypes);
  return new JsonSimple(responseObject).toString(true);
}

代码示例来源:origin: com.googlecode.redbox-mint/redbox-reports

/**
 * Generates the report specific query from parameters
 */
@Override
public String getQueryAsString() {
  String query = "";
  JsonObject queryFilters = config.getObject("query", "filter");
  String[] keyArray = Arrays.copyOf(
      new ArrayList<Object>(queryFilters.keySet()).toArray(),
      queryFilters.keySet().size(), String[].class);
  List<String> keys = Arrays.asList(keyArray);
  java.util.Collections.sort(keys);
  query += processDateCriteria(queryFilters);
  query += processShowCriteria(queryFilters);       
  return query;
}

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common

/**
 * Wrap a JsonObject in this class
 *
 * @param newJsonObject : The JsonObject to wrap
 */
public JsonSimple(JsonObject newJsonObject) {
  substitueProperties = true;
  if (newJsonObject == null) {
    newJsonObject = new JsonObject();
  }
  jsonObject = newJsonObject;
}

代码示例来源:origin: com.googlecode.redbox-mint/plugin-transaction-curation-mint

"publish");
task.remove("oid") ;
task.put("identifier", relatedId);

相关文章