javax.ejb.TransactionAttribute Java Examples

The following examples show how to use javax.ejb.TransactionAttribute. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocalizerServiceBean.java    From development with Apache License 2.0 6 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public Properties loadLocalizedPropertiesFromDatabase(long objectKey,
        LocalizedObjectTypes objectType, String localeString) {
    Properties properties = new Properties();
    LocalizedResource template = new LocalizedResource(localeString,
            objectKey, objectType);
    LocalizedResource resource = (LocalizedResource) dm.find(template);
    if (resource != null && resource.getValue().length() > 0) {
        try {
            // Property files are always encoded in ISO-8859-1:
            final InputStream inputStream = new ByteArrayInputStream(
                    resource.getValue().getBytes("ISO-8859-1"));
            properties.load(inputStream);
            inputStream.close();
        } catch (IOException e) {
            logger.logError(Log4jLogger.SYSTEM_LOG, e,
                    LogMessageIdentifier.ERROR_OBJECT_ENCODING_FAILED);
        }
    }

    return properties;
}
 
Example #2
Source File: AWSController.java    From development with Apache License 2.0 6 votes vote down vote up
/**
 * Starts the deactivation of an application instance.
 * <p>
 * The internal status <code>DEACTIVATION_REQUESTED</code> is stored as a
 * controller configuration setting. It is evaluated and handled by the
 * status dispatcher, which is invoked at regular intervals by APP through
 * the <code>getInstanceStatus</code> method.
 * 
 * @param instanceId
 *            the ID of the application instance to be activated
 * @param settings
 *            a <code>ProvisioningSettings</code> object specifying the
 *            service parameters and configuration settings
 * @return an <code>InstanceStatus</code> instance with the overall status
 *         of the application instance
 * @throws APPlatformException
 */
@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public InstanceStatus deactivateInstance(String instanceId,
        ProvisioningSettings settings) throws APPlatformException {
    LOGGER.info("deactivateInstance({})",
            LogAndExceptionConverter.getLogText(instanceId, settings));
    try {
        // Set status to store for application instance
        PropertyHandler ph = PropertyHandler.withSettings(settings);
        ph.setOperation(Operation.EC2_ACTIVATION);
        ph.setState(FlowState.DEACTIVATION_REQUESTED);

        InstanceStatus result = new InstanceStatus();
        result.setChangedParameters(settings.getParameters());
        result.setChangedAttributes(settings.getAttributes());
        return result;
    } catch (Throwable t) {
        throw LogAndExceptionConverter.createAndLogPlatformException(t,
                Context.DEACTIVATION);
    }
}
 
Example #3
Source File: ServiceProvisioningPartnerServiceLocalBean.java    From development with Apache License 2.0 6 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public void saveOperatorRevenueShare(long serviceKey,
        RevenueShareModel newRevenueShare, int newRevenueShareVersion)
        throws ValidationException, ConcurrentModificationException,
        ObjectNotFoundException, ServiceOperationException {

    ArgumentValidator.notNull("newRevenueShare", newRevenueShare);
    Product product = dm.getReference(Product.class, serviceKey);
    validateProductTemplate(product);
    validateOperatorRevenueShare(product);

    CatalogEntry ce = product.getCatalogEntries().get(0);
    try {
        updateRevenueShare(newRevenueShare, ce.getOperatorPriceModel(),
                newRevenueShareVersion);
    } catch (ValidationException e) {
        sessionCtx.setRollbackOnly();
        throw e;
    }

}
 
Example #4
Source File: IaasController.java    From development with Apache License 2.0 6 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public InstanceStatus deleteInstance(String instanceId,
        ProvisioningSettings settings) throws APPlatformException {

    try {
        PropertyHandler paramHandler = new PropertyHandler(settings);
        defineOperation(Operation.DELETION, paramHandler);
        // Schedule instance deletion
        if (paramHandler.isVirtualSystemProvisioning()) {
            paramHandler.setState(FlowState.VSYSTEM_DELETION_REQUESTED);
        } else {
            paramHandler.setState(FlowState.VSERVER_DELETION_REQUESTED);
        }
        InstanceStatus result = new InstanceStatus();
        result.setChangedParameters(settings.getParameters());
        result.setChangedAttributes(settings.getAttributes());
        return result;
    } catch (Exception e) {
        logger.error("Error while scheduling VSERVER instance deletion", e);
        APPlatformException exception = getPlatformException(e,
                "error_deletion_overall");
        throw exception;
    }
}
 
