本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}