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


Java TxType.NEVER属性代码示例

本文整理汇总了Java中javax.transaction.Transactional.TxType.NEVER属性的典型用法代码示例。如果您正苦于以下问题:Java TxType.NEVER属性的具体用法?Java TxType.NEVER怎么用?Java TxType.NEVER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.transaction.Transactional.TxType的用法示例。


在下文中一共展示了TxType.NEVER属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

@Transactional(TxType.NEVER)
public Topology create(IdentityUser user, Topology topology) {
    LOGGER.debug("Creating topology: [User: '{}', Account: '{}']", user.getUsername(), user.getAccount());
    Topology savedTopology;
    topology.setOwner(user.getUserId());
    topology.setAccount(user.getAccount());
    try {
        savedTopology = topologyRepository.save(topology);
    } catch (DataIntegrityViolationException ex) {
        String msg = String.format("Error with resource [%s], error: [%s]", APIResourceType.TOPOLOGY, getProperSqlErrorMessage(ex));
        throw new BadRequestException(msg);
    }
    return savedTopology;
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:14,代码来源:TopologyService.java

示例2: subscribe

@Transactional(TxType.NEVER)
public Long subscribe(Subscription subscription) {
    List<Subscription> clientSubscriptions = subscriptionRepository.findByClientIdAndEndpoint(subscription.getClientId(), subscription.getEndpoint());
    if (!clientSubscriptions.isEmpty()) {
        LOGGER.info(String.format("Subscription already exists for this client with the same endpoint [client: '%s', endpoint: '%s']",
                subscription.getClientId(), subscription.getEndpoint()));
        return clientSubscriptions.get(0).getId();
    }
    return subscriptionRepository.save(subscription).getId();
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:10,代码来源:SubscriptionService.java

示例3: create

@Transactional(TxType.NEVER)
public Network create(IdentityUser user, Network network) {
    LOGGER.info("Creating network: [User: '{}', Account: '{}']", user.getUsername(), user.getAccount());
    network.setOwner(user.getUserId());
    network.setAccount(user.getAccount());
    try {
        return networkRepository.save(network);
    } catch (DataIntegrityViolationException ex) {
        String msg = String.format("Error with resource [%s], error: [%s]", APIResourceType.NETWORK, getProperSqlErrorMessage(ex));
        throw new BadRequestException(msg);
    }
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:12,代码来源:NetworkService.java

示例4: create

@Transactional(TxType.NEVER)
public LdapConfig create(IdentityUser user, LdapConfig ldapConfig) {
    ldapConfig.setOwner(user.getUserId());
    ldapConfig.setAccount(user.getAccount());
    try {
        return ldapConfigRepository.save(ldapConfig);
    } catch (DataIntegrityViolationException ex) {
        String msg = String.format("Error with resource [%s], error: [%s]", APIResourceType.LDAP_CONFIG, getProperSqlErrorMessage(ex));
        throw new BadRequestException(msg);
    }
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:11,代码来源:LdapConfigService.java

示例5: retrieveAccountStacks

@Transactional(TxType.NEVER)
public Set<StackResponse> retrieveAccountStacks(IdentityUser user) {
    if (user.getRoles().contains(IdentityUserRole.ADMIN)) {
        return convertStacks(stackRepository.findAllInAccountWithLists(user.getAccount()));
    } else {
        return convertStacks(stackRepository.findPublicInAccountForUser(user.getUserId(), user.getAccount()));
    }
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:8,代码来源:StackService.java

示例6: getJsonById

@Transactional(TxType.NEVER)
public StackResponse getJsonById(Long id, Set<String> entry) {
    Stack stack = getByIdWithLists(id);
    authorizationService.hasReadPermission(stack);
    StackResponse stackResponse = conversionService.convert(stack, StackResponse.class);
    stackResponse = stackResponseDecorator.decorate(stackResponse, stack, entry);
    return stackResponse;
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:8,代码来源:StackService.java

示例7: updateStatus

@Transactional(TxType.NEVER)
public void updateStatus(Long stackId, StatusRequest status, boolean updateCluster) {
    Stack stack = getByIdWithLists(stackId);
    Cluster cluster = null;
    if (stack.getCluster() != null) {
        cluster = clusterRepository.findOneWithLists(stack.getCluster().getId());
    }
    switch (status) {
        case SYNC:
            sync(stack, false);
            break;
        case FULL_SYNC:
            sync(stack, true);
            break;
        case REPAIR_FAILED_NODES:
            repairFailedNodes(stack);
            break;
        case STOPPED:
            stop(stack, cluster, updateCluster);
            break;
        case STARTED:
            start(stack, cluster, updateCluster);
            break;
        default:
            throw new BadRequestException("Cannot update the status of stack because status request not valid.");
    }
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:27,代码来源:StackService.java

示例8: create

@Transactional(TxType.NEVER)
public Credential create(String userId, String account, Credential credential) {
    LOGGER.debug("Creating credential: [UserId: '{}', Account: '{}']", userId, account);
    credential.setOwner(userId);
    credential.setAccount(account);
    return saveCredential(credential);
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:7,代码来源:CredentialService.java

示例9: delete

@Transactional(TxType.NEVER)
public void delete(String name, IdentityUser user) {
    Credential credential = credentialRepository.findByNameInAccount(name, user.getAccount(), user.getUserId());
    if (credential == null) {
        throw new NotFoundException(String.format("Credential '%s' not found.", name));
    }
    delete(credential);
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:8,代码来源:CredentialService.java

示例10: interactiveLogin

@Transactional(TxType.NEVER)
public Map<String, String> interactiveLogin(IdentityUser user, Credential credential) {
    LOGGER.debug("Interactive login: [User: '{}', Account: '{}']", user.getUsername(), user.getAccount());
    credential.setOwner(user.getUserId());
    credential.setAccount(user.getAccount());
    return credentialAdapter.interactiveLogin(credential);
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:7,代码来源:CredentialService.java

示例11: updateAmbariClientConfig

@Override
@Transactional(TxType.NEVER)
public Cluster updateAmbariClientConfig(Long clusterId, HttpClientConfig ambariClientConfig) {
    Cluster cluster = clusterRepository.findById(clusterId);
    cluster.setAmbariIp(ambariClientConfig.getApiAddress());
    cluster = clusterRepository.save(cluster);
    LOGGER.info("Updated cluster: [ambariIp: '{}'].", ambariClientConfig.getApiAddress());
    return cluster;
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:9,代码来源:AmbariClusterService.java

示例12: create

@Transactional(TxType.NEVER)
public Blueprint create(IdentityUser user, Blueprint blueprint, List<Map<String, Map<String, String>>> properties) {
    LOGGER.debug("Creating blueprint: [User: '{}', Account: '{}']", user.getUsername(), user.getAccount());
    Blueprint savedBlueprint;
    blueprint.setOwner(user.getUserId());
    blueprint.setAccount(user.getAccount());
    if (properties != null && !properties.isEmpty()) {
        LOGGER.info("Extend blueprint with the following properties: {}", properties);
        Map<String, Map<String, String>> configs = new HashMap<>(properties.size());
        for (Map<String, Map<String, String>> property : properties) {
            for (Entry<String, Map<String, String>> entry : property.entrySet()) {
                Map<String, String> configValues = configs.get(entry.getKey());
                if (configValues != null) {
                    configValues.putAll(entry.getValue());
                } else {
                    configs.put(entry.getKey(), entry.getValue());
                }
            }
        }
        String extendedBlueprint = new AmbariClient().extendBlueprintGlobalConfiguration(blueprint.getBlueprintText(), configs);
        LOGGER.info("Extended blueprint result: {}", extendedBlueprint);
        blueprint.setBlueprintText(extendedBlueprint);
    }
    try {
        savedBlueprint = blueprintRepository.save(blueprint);
    } catch (DataIntegrityViolationException ex) {
        String msg = String.format("Error with resource [%s], error: [%s]", APIResourceType.BLUEPRINT, getProperSqlErrorMessage(ex));
        throw new BadRequestException(msg);
    }
    return savedBlueprint;
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:31,代码来源:BlueprintService.java

示例13: create

@Transactional(TxType.NEVER)
public SecurityGroup create(IdentityUser user, SecurityGroup securityGroup) {
    LOGGER.info("Creating SecurityGroup: [User: '{}', Account: '{}']", user.getUsername(), user.getAccount());
    securityGroup.setOwner(user.getUserId());
    securityGroup.setAccount(user.getAccount());
    try {
        return groupRepository.save(securityGroup);
    } catch (DataIntegrityViolationException ex) {
        String msg = String.format("Error with resource [%s], error: [%s]", APIResourceType.SECURITY_GROUP, getProperSqlErrorMessage(ex));
        throw new BadRequestException(msg);
    }
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:12,代码来源:SecurityGroupService.java

示例14: updateCluster

@Override
@Transactional(TxType.NEVER)
public Cluster updateCluster(Cluster cluster) {
    LOGGER.debug("Updating cluster. clusterId: {}", cluster.getId());
    cluster = clusterRepository.save(cluster);
    return cluster;
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:7,代码来源:AmbariClusterService.java

示例15: updateClusterMetadata

@Override
@Transactional(TxType.NEVER)
public Cluster updateClusterMetadata(Long stackId) {
    Stack stack = stackService.getById(stackId);
    try {
        AmbariClient ambariClient = getAmbariClient(stack);
        Map<String, Integer> hostGroupCounter = new HashMap<>();
        Set<HostMetadata> hosts = hostMetadataRepository.findHostsInCluster(stack.getCluster().getId());
        Map<String, String> hostStatuses = ambariClient.getHostStatuses();
        for (HostMetadata host : hosts) {
            if (hostStatuses.containsKey(host.getHostName())) {
                String hgName = host.getHostGroup().getName();
                Integer hgCounter = hostGroupCounter.getOrDefault(hgName, 0) + 1;
                hostGroupCounter.put(hgName, hgCounter);
                HostMetadataState newState = HostMetadataState.HEALTHY.name().equals(hostStatuses.get(host.getHostName()))
                    ? HostMetadataState.HEALTHY : HostMetadataState.UNHEALTHY;
                boolean stateChanged = updateHostMetadataByHostState(stack, host.getHostName(), newState);
                if (stateChanged && HostMetadataState.HEALTHY == newState) {
                    updateInstanceMetadataStateToRegistered(stackId, host);
                }
            }
        }
        hostGroupCounter(stack.getCluster().getId(), hostGroupCounter);
    } catch (CloudbreakSecuritySetupException e) {
        throw new CloudbreakServiceException(e);
    }
    return stack.getCluster();
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:28,代码来源:AmbariClusterService.java


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