Example #5
Source File: AccountServiceBean.java    From development with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #6
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@POST
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/{logicName}/async/createAndNext")
@GZIP
@GenerateQuerySessionId(cookieBasePath = "/DataWave/Query/")
@EnrichQueryMetrics(methodType = MethodType.CREATE_AND_NEXT)
@Interceptors({ResponseInterceptor.class, RequiredInterceptor.class})
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
@Asynchronous
@Timed(name = "dw.query.createAndNextAsync", absolute = true)
public void createQueryAndNextAsync(@Required("logicName") @PathParam("logicName") String logicName, MultivaluedMap<String,String> queryParameters,
                @Suspended AsyncResponse asyncResponse) {
    try {
        BaseQueryResponse response = createQueryAndNext(logicName, queryParameters);
        asyncResponse.resume(response);
    } catch (Throwable t) {
        asyncResponse.resume(t);
    }
}
 
Example #7
Source File: BillingDataRetrievalServiceBean.java    From development with Apache License 2.0 6 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public SubscriptionHistory loadPreviousSubscriptionHistoryForPriceModel(
        final long priceModelKey, final long timeMillis) {
    TypedQuery<SubscriptionHistory> query = dm.createNamedQuery(
            "SubscriptionHistory.findPreviousForPriceModel",
            SubscriptionHistory.class);
    query.setParameter("priceModelKey", Long.valueOf(priceModelKey));
    query.setParameter("modDate", new Date(timeMillis));

    List<SubscriptionHistory> resultList = query.getResultList();
    if (resultList.size() > 0) {
        return resultList.get(0);
    } else {
        return null;
    }
}
 
Example #8
Source File: SharesCalculatorBean.java    From development with Apache License 2.0 6 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void performBrokerShareCalculationRun(long startOfLastMonth,
        long endOfLastMonth, Long brokerKey) throws Exception {
    // build the result object tree
    BrokerRevenueShareResult brokerShareResult = new BrokerShareResultAssembler(
            sharesRetrievalService, billingRetrievalService).build(
            brokerKey, startOfLastMonth, endOfLastMonth);

    // calculate all shares
    brokerShareResult.calculateAllShares();

    // serialize the result object and persist
    saveBillingSharesResult(startOfLastMonth, endOfLastMonth,
            BillingSharesResultType.BROKER, brokerShareResult, brokerKey);
}
 
Example #9
Source File: BillingDataRetrievalServiceBean.java    From development with Apache License 2.0 6 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public Map<Long, RoleDefinitionHistory> loadRoleDefinitionsForPriceModel(
        long priceModelKey, long periodEndTime) {
    List<RoleDefinitionHistory> tempResult = findRoleDefinitionsForPriceModel(
            priceModelKey, periodEndTime);

    Map<Long, RoleDefinitionHistory> result = new HashMap<Long, RoleDefinitionHistory>();
    Set<Long> containedRoleKeys = new HashSet<Long>();

    for (RoleDefinitionHistory currentHist : tempResult) {
        if (containedRoleKeys.add(Long.valueOf(currentHist.getObjKey()))) {
            result.put(Long.valueOf(currentHist.getObjKey()), currentHist);
        }
    }

    return result;
}
 
Example #10
Source File: AWSController.java    From development with Apache License 2.0 6 votes vote down vote up
/**
 * Starts the modification of an application instance.
 * <p>
 * The internal status <code>MODIFICATION_REQUESTED</code> is stored as a
 * controller configuration setting. It is evaluated and handled by the
 * status dispatcher, which is invoked at regular intervals by APP through
 * the <code>getInstanceStatus</code> method.
 * 
 * @param instanceId
 *            the ID of the application instance to be modified
 * @param currentSettings
 *            a <code>ProvisioningSettings</code> object specifying the
 *            current service parameters and configuration settings
 * @param newSettings
 *            a <code>ProvisioningSettings</code> object specifying the
 *            modified service parameters and configuration settings
 * @return an <code>InstanceStatus</code> instance with the overall status
 *         of the application instance
 * @throws APPlatformException
 */
@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public InstanceStatus modifyInstance(String instanceId,
        ProvisioningSettings currentSettings,
        ProvisioningSettings newSettings) throws APPlatformException {
    LOGGER.info("modifyInstance({})", LogAndExceptionConverter
            .getLogText(instanceId, currentSettings));
    try {
        PropertyHandler ph = PropertyHandler.withSettings(newSettings);
        ph.setOperation(Operation.EC2_MODIFICATION);
        ph.setState(FlowState.MODIFICATION_REQUESTED);

        InstanceStatus result = new InstanceStatus();
        result.setChangedParameters(newSettings.getParameters());
        result.setChangedAttributes(newSettings.getAttributes());
        return result;
    } catch (Throwable t) {
        throw LogAndExceptionConverter.createAndLogPlatformException(t,
                Context.MODIFICATION);
    }
}
 
