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


Java TransactionAttributeType.REQUIRED属性代码示例

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


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

示例1: getControllerOrganizations

@TransactionAttribute(TransactionAttributeType.REQUIRED)
public HashMap<String, String> getControllerOrganizations() {

    LOGGER.debug("Retrieving configured controllers");
    HashMap<String, String> result = new HashMap<>();
    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;
        result.put(currentCs.getControllerId(),
                currentCs.getSettingValue());
    }
    return result;
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:17,代码来源:APPConfigurationServiceBean.java

示例2: restart

/**
 * If BES is available process failed serviceInstances and reset
 * APP_SUSPEND.
 * 
 * @param isRestartAPP
 *            if true the method invoked by restartAPP else invoked by
 *            ControllerUI
 * @return If true restart successfully else restart unsuccessfully
 */
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public boolean restart(boolean isRestartAPP) {
    final String messageKey = "mail_bes_notification_connection_success";
    boolean isSuspendedByApp = false;
    if (!besDAO.isBESAvalible()) {
        if (isRestartAPP) {
            sendMailToAppAdmin("mail_bes_notification_error_app_admin");
        }
        return false;
    }
    List<ServiceInstance> serviceInstances = instanceDAO
            .getInstancesSuspendedbyApp();
    for (ServiceInstance instance : serviceInstances) {
        String actionLink = getResumeLinkForInstance(instance);
        if (actionLink == null || actionLink.isEmpty()) {
            isSuspendedByApp = true;
            continue;
        }
        sendActionMail(true, instance, messageKey, null, actionLink, false);
        instance.setSuspendedByApp(false);
    }
    configService
            .setAPPSuspend(Boolean.valueOf(isSuspendedByApp).toString());
    return true;
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:34,代码来源:APPTimerServiceBean.java

示例3: checkTransactionBehaviour

@TransactionAttribute(TransactionAttributeType.REQUIRED)
@PermitAll
@Override
public void checkTransactionBehaviour(boolean setLocalRollbackOnly, boolean throwLocalException, boolean setRemoteRollbackOnly, boolean throwRemoteException, boolean expectedToCommit) throws NamingException {
    txRegistry.registerInterposedSynchronization(new TxSyncInterceptor(!expectedToCommit));

	proxy.checkTransactionContext(setRemoteRollbackOnly, throwRemoteException, expectedToCommit);
	
	if(setLocalRollbackOnly) {
		context.setRollbackOnly();
		log.warning("Rollback set!");
	}
	if(throwLocalException) {
		throw new RuntimeException("Forced failure!");
	}
	log.info("Method done");
}
 
开发者ID:wfink,项目名称:jboss-eap7.1-playground,代码行数:17,代码来源:DelegateROCBean.java

示例4: loadSampleData

@PostConstruct
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void loadSampleData() {
    logger.info("Loading sample data.");
    unLoadAll(); //  Fail-safe in case of application restart that does not trigger a JPA schema drop.
    loadSampleLocations();
    loadSampleVoyages();
    loadSampleCargos();
}
 
开发者ID:RETIT,项目名称:continuous-performance-evaluation,代码行数:9,代码来源:SampleDataGenerator.java

示例5: getProxyConfigurationSettings

@TransactionAttribute(TransactionAttributeType.REQUIRED)
public HashMap<String, Setting> getProxyConfigurationSettings()
        throws ConfigurationException {
    LOGGER.debug("Retrieving all configuration settings for proxy");
    HashMap<String, Setting> result = new HashMap<>();
    Query query = em.createNamedQuery("ConfigurationSetting.getAllProxy");
    List<?> resultList = query.getResultList();
    for (Object entry : resultList) {
        ConfigurationSetting currentCs = (ConfigurationSetting) entry;
        result.put(currentCs.getSettingKey(), new Setting(
                currentCs.getSettingKey(), currentCs.getDecryptedValue()));
    }
    PlatformConfigurationKey[] keys = PlatformConfigurationKey.values();
    StringBuffer missing = new StringBuffer();
    for (int i = 0; i < keys.length; i++) {
        if (keys[i].isMandatory() && !result.containsKey(keys[i].name())) {
            if (missing.length() > 0) {
                missing.append(", ");
            }
            missing.append(keys[i].name());
        }
    }
    if (missing.length() > 0) {
        throw new ConfigurationException(
                "The configuration is missing the following parameter(s): "
                        + missing.toString(),
                missing.toString());
    }
    return result;
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:30,代码来源:APPConfigurationServiceBean.java

示例6: notifySubscriptionsAboutUserUpdate

@Override
@Asynchronous
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void notifySubscriptionsAboutUserUpdate(PlatformUser existingUser) {

    // 2. notify all products the user is subscribed to
    List<Subscription> subscriptions = sm
            .getSubscriptionsForUserInt(existingUser);
    List<TaskMessage> messages = new ArrayList<>();
    for (Subscription subscription : subscriptions) {
        SubscriptionStatus status = subscription.getStatus();
        // in these states the product instance is not existing
        if (status != SubscriptionStatus.PENDING
                && status != SubscriptionStatus.INVALID) {
            UsageLicense license = getUsgeLicenseForUserAndSubscription(
                    existingUser, subscription);
            if (license != null) {
                UpdateUserPayload payload = new UpdateUserPayload(
                        subscription.getKey(), license.getKey());
                TaskMessage message = new TaskMessage(
                        UpdateUserHandler.class, payload);
                messages.add(message);
            }
        }
    }
    tqs.sendAllMessages(messages);

}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:28,代码来源:IdentityServiceBean.java

示例7: saveOrUpdate

@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void saveOrUpdate(Dictionary dic) {
    if (null != dic.getId()) {
        em.merge(dic);
    } else {
        em.persist(dic);
    }
}
 
开发者ID:CLARIN-PL,项目名称:WordnetLoom,代码行数:8,代码来源:DictionaryRepository.java

示例8: saveOrUpdate

@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void saveOrUpdate(User user) {
    if (null != user.getId()) {
        em.merge(user);
    } else {
        em.persist(user);
    }
}
 
开发者ID:CLARIN-PL,项目名称:WordnetLoom,代码行数:8,代码来源:UserRepository.java

示例9: update

@TransactionAttribute(TransactionAttributeType.REQUIRED)
public T update(@Valid T bean) {
    return getDao().update(bean);
}
 
开发者ID:jhonystein,项目名称:Pedidex,代码行数:4,代码来源:AbstractCrudService.java

示例10: checkTransactionBehaviour

@TransactionAttribute(TransactionAttributeType.REQUIRED)
  @PermitAll
  @Override
  public void checkTransactionBehaviour(boolean setLocalRollbackOnly, boolean throwLocalException, boolean setRemoteRollbackOnly, boolean throwRemoteException, boolean expectedToCommit) throws NamingException {
  	Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, WildFlyInitialContextFactory.class.getName());
p.put(Context.PROVIDER_URL, "http-remoting://localhost:8080");

p.put(Context.SECURITY_PRINCIPAL, "delegateUserR");
p.put(Context.SECURITY_CREDENTIALS, "delegateUser");

  	InitialContext ic = new InitialContext(p);
  	Simple localProxy = (Simple)ic.lookup("ejb:EAP71-PLAYGROUND-server/ejb/SimpleBean!" + Simple.class.getName());
  	
      //TransactionSynchronizationRegistry txRegistry = (TransactionSynchronizationRegistry) context.lookup("java:jboss/TransactionSynchronizationRegistry");
      txRegistry.registerInterposedSynchronization(new TxSyncInterceptor(setLocalRollbackOnly|setRemoteRollbackOnly));

  	localProxy.checkTransactionContext(setRemoteRollbackOnly, throwRemoteException, expectedToCommit);
  	
  	if(setLocalRollbackOnly) {
  		context.setRollbackOnly();
  		log.warning("Rollback set!");
  	}
  	if(throwLocalException) {
  		throw new RuntimeException("Forced failure!");
  	}
  	log.info("Method done");
  }
 
开发者ID:wfink,项目名称:jboss-eap7.1-playground,代码行数:28,代码来源:DelegateBean.java

示例11: checkTransactionStickyness

@TransactionAttribute(TransactionAttributeType.REQUIRED)
@PermitAll
@Override
public void checkTransactionStickyness() {

    HashSet<String> servers = new HashSet<String>();
    for(int i = 0 ; i <20 ; i++) {
    	servers.add(proxy.getJBossServerNameInRunningTx());
    }
	if(servers.size() != 1) {
		log.severe("Unexpected list of target servers : " + servers);
		throw new RuntimeException("Tx seems not to be sticky servers are : " + servers);
	}
	log.info("Method done");
}
 
开发者ID:wfink,项目名称:jboss-eap7.1-playground,代码行数:15,代码来源:DelegateROCBean.java

示例12: executeOperation

/**
 * Execute the given operation.
 * 
 * @param serviceInstance
 *            - the service instance object
 * @param operation
 *            - the operation to execute
 */
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void executeOperation(ServiceInstance serviceInstance,
        ServiceUser user, InstanceOperation operation)
        throws ServiceInstanceException {

    String locale = user.getLocale();
    if (serviceInstance == null) {
        throw new ServiceInstanceException(Messages.get(locale,
                "error_instance_not_exist"), "[serviceInstance is null]");
    }

    serviceInstance = em.getReference(ServiceInstance.class,
        serviceInstance.getTkey());

    switch (operation) {

    case RESUME:
        resumeInstance(serviceInstance, locale);
        break;

    case SUSPEND:
        suspendInstance(serviceInstance, locale);
        break;

    case UNLOCK:
        unlockInstance(serviceInstance, locale);
        break;

    case DELETE:
        deleteServiceInstance(serviceInstance, locale);
        break;

    case DEPROVISION:
        deprovision(serviceInstance, user);
        break;

    case ABORT_PENDING:
        abortPendingInstance(serviceInstance, locale);
        break;

    case COMPLETE_PENDING:
        completePendingInstance(serviceInstance, locale);
        break;

    default:
        break;
    }

}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:57,代码来源:ServiceInstanceServiceBean.java

示例13: reInitTimers

@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void reInitTimers() throws ValidationException {
    cancelAllObsoleteTimer();
    initAllTimers();
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:5,代码来源:TimerServiceBean.java

示例14: executeOperation

/**
 * Execute the given operation.
 * 
 * @param serviceInstance
 *            - the service instance object
 * @param operation
 *            - the operation to execute
 */
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void executeOperation(ServiceInstance serviceInstance,
        ServiceUser user, InstanceOperation operation)
        throws ServiceInstanceException {

    String locale = user.getLocale();
    if (serviceInstance == null) {
        throw new ServiceInstanceException(Messages.get(locale,
                "error_instance_not_exist"), "[serviceInstance is null]");
    }

    serviceInstance = em.getReference(ServiceInstance.class,
            Long.valueOf(serviceInstance.getTkey()));

    switch (operation) {

    case RESUME:
        resumeInstance(serviceInstance, locale);
        break;

    case SUSPEND:
        suspendInstance(serviceInstance, locale);
        break;

    case UNLOCK:
        unlockInstance(serviceInstance, locale);
        break;

    case DELETE:
        deleteServiceInstance(serviceInstance, locale);
        break;

    case DEPROVISION:
        deprovision(serviceInstance, user);
        break;

    case ABORT_PENDING:
        abortPendingInstance(serviceInstance, locale);
        break;

    case COMPLETE_PENDING:
        completePendingInstance(serviceInstance, locale);
        break;

    default:
        break;
    }

}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:57,代码来源:ServiceInstanceServiceBean.java

示例15: createFooWithRequiredTransaction

@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void createFooWithRequiredTransaction(String name){
    Foo foo = new Foo(name);
    em.persist(foo);
}
 
开发者ID:arcuri82,项目名称:testing_security_development_enterprise_systems,代码行数:5,代码来源:EJB_04_SUPPORTS.java


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