当前位置: 首页>>代码示例>>Java>>正文


Java ArrayNode.add方法代码示例

本文整理汇总了Java中org.codehaus.jackson.node.ArrayNode.add方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayNode.add方法的具体用法?Java ArrayNode.add怎么用?Java ArrayNode.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.codehaus.jackson.node.ArrayNode的用法示例。


在下文中一共展示了ArrayNode.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createAuthLinkResponse

import org.codehaus.jackson.node.ArrayNode; //导入方法依赖的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: getClusterAsJson

import org.codehaus.jackson.node.ArrayNode; //导入方法依赖的package包/类
@Path("list")
@GET
@Produces(MediaType.APPLICATION_JSON)
public String   getClusterAsJson() throws Exception
{
    InstanceConfig      config = context.getExhibitor().getConfigManager().getConfig();

    ObjectNode          node = JsonNodeFactory.instance.objectNode();

    ArrayNode           serversNode = JsonNodeFactory.instance.arrayNode();
    ServerList          serverList = new ServerList(config.getString(StringConfigs.SERVERS_SPEC));
    for ( ServerSpec spec : serverList.getSpecs() )
    {
        serversNode.add(spec.getHostname());
    }
    node.put("servers", serversNode);
    node.put("port", config.getInt(IntConfigs.CLIENT_PORT));

    return JsonUtil.writeValueAsString(node);
}
 
开发者ID:dcos,项目名称:exhibitor,代码行数:21,代码来源:ClusterResource.java

示例3: extractCrosspostBlogs

import org.codehaus.jackson.node.ArrayNode; //导入方法依赖的package包/类
/**
 * Extracts the crosspost blogs from an autosave and creates a JSON array.
 *
 * @param item
 *            the item that holds the note data
 * @return the array
 */
