Example usage for javax.ejb TransactionAttributeType REQUIRED

List of usage examples for javax.ejb TransactionAttributeType REQUIRED

Introduction

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

Prototype

TransactionAttributeType REQUIRED

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

Click Source Link

Document

If a client invokes the enterprise bean's method while the client is associated with a transaction context, the container invokes the enterprise bean's method in the client's transaction context.

Usage

From source file:gov.nih.nci.caarray.application.project.ProjectManagementServiceBean.java

/**
 * {@inheritDoc}/* w  w w .  j  a  va 2s. co  m*/
 */
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRED)
@TransactionTimeout(UPLOAD_TIMEOUT)
public CaArrayFile addFile(Project project, File file, String filename)
        throws ProposalWorkflowException, InconsistentProjectStateException {
    LogUtil.logSubsystemEntry(LOG, project, file);
    checkIfProjectSaveAllowed(project);
    final CaArrayFile caArrayFile = doAddFile(project, file, filename);
    LogUtil.logSubsystemExit(LOG);
    return caArrayFile;
}

From source file:com.flexive.ejb.beans.search.SearchEngineBean.java

/**
 * {@inheritDoc}/*  w  ww  .  j av  a  2  s. c o  m*/
 */
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public QueryRootNode loadDefault(ResultLocation location) throws FxApplicationException {
    try {
        return load(location, DEFAULT_QUERY_NAME);
    } catch (FxNotFoundException e) {
        return new QueryRootNode(QueryRootNode.Type.CONTENTSEARCH, location);
    } catch (FxApplicationException e) {
        LOG.error(e.getMessage(), e);
        throw e;
    }
}

From source file:com.flexive.ejb.beans.search.ResultPreferencesEngineBean.java

/** {@inheritDoc} */
@Override/*from   ww w.  ja v a 2s  .c  o  m*/
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public ResultPreferences loadSystemDefault(long typeId, ResultViewType viewType, ResultLocation location)
        throws FxApplicationException {
    try {
        return divisionConfiguration.get(SystemParameters.USER_RESULT_PREFERENCES,
                getKey(typeId, viewType, location));
    } catch (FxNotFoundException e) {
        // return empty result preferences
        return new ResultPreferences();
    }
}

From source file:com.sfs.ucm.controller.SpecificationAction.java

/**
 * Action: remove object// ww w  .jav a  2 s . co  m
 * 
 * @throws UCMException
 */
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void remove() throws UCMException {
    try {
        // remove any specification rule tests
        for (SpecificationRule specificationRule : this.specification.getSpecificationRules()) {
            List<SpecificationRuleTest> specificationRuleTests = findSpecificationRuleTests(specificationRule);
            Iterator<SpecificationRuleTest> specificationRuleTestIter = specificationRuleTests.iterator();
            while (specificationRuleTestIter.hasNext()) {
                em.remove(specificationRuleTestIter.next());
            }
        }

        // remove any parent test classes
        List<SpecificationTest> specificationTests = findSpecificationTests(this.specification);
        Iterator<SpecificationTest> specificationTestIter = specificationTests.iterator();
        while (specificationTestIter.hasNext()) {
            em.remove(specificationTestIter.next());
        }

        this.project.removeSpecification(this.specification);
        em.remove(this.specification);
        logger.info("deleted {}", this.specification.getArtifact());
        this.facesContextMessage.infoMessage("{0} deleted successfully", this.specification.getArtifact());

        // refresh list
        loadList();

        this.selected = false;
    } catch (Exception e) {
        throw new UCMException(e);
    }
}

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

/**
 * {@inheritDoc}//w w w .  j a va2 s .c om
 */
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void login(String username, String password, boolean takeOver)
        throws FxLoginFailedException, FxAccountInUseException {
    DataSource ds;
    try {
        ds = Database.getDataSource();
    } catch (Exception exc) {
        throw new FxLoginFailedException(exc.getMessage(), FxLoginFailedException.TYPE_SQL_ERROR);
    }
    LoginLogoutHandler.doLogin(username, password, takeOver, ctx, ds);
}

From source file:gov.medicaid.screening.dao.impl.NursingLicenseDAOBean.java

