本文整理匯總了Java中models.daos.DatasetDao類的典型用法代碼示例。如果您正苦於以下問題:Java DatasetDao類的具體用法?Java DatasetDao怎麽用?Java DatasetDao使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DatasetDao類屬於models.daos包,在下文中一共展示了DatasetDao類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getDatasetDependentsById
import models.daos.DatasetDao; //導入依賴的package包/類
public static Result getDatasetDependentsById(Long datasetId) throws SQLException {
ObjectNode resultJson = Json.newObject();
if (datasetId > 0) {
try {
List<Map<String, Object>> dependents = DatasetDao.getDatasetDependents(datasetId);
resultJson.put("return_code", 200);
resultJson.set("dependents", Json.toJson(dependents));
} catch (EmptyResultDataAccessException e) {
ContrUtil.failure(resultJson, 404, "no dependent datasets can be found!");
Logger.error(e.getMessage());
}
return ok(resultJson);
}
// if no parameter, return an error message
ContrUtil.failure(resultJson, "Dataset Id is not provided or invalid");
return ok(resultJson);
}
示例2: getLatestBetween
import models.daos.DatasetDao; //導入依賴的package包/類
public static Result getLatestBetween(String type, long firsttime, long secondtime) {
ObjectNode resultJson = Json.newObject();
try {
if (type == null) {
ContrUtil.failure(resultJson, "no type provided");
Logger.error("no type provided");
} else {
if (firsttime > secondtime) {
long temp = secondtime;
secondtime = firsttime;
firsttime = temp;
}
resultJson = DatasetDao.getLatestBetween(type, firsttime, secondtime);
}
} catch (SQLException e) {
ContrUtil.failure(resultJson, e.getMessage());
Logger.error(e.getMessage());
}
return ok(resultJson);
}
示例3: getAtTimeWindow
import models.daos.DatasetDao; //導入依賴的package包/類
public static Result getAtTimeWindow(String type, long time, long window) throws SQLException {
ObjectNode resultJson = Json.newObject();
try {
if (type == null) {
ContrUtil.failure(resultJson, "no type provided");
Logger.error("no type provided");
} else {
long firsttime = time - window;
long secondtime = time + window;
resultJson = DatasetDao.getLatestBetween(type, firsttime, secondtime);
}
} catch (SQLException e) {
ContrUtil.failure(resultJson, e.getMessage());
Logger.error(e.getMessage());
}
return ok(resultJson);
}
示例4: getCommonParents
import models.daos.DatasetDao; //導入依賴的package包/類
public static Result getCommonParents() {
ObjectNode resultJson = Json.newObject();
String urnOne = request().getQueryString("urnOne");
String urnTwo = request().getQueryString("urnTwo");
if (urnOne != null && urnTwo != null) {
try {
resultJson = DatasetDao.getCommonParents(urnOne, urnTwo);
} catch (Exception e) {
ContrUtil.failure(resultJson, e.getMessage());
Logger.error("sql exception in getCommonParents", e);
}
} else {
ContrUtil.failure(resultJson, "not all required arguments passed");
Logger.error("not all required arguments passed");
}
return ok(resultJson);
}
示例5: testDataset
import models.daos.DatasetDao; //導入依賴的package包/類
@Test
public void testDataset()
{
ObjectNode inputJson = Json.newObject();
inputJson.put("dataset_uri", "dalids:///feedimpressionevent_mp/feedimpressionevent");
try
{
ObjectNode resultNode = DatasetDao.getDatasetDependency(
inputJson);
assertThat(resultNode.isContainerNode());
}
catch (Exception e)
{
assertThat(false);
}
}
示例6: addDataset
import models.daos.DatasetDao; //導入依賴的package包/類
@BodyParser.Of(BodyParser.Json.class)
public static Result addDataset() {
JsonNode dataset = request().body().asJson();
ObjectNode resultJson = Json.newObject();
try {
DatasetDao.setDatasetRecord(dataset);
resultJson.put("return_code", 200);
resultJson.put("message", "Dataset inserted!");
} catch (Exception e) {
e.printStackTrace();
resultJson.put("return_code", 404);
resultJson.put("error_message", e.getMessage());
}
return ok(resultJson);
}
示例7: getDatasetDependency
import models.daos.DatasetDao; //導入依賴的package包/類
@BodyParser.Of(BodyParser.Json.class)
public static Result getDatasetDependency() {
String queryString = request().getQueryString("query");
JsonNode input = Json.parse(queryString);
ObjectNode resultJson = Json.newObject();
try {
resultJson = DatasetDao.getDatasetDependency(input);
} catch (Exception e) {
Logger.error(e.getMessage());
resultJson.put("return_code", 404);
resultJson.put("error_message", e.getMessage());
}
return ok(resultJson);
}
示例8: getDatasetUrns
import models.daos.DatasetDao; //導入依賴的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) {
e.printStackTrace();
resultJson.put("return_code", 404);
resultJson.put("error_message", e.getMessage());
}
return ok(resultJson);
}
示例9: getDatasetDependentsById
import models.daos.DatasetDao; //導入依賴的package包/類
public static Result getDatasetDependentsById(Long datasetId)
throws SQLException {
ObjectNode resultJson = Json.newObject();
if (datasetId > 0) {
try {
List<Map<String, Object>> dependents = DatasetDao.getDatasetDependents(datasetId);
resultJson.put("return_code", 200);
resultJson.set("dependents", Json.toJson(dependents));
} catch (EmptyResultDataAccessException e) {
e.printStackTrace();
resultJson.put("return_code", 404);
resultJson.put("error_message", "no dependent datasets can be found!");
}
return ok(resultJson);
}
// if no parameter, return an error message
resultJson.put("return_code", 400);
resultJson.put("error_message", "Dataset Id is not provided or invalid");
return ok(resultJson);
}
示例10: addEntity
import models.daos.DatasetDao; //導入依賴的package包/類
private static Result addEntity(JsonNode entity, String entity_type) {
ObjectNode resultJson = Json.newObject();
try {
DatasetDao.setDatasetRecord(entity);
resultJson.put("return_code", 200);
resultJson.put("message", entity_type + " inserted!");
Logger.info(entity_type + " with urn: " + entity.get("urn") + " inserted");
} catch (Exception e) {
ContrUtil.failure(resultJson, 404, e.getMessage());
Logger.info("Post JSON for " + entity_type + " failed insertion: " + entity.toString());
Logger.error(e.getMessage());
}
return ok(resultJson);
}
示例11: getDatasetDependency
import models.daos.DatasetDao; //導入依賴的package包/類
@BodyParser.Of(BodyParser.Json.class)
public static Result getDatasetDependency() {
String queryString = request().getQueryString("query");
JsonNode input = Json.parse(queryString);
ObjectNode resultJson = Json.newObject();
try {
resultJson = DatasetDao.getDatasetDependency(input);
} catch (Exception e) {
ContrUtil.failure(resultJson, 404, e.getMessage());
Logger.error(e.getMessage());
}
return ok(resultJson);
}
示例12: getDatasetUrns
import models.daos.DatasetDao; //導入依賴的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);
}
示例13: getDatasetDependentsByUri
import models.daos.DatasetDao; //導入依賴的package包/類
public static Result getDatasetDependentsByUri(String datasetUri) throws SQLException {
/* expect
* hive:///db_name.table_name
* hive:///db_name/table_name
* dalids:///db_name.table_name
* dalids:///db_name/table_name
* hdfs:///dir1/dir2/dir3/dir4
* teradata:///db_name/table_name
*/
ObjectNode resultJson = Json.newObject();
String[] uri_parts = datasetUri.split(":");
if (uri_parts.length != 2) {
resultJson.put("return_code", 400);
resultJson.put("error_message", "Invalid dataset URI");
return ok(resultJson);
}
String dataset_type = uri_parts[0];
String dataset_path = uri_parts[1].substring(2); // start from the 3rd slash
if (dataset_path.indexOf(".") > 0) {
dataset_path = dataset_path.replace(".", "/");
}
if (dataset_path != null) {
try {
List<Map<String, Object>> dependents = DatasetDao.getDatasetDependents(dataset_type, dataset_path);
resultJson.put("return_code", 200);
resultJson.set("dependents", Json.toJson(dependents));
} catch (EmptyResultDataAccessException e) {
ContrUtil.failure(resultJson, 404, "no dependent datasets can be found!");
Logger.error(e.getMessage());
}
return ok(resultJson);
}
// if no parameter, return an error message
resultJson.put("return_code", 400);
resultJson.put("error_message", "No parameter provided");
return ok(resultJson);
}
示例14: getLatestOfType
import models.daos.DatasetDao; //導入依賴的package包/類
public static Result getLatestOfType(String type) {
ObjectNode resultJson = Json.newObject();
try {
if (type == null) {
ContrUtil.failure(resultJson, "no type provided");
Logger.error("no type provided");
} else {
resultJson = DatasetDao.getLatestOfType(type);
}
} catch (SQLException e) {
ContrUtil.failure(resultJson, e.getMessage());
Logger.error(e.getMessage());
}
return ok(resultJson);
}
示例15: getLatestAfter
import models.daos.DatasetDao; //導入依賴的package包/類
public static Result getLatestAfter(String type, long time) {
ObjectNode resultJson = Json.newObject();
try {
if (type == null) {
ContrUtil.failure(resultJson, "no type provided");
Logger.error("no type provided");
} else {
resultJson = DatasetDao.getLatestAfter(type, time);
}
} catch (SQLException e) {
ContrUtil.failure(resultJson, e.getMessage());
Logger.error(e.getMessage());
}
return ok(resultJson);
}