當前位置: 首頁>>代碼示例>>Java>>正文


Java ObjectNode.putArray方法代碼示例

本文整理匯總了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();

    }
 
開發者ID:skygiraffe,項目名稱:skygiraffe-slackbot,代碼行數:19,代碼來源:JsonUtil.java

示例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();

}
 
開發者ID:skygiraffe,項目名稱:skygiraffe-slackbot,代碼行數:35,代碼來源:JsonUtil.java

示例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;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:21,代碼來源:JobHistoryEventHandler.java

示例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;
}
 
開發者ID:Communote,項目名稱:communote-server,代碼行數:17,代碼來源:EmbedController.java

示例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;
}
 
開發者ID:Communote,項目名稱:communote-server,代碼行數:41,代碼來源:CreateNoteWidget.java

示例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;
    }
 
開發者ID:skygiraffe,項目名稱:skygiraffe-slackbot,代碼行數:44,代碼來源:SGDSClient.java


注:本文中的org.codehaus.jackson.node.ObjectNode.putArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。