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.StudyServiceBean.java

/**
 *   Gets Study and dependent objects based on Map parameter;
 *   Should only be used for studies with Released versions
 *   used by studyListingPage//w w w .j av a2 s  .  c o m
 *
 */
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public Study getStudyForSearch(Long studyId, Map studyFields) {

    Study study = em.find(Study.class, studyId);
    if (study == null) {
        throw new IllegalArgumentException("Unknown studyId: " + studyId);
    }

    Metadata metadata = null;
    if (study.getReleasedVersion() != null) {
        metadata = study.getReleasedVersion().getMetadata();
    } else {
        throw new IllegalArgumentException("No released version available for this study: " + studyId);
    }

    if (studyFields != null) {
        for (Object studyField : studyFields.keySet()) {

            String fieldName = (String) studyField;
            if ("authorName".equals(fieldName)) {
                for (Iterator<StudyAuthor> it = metadata.getStudyAuthors().iterator(); it.hasNext();) {
                    StudyAuthor elem = it.next();
                    elem.getId();
                }
            } else if ("abstractText".equals(fieldName)) {
                for (Iterator<StudyAbstract> it = metadata.getStudyAbstracts().iterator(); it.hasNext();) {
                    StudyAbstract elem = it.next();
                    elem.getId();
                }
            } else if ("producerName".equals(fieldName)) {
                for (Iterator<StudyProducer> it = metadata.getStudyProducers().iterator(); it.hasNext();) {
                    StudyProducer elem = it.next();
                    elem.getId();
                }
            } else if ("distributorName".equals(fieldName)) {
                for (Iterator<StudyDistributor> it = metadata.getStudyDistributors().iterator(); it
                        .hasNext();) {
                    StudyDistributor elem = it.next();
                    elem.getId();
                }
            } else if ("relatedStudies".equals(fieldName)) {
                for (Iterator<StudyRelStudy> it = metadata.getStudyRelStudies().iterator(); it.hasNext();) {
                    StudyRelStudy elem = it.next();
                    elem.getId();
                }
            } else if ("relatedMaterial".equals(fieldName)) {
                for (Iterator<StudyRelMaterial> it = metadata.getStudyRelMaterials().iterator(); it
                        .hasNext();) {
                    StudyRelMaterial elem = it.next();
                    elem.getId();
                }
            } else if ("relatedPublications".equals(fieldName)) {
                for (Iterator<StudyRelPublication> it = metadata.getStudyRelPublications().iterator(); it
                        .hasNext();) {
                    StudyRelPublication elem = it.next();
                    elem.getId();
                }
            }
        }

    }

    return study;
}