Example #11
Source File: XAProducerSB.java    From solace-integration-guides with Apache License 2.0 6 votes vote down vote up
@TransactionAttribute(value = TransactionAttributeType.REQUIRED)
@Override
public void sendMessage() throws JMSException {

    Connection conn = null;
    Session session = null;
    MessageProducer prod = null;

    try {
        conn = myCF.createConnection();
        session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        prod = session.createProducer(myReplyQueue);

        ObjectMessage msg = session.createObjectMessage();
        msg.setObject("Hello world!");
        prod.send(msg, DeliveryMode.PERSISTENT, 0, 0);
    } finally {
        if (prod != null)
            prod.close();
        if (session != null)
            session.close();
        if (conn != null)
            conn.close();
    }
}
 
Example #12
Source File: PaymentServiceBean.java    From development with Apache License 2.0 6 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public void deregisterPaymentInPSPSystem(PaymentInfo payment)
        throws PaymentDeregistrationException,
        OperationNotPermittedException {

    // check pre-conditions
    if (payment == null
            || payment.getPaymentType().getCollectionType() != PaymentCollectionType.PAYMENT_SERVICE_PROVIDER) {
        return;
    }
    PlatformUser currentUser = dm.getCurrentUser();
    PermissionCheck.owns(payment, currentUser.getOrganization(), logger);

    RequestData data = createRequestData(currentUser.getLocale(), payment);

    deregisterPaymentInfo(payment.getPaymentType().getPsp().getWsdlUrl(),
            data);

}
 
Example #13
Source File: BillingDataRetrievalServiceBean.java    From development with Apache License 2.0 6 votes vote down vote up
/**
 * Load the list of UsageLicense objects that belong to the subscription and
 * thus the product. The list will be ordered by userobjkey ASC, objVersion
 * DESC.
 *
 * @return list of usage licenses, may be empty but never null.
 */
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public List<UsageLicenseHistory> loadUsageLicenses(long subscriptionKey,
        long startTimeForPeriod, long endTimeForPeriod) {

    Query query = dm
            .createNamedQuery("UsageLicenseHistory.getForSubKey_VersionDESC");
    Date startDate = new Date(startTimeForPeriod);
    query.setParameter("startTimeAsDate", startDate);
    query.setParameter("subscriptionKey", Long.valueOf(subscriptionKey));
    Date endDate = new Date(endTimeForPeriod);
    query.setParameter("endTimeAsDate", endDate);

    final List<UsageLicenseHistory> usageLicenseHistoryElements = ParameterizedTypes
            .list(query.getResultList(), UsageLicenseHistory.class);

    setUserIdsForUsageLicenses(usageLicenseHistoryElements);

    return usageLicenseHistoryElements;
}
 
Example #14
Source File: SharesCalculatorBean.java    From development with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #15
Source File: IaasController.java    From development with Apache License 2.0 5 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public InstanceStatus notifyInstance(String instanceId,
        ProvisioningSettings settings, Properties properties)
        throws APPlatformException {

    InstanceStatus status = null;
    if (instanceId == null || settings == null || properties == null) {
        return status;
    }
    PropertyHandler propertyHandler = new PropertyHandler(settings);

    if ("finish".equals(properties.get("command"))) {
        // since deletion currently does not have manual steps, the event
        // can be ignored
        if (!propertyHandler.getOperation().isDeletion()) {
            if (FlowState.MANUAL.equals(propertyHandler.getState())) {
                propertyHandler.setState(FlowState.FINISHED);
                status = setNotificationStatus(settings, propertyHandler);
                logger.debug("Got finish event => changing instance status to finished");
            } else {
                APPlatformException pe = new APPlatformException(
                        "Got finish event but instance is in state "
                                + propertyHandler.getState()
                                + " => nothing changed");
                logger.debug(pe.getMessage());
                throw pe;
            }
        }
    }
    return status;
}
 
Example #16
Source File: IaasController.java    From development with Apache License 2.0 5 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public InstanceStatus deleteUsers(String instanceId,
        ProvisioningSettings settings, List<ServiceUser> users)
        throws APPlatformException {
    return null;
}
 
Example #17
Source File: TransactionInvocationHandlers.java    From development with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the handler suitable for the given bean implementation class and
 * method.
 * 
 * @param beanClass
 * @return
 */
