use of org.codehaus.jackson.node.ArrayNode in project ovirt-engine by oVirt.
the class WebAdminHostPageServlet method getPluginDefinitionsArray.
protected ArrayNode getPluginDefinitionsArray(List<PluginData> pluginData) {
ArrayNode arr = createArrayNode();
for (PluginData data : pluginData) {
ObjectNode dataObj = createObjectNode();
// $NON-NLS-1$
dataObj.put("name", data.getName());
// $NON-NLS-1$
dataObj.put("url", data.getUrl());
// $NON-NLS-1$
dataObj.put("config", data.mergeConfiguration());
// $NON-NLS-1$
dataObj.put("lazyLoad", data.isLazyLoad());
// $NON-NLS-1$
dataObj.put("enabled", data.isEnabled());
arr.add(dataObj);
}
return arr;
}
use of org.codehaus.jackson.node.ArrayNode in project openmrs-module-coreapps by openmrs.
the class VisitTypeHelper method getVisitTypeColorCodes.
private Map<String, Object> getVisitTypeColorCodes(VisitType visitType) {
Map<String, Object> colorCode = new HashMap<String, Object>();
AdministrationService adminService = Context.getAdministrationService();
String propertyValue = adminService.getGlobalProperty(CoreAppsConstants.VISIT_TYPE_COLORS);
try {
if (StringUtils.isNotEmpty(propertyValue)) {
ArrayNode array = new ObjectMapper().readValue(propertyValue, ArrayNode.class);
for (JsonNode node : array) {
String visitTypeUuid = node.path("uuid").getTextValue();
if (visitType.getUuid().equalsIgnoreCase(visitTypeUuid)) {
colorCode.put("uuid", visitTypeUuid);
String color = node.path("color").getTextValue();
colorCode.put("color", color);
String shortName = node.path("shortName").getTextValue();
colorCode.put("shortName", shortName);
}
}
}
} catch (IOException ex) {
LOG.error("Error retrieving visit type color codes, " + ex);
}
return colorCode;
}
use of org.codehaus.jackson.node.ArrayNode in project openmrs-module-mirebalais by PIH.
the class CustomAppLoaderUtil method objectNode.
public static ObjectNode objectNode(Object... obj) {
ObjectNode objectNode = new ObjectMapper().createObjectNode();
for (int i = 0; i < obj.length; i = i + 2) {
String key = (String) obj[i];
Object value = obj[i + 1];
if (value instanceof Boolean) {
objectNode.put(key, (Boolean) value);
} else if (value instanceof String) {
objectNode.put(key, (String) value);
} else if (value instanceof Integer) {
objectNode.put(key, (Integer) value);
} else if (value instanceof ArrayNode) {
objectNode.put(key, (ArrayNode) value);
} else if (value instanceof ObjectNode) {
objectNode.put(key, (ObjectNode) value);
}
}
return objectNode;
}
use of org.codehaus.jackson.node.ArrayNode in project mongo-hadoop by mongodb.
the class TestStandalone method collectionSettings.
private JsonNode collectionSettings() {
ArrayNode settings = new ArrayNode(JsonNodeFactory.instance);
ObjectNode node = new ObjectNode(JsonNodeFactory.instance);
node.put(INPUT_URI, getInputUri().toString());
ObjectNode dow = new ObjectNode(JsonNodeFactory.instance);
dow.put("dayOfWeek", "FRIDAY");
node.put("query", dow);
node.put(MONGO_SPLITTER_CLASS, SingleMongoSplitter.class.getName());
node.put(SPLITS_USE_RANGEQUERY, true);
node.put(INPUT_NOTIMEOUT, true);
settings.add(node);
MongoClientURI inputUri3 = authCheck(new MongoClientURIBuilder().collection("mongo_hadoop", "yield_historical.in3")).build();
node = new ObjectNode(JsonNodeFactory.instance);
node.put(INPUT_URI, inputUri3.toString());
node.put(SPLITS_USE_RANGEQUERY, true);
node.put(INPUT_NOTIMEOUT, true);
settings.add(node);
return settings;
}
use of org.codehaus.jackson.node.ArrayNode in project stanbol by apache.
the class PosTagSupport method serialize.
@Override
public ObjectNode serialize(ObjectMapper mapper, PosTag value) {
ObjectNode jPosTag = mapper.createObjectNode();
jPosTag.put("tag", value.getTag());
if (value.getPos().size() == 1) {
jPosTag.put("pos", value.getPos().iterator().next().ordinal());
} else if (!value.getPos().isEmpty()) {
ArrayNode jPos = mapper.createArrayNode();
for (Pos pos : value.getPos()) {
jPos.add(pos.ordinal());
}
jPosTag.put("pos", jPos);
}
if (!value.getCategories().isEmpty()) {
// we need only the categories not covered by Pos elements
EnumSet<LexicalCategory> categories = EnumSet.noneOf(LexicalCategory.class);
categories.addAll(value.getCategories());
for (Pos pos : value.getPos()) {
categories.removeAll(pos.categories());
}
if (categories.size() == 1) {
jPosTag.put("lc", categories.iterator().next().ordinal());
} else if (!categories.isEmpty()) {
ArrayNode jCategory = mapper.createArrayNode();
for (LexicalCategory lc : categories) {
jCategory.add(lc.ordinal());
}
jPosTag.put("lc", jCategory);
}
}
return jPosTag;
}
Aggregations