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


Java Json.newObject方法代码示例

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


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

示例1: getDatasetColumnsByID

import play.libs.Json; //导入方法依赖的package包/类
public static Result getDatasetColumnsByID(int id)
{
    List<DatasetColumn> datasetColumnList = DatasetsDAO.getDatasetColumnsByID(id);

    ObjectNode result = Json.newObject();

    if (datasetColumnList != null && datasetColumnList.size() > 0)
    {
        result.put("status", "ok");
        result.set("columns", Json.toJson(datasetColumnList));
    }
    else
    {
        result.put("status", "error");
        result.put("message", "record not found");
    }

    return ok(result);
}
 
开发者ID:SirAeroWN,项目名称:premier-wherehows,代码行数:20,代码来源:Dataset.java

示例2: watchURN

import play.libs.Json; //导入方法依赖的package包/类
public static Result watchURN()
{
    Map<String, String[]> params = request().body().asFormUrlEncoded();
    ObjectNode result = Json.newObject();

    String username = session("user");
    if (StringUtils.isNotBlank(username))
    {
        String message = DatasetsDAO.watchURN(params, username);
        if (StringUtils.isBlank(message))
        {
            result.put("status", "success");
        }
        else
        {
            result.put("status", "failed");
            result.put("message", message);
        }
    }
    else
    {
        result.put("status", "failed");
        result.put("message", "User is not authenticated");
    }
    return ok(result);
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:27,代码来源:Dataset.java

示例3: putDatasetColumnComment

import play.libs.Json; //导入方法依赖的package包/类
public static Result putDatasetColumnComment(int id, int columnId, int commentId)
{
    ObjectNode result = Json.newObject();
    String username = session("user");
    Map<String, String[]> params = request().body().asFormUrlEncoded();
    if (StringUtils.isNotBlank(username))
    {
        String errorMsg = DatasetsDAO.postColumnComment(id, commentId, params, username);
        if (StringUtils.isBlank(errorMsg))
        {
            result.put("status", "success");
        }
        else
        {
            result.put("status", "failed");
            result.put("msg", errorMsg);
        }
    }
    else
    {
        result.put("status", "failed");
        result.put("msg", "Authentication Required");
    }

    return ok(result);
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:27,代码来源:Dataset.java

示例4: getDatasetImpactAnalysisByID

import play.libs.Json; //导入方法依赖的package包/类
public static Result getDatasetImpactAnalysisByID(int id)
{
    List<ImpactDataset> impactDatasetList = DatasetsDAO.getImpactAnalysisByID(id);

    ObjectNode result = Json.newObject();

    if (impactDatasetList != null)
    {
        result.put("status", "ok");
        result.set("impacts", Json.toJson(impactDatasetList));
    }
    else
    {
        result.put("status", "error");
        result.put("message", "record not found");
    }

    return ok(result);
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:20,代码来源:Dataset.java

示例5: addJobLineage

import play.libs.Json; //导入方法依赖的package包/类
@BodyParser.Of(BodyParser.Json.class)
public static Result addJobLineage() {
  JsonNode lineage = request().body().asJson();
  ObjectNode resultJson = Json.newObject();
  try {
    LineageDao.insertLineage(lineage);
    resultJson.put("return_code", 200);
    resultJson.put("message", "Lineage inserted!");
  } catch (Exception e) {
    e.printStackTrace();
    resultJson.put("return_code", 404);
    resultJson.put("error_message", e.getMessage());
  }

  return ok(resultJson);
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:17,代码来源:LineageController.java

示例6: unfavorite

import play.libs.Json; //导入方法依赖的package包/类
public static boolean unfavorite(int id, String user)
{
	ObjectNode resultNode = Json.newObject();
	boolean result = false;
	Integer userId = UserDAO.getUserIDByUserName(user);

	if (userId != null && userId !=0)
	{
		int row = getJdbcTemplate().update(UNFAVORITE_A_DATASET, userId, id);
		if (row > 0)
		{
			result = true;
		}
	}
	return result;
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:17,代码来源:DatasetsDAO.java

示例7: writeEmptyJsonResponse

import play.libs.Json; //导入方法依赖的package包/类
public static void writeEmptyJsonResponse(HttpServletResponse response) {
    response.setContentType("application/json");
    response.setStatus(HttpServletResponse.SC_OK);
    try (Writer writer = response.getWriter()) {
        ObjectNode data = Json.newObject();
        data.set("data", new ObjectMapper().createArrayNode());
        writer.write(data.toString());
    } catch (IOException e) {
        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    }
}
 
开发者ID:CSCfi,项目名称:exam,代码行数:12,代码来源:RemoteServerHelper.java

示例8: getAllCompanyUsers

import play.libs.Json; //导入方法依赖的package包/类
public static Result getAllCompanyUsers()
{
    ObjectNode result = Json.newObject();

    result.put("status", "ok");
    result.set("employees", Json.toJson(UserDAO.getAllCompanyUsers()));
    return ok(result);
}
 
开发者ID:SirAeroWN,项目名称:premier-wherehows,代码行数:9,代码来源:User.java

示例9: postDatasetComment

import play.libs.Json; //导入方法依赖的package包/类
public static Result postDatasetComment(int id)
{
    String body = request().body().asText();
    ObjectNode result = Json.newObject();
    String username = session("user");
    Map<String, String[]> params = request().body().asFormUrlEncoded();

    if (StringUtils.isNotBlank(username))
    {
        if (DatasetsDAO.postComment(id, params, username))
        {
            result.put("status", "success");
        }
        else
        {
            result.put("status", "failed");
            result.put("error", "true");
            result.put("msg", "Could not create comment.");
            return badRequest(result);
        }
    }
    else
    {
        result.put("status", "failed");
        result.put("error", "true");
        result.put("msg", "Unauthorized User.");
        return badRequest(result);
    }

    return ok(result);
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:32,代码来源:Dataset.java

示例10: getDatasetUrns

import play.libs.Json; //导入方法依赖的package包/类
public static Result getDatasetUrns(String propertiesLike) throws SQLException {
  ObjectNode resultJson = Json.newObject();
  try {
    if (propertiesLike != null) {
      ObjectNode result = DatasetDao.getDatasetUrnForPropertiesLike(propertiesLike);
      resultJson.put("return_code", 200);
      resultJson.set("dataset_urns", result);
    }
  } catch (Exception e) {
      ContrUtil.failure(resultJson, 404, e.getMessage());
      Logger.error(e.getMessage());
  }

  return ok(resultJson);
}
 
开发者ID:SirAeroWN,项目名称:premier-wherehows,代码行数:16,代码来源:DatasetController.java

示例11: unwatchDataset

import play.libs.Json; //导入方法依赖的package包/类
public static Result unwatchDataset(int id, int watchId)
{
    ObjectNode result = Json.newObject();
    if (DatasetsDAO.unwatch(watchId))
    {
        result.put("status", "success");
    }
    else
    {
        result.put("status", "failed");
    }

    return ok(result);
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:15,代码来源:Dataset.java

示例12: getSchemaHistory

import play.libs.Json; //导入方法依赖的package包/类
public static Result getSchemaHistory(int id)
{
    ObjectNode result = Json.newObject();

    result.put("status", "ok");
    result.set("data", Json.toJson(SchemaHistoryDAO.getSchemaHistoryByDatasetID(id)));
    return ok(result);
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:9,代码来源:SchemaHistory.java

示例13: updateDb

import play.libs.Json; //导入方法依赖的package包/类
public static Result updateDb() {
  JsonNode db = request().body().asJson();
  ObjectNode resultJson = Json.newObject();
  try {
    CfgDao.updateDb(db);
    resultJson.put("return_code", 200);
    resultJson.put("message", "App updated!");
  } catch (Exception e) {
    e.printStackTrace();
    resultJson.put("return_code", 404);
    resultJson.put("error_message", e.getMessage());
  }

  return ok(resultJson);
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:16,代码来源:CfgController.java

示例14: ownDataset

import play.libs.Json; //导入方法依赖的package包/类
public static Result ownDataset(int id)
{
    ObjectNode result = Json.newObject();
    String username = session("user");
    if (StringUtils.isNotBlank(username))
    {
        result = DatasetsDAO.ownDataset(id, username);
    }
    else
    {
        result.put("status", "failed");
    }

    return ok(result);
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:16,代码来源:Dataset.java

示例15: getFlowSchedules

import play.libs.Json; //导入方法依赖的package包/类
public static Result getFlowSchedules(String flowPath) {
  String instance = request().getQueryString("instance");
  ObjectNode resultJson = Json.newObject();

  try {
    List<Map<String, Object>> schedules = FlowDao.getFlowSchedules(flowPath, instance);
    resultJson.put("return_code", 200);
    resultJson.set("schedules", Json.toJson(schedules));
  } catch (Exception e) {
    e.printStackTrace();
    resultJson.put("return_code", 404);
    resultJson.put("error_message", e.getMessage());
  }
  return ok(resultJson);
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:16,代码来源:FlowController.java


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