public static IInvocationHandler getHandlerFor(Class<?> beanClass,
        Method beanMethod) {
    TransactionAttribute attr = beanMethod
            .getAnnotation(TransactionAttribute.class);
    if (attr != null) {
        return getHandlerFor(attr.value());
    }
    // Default is class scope:
    return getHandlerFor(beanClass);
}
 
Example #18
Source File: EquipmentModelBean.java    From hurraa with GNU General Public License v2.0 5 votes vote down vote up
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public boolean isNameAvailable(String name){
    TypedQuery<EquipmentModel> query = getEntityManager()
                .createNamedQuery( "FIND_BY_NAME", EquipmentModel.class );
    query.setParameter("name", name);
    return query.getResultList().isEmpty();
}
 
Example #19
Source File: ConfigurationServiceBean.java    From development with Apache License 2.0 5 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public boolean isCustomerSelfRegistrationEnabled() {
    return getConfigurationSetting(
            ConfigurationKey.CUSTOMER_SELF_REGISTRATION_ENABLED,
            Configuration.GLOBAL_CONTEXT).getValue()
                    .equalsIgnoreCase("true");
}
 
Example #20
Source File: SessionServiceBean.java    From development with Apache License 2.0 5 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public List<Session> getProductSessionsForSubscriptionTKey(
        long subscriptionTKey) {

    // find all entries for the given session id
    Query query = dm.createNamedQuery("Session.findEntriesForSubscription");
    query.setParameter("subscriptionTKey", Long.valueOf(subscriptionTKey));
    query.setParameter("sessionType", SessionType.SERVICE_SESSION);
    return ParameterizedTypes.list(query.getResultList(),
            Session.class);
}
 
Example #21
Source File: BillingDataRetrievalServiceBean.java    From development with Apache License 2.0 5 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public String loadPaymentTypeIdForSubscription(long subscriptionKey) {
    Query query = dm
            .createNamedQuery("SubscriptionHistory.getPaymentTypeId");
    query.setParameter("subscriptionKey", Long.valueOf(subscriptionKey));
    String result;
    try {
        result = (String) query.getSingleResult();
    } catch (NoResultException e) {
        result = "";
    }
    return result;
}
 
Example #22
Source File: MarketplaceServiceLocalBean.java    From development with Apache License 2.0 5 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public void updateMarketplaceTrackingCode(String marketplaceId,
        int marketplaceVersion, String trackingCode)
        throws ObjectNotFoundException, ConcurrentModificationException {
    Marketplace dbMarketplace = getMarketplace(marketplaceId);
    VersionAndKeyValidator.verify(dbMarketplace, dbMarketplace,
            marketplaceVersion);
    dbMarketplace.setTrackingCode(trackingCode);
}
 
Example #23
Source File: MarketplaceServiceLocalBean.java    From development with Apache License 2.0 5 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public Marketplace updateMarketplaceAccessType(String marketplaceId,
        boolean isRestricted)
        throws ObjectNotFoundException, NonUniqueBusinessKeyException {
    Marketplace marketplace = (Marketplace) ds
            .getReferenceByBusinessKey(new Marketplace(marketplaceId));
    if (marketplace.isRestricted() == isRestricted) {
        return marketplace;
    }
    marketplace.setRestricted(isRestricted);
    ds.persist(marketplace);
    marketplaceCache.resetConfiguration(marketplace.getMarketplaceId());
    return marketplace;
}
 
Example #24
Source File: MarketplaceServiceLocalBean.java    From development with Apache License 2.0 5 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
@RolesAllowed({ "PLATFORM_OPERATOR", "SERVICE_MANAGER" })
public void createRevenueModels(Marketplace mp,
        BigDecimal brokerRevenueShare, BigDecimal resellerRevenueShare,
        BigDecimal marketplaceRevenueShare) {
    // SERVICE_MANAGER is only allowed for 1.1 compatibility
    RevenueShareModel bmodel = createRevenueModel(
            RevenueShareModelType.BROKER_REVENUE_SHARE, brokerRevenueShare);
    RevenueShareModel rmodel = createRevenueModel(
            RevenueShareModelType.RESELLER_REVENUE_SHARE,
            resellerRevenueShare);
    RevenueShareModel mmodel = createRevenueModel(
            RevenueShareModelType.MARKETPLACE_REVENUE_SHARE,
            marketplaceRevenueShare);
    mp.setBrokerPriceModel(bmodel);
    mp.setResellerPriceModel(rmodel);
    mp.setPriceModel(mmodel);
    try {
        ds.persist(bmodel);
        ds.persist(rmodel);
        ds.persist(mmodel);
    } catch (NonUniqueBusinessKeyException e) {
        SaaSSystemException sse = new SaaSSystemException(
                "revenue share model could not be persisted", e);
        logger.logError(Log4jLogger.SYSTEM_LOG, sse,
                LogMessageIdentifier.ERROR_MARKETPLACE_CREATION_FAILED);
        throw sse;
    }
}
 
