• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Transaction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.skife.jdbi.v2.sqlobject.Transaction的典型用法代码示例。如果您正苦于以下问题:Java Transaction类的具体用法?Java Transaction怎么用?Java Transaction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Transaction类属于org.skife.jdbi.v2.sqlobject包,在下文中一共展示了Transaction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: toolsIdVersionsPost

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Transaction
@Override
public Response toolsIdVersionsPost(String id, ToolVersion body, SecurityContext securityContext) throws NotFoundException {
    // refresh the release on github
    //gitHubBuilder.createBranchAndRelease(, , body.getName());
    String[] split = id.split("/");
    LOG.info("Creating branch...");
    String organization = split[0];
    String repo = split[1];
    String version = body.getName();
    gitHubBuilder.createBranchAndRelease(organization, repo, version);
    try {
        int insert = toolVersionDAO.insert(id, version);
        if (insert != 1) {
            LOG.info("Tool version already exists in database");
            return Response.notModified().build();
        }
    } catch (UnableToExecuteStatementException e) {
        LOG.info("Tool version already exists in database");
    }
    ToolVersion byId = toolVersionDAO.findByToolVersion(id, version);
    if (byId == null) {
        return Response.notModified().build();
    }
    return Response.ok().entity(byId).build();
}
 
开发者ID:dockstore,项目名称:write_api_service,代码行数:27,代码来源:ToolsApiServiceImpl.java


示例2: toolsIdVersionsVersionIdTypeDescriptorPost

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Transaction
@Override
public Response toolsIdVersionsVersionIdTypeDescriptorPost(String type, String id, String versionId, ToolDescriptor body,
        SecurityContext securityContext) throws NotFoundException {
    String[] split = id.split("/");
    String organization = split[0];
    String repo = split[1];
    String path = body.getUrl();
    String url = generateUrl(id, versionId, body.getUrl());
    ToolDescriptor byId = toolDescriptorDAO.findByPath(id, versionId, path);
    if (byId == null) {
        try {
            toolDescriptorDAO.insert(body.getDescriptor(), id, versionId, path);
        } catch (UnableToExecuteStatementException e) {
            LOG.debug("Descriptor already exists in database");

        }
    }
    gitHubBuilder.stashFile(organization, repo, body.getUrl(), body.getDescriptor(), versionId);
    // TODO: improve this, this looks slow and awkward
    body.setUrl(url);
    toolDescriptorDAO.update(body, id, versionId, path);
    byId = toolDescriptorDAO.findByPath(id, versionId, path);
    return Response.ok().entity(byId).build();
}
 
开发者ID:dockstore,项目名称:write_api_service,代码行数:26,代码来源:ToolsApiServiceImpl.java


示例3: toolsPost

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Transaction
@Override
public Response toolsPost(Tool body, SecurityContext securityContext) throws NotFoundException {
    // try creating a repo on github for this, this should probably be made into a transaction
    if (!gitHubBuilder.repoExists(body.getOrganization(), body.getToolname())) {
        LOG.info("Repo does not exist");
        boolean repo = gitHubBuilder.createRepo(body.getOrganization(), body.getToolname());
        if (!repo) {
            return Response.notModified("Could not create github repo").build();
        }
    }
    try {
        toolDAO.insert(body.getId());
    } catch (UnableToExecuteStatementException e) {
        LOG.info("Tool already exists in database");
    }
    String gitUrl = gitHubBuilder.getGitUrl(body.getOrganization(), body.getToolname());
    body.setUrl(gitUrl);
    toolDAO.update(body);
    Tool byId = toolDAO.findById(body.getId());
    if (byId != null) {
        return Response.ok().entity(byId).build();
    }
    return Response.notModified().build();
}
 
开发者ID:dockstore,项目名称:write_api_service,代码行数:26,代码来源:ToolsApiServiceImpl.java


示例4: toolsIdPut

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Transaction
@Override
public Response toolsIdPut(String id, Tool body, SecurityContext securityContext) throws NotFoundException {
    // ensure that id matches
    if (!Objects.equals(id, body.getId())) {
        return Response.notModified().build();
    }
    int update = toolDAO.update(body);
    if (update != 1) {
        return Response.notModified().build();
    }
    return Response.ok().entity(toolDAO.findById(id)).build();
}
 
开发者ID:dockstore,项目名称:write_api_service,代码行数:14,代码来源:ToolsApiServiceImpl.java


示例5: toolsIdVersionsVersionIdDockerfileGet

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Transaction
@Override
public Response toolsIdVersionsVersionIdDockerfileGet(String id, String versionId, SecurityContext securityContext)
        throws NotFoundException {
    ToolDockerfile byId = toolDockerfileDAO.findById(id, versionId);
    return Response.ok().entity(byId).build();
}
 
开发者ID:dockstore,项目名称:write_api_service,代码行数:8,代码来源:ToolsApiServiceImpl.java


