Example usage for javax.ejb TransactionAttributeType NOT_SUPPORTED

List of usage examples for javax.ejb TransactionAttributeType NOT_SUPPORTED

Introduction

In this page you can find the example usage for javax.ejb TransactionAttributeType NOT_SUPPORTED.

Prototype

TransactionAttributeType NOT_SUPPORTED

To view the source code for javax.ejb TransactionAttributeType NOT_SUPPORTED.

Click Source Link

Document

The container invokes an enterprise bean method whose transaction attribute NOT_SUPPORTED with an unspecified transaction context.

Usage

From source file:edu.harvard.iq.dvn.core.study.StudyFileServiceBean.java

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public java.util.List<Object[]> getOrderedFilesByStudy(Long studyId) {

    /*/*  w ww . j av  a  2  s  .  co m*/
     * This query returns one row per filemetadata for each of the studyfiles belonging to
     * this study, ordered by the category
     */

    String nativeQuery = "select studyfile_id, fmd.id, sv.versionnumber "
            + "from filemetadata fmd, studyversion sv " + "where fmd.studyversion_id = sv.id "
            + "and sv.study_id = " + studyId
            + "order by  UPPER(fmd.category), studyfile_id, versionNumber desc";
    Query query = em.createNativeQuery(nativeQuery);

    return convertIntegerToLong(query.getResultList(), 1);
}

From source file:eu.europa.ec.fisheries.uvms.rules.service.bean.FactRuleEvaluator.java

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
private Map<String, String> generateExternalRulesFromTemplate(List<ExternalRuleType> externalRules) {
    if (CollectionUtils.isEmpty(externalRules)) {
        return Collections.emptyMap();
    }//from  w  w  w  .j av  a  2 s.co m
    Map<String, String> drlsAndBrId = new HashMap<>();
    for (ExternalRuleType extRuleType : externalRules) {
        String drl = extRuleType.getDrl();
        log.debug("DRL for BR Id {} : {} ", extRuleType.getBrId(), drl);
        drlsAndBrId.put(drl, extRuleType.getBrId());
    }
    return drlsAndBrId;
}

From source file:eu.europa.ec.fisheries.uvms.rules.service.bean.FactRuleEvaluator.java

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
private Collection<KiePackage> createAllPackages(Map<String, String> drlsAndRules) {
    Collection<KiePackage> compiledPackages = new ArrayList<>();
    KieContainer container = null;//  w w w  .  ja  v  a 2s.c om

    List<String> systemPackagesPaths = new ArrayList<>();
    String drl = rulesValidator.getSanityRuleDrlFile();
    KieFileSystem kieFileSystem = KieServices.Factory.get().newKieFileSystem();

    String sruletemplateName = "SanityRules";
    drlsAndRules.put(drl, sruletemplateName);
    for (Map.Entry<String, String> ruleEntrySet : drlsAndRules.entrySet()) {
        String rule = ruleEntrySet.getKey();
        String templateName = ruleEntrySet.getValue();
        StringBuilder ruleName = new StringBuilder("src/main/resources/rule/");
        String systemPackage = ruleName.append(templateName).append(".drl").toString();
        systemPackagesPaths.add(systemPackage);
        kieFileSystem.write(systemPackage, rule);
        KieBuilder kieBuilder = KieServices.Factory.get().newKieBuilder(kieFileSystem).buildAll();
        if (kieBuilder.getResults().hasMessages(Message.Level.ERROR)) {
            log.error("Rule failed to build {} ", templateName);
            kieFileSystem.delete(ruleName.toString(), rule);
            failedRules.add(templateName);
        }
    }

    if (drlsAndRules.size() > 0) {
        container = KieServices.Factory.get()
                .newKieContainer(KieServices.Factory.get().getRepository().getDefaultReleaseId());
    }

    if (container != null) {
        compiledPackages = container.getKieBase().getKiePackages();
    }
    return compiledPackages;
}

From source file:io.hops.hopsworks.dela.DelaSetupWorker.java

@Timeout
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
private void timeout(Timer timer) {
    LOGGER.log(Level.INFO, "{0} - state:{1} timeout:{2}",
            new Object[] { DelaException.Source.HOPS_SITE, state, timer.getInfo().toString() });
    switch (state) {
    case SETUP://from ww  w. j a va2 s  .  c o m
        setup(timer);
        break;
    case DELA_VERSION:
        delaVersion(timer);
        break;
    case DELA_CONTACT:
        delaContact(timer);
        break;
    case REGISTER:
        hopsSiteRegister(timer);
        break;
    case HEAVY_PING:
        heavyPing(timer);
        break;
    case PING:
        ping(timer);
        break;
    default:
        throw new IllegalStateException("unknown state");
    }
}