private ArrayNode extractCrosspostBlogs(AutosaveNoteData item) {
    ArrayNode result = JsonHelper.getSharedObjectMapper().createArrayNode();
    if (item.getCrosspostBlogs() != null) {
        for (BlogData b : item.getCrosspostBlogs()) {
            String title = b.getTitle();
            ObjectNode blog = BlogSearchHelper.createBlogSearchJSONResult(b.getId(),
                    b.getNameIdentifier(), title, false);
            result.add(blog);
        }
    }
    if (result.size() == 0) {
        return null;
    }
    return result;
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:23,代码来源:CreateNoteWidget.java

示例4: createLoginLinkResponse

import org.codehaus.jackson.node.ArrayNode; //导入方法依赖的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

示例5: createInputPathsNode

import org.codehaus.jackson.node.ArrayNode; //导入方法依赖的package包/类
private ArrayNode createInputPathsNode(InputPathsContext inputPathsContext)
{
    ArrayNode inputPathArray = objMapper.createArrayNode();
    for (InputPathContext pctx : inputPathsContext.inputPath())
    {

        if (pctx.INT().size() != 0)
        {
            ObjectNode pathNode = objMapper.createObjectNode();
            pathNode.put("root", cleanPath(pctx.path()));
            pathNode.put("startDate", pctx.INT().get(0).getText());
            pathNode.put("endDate", pctx.INT().get(1).getText());
            inputPathArray.add(pathNode);
        }
        else
            inputPathArray.add(cleanPath(pctx.path()));

    }
    return inputPathArray;
}
 
开发者ID:linkedin,项目名称:Cubert,代码行数:21,代码来源:PhysicalParser.java

示例6: exitProgram

import org.codehaus.jackson.node.ArrayNode; //导入方法依赖的package包/类
@Override
public void exitProgram(JsonNode json)
{
    ObjectMapper mapper = new ObjectMapper();

    // put the dictionary columns in the json
    ObjectNode dictionaryNode = mapper.createObjectNode();
    ((ObjectNode) json).put("dictionary", dictionaryNode);
    for (String path : dictionaryColumns.keySet())
    {
        String[] columns = dictionaryColumns.get(path);
        ArrayNode node = mapper.createArrayNode();
        for (String column : columns)
        {
            node.add(createObjectNode("name", column, "type", "INT"));
        }
        dictionaryNode.put(path, node);
    }
}
 
开发者ID:svemuri,项目名称:CalcEngine,代码行数:20,代码来源:DictionaryAnalyzer.java

示例7: orderCollection

import org.codehaus.jackson.node.ArrayNode; //导入方法依赖的package包/类
public ArrayNode orderCollection(Collection<Order> collection) {
    ArrayNode array = JsonNodeFactory.instance.arrayNode();
    for(Order param : collection){
        ObjectNode obj =  JsonNodeFactory.instance.objectNode();
        obj.put("orderId", param.getId() );
        obj.put("mile", param.getMilesage() );
        obj.put("price", param.getPrice() );
        obj.put("sold", param.getSold() );
        obj.put("carName", param.getCar().getName() );
        obj.put("carId", param.getCar().getId() );
        obj.put("modelId", param.getCar().getModel().getId() );
        obj.put("bodyId", param.getCar().getBody().getId() );
        obj.put("drivetype", param.getCar().getDriveType().getId());
        obj.put("engineId", param.getCar().getEngine().getId() );
        obj.put("transsmId", param.getCar().getTransmission().getId() );
        obj.put("data", param.getRelease().getTime());
        obj.put("userId", param.getUser().getId() );
        array.add(obj);
    }
    return array;
}
 
开发者ID:SergeyZhernovoy,项目名称:Java-education,代码行数:22,代码来源:UpdateOrder.java

示例8: convert

import org.codehaus.jackson.node.ArrayNode; //导入方法依赖的package包/类
public ArrayNode convert(Collection<Order> collection) {

        ArrayNode array = JsonNodeFactory.instance.arrayNode();
        for(Order param : collection){

            ObjectNode order = JsonNodeFactory.instance.objectNode();
            order.put("orderId", param.getId() );
            order.put("mile", param.getMilesage() );
            order.put("price", param.getPrice() );
            if(param.getSold()){
                order.put("sold", "V" );
            } else {
                order.put("sold", "" );
            }
            order.put("carName", param.getCar().getName() );
            order.put("carId", param.getCar().getId() );

            GregorianCalendar calendar = new GregorianCalendar();
            calendar.setTimeInMillis(param.getRelease().getTime());
            //calendar.get(Calendar.YEAR);

            order.put("data", String.valueOf(calendar.get(Calendar.YEAR)));
            order.put("userId", param.getUser().getId() );
            array.add(order);
        }
        return array;

    }
 
开发者ID:SergeyZhernovoy,项目名称:Java-education,代码行数:29,代码来源:FilterOrder.java

示例9: createEntitySearchJSONResult

import org.codehaus.jackson.node.ArrayNode; //导入方法依赖的package包/类
/**
 * Creates an array of JSON objects which hold details about the found users or groups.
 * 
 * @param list
 *            the search result to process
 * @param addSummary
 *            if true a summary JSON object will be added to the top of the array. The JSON
 *            object will be created with {@link #createSearchSummaryStatement(PageableList)} .
 * @param imageSize
 *            the size of the user logo to include in the image path, can be null to not include
 *            the image path into the JSON object. For groups no image will be included.
 * @return the JSON array with the details about the users
 */
public static ArrayNode createEntitySearchJSONResult(
        PageableList<CommunoteEntityData> list, boolean addSummary,
        ImageSizeType imageSize) {
    JsonNodeFactory nodeFactory = JsonHelper.getSharedObjectMapper()
            .getNodeFactory();
    ArrayNode result = nodeFactory.arrayNode();
    if (addSummary) {
        result.add(UserSearchHelper.createSearchSummaryStatement(list));
    }
    for (CommunoteEntityData item : list) {
        String imagePath = null;
        boolean isGroup = (item instanceof EntityGroupListItem);
        if (!isGroup && imageSize != null) {
            imagePath = ImageUrlHelper.buildUserImageUrl(item.getEntityId(), imageSize);
        }
        ObjectNode entry = createUserSearchJSONResult(item.getEntityId(),
                item.getShortDisplayName(), item.getDisplayName(),
                imagePath, item.getAlias());
        entry.put("isGroup", isGroup);
        result.add(entry);
    }
    return result;
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:37,代码来源:UserSearchHelper.java

示例10: addBlogsToJsonResponse

import org.codehaus.jackson.node.ArrayNode; //导入方法依赖的package包/类
/**
 * Add the JSON objects of the blogs to the JSON response.
 * 
 * @param jsonResponse
 *            the response object to write to
 * @param list
 *            list to process
 * @param includeDescription
 *            whether to include the description
 * @param includeImagePath
 *            whether to include the path to the image
 */
private static void addBlogsToJsonResponse(ArrayNode jsonResponse,
        Collection<BlogData> list, boolean includeDescription, boolean includeImagePath) {
    for (BlogData item : list) {
        ObjectNode entry;
        if (includeDescription) {
            entry = BlogSearchHelper.createBlogSearchJSONResult(item.getId(),
                    item.getNameIdentifier(), item.getTitle(), item.getDescription(),
                    includeImagePath);
        } else {
            entry = BlogSearchHelper.createBlogSearchJSONResult(item.getId(),
                    item.getNameIdentifier(), item.getTitle(), includeImagePath);
        }
        jsonResponse.add(entry);
    }
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:28,代码来源:BlogSearchHelper.java

示例11: exportChildrenToMetadata

import org.codehaus.jackson.node.ArrayNode; //导入方法依赖的package包/类
/**
 * Export the children of the topic to the response metadata as a JSON array
 * 
 * @param children
 *            the children to export
 */
private void exportChildrenToMetadata(List<DetailBlogListItem> children) {
    children = BlogManagementHelper.sortedBlogList(children);
    ArrayNode result = JsonHelper.getSharedObjectMapper().createArrayNode();
    for (DetailBlogListItem child : children) {
        result.add(BlogSearchHelper.createBlogSearchJSONResult(child.getId(),
                child.getNameIdentifier(), child.getTitle(), false));
    }
    this.setResponseMetadata("childTopics", result);
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:16,代码来源:EditTopicStructureWidget.java

示例12: extractAttachments

import org.codehaus.jackson.node.ArrayNode; //导入方法依赖的package包/类
/**
 * Extracts the attachments from a note and creates a JSON array.
 *
 * @param item
 *            the item that holds the note data
 * @return the array
 */
private ArrayNode extractAttachments(NoteData item) {
    ArrayNode result = JsonHelper.getSharedObjectMapper().createArrayNode();
    List<AttachmentData> attachments = item.getAttachments();
    if (attachments != null) {
        for (AttachmentData attachment : attachments) {
            ObjectNode attach = CreateBlogPostFeHelper.createAttachmentJSONObject(attachment);
            result.add(attach);
        }
    }
    return result.size() == 0 ? null : result;
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:19,代码来源:CreateNoteWidget.java

示例13: extractUsersToNotify

import org.codehaus.jackson.node.ArrayNode; //导入方法依赖的package包/类
/**
 * Extracts the users to notify from a note and creates a JSON array.
 *
 * @param item
 *            the item that holds the note data
 * @return the array
 */
private ArrayNode extractUsersToNotify(NoteData item) {
    ArrayNode result = JsonHelper.getSharedObjectMapper().createArrayNode();
    if (item.getNotifiedUsers() != null) {
        for (DetailedUserData ul : item.getNotifiedUsers()) {
            ObjectNode user = UserSearchHelper.createUserSearchJSONResult(ul,
                    ImageSizeType.MEDIUM);
            result.add(user);
        }
    }
    // add @@ mentions by building fake users
    if (item.isMentionDiscussionAuthors()) {
        result.add(UserSearchHelper.createUserSearchJSONResult(null, null,
                MessageHelper.getText(getRequest(), "autosuggest.atat.discussion"), null,
                NoteManagement.CONSTANT_MENTION_DISCUSSION_PARTICIPANTS));
    }
    if (item.isMentionTopicAuthors()) {
        result.add(UserSearchHelper.createUserSearchJSONResult(null, null,
                MessageHelper.getText(getRequest(), "autosuggest.atat.authors"), null,
                NoteManagement.CONSTANT_MENTION_TOPIC_AUTHORS));
    }
    if (item.isMentionTopicReaders()) {
        result.add(UserSearchHelper.createUserSearchJSONResult(null, null,
                MessageHelper.getText(getRequest(), "autosuggest.atat.all"), null,
                NoteManagement.CONSTANT_MENTION_TOPIC_READERS));
    }
    if (item.isMentionTopicManagers()) {
        result.add(UserSearchHelper.createUserSearchJSONResult(null, null,
                MessageHelper.getText(getRequest(), "autosuggest.atat.managers"), null,
                NoteManagement.CONSTANT_MENTION_TOPIC_MANAGERS));
    }
    if (result.size() == 0) {
        return null;
    }
    return result;
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:43,代码来源:CreateNoteWidget.java

示例14: createNotePropertyFilter

import org.codehaus.jackson.node.ArrayNode; //导入方法依赖的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

示例15: addParameters

import org.codehaus.jackson.node.ArrayNode; //导入方法依赖的package包/类
protected static void addParameters(ObjectNode cstNode, Map<Parameter<?>, Object> params) {
	ArrayNode argsNode = JsonNodeFactory.instance.arrayNode();
	cstNode.put(ArgsKey, argsNode);

	for (Entry<Parameter<?>, Object> entry : params.entrySet()) {
		ObjectNode argNode = JsonNodeFactory.instance.objectNode();
		argNode.put(ArgNameKey, entry.getKey().id());
		argNode.put(ArgValueKey, String.valueOf(entry.getValue()));
		argsNode.add(argNode);
	}
}
 
开发者ID:Comcast,项目名称:pipeclamp,代码行数:12,代码来源:QAUtil.java


注:本文中的org.codehaus.jackson.node.ArrayNode.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。