Example usage for com.liferay.portal.kernel.util LoggingTimer LoggingTimer

List of usage examples for com.liferay.portal.kernel.util LoggingTimer LoggingTimer

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util LoggingTimer LoggingTimer.

Prototype

public LoggingTimer() 

Source Link

Usage

From source file:com.liferay.adaptive.media.document.library.thumbnails.internal.upgrade.v1_0_0.UpgradeDocumentLibraryThumbnailsConfiguration.java

License:Open Source License

@Override
protected void doUpgrade() throws Exception {
    try (LoggingTimer loggingTimer = new LoggingTimer()) {
        ActionableDynamicQuery actionableDynamicQuery = _companyLocalService.getActionableDynamicQuery();

        actionableDynamicQuery.setPerformActionMethod((Company company) -> {
            try {
                _amCompanyThumbnailConfigurationInitializer.initializeCompany(company);
            } catch (Exception e) {
                _log.error(e, e);//w  w w  .j  a va  2s .c o m
            }
        });

        actionableDynamicQuery.performActions();
    }
}

From source file:com.liferay.asset.categories.internal.verify.AssetCategoriesServiceVerifyProcess.java

License:Open Source License

protected void rebuildTree() throws Exception {
    try (LoggingTimer loggingTimer = new LoggingTimer();
            PreparedStatement ps = connection
                    .prepareStatement("select distinct groupId from AssetCategory where "
                            + "(leftCategoryId is null) or (rightCategoryId is null)");
            ResultSet rs = ps.executeQuery()) {

        while (rs.next()) {
            long groupId = rs.getLong("groupId");

            _assetCategoryLocalService.rebuildTree(groupId, true);
        }/*from www . ja  v  a 2 s  . com*/
    }
}

From source file:com.liferay.asset.internal.verify.AssetServiceVerifyProcess.java

License:Open Source License

protected void deleteOrphanedAssetEntries() throws Exception {
    try (LoggingTimer loggingTimer = new LoggingTimer()) {
        long classNameId = _portal.getClassNameId(DLFileEntryConstants.getClassName());

        StringBundler sb = new StringBundler(5);

        sb.append("delete from AssetEntry where classNameId = ");
        sb.append(classNameId);//from w  ww .jav  a 2  s  .c  om
        sb.append(" and classPK not in (select fileVersionId from ");
        sb.append("DLFileVersion) and classPK not in (select fileEntryId ");
        sb.append("from DLFileEntry)");

        runSQL(sb.toString());

        EntityCacheUtil.clearCache(AssetEntryImpl.class);
        FinderCacheUtil.clearCache(AssetEntryImpl.class.getName());
    }
}

From source file:com.liferay.asset.internal.verify.AssetServiceVerifyProcess.java

License:Open Source License

protected void verifyAssetLayouts() throws Exception {
    try (LoggingTimer loggingTimer = new LoggingTimer()) {
        verifyUuid("AssetEntry");
    }/*from  w  ww  .  j  a va2 s  .  c o m*/
}

From source file:com.liferay.blogs.internal.verify.BlogsServiceVerifyProcess.java

License:Open Source License

protected void updateEntryAssets() throws Exception {
    try (LoggingTimer loggingTimer = new LoggingTimer()) {
        List<BlogsEntry> entries = _blogsEntryLocalService.getNoAssetEntries();

        if (_log.isDebugEnabled()) {
            _log.debug("Processing " + entries.size() + " entries with no asset");
        }//from   www  .ja  v  a 2 s  .co  m

        for (BlogsEntry entry : entries) {
            try {
                _blogsEntryLocalService.updateAsset(entry.getUserId(), entry, null, null, null, null);
            } catch (Exception e) {
                if (_log.isWarnEnabled()) {
                    _log.warn(StringBundler.concat("Unable to update asset for entry ",
                            String.valueOf(entry.getEntryId()), ": ", e.getMessage()));
                }
            }
        }

        if (_log.isDebugEnabled()) {
            _log.debug("Assets verified for entries");
        }
    }
}

From source file:com.liferay.blogs.internal.verify.BlogsServiceVerifyProcess.java

License:Open Source License

protected void verifyResourcedModels() throws Exception {
    try (LoggingTimer loggingTimer = new LoggingTimer()) {
        _verifyResourcePermissions.verify(new BlogsEntryVerifiableModel());
    }/*from w  w w .  j a v a  2  s.co m*/
}

From source file:com.liferay.blogs.internal.verify.BlogsServiceVerifyProcess.java

License:Open Source License

protected void verifyStatus() throws Exception {
    try (LoggingTimer loggingTimer = new LoggingTimer()) {
        runSQL("update BlogsEntry set status = " + WorkflowConstants.STATUS_APPROVED + " where status is null");
    }/*ww  w  .j av  a 2 s  . c  o m*/
}

From source file:com.liferay.blogs.internal.verify.VerifyBlogsTrackbacks.java

License:Open Source License

protected void verifyMBDiscussions() {
    try (LoggingTimer loggingTimer = new LoggingTimer()) {
        List<MBDiscussion> mbDiscussions = _mbDiscussionLocalService.getDiscussions(BlogsEntry.class.getName());

        for (MBDiscussion mbDiscussion : mbDiscussions) {
            try {
                BlogsEntry entry = _blogsEntryLocalService.getEntry(mbDiscussion.getClassPK());

                List<MBMessage> mbMessages = _mbMessageLocalService
                        .getThreadMessages(mbDiscussion.getThreadId(), WorkflowConstants.STATUS_APPROVED);

                for (MBMessage mbMessage : mbMessages) {
                    _verifyPost(entry, mbMessage);
                }//from ww  w  . j  ava 2s  .c o m
            } catch (Exception e) {
                _log.error(e, e);
            }
        }
    }
}

From source file:com.liferay.blogs.verify.BlogsServiceVerifyProcess.java

License:Open Source License

protected void updateEntryAssets() throws Exception {
    try (LoggingTimer loggingTimer = new LoggingTimer()) {
        List<BlogsEntry> entries = _blogsEntryLocalService.getNoAssetEntries();

        if (_log.isDebugEnabled()) {
            _log.debug("Processing " + entries.size() + " entries with no asset");
        }//w w w  . j a v a  2  s  . c o m

        for (BlogsEntry entry : entries) {
            try {
                _blogsEntryLocalService.updateAsset(entry.getUserId(), entry, null, null, null, null);
            } catch (Exception e) {
                if (_log.isWarnEnabled()) {
                    _log.warn("Unable to update asset for entry " + entry.getEntryId() + ": " + e.getMessage());
                }
            }
        }

        if (_log.isDebugEnabled()) {
            _log.debug("Assets verified for entries");
        }
    }
}

From source file:com.liferay.blogs.verify.VerifyBlogsTrackbacks.java

License:Open Source License

protected void verifyMBDiscussions() {
    try (LoggingTimer loggingTimer = new LoggingTimer()) {
        List<MBDiscussion> mbDiscussions = _mbMessageLocalService.getDiscussions(BlogsEntry.class.getName());

        for (MBDiscussion mbDiscussion : mbDiscussions) {
            try {
                BlogsEntry entry = _blogsEntryLocalService.getEntry(mbDiscussion.getClassPK());

                List<MBMessage> mbMessages = _mbMessageLocalService
                        .getThreadMessages(mbDiscussion.getThreadId(), WorkflowConstants.STATUS_APPROVED);

                for (MBMessage mbMessage : mbMessages) {
                    _verifyPost(entry, mbMessage);
                }/*from   www  . j a  va2 s  . c o  m*/
            } catch (Exception e) {
                _log.error(e, e);
            }
        }
    }
}