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


Java JsonUtil.writeValueAsIndentString方法代码示例

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


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

示例1: updateModelDesc

import org.apache.kylin.common.util.JsonUtil; //导入方法依赖的package包/类
@RequestMapping(value = "", method = { RequestMethod.PUT }, produces = { "application/json" })
@ResponseBody
public ModelRequest updateModelDesc(@RequestBody ModelRequest modelRequest) throws JsonProcessingException {
    DataModelDesc modelDesc = deserializeDataModelDesc(modelRequest);
    if (modelDesc == null) {
        return modelRequest;
    }
    try {
        modelDesc = modelService.updateModelAndDesc(modelRequest.getProject(), modelDesc);
    } catch (AccessDeniedException accessDeniedException) {
        throw new ForbiddenException("You don't have right to update this model.");
    } catch (Exception e) {
        logger.error("Failed to deal with the request:" + e.getLocalizedMessage(), e);
        throw new InternalErrorException("Failed to deal with the request: " + e.getLocalizedMessage());
    }

    if (modelDesc.getError().isEmpty()) {
        modelRequest.setSuccessful(true);
    } else {
        logger.warn("Model " + modelDesc.getName() + " fail to update because " + modelDesc.getError());
        updateRequest(modelRequest, false, omitMessage(modelDesc.getError()));
    }
    String descData = JsonUtil.writeValueAsIndentString(modelDesc);
    modelRequest.setModelDescData(descData);
    return modelRequest;
}
 
开发者ID:apache,项目名称:kylin,代码行数:27,代码来源:ModelController.java

示例2: testGetCopyOf

import org.apache.kylin.common.util.JsonUtil; //导入方法依赖的package包/类
@Test
public void testGetCopyOf() throws JsonProcessingException {
    DataModelDesc desc = DataModelManager.getInstance(getTestConfig()).getDataModelDesc("test_kylin_inner_join_model_desc");
    DataModelDesc copyDesc = DataModelDesc.getCopyOf(desc);

    // uuid is different, set to equals for json comparison
    copyDesc.setUuid(desc.getUuid());
    copyDesc.setLastModified(desc.getLastModified());

    String descStr = JsonUtil.writeValueAsIndentString(desc);
    String copyStr = JsonUtil.writeValueAsIndentString(copyDesc);

    assertEquals(descStr, copyStr);
}
 
开发者ID:apache,项目名称:kylin,代码行数:15,代码来源:DataModelDescTest.java

示例3: testPartitionDescCopyOf

import org.apache.kylin.common.util.JsonUtil; //导入方法依赖的package包/类
@Test
public void testPartitionDescCopyOf() throws JsonProcessingException {
    PartitionDesc desc = DataModelManager.getInstance(getTestConfig()).getDataModelDesc("test_kylin_inner_join_model_desc").partitionDesc;
    PartitionDesc copyDesc = PartitionDesc.getCopyOf(desc);

    String descStr = JsonUtil.writeValueAsIndentString(desc);
    String copyStr = JsonUtil.writeValueAsIndentString(copyDesc);

    assertEquals(descStr, copyStr);
}
 
开发者ID:apache,项目名称:kylin,代码行数:11,代码来源:DataModelDescTest.java

示例4: serialize

import org.apache.kylin.common.util.JsonUtil; //导入方法依赖的package包/类
@Override
public void serialize(DictionaryInfo obj, DataOutputStream out) throws IOException {
    String json = JsonUtil.writeValueAsIndentString(obj);
    out.writeUTF(json);

    if (infoOnly == false)
        obj.getDictionaryObject().write(out);
}
 
开发者ID:apache,项目名称:kylin,代码行数:9,代码来源:DictionaryInfoSerializer.java

示例5: serialize

import org.apache.kylin.common.util.JsonUtil; //导入方法依赖的package包/类
@Override
public void serialize(SnapshotTable obj, DataOutputStream out) throws IOException {
    String json = JsonUtil.writeValueAsIndentString(obj);
    out.writeUTF(json);

    if (infoOnly == false)
        obj.writeData(out);
}
 
开发者ID:apache,项目名称:kylin,代码行数:9,代码来源:SnapshotTableSerializer.java

示例6: testSerialize

import org.apache.kylin.common.util.JsonUtil; //导入方法依赖的package包/类
@Test
public void testSerialize() throws Exception {
    CubeDesc desc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
    String str = JsonUtil.writeValueAsIndentString(desc);
    //System.out.println(str);
    @SuppressWarnings("unused")
    CubeDesc desc2 = JsonUtil.readValue(str, CubeDesc.class);
}
 
开发者ID:apache,项目名称:kylin,代码行数:9,代码来源:CubeDescTest.java

示例7: testGetCopyOf

import org.apache.kylin.common.util.JsonUtil; //导入方法依赖的package包/类
@Test
public void testGetCopyOf() throws Exception {
    CubeDesc desc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
    CubeDesc copyDesc = CubeDesc.getCopyOf(desc);

    // uuid is different, set to equals for json comparison
    copyDesc.setUuid(desc.getUuid());
    copyDesc.setLastModified(desc.getLastModified());

    String descStr = JsonUtil.writeValueAsIndentString(desc);
    String copyStr = JsonUtil.writeValueAsIndentString(copyDesc);

    assertEquals(descStr, copyStr);
}
 
开发者ID:apache,项目名称:kylin,代码行数:15,代码来源:CubeDescTest.java

示例8: testSerialize

import org.apache.kylin.common.util.JsonUtil; //导入方法依赖的package包/类
@Test
public void testSerialize() throws Exception {
    CubeDesc desc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc("test_kylin_cube_with_slr_desc");
    String str = JsonUtil.writeValueAsIndentString(desc);
    System.out.println(str);
    @SuppressWarnings("unused")
    CubeDesc desc2 = JsonUtil.readValue(str, CubeDesc.class);
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:9,代码来源:CubeDescTest.java

示例9: testSerialization

import org.apache.kylin.common.util.JsonUtil; //导入方法依赖的package包/类
@Test
public void testSerialization() throws IOException {
    IIDesc iiDesc = IIDescManager.getInstance(getTestConfig()).getIIDesc("test_kylin_ii_desc");
    String str = JsonUtil.writeValueAsIndentString(iiDesc);
    System.out.println(str);
    @SuppressWarnings("unused")
    IIDesc desc2 = JsonUtil.readValue(str, IIDesc.class);

    Assert.assertEquals(iiDesc, desc2);
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:11,代码来源:IIDescTest.java


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