Skip to content

Instantly share code, notes, and snippets.

View sammso's full-sized avatar

Sampsa Sohlman sammso

View GitHub Profile
var MIN_MISS_PERCENTAGE = 10;
var fields = [ "CacheType", ".Bean", "ObjectCount", "CacheHits", "CacheMisses", "CacheMissPercentage" ];
var padding30 = Array(30).join(' '), padding12 = Array(12).join(' '), padding20 = Array(20).join(' ');
var platformMBeanServer = Packages.java.lang.management.ManagementFactory.getPlatformMBeanServer();
function printInColumns(values) {
var beanName = values[1];
/**
* *********************************************************************************************************
*
* 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 com.liferay.portal.kernel.util.GetterUtil
import com.liferay.portal.kernel.util.Validator
import com.liferay.portal.kernel.xml.Document
import com.liferay.portal.kernel.xml.Element
import com.liferay.portal.kernel.xml.SAXReaderUtil
import com.liferay.portal.model.LayoutSet
import com.liferay.portal.model.Portlet
import com.liferay.portal.model.PortletPreferences
import com.liferay.portal.service.GroupLocalServiceUtil
import com.liferay.portal.service.LayoutSetLocalServiceUtil
@sammso
sammso / running-sql-queries.md
Last active June 28, 2019 10:43 — forked from milendyankov/DXP70-runSQL.groovy
Running SQL queries from liferay's groovy console

Running SQL queries:

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.liferay.portal.kernel.dao.jdbc.DataAccess;

Connection con = null;