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
| def exec = { cmd -> def p = cmd.execute(); out.leftShift(new SequenceInputStream(p.getErr(), p.getIn())) } | |
| exec('df -h -a -i -T') |
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.portal.service.* | |
| locks = LockLocalServiceUtil.getLocks(-1,-1) | |
| locks.each{println it} |
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.portal.service.* | |
| locks = LockLocalServiceUtil.deleteLock(28001) |
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.portal.service.* | |
| number = com.liferay.portal.service.UserLocalServiceUtil.getUsersCount(); | |
| out.println( | |
| """ | |
| <div style="background-color:black; text-align: center"> | |
| <h1 style="color: #37A9CC; font-size:xx-large">${number}</h1> | |
| </div> | |
| """); |
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
| try { | |
| nullVar = null | |
| out.println(nullVar.length()) | |
| } catch(e) { | |
| out.println("""<div class="portlet-msg-error">${e}</div>""") | |
| e.printStackTrace(out) | |
| } |
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.portal.util.* | |
| company = PortalUtil.getCompany(actionRequest) | |
| out.println("Current company: ${company.getName()}\n") | |
| out.println("User info:") | |
| userInfo.each{ | |
| k, v -> out.println("${k}:${v}") | |
| } |
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.util.Calendar | |
| import com.liferay.portal.service.* | |
| import com.liferay.portal.model.* | |
| import com.liferay.portal.kernel.dao.orm.* | |
| import static com.liferay.portal.kernel.workflow.WorkflowConstants.* | |
| // | |
| // Deactivate users never logged and created since more than 2 years | |
| // |
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.portal.service.* | |
| import com.liferay.portal.kernel.dao.orm.* | |
| // Output management | |
| final def SCRIPT_ID = "MYSCRIPT" | |
| outputFile = new File("""${System.getProperty("liferay.home")}/scripting/out-${SCRIPT_ID}.txt""") | |
| outputFile.getParentFile().mkdirs() | |
| def trace(message) { |
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
| final def SCRIPT_ID = "MYSCRIPT" | |
| outputFile = new File("""${System.getProperty("liferay.home")}/scripting/out-${SCRIPT_ID}.txt""") | |
| out.println(outputFile.text) |
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
| // | |
| // Parse JSON string to model record with #SenchaTouch | |
| // | |
| var json = "{id: '533626fce4b029966f6cea40', firstName: 'John', lastName: 'Doe'}"; | |
| var reader = new Ext.data.JsonReader(); | |
| reader.setModel('MyApp.model.User'); | |
| var userRecord = reader.read(json).getRecords()[0]; |
OlderNewer