當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。