本文整理汇总了Java中wherehows.common.schemas.DatasetRecord类的典型用法代码示例。如果您正苦于以下问题:Java DatasetRecord类的具体用法?Java DatasetRecord怎么用?Java DatasetRecord使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DatasetRecord类属于wherehows.common.schemas包,在下文中一共展示了DatasetRecord类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insertDataset
import wherehows.common.schemas.DatasetRecord; //导入依赖的package包/类
public static void insertDataset(JsonNode dataset)
throws Exception {
ObjectMapper om = new ObjectMapper();
om.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);
DatasetRecord record = om.convertValue(dataset, DatasetRecord.class);
if (record.getRefDatasetUrn() != null) {
Map<String, Object> refDataset = getDatasetByUrn(record.getRefDatasetUrn());
// Find ref dataset id
if (refDataset != null) {
record.setRefDatasetId(((Long) refDataset.get("id")).intValue());
}
}
DatabaseWriter dw = new DatabaseWriter(JdbcUtil.wherehowsJdbcTemplate, "dict_dataset");
dw.append(record);
dw.close();
}
示例2: setDatasetRecord
import wherehows.common.schemas.DatasetRecord; //导入依赖的package包/类
public static void setDatasetRecord (JsonNode dataset) throws Exception {
ObjectMapper om = new ObjectMapper();
om.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);
DatasetRecord record = om.convertValue(dataset, DatasetRecord.class);
if (record != null) {
Map<String, Object> params = new HashMap<>();
params.put("urn", record.getUrn());
if (record.getUrn().indexOf(":///") == -1) {
throw new Exception("improperly formatted urn: " + record.getUrn() + ", requires ':///'");
}
try {
Map<String, Object> result = JdbcUtil.wherehowsNamedJdbcTemplate.queryForMap(GET_DATASET_BY_URN, params);
updateDataset(dataset);
} catch (EmptyResultDataAccessException e) {
insertDataset(dataset);
}
}
}
示例3: updateDataset
import wherehows.common.schemas.DatasetRecord; //导入依赖的package包/类
public static void updateDataset(JsonNode dataset)
throws Exception {
ObjectMapper om = new ObjectMapper();
om.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);
DatasetRecord record = om.convertValue(dataset, DatasetRecord.class);
if (record.getRefDatasetUrn() != null) {
Map<String, Object> refDataset = getDatasetByUrn(record.getRefDatasetUrn());
// Find ref dataset id
if (refDataset != null) {
record.setRefDatasetId(((Long) refDataset.get("id")).intValue());
}
}
DatabaseWriter dw = new DatabaseWriter(JdbcUtil.wherehowsJdbcTemplate, "dict_dataset");
dw.update(record.toUpdateDatabaseValue(), record.getUrn());
dw.close();
}
示例4: insertDataset
import wherehows.common.schemas.DatasetRecord; //导入依赖的package包/类
public static void insertDataset(JsonNode dataset)
throws Exception {
ObjectMapper om = new ObjectMapper();
om.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);
DatasetRecord record = om.convertValue(dataset, DatasetRecord.class);
if (record.getRefDatasetUrn() != null) {
Map<String, Object> refDataset = getDatasetByUrn(record.getRefDatasetUrn());
// Find ref dataset id
if (refDataset != null) {
record.setRefDatasetId(((Long) refDataset.get("id")).intValue());
}
}
// Find layout id
if (record.getSamplePartitionFullPath() != null) {
PartitionPatternMatcher ppm = new PartitionPatternMatcher(PartitionLayoutDao.getPartitionLayouts());
record.setPartitionLayoutPatternId(ppm.analyze(record.getSamplePartitionFullPath()));
}
DatabaseWriter dw = new DatabaseWriter(JdbcUtil.wherehowsJdbcTemplate, "dict_dataset");
dw.append(record);
dw.close();
}
示例5: setDatasetRecord
import wherehows.common.schemas.DatasetRecord; //导入依赖的package包/类
public static void setDatasetRecord (JsonNode dataset)
throws Exception {
ObjectMapper om = new ObjectMapper();
om.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);
DatasetRecord record = om.convertValue(dataset, DatasetRecord.class);
if (record != null) {
Map<String, Object> params = new HashMap<>();
params.put("urn", record.getUrn());
try {
Map<String, Object> result = JdbcUtil.wherehowsNamedJdbcTemplate.queryForMap(GET_DATASET_BY_URN, params);
updateDataset(dataset);
} catch (EmptyResultDataAccessException e) {
insertDataset(dataset);
}
}
}
示例6: updateDataset
import wherehows.common.schemas.DatasetRecord; //导入依赖的package包/类
public static void updateDataset(JsonNode dataset)
throws Exception {
ObjectMapper om = new ObjectMapper();
om.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);
DatasetRecord record = om.convertValue(dataset, DatasetRecord.class);
if (record.getRefDatasetUrn() != null) {
Map<String, Object> refDataset = getDatasetByUrn(record.getRefDatasetUrn());
// Find ref dataset id
if (refDataset != null) {
record.setRefDatasetId(((Long) refDataset.get("id")).intValue());
}
}
// Find layout id
if (record.getSamplePartitionFullPath() != null) {
PartitionPatternMatcher ppm = new PartitionPatternMatcher(PartitionLayoutDao.getPartitionLayouts());
record.setPartitionLayoutPatternId(ppm.analyze(record.getSamplePartitionFullPath()));
}
DatabaseWriter dw = new DatabaseWriter(JdbcUtil.wherehowsJdbcTemplate, "dict_dataset");
dw.update(record.toUpdateDatabaseValue(), record.getUrn());
dw.close();
}
示例7: insertDataset
import wherehows.common.schemas.DatasetRecord; //导入依赖的package包/类
public static void insertDataset(DatasetRecord record) throws Exception {
if (record.getRefDatasetUrn() != null) {
Map<String, Object> refDataset = getDatasetByUrn(record.getRefDatasetUrn());
// Find ref dataset id
if (refDataset != null) {
record.setRefDatasetId(((Long) refDataset.get("id")).intValue());
}
}
// Find layout id
if (record.getSamplePartitionFullPath() != null) {
PartitionPatternMatcher ppm = new PartitionPatternMatcher(PartitionLayoutDao.getPartitionLayouts());
record.setPartitionLayoutPatternId(ppm.analyze(record.getSamplePartitionFullPath()));
}
DatabaseWriter dw = new DatabaseWriter(JdbcUtil.wherehowsJdbcTemplate, "dict_dataset");
dw.append(record);
dw.close();
}
示例8: updateDataset
import wherehows.common.schemas.DatasetRecord; //导入依赖的package包/类
public static void updateDataset(DatasetRecord record) throws Exception {
if (record.getRefDatasetUrn() != null) {
Map<String, Object> refDataset = getDatasetByUrn(record.getRefDatasetUrn());
// Find ref dataset id
if (refDataset != null) {
record.setRefDatasetId(((Long) refDataset.get("id")).intValue());
}
}
// Find layout id
if (record.getSamplePartitionFullPath() != null) {
PartitionPatternMatcher ppm = new PartitionPatternMatcher(PartitionLayoutDao.getPartitionLayouts());
record.setPartitionLayoutPatternId(ppm.analyze(record.getSamplePartitionFullPath()));
}
DatabaseWriter dw = new DatabaseWriter(JdbcUtil.wherehowsJdbcTemplate, "dict_dataset");
dw.update(record.toUpdateDatabaseValue(), record.getUrn());
dw.close();
}
示例9: setDatasetRecord
import wherehows.common.schemas.DatasetRecord; //导入依赖的package包/类
public static void setDatasetRecord (DatasetRecord record)
throws Exception {
if (record != null) {
Map<String, Object> params = new HashMap<>();
params.put("urn", record.getUrn());
try {
Map<String, Object> result = JdbcUtil.wherehowsNamedJdbcTemplate.queryForMap(GET_DATASET_BY_URN, params);
updateDataset(record);
} catch (EmptyResultDataAccessException e) {
insertDataset(record);
}
}
}