List of usage examples for com.liferay.portal.kernel.dao.orm Property eqProperty
public Criterion eqProperty(String other);
From source file:com.liferay.adaptive.media.document.library.repository.internal.counter.DLAdaptiveMediaImageCounter.java
License:Open Source License
@Override public int countExpectedAdaptiveMediaImageEntries(long companyId) { DynamicQuery dynamicQuery = _dlFileEntryLocalService.dynamicQuery(); Property companyIdProperty = PropertyFactoryUtil.forName("companyId"); dynamicQuery.add(companyIdProperty.eq(companyId)); Property groupIdProperty = PropertyFactoryUtil.forName("groupId"); Property repositoryIdProperty = PropertyFactoryUtil.forName("repositoryId"); dynamicQuery.add(groupIdProperty.eqProperty(repositoryIdProperty)); Property mimeTypeProperty = PropertyFactoryUtil.forName("mimeType"); dynamicQuery.add(mimeTypeProperty.in(AdaptiveMediaImageConstants.getSupportedMimeTypes())); return (int) _dlFileEntryLocalService.dynamicQueryCount(dynamicQuery); }
From source file:com.liferay.adaptive.media.document.library.repository.internal.optimizer.DLAdaptiveMediaImageOptimizer.java
License:Open Source License
private void _optimize(long companyId, String configurationEntryUuid, int total, AtomicInteger atomicCounter) { ActionableDynamicQuery actionableDynamicQuery = _dlFileEntryLocalService.getActionableDynamicQuery(); actionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() { @Override//from w w w .jav a 2 s . co m public void addCriteria(DynamicQuery dynamicQuery) { Property companyIdProperty = PropertyFactoryUtil.forName("companyId"); dynamicQuery.add(companyIdProperty.eq(companyId)); Property groupIdProperty = PropertyFactoryUtil.forName("groupId"); Property repositoryIdProperty = PropertyFactoryUtil.forName("repositoryId"); dynamicQuery.add(groupIdProperty.eqProperty(repositoryIdProperty)); Property mimeTypeProperty = PropertyFactoryUtil.forName("mimeType"); dynamicQuery.add(mimeTypeProperty.in(AdaptiveMediaImageConstants.getSupportedMimeTypes())); } }); actionableDynamicQuery .setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<DLFileEntry>() { @Override public void performAction(DLFileEntry dlFileEntry) throws PortalException { FileEntry fileEntry = new LiferayFileEntry(dlFileEntry); try { _processor.process(fileEntry.getFileVersion(), configurationEntryUuid); _sendStatusMessage(atomicCounter.incrementAndGet(), total); } catch (AdaptiveMediaException | PortalException e) { _log.error("Unable to process file entry id " + fileEntry.getFileEntryId(), e); } } }); try { actionableDynamicQuery.performActions(); } catch (PortalException pe) { _log.error(pe, pe); } }
From source file:com.liferay.adaptive.media.document.library.web.internal.counter.DLAMImageCounter.java
License:Open Source License
private int _getFileEntriesCount(long companyId) { DynamicQuery dlFileEntryEntryDynamicQuery = _dlFileEntryLocalService.dynamicQuery(); Property companyIdProperty = PropertyFactoryUtil.forName("companyId"); dlFileEntryEntryDynamicQuery.add(companyIdProperty.eq(companyId)); Property groupIdProperty = PropertyFactoryUtil.forName("groupId"); Property repositoryIdProperty = PropertyFactoryUtil.forName("repositoryId"); dlFileEntryEntryDynamicQuery.add(groupIdProperty.eqProperty(repositoryIdProperty)); Property mimeTypeProperty = PropertyFactoryUtil.forName("mimeType"); dlFileEntryEntryDynamicQuery.add(mimeTypeProperty.in(_amImageMimeTypeProvider.getSupportedMimeTypes())); return (int) _dlFileEntryLocalService.dynamicQueryCount(dlFileEntryEntryDynamicQuery); }
From source file:com.liferay.adaptive.media.document.library.web.internal.counter.DLAMImageCounter.java
License:Open Source License
private int _getTrashedFileEntriesCount(long companyId) { DynamicQuery dlFileVersionDynamicQuery = _dlFileVersionLocalService.dynamicQuery(); dlFileVersionDynamicQuery.setProjection(ProjectionFactoryUtil.countDistinct("fileEntryId")); Property companyIdProperty = PropertyFactoryUtil.forName("companyId"); dlFileVersionDynamicQuery.add(companyIdProperty.eq(companyId)); Property groupIdProperty = PropertyFactoryUtil.forName("groupId"); Property repositoryIdProperty = PropertyFactoryUtil.forName("repositoryId"); dlFileVersionDynamicQuery.add(groupIdProperty.eqProperty(repositoryIdProperty)); Property mimeTypeProperty = PropertyFactoryUtil.forName("mimeType"); dlFileVersionDynamicQuery.add(mimeTypeProperty.in(_amImageMimeTypeProvider.getSupportedMimeTypes())); Property statusProperty = PropertyFactoryUtil.forName("status"); dlFileVersionDynamicQuery.add(statusProperty.eq(WorkflowConstants.STATUS_IN_TRASH)); return (int) _dlFileEntryLocalService.dynamicQueryCount(dlFileVersionDynamicQuery); }
From source file:com.liferay.adaptive.media.document.library.web.internal.optimizer.DLAdaptiveMediaImageOptimizer.java
License:Open Source License
private void _optimize(long companyId, String configurationEntryUuid, int total, AtomicInteger atomicCounter) { ActionableDynamicQuery actionableDynamicQuery = _dlFileEntryLocalService.getActionableDynamicQuery(); actionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() { @Override//from w w w. j a va 2 s . c om public void addCriteria(DynamicQuery dynamicQuery) { Property companyIdProperty = PropertyFactoryUtil.forName("companyId"); dynamicQuery.add(companyIdProperty.eq(companyId)); Property groupIdProperty = PropertyFactoryUtil.forName("groupId"); Property repositoryIdProperty = PropertyFactoryUtil.forName("repositoryId"); dynamicQuery.add(groupIdProperty.eqProperty(repositoryIdProperty)); Property mimeTypeProperty = PropertyFactoryUtil.forName("mimeType"); dynamicQuery.add(mimeTypeProperty.in(AdaptiveMediaImageConstants.getSupportedMimeTypes())); } }); actionableDynamicQuery .setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<DLFileEntry>() { @Override public void performAction(DLFileEntry dlFileEntry) throws PortalException { FileEntry fileEntry = new LiferayFileEntry(dlFileEntry); try { _adaptiveMediaImageProcessor.process(fileEntry.getFileVersion(), configurationEntryUuid); _sendStatusMessage(atomicCounter.incrementAndGet(), total); } catch (PortalException pe) { _log.error("Unable to process file entry id " + fileEntry.getFileEntryId(), pe); } } }); try { actionableDynamicQuery.performActions(); } catch (PortalException pe) { _log.error(pe, pe); } }
From source file:com.liferay.adaptive.media.document.library.web.internal.optimizer.DLAMImageOptimizer.java
License:Open Source License
private void _optimize(long companyId, String configurationEntryUuid, int total, AtomicInteger atomicCounter) { ActionableDynamicQuery actionableDynamicQuery = _dlFileEntryLocalService.getActionableDynamicQuery(); actionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() { @Override/*from ww w.j av a 2 s . co m*/ public void addCriteria(DynamicQuery dynamicQuery) { Property companyIdProperty = PropertyFactoryUtil.forName("companyId"); dynamicQuery.add(companyIdProperty.eq(companyId)); Property groupIdProperty = PropertyFactoryUtil.forName("groupId"); Property repositoryIdProperty = PropertyFactoryUtil.forName("repositoryId"); dynamicQuery.add(groupIdProperty.eqProperty(repositoryIdProperty)); Property mimeTypeProperty = PropertyFactoryUtil.forName("mimeType"); dynamicQuery.add(mimeTypeProperty.in(_amImageMimeTypeProvider.getSupportedMimeTypes())); DynamicQuery dlFileVersionDynamicQuery = _dlFileVersionLocalService.dynamicQuery(); dlFileVersionDynamicQuery.setProjection( ProjectionFactoryUtil.distinct(ProjectionFactoryUtil.property("fileEntryId"))); dlFileVersionDynamicQuery.add(companyIdProperty.eq(companyId)); dlFileVersionDynamicQuery.add(groupIdProperty.eqProperty(repositoryIdProperty)); dlFileVersionDynamicQuery .add(mimeTypeProperty.in(_amImageMimeTypeProvider.getSupportedMimeTypes())); Property statusProperty = PropertyFactoryUtil.forName("status"); dlFileVersionDynamicQuery.add(statusProperty.eq(WorkflowConstants.STATUS_IN_TRASH)); Property fileEntryIdProperty = PropertyFactoryUtil.forName("fileEntryId"); dynamicQuery.add(fileEntryIdProperty.notIn(dlFileVersionDynamicQuery)); } }); actionableDynamicQuery .setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<DLFileEntry>() { @Override public void performAction(DLFileEntry dlFileEntry) throws PortalException { FileEntry fileEntry = new LiferayFileEntry(dlFileEntry); try { _amImageProcessor.process(fileEntry.getFileVersion(), configurationEntryUuid); _sendStatusMessage(atomicCounter.incrementAndGet(), total); } catch (PortalException pe) { _log.error("Unable to process file entry " + fileEntry.getFileEntryId(), pe); } } }); try { actionableDynamicQuery.performActions(); } catch (PortalException pe) { _log.error(pe, pe); } }
From source file:com.liferay.localization.util.InstanceUtil.java
License:Open Source License
private static void _localizeUsers(long companyId) throws Exception { Company company = CompanyLocalServiceUtil.getCompany(companyId); ExpandoBridge expandoBridge = company.getExpandoBridge(); String attributeName = "localizationUpdated_" + PortletPropsValues.COMPANY_DEFAULT_LOCALE; boolean localizationUpdated = GetterUtil.getBoolean(expandoBridge.getAttribute(attributeName, false)); if (localizationUpdated) { return;//from w ww . j a va 2 s . c om } try { expandoBridge.addAttribute(attributeName, ExpandoColumnConstants.BOOLEAN, Boolean.FALSE, false); } catch (DuplicateColumnNameException dcne) { } expandoBridge.setAttribute(attributeName, Boolean.TRUE, false); CompanyLocalServiceUtil.updateCompany(company); ActionableDynamicQuery actionableDynamicQuery = new UserActionableDynamicQuery() { @Override protected void addCriteria(DynamicQuery dynamicQuery) { Property property = PropertyFactoryUtil.forName("createDate"); dynamicQuery.add(property.eqProperty("modifiedDate")); } @Override protected void performAction(Object object) throws PortalException { User user = (User) object; user.setModifiedDate(new Date()); user.setLanguageId(PortletPropsValues.COMPANY_DEFAULT_LOCALE); user.setTimeZoneId(PortletPropsValues.COMPANY_DEFAULT_TIME_ZONE); UserLocalServiceUtil.updateUser(user); } }; actionableDynamicQuery.setCompanyId(companyId); actionableDynamicQuery.performActions(); }