From source file:edu.harvard.iq.dvn.core.study.StudyFileServiceBean.java

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public java.util.List<FileMetadata> getOrderedFilesByStudyVersion(Long svId) {
    // Note: This ordering is case-sensitive, so names beginning with upperclass chars will appear first.
    // (I tried using UPPER(f.name) to make the sorting case-insensitive, but the EJB query language doesn't seem
    // to like this.)
    String queryStr = "SELECT f FROM FileMetadata f  WHERE f.studyVersion.id = " + svId
            + " ORDER BY f.category, f.label";
    Query query = em.createQuery(queryStr);
    List<FileMetadata> studyFiles = query.getResultList();
    //     for (StudyFile sf: studyFiles) {
    //         sf.getDataTables().size();
    //     }//from w w  w .  j a  v a  2  s.  c  o m
    return studyFiles;
}

From source file:com.hiperium.bo.security.impl.ProfileBOImpl.java

/**
 * /*from  w w  w.j a va  2  s  . c o  m*/
 * @param profile
 * @param functionality
 * @return
 */
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
private ProfileFunctionality persistProfileFunctionality(Profile profile, Functionality functionality) {
    ProfileFunctionality profileFunctionality = new ProfileFunctionality(functionality.getId(),
            profile.getId());
    profileFunctionality.setAllowDelete(functionality.getHandleDeletions());
    profileFunctionality.setAllowInsert(functionality.getHandleInsertions());
    profileFunctionality.setAllowUpdate(functionality.getHandlesUpdates());
    profileFunctionality.setHourFrom(new Date());
    profileFunctionality.setHourOfHourFrom(0);
    profileFunctionality.setMinuteOfHourFrom(0);
    profileFunctionality.setHourUntil(new Date());
    profileFunctionality.setHourOfHourUntil(23);
    profileFunctionality.setMinuteOfHourUntil(59);
    return profileFunctionality;
}

From source file:edu.harvard.iq.dvn.core.study.StudyFileServiceBean.java

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public java.util.List<FileMetadata> getFilesByStudyVersionOrderedById(Long svId) {
    String queryStr = "SELECT f FROM FileMetadata f  WHERE f.studyVersion.id = " + svId
            + " ORDER BY f.studyFile.id";
    Query query = em.createQuery(queryStr);
    List<FileMetadata> studyFiles = query.getResultList();

    return studyFiles;
}

From source file:pl.psnc.synat.wrdz.zmkd.plan.MigrationPlanProcessorBean.java

@Override
@Asynchronous/* ww w .  j a v  a  2  s. c  om*/
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public Future<Void> processAll(long planId) {
    MigrationPlanProcessor proxy = ctx.getBusinessObject(MigrationPlanProcessor.class);

    boolean finished = false;

    List<TransformationInfo> path = null;
    try {
        path = planExecutionParser.parseTransformationPath(migrationPathRetriever.retrieveActivePath(planId));
    } catch (InconsistentServiceDescriptionException e) {
        logger.error(e.getMessage(), e);
        finished = true;
    }

    while (!ctx.wasCancelCalled() && !finished) {
        try {
            MigrationProcessingResult migrationProcessingResult = proxy.processOne(planId, path);
            switch (migrationProcessingResult) {
            case PROCESSED:
                finished = false;
                break;
            case PAUSED:
                finished = true;
                break;
            case FINISHED:
                finished = true;
                migrationPlanManager.logFinished(planId);
                break;
            default:
                throw new WrdzRuntimeException("Unexpected result: " + migrationProcessingResult);
            }
        } catch (MigrationProcessingException e) {
            logger.error(e.getMessage(), e);
        } catch (MigrationPlanNotFoundException nfe) {
            throw new WrdzRuntimeException("Plan not found", nfe);
        }
    }

    return new AsyncResult<Void>(null);
}

From source file:edu.harvard.iq.dvn.core.study.StudyFileServiceBean.java

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public Long getCountFilesByStudyVersion(Long svId) {
    String queryString = "SELECT count(f.*) FROM FileMetadata f WHERE f.studyVersion_id = " + svId + " ";
    Query query = em.createNativeQuery(queryString);
    Long retVal = (Long) query.getSingleResult();
    return retVal;
}

From source file:com.flexive.ejb.beans.FxTimerServiceBean.java

/**
 * {@inheritDoc}//from w  ww.j  av a 2s.  co m
 */
@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void maintenance() {
    try {
        for (DivisionData dd : EJBLookup.getGlobalConfigurationEngine().getDivisions()) {
            if (dd.getId() <= 0 || !dd.isAvailable())
                continue;
            if (LOG.isDebugEnabled())
                LOG.debug("Performing maintenance for division #" + dd.getId() + " ... ");
            Connection con = null;
            try {
                con = Database.getDbConnection(dd.getId());
                for (TypeStorageMode mode : TypeStorageMode.values()) {
                    if (!mode.isSupported())
                        continue;
                    StorageManager.getContentStorage(dd, mode).maintenance(con);
                    FxFlatStorageManager.maintenance(dd.getId(), con);
                }
            } catch (Exception e) {
                LOG.error("Failed to perform maintenance for division #" + dd.getId() + ": " + e.getMessage(),
                        e);
            } finally {
                Database.closeObjects(FxTimerServiceBean.class, con, null);
            }
        }
    } catch (FxApplicationException e) {
        LOG.error("Maintenance error: " + e.getMessage(), e);
    }
}