本文整理汇总了Java中org.skife.jdbi.v2.StatementContext类的典型用法代码示例。如果您正苦于以下问题:Java StatementContext类的具体用法?Java StatementContext怎么用?Java StatementContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StatementContext类属于org.skife.jdbi.v2包,在下文中一共展示了StatementContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: map
import org.skife.jdbi.v2.StatementContext; //导入依赖的package包/类
@Override
public Claim map(int index, ResultSet result, StatementContext ctx) throws SQLException {
return new Claim(
result.getLong("id"),
result.getString("submitter_id"),
result.getString("letter_holder_id"),
result.getString("defendant_id"),
result.getString("external_id"),
result.getString("reference_number"),
toClaimData(result.getString("claim")),
toLocalDateTimeFromUTC(result.getTimestamp("created_at")),
result.getTimestamp("issued_on").toLocalDateTime().toLocalDate(),
result.getTimestamp("response_deadline").toLocalDateTime().toLocalDate(),
result.getBoolean("more_time_requested"),
result.getString("submitter_email"),
toNullableLocalDateTimeFromUTC(result.getTimestamp("responded_at")),
toNullableResponseData(result.getString("response")),
result.getString("defendant_email"),
toNullableCountyCourtJudgment(result.getString("county_court_judgment")),
toNullableLocalDateTimeFromUTC(result.getTimestamp("county_court_judgment_requested_at")),
toNullableSettlement(result.getString("settlement")),
toNullableLocalDateTimeFromUTC(result.getTimestamp("settlement_reached_at")),
result.getString("sealed_claim_document_management_self_path")
);
}
示例2: map
import org.skife.jdbi.v2.StatementContext; //导入依赖的package包/类
@Override
public Monitor map(int index, ResultSet r, StatementContext ctx) throws SQLException {
int status = r.getInt("STATUS");
boolean isUsable = true;
if (status == 0) {
isUsable = false;
}
Monitor monitor = Monitor.builder()
.monitorId(r.getString("MONITOR_ID"))
.version(r.getString("VERSION"))
.name(r.getString("NAME"))
.country(r.getString("COUNTRY"))
.province(r.getString("PROVINCE"))
.city(r.getString("CITY"))
.isp(r.getString("ISP"))
.area(r.getString("AREA"))
.ip(r.getString("IP"))
.nipingT(r.getString("NIPING_T"))
.status(status)
.isUsable(isUsable).build();
monitor.set(r.getString("ACCOUNT_ID"), r.getDate("CREATION_TIME"), r.getDate("MODIFIED_TIME"));
return monitor;
}
示例3: map
import org.skife.jdbi.v2.StatementContext; //导入依赖的package包/类
@Override
public Source map(int i, ResultSet resultSet, StatementContext statementContext) throws SQLException {
String resultSource = resultSet.getString("source");
if (StringUtils.isEmpty(resultSource)) {
return null;
}
Source source;
try {
source = new Source(new URL(resultSource));
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
Array tags = resultSet.getArray("tags");
source.setTags(tags == null
? Collections.emptyList()
: Arrays.asList((Object[]) tags.getArray()).stream().map(Object::toString).collect(Collectors.toList())
);
source.setFrontpage(resultSet.getBoolean("frontpage"));
return source;
}
示例4: map
import org.skife.jdbi.v2.StatementContext; //导入依赖的package包/类
@Override
public Article map(int i, ResultSet resultSet, StatementContext statementContext) throws SQLException {
String title = resultSet.getString("title");
if (StringUtils.isEmpty(title)) {
return null;
}
Article article = new Article (
title,
new Date(resultSet.getTimestamp("date").getTime()),
Arrays.asList((String[]) resultSet.getArray("authors").getArray()),
resultSet.getString("description"),
resultSet.getString("url"),
resultSet.getString("channelTitle"),
resultSet.getString("channelUrl")
);
article.setBookmark(true); //saved articles are always bookmarked articles
return article;
}
示例5: map
import org.skife.jdbi.v2.StatementContext; //导入依赖的package包/类
@Override
public Tool map(int i, ResultSet resultSet, StatementContext statementContext) throws SQLException {
Tool tool = new Tool();
tool.setUrl(resultSet.getString("url"));
tool.setId(resultSet.getString("tool_id"));
tool.setOrganization(resultSet.getString("organization"));
tool.setToolname(resultSet.getString("toolname"));
// needs its own type
//tool.setToolclass(resultSet.getString("id"));
tool.setDescription(resultSet.getString("description"));
tool.setAuthor(resultSet.getString("author"));
tool.setMetaVersion(resultSet.getString("metaVersion"));
// contains is multiple strings
//tool.setId(resultSet.getString("id"));
tool.setVerified(resultSet.getBoolean("verified"));
tool.setVerifiedSource(resultSet.getString("verifiedSource"));
tool.setSigned(resultSet.getBoolean("signed"));
// need to properly hook up tool versions
return tool;
}
示例6: map
import org.skife.jdbi.v2.StatementContext; //导入依赖的package包/类
@Override
public Location map(int index, ResultSet rs, StatementContext ctx) throws SQLException {
Location l = new Location();
l.setId(rs.getInt("id"));
l.setName(rs.getString("name"));
l.setLat(rs.getDouble("lat"));
l.setLng(rs.getDouble("lng"));
l.setCreatedAt(new DateTime(rs.getTimestamp("createdAt")));
l.setUpdatedAt(new DateTime(rs.getTimestamp("updatedAt")));
l.setLoadLevel(LoadLevel.PROPERTIES);
if (MapperUtils.containsColumnNamed(rs, "totalCount")) {
ctx.setAttribute("totalCount", rs.getInt("totalCount"));
}
return l;
}
示例7: map
import org.skife.jdbi.v2.StatementContext; //导入依赖的package包/类
@Override
public Position map(int index, ResultSet rs, StatementContext ctx) throws SQLException {
//This hits when we do a join but there's no Billet record.
if (rs.getObject("positions_id") == null) { return null; }
Position p = fillInFields(new Position(), rs);
if (MapperUtils.containsColumnNamed(rs, "totalCount")) {
ctx.setAttribute("totalCount", rs.getInt("totalCount"));
}
if (MapperUtils.containsColumnNamed(rs, "people_id")) {
PersonMapper.fillInFields(p.getPerson(), rs);
}
return p;
}
示例8: map
import org.skife.jdbi.v2.StatementContext; //导入依赖的package包/类
@Override
public Organization map(int index, ResultSet r, StatementContext ctx) throws SQLException {
Organization org = new Organization();
org.setId(r.getInt("organizations_id"));
org.setShortName(r.getString("organizations_shortName"));
org.setLongName(r.getString("organizations_longName"));
org.setType(MapperUtils.getEnumIdx(r, "organizations_type", OrganizationType.class));
Integer parentOrgId = MapperUtils.getInteger(r, "organizations_parentOrgId");
if (parentOrgId != null) {
org.setParentOrg(Organization.createWithId(parentOrgId));
}
org.setCreatedAt(new DateTime(r.getTimestamp("organizations_createdAt")));
org.setUpdatedAt(new DateTime(r.getTimestamp("organizations_updatedAt")));
org.setLoadLevel(LoadLevel.PROPERTIES);
if (MapperUtils.containsColumnNamed(r, "totalCount")) {
ctx.setAttribute("totalCount", r.getInt("totalCount"));
}
return org;
}
示例9: map
import org.skife.jdbi.v2.StatementContext; //导入依赖的package包/类
@Override
public ApprovalAction map(int index, ResultSet rs, StatementContext ctx) throws SQLException {
ApprovalAction aa = new ApprovalAction();
aa.setPerson(Person.createWithId(MapperUtils.getInteger(rs, "personId")));
aa.setReport(Report.createWithId(MapperUtils.getInteger(rs, "reportId")));
Integer approvalStepId = MapperUtils.getInteger(rs, "approvalStepId");
if (approvalStepId != null) {
aa.setStep(ApprovalStep.createWithId(approvalStepId));
}
aa.setCreatedAt(new DateTime(rs.getTimestamp("createdAt")));
aa.setType(MapperUtils.getEnumIdx(rs, "type", ApprovalType.class));
aa.setLoadLevel(LoadLevel.PROPERTIES);
return aa;
}
示例10: map
import org.skife.jdbi.v2.StatementContext; //导入依赖的package包/类
@Override
public Record map(int index, ResultSet r, StatementContext ctx) throws SQLException {
List<Item> items = new ArrayList<>();
String[] itemHashes = (String[]) r.getArray("sha256hex").getArray();
String[] itemContent = (String[]) r.getArray("content").getArray();
if (itemHashes.length != itemContent.length) {
throw new RuntimeException("Number of item hashes not equal to number of item content");
}
for (int i = 0; i < itemHashes.length; i++) {
try {
items.add(new Item(new HashValue(HashingAlgorithm.SHA256, itemHashes[i]), objectMapper.readValue(itemContent[i], JsonNode.class)));
} catch (IOException e) {
e.printStackTrace();
}
}
return new Record(
entryMapper.map(index, r, ctx),
items
);
}
示例11: map
import org.skife.jdbi.v2.StatementContext; //导入依赖的package包/类
@Override
public Entry map(int index, ResultSet r, StatementContext ctx) throws SQLException {
String key = r.getString("key");
int indexEntryNumber = r.getInt("index_entry_number");
int entryNumber = r.getInt("entry_number");
String entryType = r.getString("type");
Instant timestamp = longTimestampToInstantMapper.map(index, r, ctx);
String[] hashes = (String[]) r.getArray("sha256_arr").getArray();
List<HashValue> hashValues = new ArrayList<>();
for (int i = 0; i < hashes.length; i++) {
HashValue hashValue = new HashValue(HashingAlgorithm.SHA256, hashes[i]);
hashValues.add(hashValue);
}
return new Entry(indexEntryNumber, entryNumber, hashValues, timestamp, key, EntryType.valueOf(entryType));
}
示例12: map
import org.skife.jdbi.v2.StatementContext; //导入依赖的package包/类
@Override
public ProductCatalog map(int i, ResultSet resultSet, StatementContext statementContext) throws SQLException {
ProductCatalog productCatalog = new ProductCatalog();
productCatalog.setId(resultSet.getString("id"));
productCatalog.setDesc(resultSet.getString("desc"));
productCatalog.setName(resultSet.getString("name"));
productCatalog.setWidth(resultSet.getInt("width"));
productCatalog.setHeight(resultSet.getInt("height"));
productCatalog.setDepth(resultSet.getInt("depth"));
productCatalog.setDimensionUnit(resultSet.getString("dimension_unit"));
productCatalog.setWeight(resultSet.getDouble("weight"));
productCatalog.setCategories(resultSet.getString("categories"));
productCatalog.setPriceUnit(resultSet.getString("price_unit"));
productCatalog.setListPrice(resultSet.getInt("list_price"));
productCatalog.setSalePrice(resultSet.getInt("sale_price"));
return productCatalog;
}
示例13: map
import org.skife.jdbi.v2.StatementContext; //导入依赖的package包/类
public TestcaseRun map(int index, ResultSet rs, StatementContext ctx) throws SQLException {
TestcaseRun testcaseRun = new TestcaseRun();
testcaseRun.setId(rs.getLong("id"));
Testcase testcase = new Testcase();
testcase.setId(rs.getLong("testcase_id"));
testcase.setName(rs.getString("testcase_name"));
testcase.setFolderPath(rs.getString("testcase_folderpath"));
testcaseRun.setTestcase(testcase);
testcaseRun.setStartTime(rs.getTimestamp("starttime"));
testcaseRun.setDuration(rs.getLong("duration"));
testcaseRun.setResult(TestResult.getByText(rs.getString("result")));
List<TeststepRun> stepRuns = null;
try {
stepRuns = new ObjectMapper().readValue(rs.getString("stepruns"), new TypeReference<List<TeststepRun>>() { });
} catch (IOException e) {
throw new SQLException("Failed to deserialize stepruns JSON.", e);
}
testcaseRun.setStepRuns(stepRuns);
return testcaseRun;
}
示例14: map
import org.skife.jdbi.v2.StatementContext; //导入依赖的package包/类
public Assertion map(int index, ResultSet rs, StatementContext ctx) throws SQLException {
Assertion assertion = null;
String type = rs.getString("type");
String tempAssertionJSON = "{\"type\":\"" + type + "\",\"otherProperties\":" +
rs.getString("other_properties") + "}";
try {
assertion = new ObjectMapper().readValue(tempAssertionJSON, Assertion.class);
} catch (IOException e) {
throw new SQLException("Failed to deserialize other_properties JSON.", e);
}
assertion.setId(rs.getLong("id"));
assertion.setTeststepId(rs.getLong("teststep_id"));
assertion.setName(rs.getString("name"));
assertion.setType(type);
return assertion;
}
示例15: map
import org.skife.jdbi.v2.StatementContext; //导入依赖的package包/类
@Override
public User map(int index, ResultSet rs, StatementContext ctx) throws SQLException {
List<String> fields = IronTestUtils.getFieldsPresentInResultSet(rs);
User user = new User();
user.setId(rs.getLong("id"));
user.setUsername(rs.getString("username"));
user.setPassword(fields.contains("password") ? rs.getString("password") : null);
user.setSalt(fields.contains("salt") ? rs.getString("salt") : null);
if (fields.contains("roles") && rs.getString("roles") != null) {
try {
user.getRoles().addAll(new ObjectMapper().readValue(rs.getString("roles"), HashSet.class));
} catch (IOException e) {
throw new SQLException("Failed to deserialize roles JSON.", e);
}
}
return user;
}