From source file:com.lp.server.fertigung.ejbfac.FertigungFacBean.java

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public HashMap<Integer, StuecklistepositionDto> holeAlleLossollmaterialFuerStuecklistenAktualisierung(
        Integer stuecklisteIId, BigDecimal bdLosgroesse, int iEbene,
        HashMap<Integer, StuecklistepositionDto> hmPositionen, TheClientDto theClientDto) {
    iEbene++;//from   w  w w.j  av a2 s  . c o m

    if (hmPositionen == null) {
        hmPositionen = new HashMap<Integer, StuecklistepositionDto>();
    }
    try {
        StuecklistepositionDto[] stkPos = getStuecklisteFac()
                .stuecklistepositionFindByStuecklisteIId(stuecklisteIId, theClientDto);

        StuecklisteDto stklDto = getStuecklisteFac().stuecklisteFindByPrimaryKey(stuecklisteIId, theClientDto);

        for (int i = 0; i < stkPos.length; i++) {
            // alle stuecklistenpositionen ins los uebernehmen

            // W02451
            if (stkPos[i].getArtikelIId() == 6093) {
                int u = 0;
            }

            // Einheit umrechnen
            ArtikelDto artikelDto = getArtikelFac().artikelFindByPrimaryKeySmall(stkPos[i].getArtikelIId(),
                    theClientDto);

            BigDecimal bdFaktor = getSystemFac().rechneUmInAndereEinheit(new BigDecimal(1),
                    stkPos[i].getEinheitCNr(), artikelDto.getEinheitCNr(), stkPos[i].getIId(), theClientDto);

            // nun die Dimensionen
            BigDecimal bdDimProdukt = new BigDecimal(1);
            EinheitDto einheitDto = getSystemFac().einheitFindByPrimaryKey(stkPos[i].getEinheitCNr(),
                    theClientDto);
            if (einheitDto.getIDimension().intValue() >= 1) {
                if (stkPos[i].getFDimension1() != null) {
                    bdDimProdukt = bdDimProdukt
                            .multiply(new BigDecimal(stkPos[i].getFDimension1().floatValue()));
                }
            }
            if (einheitDto.getIDimension().intValue() >= 2) {
                if (stkPos[i].getFDimension2() != null) {
                    bdDimProdukt = bdDimProdukt
                            .multiply(new BigDecimal(stkPos[i].getFDimension2().floatValue()));
                }
            }
            if (einheitDto.getIDimension().intValue() >= 3) {
                if (stkPos[i].getFDimension3() != null) {
                    bdDimProdukt = bdDimProdukt
                            .multiply(new BigDecimal(stkPos[i].getFDimension3().floatValue()));
                }
            }
            // verschnitt
            BigDecimal bdMenge = Helper.berechneMengeInklusiveVerschnitt(stkPos[i].getNMenge(),
                    artikelDto.getFVerschnittfaktor(), artikelDto.getFVerschnittbasis(), bdLosgroesse);

            // endgueltige Menge berechnen
            BigDecimal posMenge = bdMenge.multiply(bdDimProdukt).multiply(bdLosgroesse).multiply(bdFaktor)
                    .divide(new BigDecimal(stklDto.getIErfassungsfaktor().doubleValue()),
                            BigDecimal.ROUND_HALF_EVEN);

            if (posMenge.doubleValue() < 0.001 && posMenge.doubleValue() > 0.000001) {
                posMenge = new BigDecimal("0.001");
                posMenge = posMenge.setScale(3, BigDecimal.ROUND_HALF_EVEN);
            } else {
                posMenge = posMenge.setScale(3, BigDecimal.ROUND_HALF_EVEN);
            }

            stkPos[i].setNMenge(posMenge);

            StuecklisteDto stuecklisteDto = getStuecklisteFac()
                    .stuecklisteFindByMandantCNrArtikelIIdOhneExc(stkPos[i].getArtikelIId(), theClientDto);

            if (stuecklisteDto != null && stuecklisteDto.getStuecklisteartCNr()
                    .equals(StuecklisteFac.STUECKLISTEART_HILFSSTUECKLISTE)) {
                if (iEbene < 10) {
                    holeAlleLossollmaterialFuerStuecklistenAktualisierung(stuecklisteDto.getIId(), posMenge,
                            iEbene, hmPositionen, theClientDto);
                }

            } else {

                if (stkPos[i].getNMenge().doubleValue() > 0) {

                    if (hmPositionen.containsKey(stkPos[i].getArtikelIId())) {

                        StuecklistepositionDto p = hmPositionen.get(stkPos[i].getArtikelIId());
                        p.setNMenge(stkPos[i].getNMenge().add(p.getNMenge()));
                        hmPositionen.put(stkPos[i].getArtikelIId(), p);
                    } else {
                        hmPositionen.put(stkPos[i].getArtikelIId(), stkPos[i]);
                    }
                }

            }
        }
    } catch (RemoteException ex1) {
        throwEJBExceptionLPRespectOld(ex1);
    }

    return hmPositionen;

}

From source file:fr.ortolang.diffusion.core.CoreServiceBean.java

@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public String put(InputStream data) throws CoreServiceException, DataCollisionException {
    LOGGER.log(Level.FINE, "putting binary content in store");
    try {//  w w  w .j  a va2s  .co  m
        return binarystore.put(data);
    } catch (BinaryStoreServiceException e) {
        LOGGER.log(Level.SEVERE, "unexpected error occurred during putting binary content", e);
        throw new CoreServiceException("unable to put binary content", e);
    }
}

