Skip to content

Instantly share code, notes, and snippets.

View sammso's full-sized avatar

Sampsa Sohlman sammso

View GitHub Profile
@sammso
sammso / asset-hook.md
Last active July 27, 2016 15:14
Dev1 Training Leiden Extra 1

liferay-hook.xml

<?xml version="1.0"?>
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">

<hook>
	<custom-jsp-dir>/custom_jsps</custom-jsp-dir>
</hook>

This for replacement for AlloyUI Component exercise

<%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%>
<%@include file="/html/init.jsp" %>

<%
	boolean hasAddPermission = InventoryPermission.contains(
			permissionChecker, scopeGroupId, "ADD_MANUFACTURER");
	boolean hasConfigurePermission = InventoryPermission.contains(

Add following methods to ManufacturerAssetRendererFactory

	@Override
	public PortletURL getURLAdd(
		LiferayPortletRequest liferayPortletRequest,
		LiferayPortletResponse liferayPortletResponse) {
	
		try {
 ThemeDisplay themeDisplay =

Display all renderRequest attribute names

    <ul>
    <#list renderRequest.getAttributeNames() as name >
        <li>${name}</li>
    </#list>
    </ul>

Install java to Debian or Ubuntu

setup-java.sh

if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root run: sudo ./setup-java.sh" 1>&2
   exit 1
fi

Users

portalUtilReference=(serviceReference "com.liferay.portal.kernel.util.PortalUtil")
portalUtil=(service $portalUtilReference)
defaultCompanyId=($portalUtil getDefaultCompanyId)
userServiceReference=(serviceReference "com.liferay.portal.kernel.service.UserLocalService")
userService=(service $userServiceReference)
users=$userService getCompanyUsers $defaultCompanyId 0 100   
each $users { $it getFullName }
/**
* *********************************************************************************************************
*
* Usage:
*
* Run this Script Lifeay 6.2 's scripting console to trouble shot caches
*
* variable MIN_MISS_PERCENTAGE you can limit that itdoes not pring caches that fill rate is low.
* variable PRINT_SQL set this true if you want to print SQL statement ready to be inserted
* variable NODE_NAME is the node name for printSQL statement.
import groovy.io.FileType
if ( args.length < 2 ) {
println "Scan's thread dump *.log files from directory";
println "";
println "Usage:";
println "groovy ThreadDumpAnalyzer.groovy <directory> <first value to look from thread dump> <second value to look from thread dump> <third value to look from thread dump>";
println "";
return;
}