Example #25
Source File: ImageResourceServiceBean.java    From development with Apache License 2.0 5 votes vote down vote up
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public void save(ImageResource imageResource) {
    

    ImageResource template = new ImageResource(
            imageResource.getObjectKey(), imageResource.getImageType());
    ImageResource storedImageResource = (ImageResource) ds.find(template);
    boolean persistFlag = false;
    if (storedImageResource == null) {
        storedImageResource = new ImageResource();
        persistFlag = true;
    }
    storedImageResource.setContentType(imageResource.getContentType());
    storedImageResource.setBuffer(imageResource.getBuffer());
    if (persistFlag) {
        try {
            ds.persist(imageResource);
            ds.flush();
        } catch (NonUniqueBusinessKeyException e) {
            SaaSSystemException sse = new SaaSSystemException(
                    "Image Resource could not be persisted although prior check was performed, "
                            + imageResource, e);
            logger.logError(
                    Log4jLogger.SYSTEM_LOG,
                    sse,
                    LogMessageIdentifier.ERROR_PERSIST_IMAGE_RESOURCE_FAILED_PRIOR_CHECK_PERFORMED,
                    String.valueOf(imageResource));
            throw sse;
        }
    }

    
}
 
Example #26
Source File: TransactionInvocationHandlersTest.java    From development with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetHandlerForBeanClassAndMethod1() throws Exception {
    @TransactionAttribute(TransactionAttributeType.SUPPORTS)
    class Bean implements Runnable {
        @Override
        @TransactionAttribute(TransactionAttributeType.MANDATORY)
        public void run() {
        }
    }
    assertSame(TransactionInvocationHandlers.TX_MANDATORY,
            TransactionInvocationHandlers.getHandlerFor(Bean.class,
                    Bean.class.getMethod("run")));
}
 
Example #27
Source File: MarketplaceServiceLocalBean.java    From development with Apache License 2.0 5 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public void removeOwnerRole(Organization org) {
    // Get role marketplace owner
    OrganizationRole orgRole = new OrganizationRole();
    orgRole.setRoleName(OrganizationRoleType.MARKETPLACE_OWNER);
    orgRole = (OrganizationRole) ds.find(orgRole);
    if (orgRole == null) {
        return;
    }
    // second retrieve relevant marketplaces by query
    Query query = ds.createNamedQuery(
            "OrganizationToRole.getByOrganizationAndRole");
    query.setParameter("orgTKey", new Long(org.getKey()));
    query.setParameter("orgRoleTKey", new Long(orgRole.getKey()));
    List<OrganizationToRole> tempList = ParameterizedTypes
            .list(query.getResultList(), OrganizationToRole.class);

    if (tempList.isEmpty()) {
        return;
    }
    // Remove relation
    OrganizationToRole orgToRole = tempList.get(0);
    ds.remove(orgToRole);
    ds.flush();
    org.getGrantedRoles().remove(orgToRole);
}
 
Example #28
Source File: AccountServiceStub.java    From development with Apache License 2.0 5 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public VOOrganization registerKnownCustomerInt(TriggerProcess tp)
        throws OrganizationAuthoritiesException, ValidationException,
        NonUniqueBusinessKeyException, MailOperationException {

    return null;
}
 
Example #29
Source File: IaasController.java    From development with Apache License 2.0 5 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public InstanceStatusUsers createUsers(String instanceId,
        ProvisioningSettings settings, List<ServiceUser> users)
        throws APPlatformException {
    return null;
}
 
Example #30
Source File: BillingDataRetrievalServiceBean.java    From development with Apache License 2.0 5 votes vote down vote up
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
@SuppressWarnings("unchecked")
public List<PriceModelHistory> loadPriceModelHistories(
        long priceModelKeyForSubscription, long endTimeForPeriod) {

    Query query = dm
            .createNamedQuery("PriceModelHistory.findByKeyDescVersion");
    query.setParameter("objKey", Long.valueOf(priceModelKeyForSubscription));
    query.setParameter("modDate", new Date(endTimeForPeriod));
    return query.getResultList();
}