This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.liferay.document.library.kernel.service.DLAppLocalServiceUtil | |
| import com.liferay.petra.string.StringPool | |
| import com.liferay.portal.kernel.service.ServiceContextThreadLocal | |
| import java.nio.charset.StandardCharsets | |
| void createDLFile(String filnameWithExtension, long folderId, String mimeType, String title, String description, String text) { | |
| def serviceContext = ServiceContextThreadLocal.getServiceContext() | |
| def inputStream = new ByteArrayInputStream(text.getBytes(StandardCharsets.UTF_8)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.liferay.asset.kernel.model.AssetEntry; | |
| import com.liferay.asset.kernel.service.AssetEntryLocalServiceUtil; | |
| import com.liferay.info.constants.InfoDisplayWebKeys; | |
| import com.liferay.info.item.InfoItemDetails; | |
| import com.liferay.journal.model.JournalArticle; | |
| import com.liferay.journal.service.JournalArticleLocalService; | |
| import com.liferay.journal.service.JournalArticleLocalServiceUtil; | |
| import com.liferay.portal.kernel.exception.PortalException; | |
| import com.liferay.portal.kernel.util.PortalUtil; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.osgi.framework.Bundle | |
| import org.osgi.framework.BundleContext | |
| import org.osgi.framework.FrameworkUtil | |
| import org.osgi.util.tracker.ServiceTracker | |
| static <T> T getService(Class<T> clazz) { | |
| Bundle bundle = FrameworkUtil.getBundle(clazz) | |
| BundleContext bundleContext = bundle.getBundleContext() | |
| ServiceTracker serviceTracker = new ServiceTracker(bundleContext, clazz, null) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.text.Normalizer; | |
| public String unaccent(String str) { | |
| return Normalizer.normalize(src, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", ""); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Copyright (c) 2000-present Liferay, Inc. All rights reserved. | |
| * <p> | |
| * This library is free software; you can redistribute it and/or modify it under | |
| * the terms of the GNU Lesser General Public License as published by the Free | |
| * Software Foundation; either version 2.1 of the License, or (at your option) | |
| * any later version. | |
| * <p> | |
| * This library is distributed in the hope that it will be useful, but WITHOUT | |
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.liferay.dynamic.data.mapping.storage.DDMFormFieldValue; | |
| import com.liferay.journal.model.JournalArticle; | |
| import com.liferay.journal.service.JournalArticleLocalServiceUtil; | |
| import com.liferay.portal.kernel.util.LocaleUtil; | |
| String fieldName = "field name"; | |
| Locale locale = LocaleUtil.getDefault(); | |
| boolean includeNestedDDMFormFieldValues = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private SchedulerEngine getSchedulerEngine() { | |
| SchedulerEngine schedulerEngine = (SchedulerEngine) IdentifiableOSGiServiceUtil.getIdentifiableOSGiService(OSGI_SERVICE_IDENTIFIER); | |
| } | |
| private final String OSGI_SERVICE_IDENTIFIER = "com.liferay.portal.scheduler.multiple.internal.ClusterSchedulerEngine"; | |
| SchedulerEngine schedulerEngine = getSchedulerEngine(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.liferay.registry.Registry | |
| import com.liferay.registry.RegistryUtil | |
| import com.liferay.registry.ServiceReference | |
| def getService(Class clazz) { | |
| Registry registry = RegistryUtil.getRegistry(); | |
| ServiceReference serviceReference = registry.getServiceReference(clazz); | |
| return registry.getService(serviceReference); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "fieldSets": [ | |
| { | |
| "fields": [ | |
| { | |
| "name": "number", | |
| "label": "Number", | |
| "type": "text", | |
| "dataType": "int", | |
| "defaultValue": "5", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.liferay.journal.service.JournalArticleLocalService | |
| import com.liferay.portal.template.ServiceLocator | |
| serviceLocator = ServiceLocator.newInstance() | |
| journalArticleLocalService = serviceLocator.findService(JournalArticleLocalService.class.getName()) | |
| println journalArticleLocalService.getJournalArticles(1,3) |
NewerOlder