本文整理汇总了Java中javax.ejb.TransactionAttributeType类的典型用法代码示例。如果您正苦于以下问题:Java TransactionAttributeType类的具体用法?Java TransactionAttributeType怎么用?Java TransactionAttributeType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransactionAttributeType类属于javax.ejb包,在下文中一共展示了TransactionAttributeType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeLocalizedValue
import javax.ejb.TransactionAttributeType; //导入依赖的package包/类
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public void removeLocalizedValue(long objectKey,
LocalizedObjectTypes objectType, String localeString) {
Query query = dm
.createNamedQuery("LocalizedResource.deleteForObjectAndTypeAndLocale");
query.setParameter("objectKey", Long.valueOf(objectKey));
query.setParameter("objectType", objectType);
query.setParameter("locale", localeString);
query.executeUpdate();
}
示例2: activateInstance
import javax.ejb.TransactionAttributeType; //导入依赖的package包/类
@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public InstanceStatus activateInstance(String instanceId,
ProvisioningSettings settings) throws APPlatformException {
logger.info("activateInstance({})",
LogAndExceptionConverter.getLogText(instanceId, settings));
try {
StateMachine.initializeProvisioningSettings(settings,
"activate_vm.xml");
InstanceStatus result = new InstanceStatus();
result.setChangedParameters(settings.getParameters());
return result;
} catch (Throwable t) {
throw LogAndExceptionConverter.createAndLogPlatformException(t,
Context.ACTIVATION);
}
}
示例3: getMarketplacesForSupplier
import javax.ejb.TransactionAttributeType; //导入依赖的package包/类
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public List<Marketplace> getMarketplacesForSupplier() {
Organization supplier = ds.getCurrentUser().getOrganization();
Query query = ds.createNamedQuery(
"Marketplace.findMarketplacesForPublishingForOrg");
query.setParameter("organization_tkey",
Long.valueOf(supplier.getKey()));
query.setParameter("publishingAccessGranted",
PublishingAccess.PUBLISHING_ACCESS_GRANTED);
query.setParameter("publishingAccessDenied",
PublishingAccess.PUBLISHING_ACCESS_DENIED);
List<Marketplace> marketplaceList = ParameterizedTypes
.list(query.getResultList(), Marketplace.class);
return marketplaceList;
}
示例4: getDataList
import javax.ejb.TransactionAttributeType; //导入依赖的package包/类
@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public List<JmdTaskData> getDataList(Long taskId) {
Connection connection = null;
List<JmdTaskData> result = new ArrayList<>();
try {
connection = ds.getConnection();
result = getDataList(connection, taskId);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, e.toString(), e);
throw new RuntimeException(e);
} finally {
SqlUtil.close(connection);
}
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "RESULT:{0}", result);
}
return result;
}
示例5: setStopEnabled
import javax.ejb.TransactionAttributeType; //导入依赖的package包/类
@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void setStopEnabled(Long taskId, Boolean stopEnabled) {
Connection connection = null;
try {
connection = ds.getConnection();
new OraSqlBuilder().update(connection, Query
.UPDATE(TABLE.JMD_TASK())
.SET(JMD_TASK.STOP_ENABLED(), stopEnabled)
.WHERE(JMD_TASK.ID(), Condition.EQUALS, taskId)
);
} catch (SQLException e) {
LOGGER.log(Level.SEVERE, e.toString(), e);
throw new RuntimeException(e);
} finally {
SqlUtil.close(connection);
}
}
示例6: setFinished
import javax.ejb.TransactionAttributeType; //导入依赖的package包/类
@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void setFinished(Long taskId) {
Connection connection = null;
try {
connection = ds.getConnection();
Column currentTimestamp = new ColumnFunction("id", "current_timestamp", DataType.DATE);
new H2SqlBuilder().update(connection, Query
.UPDATE(TABLE.JMD_TASK())
.SET(JMD_TASK.FINISHED(), currentTimestamp)
.WHERE(JMD_TASK.ID(), Condition.EQUALS, taskId)
);
} catch (SQLException e) {
LOGGER.log(Level.SEVERE, e.toString(), e);
throw new RuntimeException(e);
} finally {
SqlUtil.close(connection);
}
}
示例7: removeOverdueOrganizations
import javax.ejb.TransactionAttributeType; //导入依赖的package包/类
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public boolean removeOverdueOrganizations(long currentTime) {
boolean successfulExecution = true;
List<PlatformUser> overdueOrganizationAdmins = im
.getOverdueOrganizationAdmins(currentTime);
for (PlatformUser userToBeRemoved : overdueOrganizationAdmins) {
try {
// call has to be made by calling into the container again, so
// that the new transactional behaviour is considered.
prepareForNewTransaction().removeOverdueOrganization(
userToBeRemoved.getOrganization());
} catch (Exception e) {
successfulExecution = false;
logger.logError(Log4jLogger.SYSTEM_LOG, e,
LogMessageIdentifier.ERROR_ORGANIZATION_DELETION_FAILED,
Long.toString(
userToBeRemoved.getOrganization().getKey()));
// logging is sufficient for now, so simply proceed
}
}
return successfulExecution;
}
示例8: checkApplicationUserWithRemoteOutboundConnection
import javax.ejb.TransactionAttributeType; //导入依赖的package包/类
@RolesAllowed({"Application"})
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
@Override
public void checkApplicationUserWithRemoteOutboundConnection(String userName, int invocations) {
Principal caller = context.getCallerPrincipal();
if(!userName.equals(caller.getName())) {
log.severe("Given user name '" + userName + "' not equal to real use name '" + caller.getName() + "'");
}else{
log.info("Try to invoke remote SimpleBean with user '" + userName + "' " + invocations + " times");
try {
Simple proxy = (Simple)new InitialContext().lookup("ejb:EAP71-PLAYGROUND-server/ejb/SimpleBean!" + Simple.class.getName());
for(int i = 0 ; i < invocations ; i++) {
proxy.checkApplicationUser(userName);
}
} catch (NamingException e) {
throw new RuntimeException("No target Bean found!", e);
}
}
return;
}
示例9: restart
import javax.ejb.TransactionAttributeType; //导入依赖的package包/类
/**
* 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;
}
示例10: getLocalizedTextFromBundle
import javax.ejb.TransactionAttributeType; //导入依赖的package包/类
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public String getLocalizedTextFromBundle(LocalizedObjectTypes objectType,
Marketplace marketplace, String localeString, String key) {
String result = null;
if (objectType.getSource() == InformationSource.RESOURCE_BUNDLE) {
result = getLocalizedTextFromResourceBundle(
objectType.getSourceLocation(), marketplace, localeString,
key);
} else if (objectType.getSource() == InformationSource.DATABASE_AND_RESOURCE_BUNDLE) {
result = getLocalizedTextFromResourceBundleForPlatformObjects(
objectType.getSourceLocation(), localeString, key);
} else {
logger.logWarn(Log4jLogger.SYSTEM_LOG,
LogMessageIdentifier.WARN_NON_SUPPORTED_LOCALE,
String.valueOf(objectType.getSource()));
}
return result;
}
示例11: initTimers_internal
import javax.ejb.TransactionAttributeType; //导入依赖的package包/类
/**
* 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.");
}
}
}
示例12: setQueueId
import javax.ejb.TransactionAttributeType; //导入依赖的package包/类
@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void setQueueId(Long taskId, String queueId) {
Connection connection = null;
try {
connection = ds.getConnection();
new OraSqlBuilder().update(connection, Query
.UPDATE(TABLE.JMD_TASK())
.SET(JMD_TASK.QUEUE_ID(), queueId)
.WHERE(JMD_TASK.ID(), Condition.EQUALS, taskId)
);
} catch (SQLException e) {
LOGGER.log(Level.SEVERE, e.toString(), e);
throw new RuntimeException(e);
} finally {
SqlUtil.close(connection);
}
}
示例13: unlockServiceInstance
import javax.ejb.TransactionAttributeType; //导入依赖的package包/类
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void unlockServiceInstance(String controllerId, String instanceId)
throws APPlatformException {
ServiceInstance service = null;
try {
service = instanceDAO.getInstanceById(controllerId, instanceId);
} catch (ServiceInstanceNotFoundException e) {
throw new APPlatformException(e.getMessage());
}
if (service.isLocked()) {
LOGGER.debug("unlock service instance {}", instanceId);
service.setLocked(false);
em.flush();
}
}
示例14: abortAsyncSubscription
import javax.ejb.TransactionAttributeType; //导入依赖的package包/类
@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);
}
示例15: findLastHistory
import javax.ejb.TransactionAttributeType; //导入依赖的package包/类
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public DomainHistoryObject<?> findLastHistory(DomainObject<?> obj) {
if (obj == null) {
return null;
}
String className = DomainObject.getDomainClass(obj).getName();
String histClassName = className
.substring(className.lastIndexOf(".") + 1) + "History";
String qryString = histClassName + ".findByObjectDesc";
Query query = em.createNamedQuery(qryString);
query.setParameter("objKey", Long.valueOf(obj.getKey()));
query.setMaxResults(1);
List<?> qryresult = query.getResultList();
if (qryresult.isEmpty()) {
return null;
}
return (DomainHistoryObject<?>) qryresult.get(0);
}