/**
 * Searches for providers with Nursing license using the identifier filter.
 *
 * @param criteria the search criteria//w ww  .j a v  a  2 s. com
 * @return the matched results
 * @throws ParsingException if any parsing errors are encountered
 * @throws ServiceException for any other exceptions encountered
 */
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public SearchResult<License> searchByLicenseNumber(NursingLicenseSearchCriteria criteria)
        throws ParsingException, ServiceException {
    String signature = "NursingLicenseDataAccessImpl#searchByLicenseNumber";
    LogUtil.traceEntry(getLog(), signature, new String[] { "criteria" }, new Object[] { criteria });

    if (criteria == null) {
        throw new ServiceException(ErrorCode.MITA10005.getDesc());
    }

    if (criteria.getLicenseType() == null || Util.isBlank(criteria.getLicenseType().getName())) {
        throw new ServiceException(ErrorCode.MITA10008.getDesc());
    }

    // transform the license type mapping
    boolean found = false;
    for (Map.Entry<String, String> type : TYPES.entrySet()) {
        if (type.getValue().equals(criteria.getLicenseType().getName())) {
            criteria.getLicenseType().setName(type.getKey());
            found = true;
        }
    }
    if (!found) {
        throw new ServiceException(ErrorCode.MITA10009.getDesc());
    }

    if (Util.isBlank(criteria.getIdentifier())) {
        throw new ServiceException(ErrorCode.MITA10004.getDesc());
    }

    if (!Util.isDigits(criteria.getIdentifier())) {
        throw new ServiceException(ErrorCode.MITA10010.getDesc());
    }

    if (Util.isBlank(criteria.getCheckDigit())) {
        throw new ServiceException(ErrorCode.MITA10011.getDesc());
    }

    if (!Util.isDigits(criteria.getCheckDigit())) {
        throw new ServiceException(ErrorCode.MITA10012.getDesc());
    }

    validateSortOptions(criteria, SORT_COLUMNS);

    try {
        SearchResult<License> allResults = getAllResults(criteria, false);
        SearchResult<License> results = trimResults(allResults, criteria.getPageSize(),
                criteria.getPageNumber(), SORT_COLUMNS.get(criteria.getSortColumn()), criteria.getSortOrder());

        logSearchEntry(criteria);
        return LogUtil.traceExit(getLog(), signature, results);
    } catch (ClientProtocolException e) {
        LogUtil.traceError(getLog(), signature, e);
        throw new ServiceException(ErrorCode.MITA50001.getDesc(), e);
    } catch (URISyntaxException e) {
        LogUtil.traceError(getLog(), signature, e);
        throw new ServiceException(ErrorCode.MITA50001.getDesc(), e);
    } catch (IOException e) {
        LogUtil.traceError(getLog(), signature, e);
        throw new ServiceException(ErrorCode.MITA50001.getDesc(), e);
    } catch (ParseException e) {
        LogUtil.traceError(getLog(), signature, e);
        throw new ServiceException(ErrorCode.MITA50001.getDesc(), e);
    }
}

From source file:gov.nih.nci.caarray.application.project.ProjectManagementServiceBean.java

/**
 * {@inheritDoc}//from  w ww  .  j a  v a  2s  . c om
 */
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRED)
@TransactionTimeout(UPLOAD_TIMEOUT)
public CaArrayFile addFileChunk(Project project, File file, String filename, long fileSize)
        throws ProposalWorkflowException, InconsistentProjectStateException {
    LogUtil.logSubsystemEntry(LOG, project, file);
    checkIfProjectSaveAllowed(project);
    CaArrayFile partialFile = fileDao.getPartialFile(project.getId(), filename, fileSize);
    final CaArrayFile caArrayFile = getFileAccessService().addChunk(file, filename, fileSize, partialFile);
    addCaArrayFileToProject(project, caArrayFile);
    LogUtil.logSubsystemExit(LOG);
    return caArrayFile;
}

From source file:com.flexive.ejb.beans.search.SearchEngineBean.java

/**
 * {@inheritDoc}/*from ww  w. j ava 2  s  . c  o m*/
 */
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public QueryRootNode loadSystemDefault(ResultLocation location) throws FxApplicationException {
    try {
        return check(divisionConfiguration.get(getConfigurationParameter(location), DEFAULT_QUERY_NAME));
    } catch (FxNotFoundException e) {
        return new QueryRootNode(QueryRootNode.Type.CONTENTSEARCH, location);
    } catch (FxApplicationException e) {
        LOG.error(e.getMessage(), e);
        throw e;
    }
}

From source file:com.flexive.ejb.beans.structure.AssignmentEngineBean.java

/**
 * {@inheritDoc}/*from   ww w  .  j  a  v a 2s . co m*/
 */
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public long createProperty(FxPropertyEdit property, String parentXPath) throws FxApplicationException {
    return createProperty(FxType.ROOT_ID, property, parentXPath);
}

From source file:com.sfs.ucm.controller.UseCaseFlowAction.java

/**
 * Insert a basic flow step//ww  w.ja  v  a2s . com
 * 
 * @throws UCMException
 */
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void insertFlowStep() throws UCMException {
    try {
        logger.debug("inserting flow step before: {}", this.basicFlowStep.getStepNumber());
        this.basicFlowStep = new FlowStep(this.basicFlowStep.getStepNumber());

        // renumber steps
        short startStep = this.basicFlowStep.getStepNumber();

        // increment start step
        startStep++;

        // renumber from this starting step
        renumberFlowSteps(startStep);
    } catch (Exception e) {
        throw new UCMException(e);
    }
}