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


Java StatementContext类代码示例

本文整理汇总了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")
    );
}
 
开发者ID:hmcts,项目名称:cmc-claim-store,代码行数:27,代码来源:ClaimMapper.java

示例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;
}
 
开发者ID:CloudWise-OpenSource,项目名称:SAPNetworkMonitor,代码行数:27,代码来源:MonitorMapper.java

示例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;
}
 
开发者ID:jtanza,项目名称:rufus,代码行数:23,代码来源:SourceMapper.java

示例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;
}
 
开发者ID:jtanza,项目名称:rufus,代码行数:20,代码来源:ArticleMapper.java

示例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;
}
 
开发者ID:dockstore,项目名称:write_api_service,代码行数:21,代码来源:ToolMapper.java

示例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;
}
 
开发者ID:deptofdefense,项目名称:anet,代码行数:18,代码来源:LocationMapper.java

示例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;
}
 
开发者ID:deptofdefense,项目名称:anet,代码行数:17,代码来源:PositionMapper.java

示例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;
}
 
开发者ID:deptofdefense,项目名称:anet,代码行数:24,代码来源:OrganizationMapper.java

示例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;
}
 
开发者ID:deptofdefense,项目名称:anet,代码行数:18,代码来源:ApprovalActionMapper.java

示例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
    );
}
 
开发者ID:openregister,项目名称:openregister-java,代码行数:25,代码来源:RecordMapper.java

示例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));
}
 
开发者ID:openregister,项目名称:openregister-java,代码行数:19,代码来源:DerivationEntryMapper.java

示例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;
}
 
开发者ID:G1GC,项目名称:dropwizard-microservices-example,代码行数:18,代码来源:ProductCatalogMapper.java

示例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;
}
 
开发者ID:zheng-wang,项目名称:irontest,代码行数:23,代码来源:TestcaseRunMapper.java

示例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;
}
 
开发者ID:zheng-wang,项目名称:irontest,代码行数:19,代码来源:AssertionMapper.java

示例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;
}
 
开发者ID:zheng-wang,项目名称:irontest,代码行数:20,代码来源:UserMapper.java


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