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


Java JsonNodeFactory.arrayNode方法代码示例

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


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

示例1: createEntitySearchJSONResult

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

示例2: createOverrideStrategyField

import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
/**
 * Creates the override strategy field.
 *
 * @return the field
 */
private Field createOverrideStrategyField() {
  List<String> overrideStrategySymbols = Arrays.asList(OverrideStrategy.APPEND.name(),
      OverrideStrategy.REPLACE.name());
  Schema overrideStrategyEnum = Schema.createEnum(OVERRIDE_STRATEGY_TYPE_NAME, null,
      BASE_SCHEMA_FORM_NAMESPACE, overrideStrategySymbols);
  Field overrideStrategyField = new Field(OVERRIDE_STRATEGY, Schema.createUnion(Arrays.asList(
      overrideStrategyEnum, Schema.create(Type.NULL))), null, null);
  overrideStrategyField.addProp(DISPLAY_NAME, "Override strategy");
  JsonNodeFactory jsonFactory = JsonNodeFactory.instance;
  ArrayNode displayNamesNode = jsonFactory.arrayNode();
  displayNamesNode.add(TextNode.valueOf("Append"));
  displayNamesNode.add(TextNode.valueOf("Replace"));
  overrideStrategyField.addProp(DISPLAY_NAMES, displayNamesNode);
  overrideStrategyField.addProp(DISPLAY_PROMPT, "Select array override strategy");
  return overrideStrategyField;
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:22,代码来源:ConfigurationSchemaFormAvroConverter.java

示例3: createClassTypeField

import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
/**
 * Creates the class type field.
 *
 * @return the field
 */
private Field createClassTypeField() {
  List<String> classTypeSymbols = Arrays.asList(OBJECT, EVENT);
  Schema classTypeEnum = Schema.createEnum(CLASS_TYPE_TYPE_NAME, null,
      BASE_SCHEMA_FORM_NAMESPACE, classTypeSymbols);
  Field classTypeField = new Field(CLASS_TYPE, classTypeEnum, null, null);
  classTypeField.addProp(DISPLAY_NAME, "Class type");
  JsonNodeFactory jsonFactory = JsonNodeFactory.instance;
  ArrayNode displayNamesNode = jsonFactory.arrayNode();
  displayNamesNode.add(TextNode.valueOf("Object"));
  displayNamesNode.add(TextNode.valueOf("Event"));
  classTypeField.addProp(DISPLAY_NAMES, displayNamesNode);
  classTypeField.addProp(DISPLAY_PROMPT, "Select class type");
  classTypeField.addProp(BY_DEFAULT, OBJECT);
  return classTypeField;
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:21,代码来源:EcfSchemaFormAvroConverter.java

示例4: getParameterList

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

示例5: createBytesJsonValue

import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
/**
 * Creates the bytes json value.
 *
 * @param value the value
 * @return the array node
 * @throws ParseException the parse exception
 */
private static ArrayNode createBytesJsonValue(String value) throws ParseException {
    if (value != null) {
        JsonNodeFactory jsonFactory = JsonNodeFactory.instance;            
        ArrayNode bytesNode = jsonFactory.arrayNode();
        byte[] data = Base64Utils.fromBase64(value);
        for (int i=0;i<data.length;i++) {
            bytesNode.add(data[i]);
        }
        return bytesNode;
    } else {
        return null;
    }
}
 
开发者ID:kaaproject,项目名称:avro-ui,代码行数:21,代码来源:SchemaFormAvroConverter.java


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