示例6: toolsIdVersionsVersionIdDockerfilePost

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Transaction
@Override
public Response toolsIdVersionsVersionIdDockerfilePost(String id, String versionId, ToolDockerfile dockerfile,
        SecurityContext securityContext) throws NotFoundException {
    String[] split = id.split("/");
    String organization = split[0];
    String repo = split[1];
    gitHubBuilder.stashFile(organization, repo, dockerfile.getUrl(), dockerfile.getDockerfile(), versionId);
    gitHubBuilder.createBranchAndRelease(organization, repo, versionId);
    if (!quayIoBuilder.repoExists(organization, repo)) {
        quayIoBuilder.createRepo(organization, repo, repo);
        LOG.info("Created quay.io repository.");
    }
    quayIoBuilder.triggerBuild(organization, organization, repo, repo, versionId, true);
    String url = generateUrl(id, versionId, dockerfile.getUrl());
    dockerfile.setUrl(url);
    ToolDockerfile findById = toolDockerfileDAO.findById(id, versionId);
    if (findById == null) {
        try {
            toolDockerfileDAO.insert(id, versionId, dockerfile.getDockerfile());
            toolDockerfileDAO.update(dockerfile, id, versionId);
        } catch (UnableToExecuteStatementException e) {
            LOG.info("Dockerfile already exists in database");
        }
    }
    toolDockerfileDAO.update(dockerfile, id, versionId);
    ToolDockerfile created = toolDockerfileDAO.findById(id, versionId);

    if (created != null) {
        created.setUrl(quayIoBuilder.getQuayUrl(organization, repo));
        return Response.ok().entity(created).build();
    }
    return Response.serverError().build();
}
 
开发者ID:dockstore,项目名称:write_api_service,代码行数:35,代码来源:ToolsApiServiceImpl.java


示例7: toolsIdVersionsVersionIdPut

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Transaction
@Override
public Response toolsIdVersionsVersionIdPut(String id, String versionId, ToolVersion body, SecurityContext securityContext)
        throws NotFoundException {
    // ensure that id matches
    if (!Objects.equals(versionId, body.getId())) {
        return Response.notModified().build();
    }
    int update = toolVersionDAO.update(body);
    if (update != 1) {
        return Response.notModified().build();
    }
    return Response.ok().entity(toolVersionDAO.findByToolVersion(id, versionId)).build();
}
 
开发者ID:dockstore,项目名称:write_api_service,代码行数:15,代码来源:ToolsApiServiceImpl.java