From source file:com.lp.server.fertigung.ejbfac.FertigungFacBean.java

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public BigDecimal getAusgegebeneMengePreis(Integer lossollmaterialIId, java.sql.Timestamp tStichtag,
        TheClientDto theClientDto) throws EJBExceptionLP {
    try {/*  ww  w.  ja  va 2 s . c o m*/
        BigDecimal bdMenge = new BigDecimal(0);
        BigDecimal bdWert = new BigDecimal(0);
        LosistmaterialDto[] losist = losistmaterialFindByLossollmaterialIId(lossollmaterialIId);
        for (int i = 0; i < losist.length; i++) {

            BigDecimal bdAusgegeben = getLagerFac().getMengeEinerBelegposition(LocaleFac.BELEGART_LOS,
                    losist[i].getIId(), tStichtag);

            if (Helper.short2boolean(losist[i].getBAbgang())) {

                BigDecimal bdPreis = getLagerFac().getGemittelterGestehungspreisEinerAbgangsposition(
                        LocaleFac.BELEGART_LOS, losist[i].getIId());
                bdMenge = bdMenge.add(bdAusgegeben);
                bdWert = bdWert.add(bdPreis.multiply(bdAusgegeben));
            } else {
                BigDecimal bdPreis = getLagerFac().getGemittelterEinstandspreisEinerZugangsposition(
                        LocaleFac.BELEGART_LOS, losist[i].getIId());
                bdMenge = bdMenge.subtract(bdAusgegeben);
                bdWert = bdWert.subtract(bdPreis.multiply(bdAusgegeben));
            }
        }
        if (bdMenge.doubleValue() == 0) {
            return bdMenge;
        } else {
            return bdWert.divide(bdMenge, BigDecimal.ROUND_HALF_EVEN);
        }
    } catch (RemoteException ex) {
        throwEJBExceptionLPRespectOld(ex);
        return null;
    }
}

From source file:org.cesecore.audit.impl.integrityprotected.IntegrityProtectedAuditorSessionBean.java

@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public AuditLogExportReport exportAuditLogs(AuthenticationToken token, CryptoToken cryptoToken, Date timestamp,
        boolean deleteAfterExport, Map<String, Object> signatureDetails, final Properties properties,
        final Class<? extends AuditExporter> c) throws AuditLogExporterException {
    final AuditLogExportReport report = new AuditLogExportReport();
    try {//from   w  w w .  ja va  2  s  .  c o  m
        final File exportFile = AuditDevicesConfig.getExportFile(properties, timestamp);
        final SigningFileOutputStream signingFileOutputStream = new SigningFileOutputStream(exportFile,
                cryptoToken, signatureDetails);
        final AuditExporter auditExporter = c.newInstance();
        auditExporter.setOutputStream(signingFileOutputStream);
        verifyAndOptionalExport(auditExporter, report, timestamp,
                AuditDevicesConfig.getAuditLogExportFetchSize(properties));
        report.setExportedFile(exportFile.getCanonicalPath());
        if (log.isDebugEnabled()) {
            log.debug("Exported " + report.getExportCount() + " rows.");
        }
        logVerificationResult(report.errors().size(), timestamp, token);
        // Sign the exported file ... it will write the signature on the side
        final String signatureFilename = signingFileOutputStream.writeSignature();
        report.setSignatureFile(signatureFilename);
        // Log export success
        final Map<String, Object> details = new LinkedHashMap<String, Object>();
        details.put("deleteAfterExport", deleteAfterExport);
        details.put("timestamp", ValidityDate.formatAsISO8601(new Date(), ValidityDate.TIMEZONE_UTC));
        securityEventsLogger.log(EventTypes.LOG_EXPORT, EventStatus.SUCCESS, ModuleTypes.SECURITY_AUDIT,
                ServiceTypes.CORE, token.toString(), null, null, null, details);
        // Delete the exported log entries if requested
        if (deleteAfterExport) {
            if (log.isDebugEnabled()) {
                log.debug("deleting exported logs");
            }
            final int deletedRowCount = integrityProtectedAuditorSession.deleteRows(token, timestamp,
                    properties);
            if (log.isDebugEnabled()) {
                log.debug("Deleted " + deletedRowCount + " rows from audit log after export.");
            }
        }
        auditExporter.close();
    } catch (final Exception e) {
        throw new AuditLogExporterException(e.getMessage(), e);
    }
    return report;
}

