This file contains 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 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 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 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 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 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 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 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 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) |
This file contains 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.headless.admin.user.resource.v1_0.RoleResource | |
import com.liferay.portal.kernel.model.User | |
import com.liferay.portal.kernel.model.role.RoleConstants | |
import com.liferay.portal.kernel.security.auth.GuestOrUserUtil | |
import com.liferay.portal.kernel.service.ServiceContext | |
import com.liferay.portal.kernel.service.ServiceContextThreadLocal | |
import com.liferay.portal.vulcan.pagination.Pagination | |
import com.liferay.portal.vulcan.resource.locator.ResourceLocator | |
import com.liferay.portal.vulcan.resource.locator.ResourceLocatorFactory | |
import org.osgi.framework.Bundle |
NewerOlder