示例8: toolsIdVersionsVersionIdTypeDescriptorRelativePathPost

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Transaction
@Override
public Response toolsIdVersionsVersionIdTypeDescriptorRelativePathPost(String type, String id, String versionId, String relativePath,
        ToolDescriptor body, SecurityContext securityContext) throws NotFoundException {
    // hook up to github

    return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
 
开发者ID:dockstore,项目名称:write_api_service,代码行数:9,代码来源:ToolsApiServiceImpl.java


示例9: toolsIdVersionsVersionIdTypeTestsPut

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Transaction
@Override
public Response toolsIdVersionsVersionIdTypeTestsPut(String type, String id, String versionId, List<ToolTests> body,
        SecurityContext securityContext) throws NotFoundException {
    // do some magic!
    return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
 
开发者ID:dockstore,项目名称:write_api_service,代码行数:8,代码来源:ToolsApiServiceImpl.java


示例10: createUser

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Transaction
public void createUser(final DBUser user) {
    insertUser(user);
    for (final Roles role : user.getRoles()) {
        insertUserRole(UUID.randomUUID(), user, role);
    }
}
 
开发者ID:lewisd32,项目名称:authrite,代码行数:8,代码来源:UsersDao.java


示例11: update

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Transaction
public int update(JdbcSource source, DataSourceDAO dao, Encrypt encrypt) {
  try {
    source.setUrl(encrypt.convertToDatabaseColumn(source.getUrl()));
    source.setUsername(encrypt.convertToDatabaseColumn(source.getUsername()));
    source.setPassword(encrypt.convertToDatabaseColumn(source.getPassword()));
  } catch (SQLException e) {
    throw new RuntimeException(e);
  }
  updateJdbc(source);
  return dao.update(source);
}
 
开发者ID:qubole,项目名称:quark,代码行数:13,代码来源:JdbcSourceDAO.java


示例12: update

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Transaction
public int update(QuboleDbSource db, DataSourceDAO dao, Encrypt encrypt) {
  try {
    db.setUrl(encrypt.convertToDatabaseColumn(db.getUrl()));
    db.setAuthToken(encrypt.convertToDatabaseColumn(db.getAuthToken()));
  } catch (SQLException e) {
    throw new RuntimeException(e);
  }
  updateQubole(db);
  return dao.update(db);
}
 
开发者ID:qubole,项目名称:quark,代码行数:12,代码来源:QuboleDbSourceDAO.java


示例13: insertQuboleDB

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Transaction
public int insertQuboleDB(String name, String type, String url, long dsSetId,
    String dataSourcetype, QuboleDbSourceDAO quboleDao, int dbTapId, String authToken,
    Encrypt encrypt) {
  try {
    url = encrypt.convertToDatabaseColumn(url);
    authToken = encrypt.convertToDatabaseColumn(authToken);
  } catch (SQLException e) {
    throw new RuntimeException(e);
  }
  int id = insert(name, type, url, dsSetId, dataSourcetype);
  quboleDao.insert(id, dbTapId, authToken);
  return id;
}
 
开发者ID:qubole,项目名称:quark,代码行数:15,代码来源:DataSourceDAO.java


示例14: addNewRuleSet

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Transaction
public void addNewRuleSet(CdxAccessControl ruleset) throws JsonProcessingException {
  long newRulesetId = newRuleset();
  ruleset.setRulesSetId(newRulesetId);
  for (CdxRule rule : ruleset.getRules().values()) {
    String json = jsonMapper.writeValueAsString(rule);
    writeRule(newRulesetId, rule.getId(), json);
  }
}
 
开发者ID:nla,项目名称:bamboo,代码行数:10,代码来源:RestrictionsDAO.java


示例15: finishNightyRun

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Transaction
public void finishNightyRun(long id, CdxAccessControl newRules, CdxAccessControl currentRules) {
	Date activationTime = new Date();
	finishNightyRunForId(id, activationTime);
	if(newRules != null){
		// we have a new rule set so retire the current and make the new active
  	if(currentRules != null && currentRules.getRulesSetId() > 0){
  		retireCurrentRules(currentRules.getRulesSetId(), activationTime);
  	}
  	if(newRules != null && newRules.getRulesSetId() > 0){
  		activateNewRules(newRules.getRulesSetId(), activationTime);
  	}
	}
}
 
开发者ID:nla,项目名称:bamboo,代码行数:15,代码来源:RestrictionsDAO.java


示例16: deleteUser

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Override
@Transaction
public void deleteUser(Long userId) {
    checkArgument(userId != null, "deleteUser() requires a non-null userId parameter.");
    deleteUsersRoles(userId);
    deleteUserOnly(userId);
}
 
开发者ID:Multifarious,项目名称:shiro-jdbi-realm,代码行数:8,代码来源:DefaultJdbiUserDAO.java


示例17: createUser

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@Override
@Transaction
public Long createUser(DefaultUserImpl user) {
    checkNotNull(user, "createUser(), user parameter cannot be null.");
    checkArgument(user.getId() == null, "DefaultUserImpl's id field is assigned by the database and must be null.");
    Long userId;
    createUserOnly(user.getUsername(), user.getPassword());
    userId = fetchUserId(user.getUsername());
    user.setId(userId);
    for (ISecurityRole r : user.getRoles()) {
        createUserRole(userId, r.getName());
    }
    return userId;
}
 
开发者ID:Multifarious,项目名称:shiro-jdbi-realm,代码行数:15,代码来源:DefaultJdbiUserDAO.java


示例18: findEnabledUsersWithRolesAndPermissions

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@SqlQuery(EnabledUserRolesPermissionsBaseSelectPrefix + "users.username = :username")
@MapResultAsBean
@Transaction(value = TransactionIsolationLevel.READ_COMMITTED)
protected abstract Iterator<UserRolePermissionJoinRow> findEnabledUsersWithRolesAndPermissions(@Bind("username") String username);
 
开发者ID:Multifarious,项目名称:shiro-jdbi-realm,代码行数:5,代码来源:DefaultJdbiUserSecurityDAO.java


示例19: findUsersWithRolesAndPermissions

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@SqlQuery(UserRolesPermissionsBaseSelectPrefix + "users.username = :username")
@MapResultAsBean
@Transaction(value = TransactionIsolationLevel.READ_COMMITTED)
protected abstract Iterator<UserRolePermissionJoinRow> findUsersWithRolesAndPermissions(@Bind("username") String username);
 
开发者ID:Multifarious,项目名称:shiro-jdbi-realm,代码行数:5,代码来源:DefaultJdbiUserSecurityDAO.java


示例20: findEnabledUsersWithoutRoles

import org.skife.jdbi.v2.sqlobject.Transaction; //导入依赖的package包/类
@SqlQuery("SELECT user_Id AS id, username, password FROM users WHERE enabled AND username = :username")
@MapResultAsBean
@Transaction(value = TransactionIsolationLevel.READ_COMMITTED)
protected abstract Iterator<DefaultUserImpl> findEnabledUsersWithoutRoles(@Bind("username") String username);
 
开发者ID:Multifarious,项目名称:shiro-jdbi-realm,代码行数:5,代码来源:DefaultJdbiUserSecurityDAO.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TextPattern类代码示例发布时间:2022-05-23
下一篇:
Java IStorage2UriMapper类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap