Example usage for com.liferay.portal.kernel.transaction Propagation REQUIRES_NEW

List of usage examples for com.liferay.portal.kernel.transaction Propagation REQUIRES_NEW

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.transaction Propagation REQUIRES_NEW.

Prototype

Propagation REQUIRES_NEW

To view the source code for com.liferay.portal.kernel.transaction Propagation REQUIRES_NEW.

Click Source Link

Document

Create a new transaction, and suspend the current transaction if one exists.

Usage

From source file:com.liferay.alloy.mvc.BaseAlloyControllerImpl.java

License:Open Source License

@Transactional(isolation = Isolation.PORTAL, propagation = Propagation.REQUIRES_NEW, rollbackFor = {
        Exception.class })
protected void executeAction(Method method) throws Exception {
    if (method != null) {
        method.invoke(this);
    }//  www.  j  a v a2  s. c  o  m

    actionRequest.setAttribute(CALLED_PROCESS_ACTION, Boolean.TRUE.toString());

    if (Validator.isNotNull(viewPath)) {
        actionRequest.setAttribute(VIEW_PATH, viewPath);

        PortalUtil.copyRequestParameters(actionRequest, actionResponse);
    } else if (Validator.isNotNull(redirect)) {
        actionResponse.sendRedirect(redirect);
    }
}

From source file:com.liferay.alloy.mvc.BaseAlloyControllerImpl.java

License:Open Source License

@Transactional(isolation = Isolation.PORTAL, propagation = Propagation.REQUIRES_NEW, rollbackFor = {
        Exception.class })
protected String processDataRequest(ActionRequest actionRequest) throws Exception {

    return null;/*from  ww  w.j  a va2  s .  co  m*/
}

From source file:com.liferay.counter.service.impl.CounterLocalServiceImpl.java

License:Open Source License

@Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW)
public long increment() throws SystemException {
    return counterFinder.increment();
}

From source file:com.liferay.counter.service.impl.CounterLocalServiceImpl.java

License:Open Source License

@Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW)
public long increment(String name) throws SystemException {
    return counterFinder.increment(name);
}

From source file:com.liferay.counter.service.impl.CounterLocalServiceImpl.java

License:Open Source License

@Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW)
public long increment(String name, int size) throws SystemException {
    return counterFinder.increment(name, size);
}

From source file:com.liferay.counter.service.impl.CounterLocalServiceImpl.java

License:Open Source License

@Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW)
public void rename(String oldName, String newName) throws SystemException {
    counterFinder.rename(oldName, newName);
}

From source file:com.liferay.counter.service.impl.CounterLocalServiceImpl.java

License:Open Source License

@Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW)
public void reset(String name) throws SystemException {
    counterFinder.reset(name);
}

From source file:com.liferay.counter.service.impl.CounterLocalServiceImpl.java

License:Open Source License

@Transactional(isolation = Isolation.COUNTER, propagation = Propagation.REQUIRES_NEW)
public void reset(String name, long size) throws SystemException {
    counterFinder.reset(name, size);/*from w w  w . j  av  a  2  s  . co  m*/
}

From source file:com.liferay.journal.service.persistence.test.JournalArticleFinderTest.java

License:Open Source License

@Before
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void setUp() throws Exception {
    _group = GroupTestUtil.addGroup();//from  w  w w .j av  a2s .c  o m

    _ddmStructure = DDMStructureTestUtil.addStructure(_group.getGroupId(), JournalArticle.class.getName());

    _folder = JournalTestUtil.addFolder(_group.getGroupId(), "Folder 1");

    _basicWebContentDDMStructure = DDMStructureTestUtil.addStructure(_group.getGroupId(),
            JournalArticle.class.getName());

    _basicWebContentDDMTemplate = DDMTemplateTestUtil.addTemplate(_group.getGroupId(),
            _basicWebContentDDMStructure.getStructureId(), PortalUtil.getClassNameId(JournalArticle.class));

    JournalArticle article = JournalTestUtil.addArticleWithXMLContent(_group.getGroupId(),
            _folder.getFolderId(), JournalArticleConstants.CLASSNAME_ID_DEFAULT, "<title>Article 1</title>",
            _basicWebContentDDMStructure.getStructureKey(), _basicWebContentDDMTemplate.getTemplateKey());

    _articles.add(article);

    JournalFolder folder = JournalTestUtil.addFolder(_group.getGroupId(), "Folder 2");

    DDMTemplate ddmTemplate = DDMTemplateTestUtil.addTemplate(_group.getGroupId(),
            _ddmStructure.getStructureId(), PortalUtil.getClassNameId(JournalArticle.class));

    article = JournalTestUtil.addArticleWithXMLContent(_group.getGroupId(), folder.getFolderId(),
            JournalArticleConstants.CLASSNAME_ID_DEFAULT, "<title>Article 2</title>",
            _ddmStructure.getStructureKey(), ddmTemplate.getTemplateKey());

    _articles.add(article);

    article = JournalTestUtil.addArticleWithXMLContent(_group.getGroupId(), folder.getFolderId(),
            JournalArticleConstants.CLASSNAME_ID_DEFAULT, "<title>Article 3</title>",
            _basicWebContentDDMStructure.getStructureKey(), _basicWebContentDDMTemplate.getTemplateKey());

    _articles.add(article);

    article.setUserId(_USER_ID);

    Calendar calendar = new GregorianCalendar();

    calendar.add(Calendar.DATE, -1);

    article.setExpirationDate(calendar.getTime());
    article.setReviewDate(calendar.getTime());

    JournalArticleLocalServiceUtil.updateJournalArticle(article);

    JournalArticleLocalServiceUtil.moveArticleToTrash(TestPropsValues.getUserId(), article);

    article = JournalTestUtil.addArticleWithXMLContent(_group.getGroupId(), folder.getFolderId(),
            PortalUtil.getClassNameId(DDMStructure.class), "<title>Article 4</title>",
            _ddmStructure.getStructureKey(), ddmTemplate.getTemplateKey());

    _articles.add(article);

    _folderIds.clear();

    _folderIds.add(_folder.getFolderId());
    _folderIds.add(folder.getFolderId());

    _article = _articles.get(0);

    Bundle bundle = FrameworkUtil.getBundle(getClass());

    _bundleContext = bundle.getBundleContext();

    _serviceReference = _bundleContext.getServiceReference(JournalArticleFinder.class);

    _journalArticleFinder = _bundleContext.getService(_serviceReference);
}

From source file:com.liferay.linkshortener.service.impl.LinkLocalServiceImpl.java

License:Open Source License

/**
 * Deletes all the Links that were not modified after the specified date.
 *
 * @param olderThen boundary date for the deletion.
 *//*w ww.j a v  a  2s.  c o m*/
@Override
@Transactional(isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRES_NEW)
public void deleteOldRecords(Date olderThen) {

    try {
        Session session = linkPersistence.openSession();

        String sql = CustomSQLUtil.get(_DELETE_LINKS);

        SQLQuery sqlQuery = session.createSQLQuery(sql);

        QueryPos qPos = QueryPos.getInstance(sqlQuery);

        Timestamp olderThenTS = CalendarUtil.getTimestamp(olderThen);

        qPos.add(olderThenTS);

        sqlQuery.executeUpdate();

        linkPersistence.closeSession(session);

    } catch (ORMException orme) {
        _LOG.error("Unable to remove old Links.", orme);
    }
}