本文整理汇总了Java中org.codehaus.jackson.node.ObjectNode.putArray方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectNode.putArray方法的具体用法?Java ObjectNode.putArray怎么用?Java ObjectNode.putArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.jackson.node.ObjectNode
的用法示例。
在下文中一共展示了ObjectNode.putArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAuthLinkResponse
import org.codehaus.jackson.node.ObjectNode; //导入方法依赖的package包/类
public static String createAuthLinkResponse(){
JsonNodeFactory f = JsonNodeFactory.instance ;
ObjectNode loginResponse = f.objectNode();
loginResponse.put("text","Authorization for SkyGiraffe to use Slack details is required.");
ArrayNode attachments = loginResponse.putArray("attachments");
ObjectNode att = f.objectNode();
att.put("fallback", "Please authorize SkyGiraffe to access to your Slack details ...");
att.put("pretext", "");
att.put("title", "Please authorize..");
att.put("title_link", Config.getPropertyValue("SLACK_AUTH_URL_DEV"));
att.put("text","Once authorized and logged into SkyGiraffe try '/sg help' to see all commands");
att.put("color", "#7CD197");
attachments.add(att);
return loginResponse.toString();
}
示例2: createLoginLinkResponse
import org.codehaus.jackson.node.ObjectNode; //导入方法依赖的package包/类
/**
* {
"attachments": [
{
"fallback": "Please login into SkyGiraffe to continue ...",
"pretext": "SkyGiraffe Login",
"title": "Please login into SkyGiraffe to continue ...",
"title_link": "https://sgbot-mobilityai.rhcloud.com/SGbot-1.0/skyg/login?key=",
"text": "Once logged in try '/sg help' to see all commands",
"color": "#7CD197"
}
]
}
* @return
*/
public static String createLoginLinkResponse(String slackUserId, String email, String teamId){
JsonNodeFactory f = JsonNodeFactory.instance ;
ObjectNode loginResponse = f.objectNode();
loginResponse.put("text","Login to SkyGiraffe is required.");
ArrayNode attachments = loginResponse.putArray("attachments");
ObjectNode att = f.objectNode();
att.put("fallback", "Please login into SkyGiraffe to continue ...");
att.put("pretext", "");
att.put("title", "Please login..");
att.put("title_link", Config.getPropertyValue("SGDS_LOGIN_URL_DEV")+slackUserId+"&EMAIL="+email+"&TEAMID="+teamId);
att.put("text","Once logged in try '/sg help' to see all commands");
att.put("color", "#7CD197");
attachments.add(att);
return loginResponse.toString();
}
示例3: countersToJSON
import org.codehaus.jackson.node.ObjectNode; //导入方法依赖的package包/类
@Private
public JsonNode countersToJSON(Counters counters) {
ObjectMapper mapper = new ObjectMapper();
ArrayNode nodes = mapper.createArrayNode();
if (counters != null) {
for (CounterGroup counterGroup : counters) {
ObjectNode groupNode = nodes.addObject();
groupNode.put("NAME", counterGroup.getName());
groupNode.put("DISPLAY_NAME", counterGroup.getDisplayName());
ArrayNode countersNode = groupNode.putArray("COUNTERS");
for (Counter counter : counterGroup) {
ObjectNode counterNode = countersNode.addObject();
counterNode.put("NAME", counter.getName());
counterNode.put("DISPLAY_NAME", counter.getDisplayName());
counterNode.put("VALUE", counter.getValue());
}
}
}
return nodes;
}
示例4: createNotePropertyFilter
import org.codehaus.jackson.node.ObjectNode; //导入方法依赖的package包/类
public static Object createNotePropertyFilter(String keyGroup, String key, String value,
PropertyFilter.MatchMode matchMode, boolean negate) {
ObjectNode propsObj = JsonHelper.getSharedObjectMapper().createObjectNode();
propsObj.put("name", "npf");
ArrayNode filterData = propsObj.putArray("value");
filterData.add("Note");
filterData.add(keyGroup);
filterData.add(key);
filterData.add(value);
filterData.add(matchMode.name());
// negation flag is optional
if (negate) {
filterData.add(true);
}
return propsObj;
}
示例5: createJsonNoteObject
import org.codehaus.jackson.node.ObjectNode; //导入方法依赖的package包/类
/**
* Creates a JSON object with data about a note.
*
* @param item
* the list item from which the data will be extracted
* @param isAutosave
* whether the item is an autosave or published note
* @param plaintextOnly
* true if the client expects the content in plaintext and not HTML
* @return the JSON object
*/
private ObjectNode createJsonNoteObject(NoteData item, boolean isAutosave, boolean plaintextOnly) {
ObjectNode jsonObj = JsonHelper.getSharedObjectMapper().createObjectNode();
if (plaintextOnly) {
jsonObj.put("content", HTMLHelper.htmlToPlaintextExt(item.getContent(), false));
} else {
jsonObj.put("content", item.getContent());
}
jsonObj.put("tags", extractTags(item));
jsonObj.put("usersToNotify", extractUsersToNotify(item));
jsonObj.put("attachments", extractAttachments(item));
jsonObj.put("isDirectMessage", item.isDirect());
jsonObj.put("isAutosave", isAutosave);
if (item.getBlog() != null) {
jsonObj.put("targetBlog", BlogSearchHelper.createBlogSearchJSONResult(item.getBlog()
.getId(), item.getBlog().getAlias(), item.getBlog().getTitle(), false));
}
if (item.getObjectProperties() != null) {
ArrayNode properties = jsonObj.putArray("properties");
for (StringPropertyTO property : item.getObjectProperties()) {
ObjectNode propertyJson = properties.addObject();
propertyJson.put("keyGroup", property.getKeyGroup());
propertyJson.put("key", property.getPropertyKey());
propertyJson.put("value", property.getPropertyValue());
}
}
return jsonObj;
}
示例6: getParameterList
import org.codehaus.jackson.node.ObjectNode; //导入方法依赖的package包/类
public static String getParameterList(String sessionId, String appId, String repId, String repUpId) throws IOException {
//
if (sessionId == null || sessionId.isEmpty())
throw new IllegalArgumentException("Session Id is empty. Please login.");
HttpPost postRequest = new HttpPost("https://wspublisherv2https.skygiraffe.com/WSPublisherV2.svc/GetReport_ParametersMainScreen4");
// add header
postRequest.setHeader("Content-Type", "application/json");
JsonNodeFactory f = JsonNodeFactory.instance;
ObjectNode o = f.objectNode();
o.put("ApplicationID", appId);
o.put("ReportID", repId);
o.put("TabID","");
ArrayNode diuId = f.arrayNode();
diuId = o.putArray("DataItemUpdateIDs");
o.put("ReportUpdateID",repUpId);
o.put("RequestID",sessionId);
o.put("SessionID",sessionId);
StringEntity inputApps = new StringEntity(o.toString());
inputApps.setContentType("application/json");
postRequest.setEntity(inputApps);
CloseableHttpResponse responseParams = getHttpClient().execute(postRequest);
String paramStr = "";
try {
HttpEntity entityApps = responseParams.getEntity();
paramStr = EntityUtils.toString(entityApps, "UTF-8");
EntityUtils.consume(entityApps);
}finally{
responseParams.close();
}
logger.debug("Params = "+paramStr);
return paramStr;
}