本文整理汇总了Java中javax.ejb.TransactionAttributeType.REQUIRES_NEW属性的典型用法代码示例。如果您正苦于以下问题:Java TransactionAttributeType.REQUIRES_NEW属性的具体用法?Java TransactionAttributeType.REQUIRES_NEW怎么用?Java TransactionAttributeType.REQUIRES_NEW使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.ejb.TransactionAttributeType
的用法示例。
在下文中一共展示了TransactionAttributeType.REQUIRES_NEW属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initTimers_internal
/**
* Initialize the timer for polling for the services
*/
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void initTimers_internal() {
Collection<Timer> timers = timerService.getTimers();
boolean appTimerExist = false;
for (Timer timerAPP : timers) {
if (APP_TIMER_INFO.equals(timerAPP.getInfo())) {
appTimerExist = true;
}
}
if (!appTimerExist) {
logger.info("Timer create.");
try {
String timerIntervalSetting = configService
.getProxyConfigurationSetting(
PlatformConfigurationKey.APP_TIMER_INTERVAL);
long interval = Long.parseLong(timerIntervalSetting);
timerService.createTimer(0, interval, APP_TIMER_INFO);
} catch (ConfigurationException e) {
timerService.createTimer(0, DEFAULT_TIMER_INTERVAL,
APP_TIMER_INFO);
logger.info(
"Timer interval not set, switch to default 15 sec.");
}
}
}
示例2: importUser
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void importUser(VOUserDetails user, String marketplaceId)
throws NonUniqueBusinessKeyException, MailOperationException,
ValidationException, UserRoleAssignmentException,
ObjectNotFoundException {
try {
Marketplace marketplace = getMarketplace(marketplaceId);
Organization organization = getOrganization(
user.getOrganizationId());
String password = new PasswordGenerator().generatePassword();
if (organization != null && organization.getTenant() != null) {
user.setTenantId(organization.getTenant().getTenantId());
}
addPlatformUser(user, organization, password,
UserAccountStatus.PASSWORD_MUST_BE_CHANGED, true, true,
marketplace, true);
} catch (NonUniqueBusinessKeyException | MailOperationException
| ValidationException | UserRoleAssignmentException e) {
sessionCtx.setRollbackOnly();
throw e;
}
}
示例3: performSupplierSharesCalculationRun
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void performSupplierSharesCalculationRun(long startOfLastMonth,
long endOfLastMonth, Long supplierKey) throws Exception {
SupplierShareResultAssembler assembler = new SupplierShareResultAssembler(
sharesRetrievalService);
SupplierRevenueShareResult supplierShareResult = assembler.build(
supplierKey, startOfLastMonth, endOfLastMonth);
supplierShareResult.calculateAllShares();
saveBillingSharesResult(startOfLastMonth, endOfLastMonth,
BillingSharesResultType.SUPPLIER, supplierShareResult,
supplierKey);
}
示例4: abortAsyncSubscription
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void abortAsyncSubscription(UUID subscriptionUUID)
throws ObjectNotFoundException, SubscriptionStateException,
OrganizationAuthoritiesException, OperationNotPermittedException {
ArgumentValidator.notNull("subscriptionUUID", subscriptionUUID);
VOSubscription subscription = getSubscription(subscriptionUUID);
if (subscription == null) {
throw new ObjectNotFoundException("Subscription with UUID "
+ subscriptionUUID + " not found!");
}
completeAsyncSubscription(subscription.getSubscriptionId(),
subscription.getOrganizationId(), null,
false);
}
示例5: completeAsyncSubscription
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void completeAsyncSubscription(UUID subscriptionUUID,
VOInstanceInfo instanceInfo) throws ObjectNotFoundException,
SubscriptionStateException, TechnicalServiceNotAliveException,
TechnicalServiceOperationException,
OrganizationAuthoritiesException, OperationNotPermittedException,
ValidationException {
ArgumentValidator.notNull("subscriptionUUID", subscriptionUUID);
ArgumentValidator.notNull("instance", instanceInfo);
VOSubscription subscription = getSubscription(subscriptionUUID);
if (subscription == null) {
throw new ObjectNotFoundException("Subscription with UUID "
+ subscriptionUUID + " not found!");
}
completeAsynProvisioning(instanceInfo, subscription.getSubscriptionId(),
subscription.getOrganizationId(), false);
}
示例6: deleteInstance
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void deleteInstance(ServiceInstance serviceInstance)
throws ServiceInstanceNotFoundException {
ServiceInstance dbInstance = find(serviceInstance);
em.remove(dbInstance);
em.flush();
}
示例7: getAllProjects
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public List<Projet> getAllProjects() {
List<Projet> list = entityManager.createNamedQuery("Projet.findAll", Projet.class).getResultList();
List<Projet> listOut = new ArrayList<>();
for (Projet projet : list) {
listOut.add(computeDonValue(projet));
}
return listOut;
}
示例8: cancelTimers
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void cancelTimers() {
Collection<Timer> timers = timerService.getTimers();
for (Timer th : timers) {
if (APP_TIMER_INFO.equals(th.getInfo())) {
th.cancel();
return;
}
}
}
示例9: lockServiceInstance
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public boolean lockServiceInstance(String controllerId, String instanceId)
throws APPlatformException {
LOGGER.debug("try to lock service instance {}", instanceId);
ServiceInstance lockedService = instanceDAO
.getLockedInstanceForController(controllerId);
if (lockedService != null) {
if (!lockedService.getInstanceId().equals(instanceId)) {
LOGGER.debug("other service is already locked ({}).",
lockedService.getInstanceId());
return false;
}
LOGGER.debug("Service is already locked");
return true;
}
ServiceInstance service = null;
try {
service = instanceDAO.getInstanceById(controllerId, instanceId);
} catch (ServiceInstanceNotFoundException e) {
throw new APPlatformException(e.getMessage());
}
service.setLocked(true);
em.flush();
LOGGER.debug("Locked successfully.");
return true;
}
示例10: setStatus
/**
* Internal method to change the status even if the caller set the
* transaction to rollback only.
*
* @see AccountServiceLocal#removeOverdueOrganization(Organization)
*/
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void setStatus(long triggerProcessKey, TriggerProcessStatus status)
throws ObjectNotFoundException {
TriggerProcess proc = dm.getReference(TriggerProcess.class,
triggerProcessKey);
proc.setState(status);
}
示例11: storeControllerConfigurationSettings
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void storeControllerConfigurationSettings(String controllerId,
HashMap<String, Setting> settings) throws ConfigurationException {
LOGGER.debug("Storing configuration settings for controller '{}'",
controllerId);
if (controllerId == null || settings == null) {
throw new IllegalArgumentException("All parameters must be set");
}
Query query = em
.createNamedQuery("ConfigurationSetting.getForController");
query.setParameter("controllerId", controllerId);
List<?> resultList = query.getResultList();
for (Object entry : resultList) {
ConfigurationSetting setting = (ConfigurationSetting) entry;
String key = setting.getSettingKey();
if (settings.containsKey(key)) {
if (settings.get(key) == null
|| settings.get(key).getValue() == null) {
em.remove(setting);
} else {
setting.setDecryptedValue(settings.get(key).getValue());
em.persist(setting);
}
settings.remove(key);
}
}
for (String newKey : settings.keySet()) {
ConfigurationSetting newSetting = new ConfigurationSetting();
newSetting.setControllerId(controllerId);
newSetting.setSettingKey(newKey);
newSetting.setDecryptedValue(settings.get(newKey) != null
? settings.get(newKey).getValue() : null);
em.persist(newSetting);
}
}
示例12: restoreInstance
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void restoreInstance(ServiceInstance instance)
throws ServiceInstanceNotFoundException {
ServiceInstance dbInstance = find(instance);
dbInstance.unmarkForDeletion();
em.flush();
}
示例13: storeControllerOrganizations
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void storeControllerOrganizations(
HashMap<String, String> controllerOrganizations) {
LOGGER.debug("Storing configured controllers");
Query query = em
.createNamedQuery("ConfigurationSetting.getControllersForKey");
query.setParameter("key",
ControllerConfigurationKey.BSS_ORGANIZATION_ID.name());
List<?> resultList = query.getResultList();
for (Object entry : resultList) {
ConfigurationSetting currentCs = (ConfigurationSetting) entry;
String cId = currentCs.getControllerId();
if (controllerOrganizations.containsKey(cId)) {
String value = controllerOrganizations.get(cId);
if (value == null || value.trim().length() == 0) {
em.remove(currentCs);
} else {
currentCs.setSettingValue(value);
em.persist(currentCs);
}
controllerOrganizations.remove(cId);
}
}
for (String key : controllerOrganizations.keySet()) {
if (controllerOrganizations.get(key) != null
&& controllerOrganizations.get(key).trim().length() > 0) {
ConfigurationSetting newSetting = new ConfigurationSetting();
newSetting.setControllerId(key);
newSetting.setSettingKey(
ControllerConfigurationKey.BSS_ORGANIZATION_ID.name());
newSetting.setSettingValue(controllerOrganizations.get(key));
em.persist(newSetting);
}
}
}
示例14: isPresent
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public boolean isPresent(String name){
return em.find(Foo.class, name) != null;
}
开发者ID:arcuri82,项目名称:testing_security_development_enterprise_systems,代码行数:4,代码来源:EJB_10_multi_base.java
示例15: createOneProject
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public Projet createOneProject(Projet projet) {
entityManager.persist(projet);
return projet;
}