From source file:org.cesecore.audit.impl.integrityprotected.IntegrityProtectedAuditorSessionBean.java

@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public AuditLogValidationReport verifyLogsIntegrity(final AuthenticationToken token, final Date timestamp,
        final Properties properties) throws AuditLogValidatorException {
    final AuditLogValidationReport report = new AuditLogValidationReport();
    try {/* w ww.  j  av  a2  s. c  om*/
        verifyAndOptionalExport(null, report, timestamp,
                AuditDevicesConfig.getAuditLogExportFetchSize(properties));
        // Log the success or failure depending on if verification returns error or not
        logVerificationResult(report.errors().size(), timestamp, token);
    } catch (final Exception e) {
        throw new AuditLogValidatorException(e.getMessage(), e);
    }
    return report;
}

From source file:org.cesecore.certificates.certificate.CertificateStoreSessionBean.java

License:asdf

@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void initTimers() {
    // Reload CA certificate cache cache, and cancel/create timers if there are no timers or if the cache is empty (probably a fresh startup)
    if (getTimerCount(TIMERID_CACERTIFICATECACHE) == 0 || CaCertificateCache.INSTANCE.isCacheExpired()) {
        reloadCaCertificateCacheAndSetTimeout();
    } else {/* w  w w  .ja v  a 2  s . c  om*/
        log.info("Not initing CaCertificateCache reload timers, there are already some.");
    }
}

From source file:org.cesecore.certificates.certificate.CertificateStoreSessionBean.java

License:asdf

/**
 * When a timer expires, this method will update
 * /*  www.ja  va2s  .c o m*/
 * According to JSR 220 FR (18.2.2), this method may not throw any exceptions.
 * 
 * @param timer The timer whose expiration caused this notification.
 */
@Timeout
/* Glassfish 2.1.1:
 * "Timeout method ....timeoutHandler(javax.ejb.Timer)must have TX attribute of TX_REQUIRES_NEW or TX_REQUIRED or TX_NOT_SUPPORTED"
 * JBoss 5.1.0.GA: We cannot mix timer updates with our EJBCA DataSource transactions. 
 */
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void timeoutHandler(Timer timer) {
    if (log.isTraceEnabled()) {
        log.trace(">timeoutHandler: " + timer.getInfo().toString());
    }
    if (timer.getInfo() instanceof Integer) {
        final int currentTimerId = ((Integer) timer.getInfo()).intValue();
        if (currentTimerId == TIMERID_CACERTIFICATECACHE) {
            reloadCaCertificateCacheAndSetTimeout();
        }
    }
    if (log.isTraceEnabled()) {
        log.trace("<timeoutHandler");
    }
}

From source file:org.cesecore.certificates.certificate.CertificateStoreSessionBean.java

License:asdf

@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void reloadCaCertificateCacheAndSetTimeout() {
    if (log.isTraceEnabled()) {
        log.trace(">timeOutReloadCaCertificateCache");
    }/*w w w.j a va  2 s  .c  om*/
    // Cancel any waiting timers of this type
    @SuppressWarnings("unchecked")
    final Collection<Timer> timers = timerService.getTimers();
    for (final Timer timer : timers) {
        if (timer.getInfo() instanceof Integer) {
            final int currentTimerId = ((Integer) timer.getInfo()).intValue();
            if (currentTimerId == TIMERID_CACERTIFICATECACHE) {
                timer.cancel();
            }
        }
    }
    try {
        certificateStoreSession.reloadCaCertificateCache();
    } finally {
        // Schedule a new timer of this type
        final long interval = OcspConfiguration.getSigningCertsValidTimeInMilliseconds();
        if (interval > 0) {
            timerService.createTimer(interval, Integer.valueOf(TIMERID_CACERTIFICATECACHE));
        }
    }
}