本文整理了Java中com.googlecode.fascinator.common.JsonObject.keySet()
方法的一些代码示例,展示了JsonObject.keySet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonObject.keySet()
方法的具体详情如下:
包路径:com.googlecode.fascinator.common.JsonObject
类名称:JsonObject
方法名:keySet
暂无
代码示例来源: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
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.redbox-mint/redbox-vital-transformer-fedora3
/**
* Trivial wrapper on the JsonConfigHelper getMap() method to cast all map
* entries to strings if appropriate and return.
*
* @param json The json object to query.
* @param path The path on which the map is found.
* @return Map<String, String>: The object map cast to Strings
*/
private Map<String, String> getStringMap(JsonSimple json, String... path) {
Map<String, String> response = new LinkedHashMap<String, String>();
JsonObject object = json.getObject((Object[]) path);
if (object == null) {
return null;
}
for (Object key : object.keySet()) {
Object value = object.get(key);
if (value instanceof String) {
response.put((String) key, (String) value);
}
}
return response;
}
代码示例来源:origin: com.googlecode.redbox-mint/redbox-vital-subscriber
/**
* Trivial wrapper on the JsonConfigHelper getMap() method to cast all map
* entries to strings if appropriate and return.
*
* @param json : The json object to query.
* @param path : The path on which the map is found.
* @return Map<String, String>: The object map cast to Strings
*/
private Map<String, String> getStringMap(JsonSimple json, String... path) {
Map<String, String> response = new LinkedHashMap();
JsonObject object = json.getObject((Object[]) path);
if (object == null) {
return null;
}
for (Object key : object.keySet()) {
Object value = object.get(key);
if (value instanceof String) {
response.put((String) key, (String) value);
}
}
return response;
}
代码示例来源: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);
reportCriteriaOptionsJson.getArray("results");
query += processDateCriteria(queryFilters);
query += processShowCriteria(queryFilters);
int i = 1;
/*while (true) {
if (keys.indexOf("report-criteria." + i + ".dropdown") == -1) {
break;
}
query += processReportCriteria(queryFilters, i);
i++;
}*/
query += " AND workflow_id:dataset";
return query;
}
代码示例来源:origin: com.googlecode.the-fascinator.plugins/plugin-transformer-jsonVelocity
for (Object oKey : json.getJsonObject().keySet()) {
代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common
for (Object oKey : json.getJsonObject().keySet()) {
代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common
/**
* Return the List of SolrFacet objects from this result set.
*
* @return List<SolrFacet> : The list of facets
*/
public Map<String, SolrFacet> getFacets() {
if (facets == null) {
facets = new LinkedHashMap<String, SolrFacet>();
JsonObject object = getObject("facet_counts", "facet_fields");
if (object == null) {
return null;
}
for (Object key : object.keySet()) {
Object value = object.get(key);
if (value instanceof JSONArray) {
facets.put((String) key,
new SolrFacet((String) key, (JSONArray) value));
}
}
}
return facets;
}
代码示例来源: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.the-fascinator/fascinator-common
/**
* Map the system-config.json to a properties file. Nested attributes are
* mapped in dot notation.
*
* e.g. { "config": { "configItem": "sample config" } } becomes
* config.configItem=sample config in the properties configuration
*
*
* @param config
* @return
*/
private Properties mapJsonToProperties(JsonSimpleConfig config) {
Properties properties = new Properties();
JsonObject obj = config.getJsonObject();
for (Object o : obj.keySet()) {
String key = (String) o;
Object value = obj.get(key);
if (value instanceof String) {
properties.put(key, value);
} else if (value instanceof JsonObject) {
processJsonObjectToProperties((JsonObject) value, key,
properties);
}
}
return properties;
}
代码示例来源:origin: com.googlecode.redbox-mint/redbox-web-service
for (Object key : params.keySet()) {
objectMetadata.setProperty(key.toString(), params.get(key).toString());
for (Object keyObject : data.keySet()) {
objectMetadata.put(keyObject, data.get(keyObject));
代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common
for (Object key : jsonObject.keySet()) {
Object value = jsonObject.get(key);
代码示例来源:origin: com.googlecode.the-fascinator.plugins/plugin-indexer-solr
for (Object key : indexerConfig.keySet()) {
if (key instanceof String) {
String keyString = (String) key;
代码示例来源:origin: com.googlecode.the-fascinator/fascinator-core
rendererNames.put(ConveyerBelt.CRITICAL_USER_SELECTOR, userQueue);
JsonObject map = config.getObject("config", "normal-renderers");
for (Object selector : map.keySet()) {
rendererNames.put(selector.toString(),
map.get(selector).toString());
代码示例来源:origin: com.googlecode.redbox-mint/plugin-transaction-curation-redbox
/**
* Accept and parse raw JSON data from an InputStream. Field name String
* literals will be broken down into meaningful JSON data structures.
*
* @param input The form data to parse from an InputStream
* @return JsonSimple The parsed form data in JSON
* @throws IOException if there are errors reading/parsing the form data
*/
public static JsonSimple parse(InputStream input) throws IOException {
JsonSimple inputData = new JsonSimple(input);
JsonSimple responseData = new JsonSimple();
// Go through every top level node
JsonObject object = inputData.getJsonObject();
for (Object key : object.keySet()) {
// Ignoring some non-form related nodes
String strKey = validString(key);
if (!EXCLUDED_FIELDS.contains(strKey)) {
// And parse them into the repsonse
String data = validString(object.get(key));
parseField(responseData, strKey, data);
}
}
return responseData;
}
代码示例来源:origin: com.googlecode.redbox-mint/redbox-web-service
@ApiOperation(value = "updates the record's Object Metadata", tags="objectmeta")
@ApiImplicitParams({
@ApiImplicitParam(name = "skipReindex", value="Skip the reindex process. Useful if you are batching many changes to a ReDBox object at once.", required = false, allowMultiple = false, defaultValue = "false", dataType = "string") })
@ApiResponses({
@ApiResponse(code = 200, message = "The object metadata is updated"),
@ApiResponse(code = 500, message = "General Error", response = Exception.class)
})
@Post("json")
public String updateMetadataResource(JsonRepresentation data) throws IOException, PluginException, MessagingException {
Storage storage = (Storage) ApplicationContextProvider.getApplicationContext().getBean("fascinatorStorage");
String oid = getAttribute("oid");
JsonSimple metadataJson = new JsonSimple(data.getText());
JsonObject metadataObject = metadataJson.getJsonObject();
DigitalObject digitalObject = StorageUtils.getDigitalObject(storage, oid);
Properties metadata = digitalObject.getMetadata();
for (Object key : metadataObject.keySet()) {
metadata.setProperty((String) key, (String) metadataObject.get(key));
}
ByteArrayOutputStream output = new ByteArrayOutputStream();
metadata.store(output, null);
ByteArrayInputStream input = new ByteArrayInputStream(output.toByteArray());
StorageUtils.createOrUpdatePayload(digitalObject, "TF-OBJ-META", input);
reindex(oid);
return getSuccessResponseString(oid);
}
代码示例来源:origin: com.googlecode.redbox-mint/redbox-web-service
for (Object key : params.keySet()) {
objectMetadata.setProperty(key.toString(), params.get(key).toString());
代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common
for (Object objKey : toMove.keySet()) {
String key = (String) objKey;
if (key.equals(destination)) {
代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common
for (Object objKey : toMove.keySet()) {
String key = (String) objKey;
if (key.equals(destination)) {
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!