Skip to content

Instantly share code, notes, and snippets.

View yasuflatland-lf's full-sized avatar
🛹
Skating

Yasuyuki Takeo yasuflatland-lf

🛹
Skating
View GitHub Profile
@yasuflatland-lf
yasuflatland-lf / JVM crusher
Last active December 29, 2015 07:49
This code will crash JVM to invoke with following parameter.java -Xbootclasspath/p:. Crash
import sun.misc.Unsafe;
import java.lang.reflect.Field;
public class Crash {
public static void main(String... args) throws Exception {
getUnsafe().getByte(0);
}
private static Unsafe getUnsafe() throws NoSuchFieldException, IllegalAccessException {
Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
@yasuflatland-lf
yasuflatland-lf / SAML mapping attributes
Last active October 19, 2017 02:54
Liferay + ADFS mapping
saml.sp.user.attribute.mappings=\http\\://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress=emailAddress\n\http\\://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname=firstName\n\http\\://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname=lastName\n\http\\://schemas.xmlsoap.org/claims/CommonName=screenName
@yasuflatland-lf
yasuflatland-lf / Liferay_DXP_and_ADFS_and_Liferay_Integration.md
Last active April 27, 2020 01:35
Liferay DXP and Windows Server 2012 R2 + ADSF 3.0 SAML2.0 integration steps with Liferay SAML Plugin

Association of ADFS Version and Windows Servers

version note
ADFS 1.0 Released with Windows 2003 R2. Built into OS.
ADFS 1.1 Released with Windows 2008 and 2008 R2. Built into OS.
ADFS 2.0 Released After Windows 2008 / 2008 R2. Separate download from here.
ADFS 2.1 Windows 2012
ADFS 3.0 Windows 2012 R2
<#-- dump.ftl
--
-- Generates tree representations of data model items.
--
-- Usage:
-- <#import "dump.ftl" as dumper>
--
-- <#assign foo = something.in["your"].data[0].model />
--
-- <@dumper.dump foo />
@yasuflatland-lf
yasuflatland-lf / taglib_snipet.ftl
Last active April 26, 2019 07:47
WCM Edit page in a pop up for Liferay 7.1
<#assign
portletName = themeDisplay.getPortletDisplay().getPortletName()
plid = getterUtil.getLong(themeDisplay.getPlid())
portletURL = portletURLFactory.create(renderRequest, portletName, plid, "RENDER_PHASE")
windowState = windowStateFactory.getWindowState("POP_UP")
assetRenderer = entry.getAssetRenderer()
editURL = assetRenderer.getURLEdit(renderRequest,renderResponse, windowState, portletURL)
VOID = editURL.setParameter("returnToFullPageURL", currentPortletURL)
>
<@liferay_ui["icon"] method="get" url="${editURL}" icon="pencil" useDialog=true />
@yasuflatland-lf
yasuflatland-lf / dl_metadata_fetch_in_wcm_template.ftl
Last active July 30, 2019 06:54
Fetch Document & Media's metadata from a Web Content Template
<#assign
languageId = languageUtil.getLanguageId(locale)
journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService")
layoutLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService")
article = journalArticleLocalService.getArticle( groupId, .vars["reserved-article-id"].data )
resourceprimKey = article.getResourcePrimKey()
assetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService")
assetEntry = assetEntryLocalService.getEntry("com.liferay.journal.model.JournalArticle", resourceprimKey)
dLFileEntryLocalService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryLocalService")
dLFileEntryTypeLocalService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryTypeLocalService")
@yasuflatland-lf
yasuflatland-lf / related_asset_fetch_sample.ftl
Created August 7, 2019 08:22
Fetch Related Assets in Web Content Template
<span class="label label-secondary" id="test">
<span class="label-item label-item-expand">Label Text</span>
</span>
<aui:script position="inline" >
$("#test").click(function(event) {
Liferay.Util.openWindow(
{
dialog: {
after: {
<liferay-portlet:renderURL var="viewDetailsURL" windowState="<%= LiferayWindowState.POP_UP.toString() %>">
<portlet:param name="mvcRenderCommandName" value="viewDetails" />
</liferay-portlet:renderURL>
uri: '<%= HtmlUtil.escapeJS(viewDetailsURL) %>'
@yasuflatland-lf
yasuflatland-lf / gist:dc8e4c5ffcf904125f27cc6bdbb789e4
Created February 26, 2020 05:33
ja_resource_library_resource_top.ftl
<#assign
languageId = languageUtil.getLanguageId(locale)
tagUtil = serviceLocator.findService("com.liferay.asset.kernel.service.AssetTagLocalService")
serviceContext = staticUtil["com.liferay.portal.kernel.service.ServiceContextThreadLocal"].getServiceContext()
httpServletRequest = serviceContext.getRequest()
rootPortletId = portletDisplay.getRootPortletId()
currentPortletURL = renderResponse.createRenderURL()
dlAppLocalServiceUtil = staticUtil["com.liferay.document.library.kernel.service.DLAppLocalServiceUtil"]
dlUtil = staticUtil["com.liferay.document.library.kernel.util.DLUtil"]
dLFileEntryLocalService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryLocalService")