Skip to content

Instantly share code, notes, and snippets.

@sammso
Last active May 18, 2017 07:28
Show Gist options
  • Save sammso/ca9f971154303c34216c302a69d7fdc0 to your computer and use it in GitHub Desktop.
Save sammso/ca9f971154303c34216c302a69d7fdc0 to your computer and use it in GitHub Desktop.

01 Development environment

Fixed : https://filebin.ca/3Mdy63PxBLul/12.3SearchQueries.xml

<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<snippets>
    <category filters="*" id="category_1494770019104" initial_state="0" label="12.3 Search Queries" largeicon="" smallicon="">
        <description/>
        <item category="category_1494770019104" id="item_1494771428516" label="04-component-property">
            <description/>
            <content><![CDATA["indexer.class.name=com.liferay.training.space.gradebook.model.Assignment"]]></content>
        </item>
        <item category="category_1494770019104" class="" editorclass="" id="item_1494770048533" label="01-ipp-dependencies" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
            <description/>
            <content><![CDATA[dependencies {
	compileOnly group: "org.osgi", name: "org.osgi.core", version: "6.0.0"
	compile group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
	compile group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
	compile group: "javax.portlet", name: "portlet-api", version: "2.0"
	compile group: "javax.servlet", name: "servlet-api", version: "2.5"
	compile group: "jstl", name: "jstl", version: "1.2"
	compile group: "org.osgi", name: "org.osgi.service.component.annotations", version :"1.3.0"
	compile files('../../libs/gradebook-api-1.0.0.jar')
}]]></content>
        </item>
        <item category="category_1494770019104" class="" editorclass="" id="item_1494770163732" label="02-postProcessSearchQuery" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
            <description/>
            <content><![CDATA[				LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>)
						searchContext.getAttribute("params");

				if (params != null) {
					long assignmentId = (long) params.get("assignmentId");

					searchQuery.addRequiredTerm("assignmentId", assignmentId);
				}
		
				if (_log.isInfoEnabled()) {
					_log.info("postProcessSearchQuery");
				}
				if (_log.isInfoEnabled()) {
					_log.info("postProcessSearchQuery");
				}]]></content>
        </item>
        <item category="category_1494770019104" class="" editorclass="" id="item_1494770231311" label="03-postProcessDocument" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
            <description/>
            <content><![CDATA[					Assignment assignment = (Assignment) obj;

					long assignmentId = assignment.getPrimaryKey();
					document.addNumber("assignmentId", assignmentId);]]></content>
        </item>
    </category>
</snippets>

GoGO Shell Liferay users example

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 }

05-JSP FRAGMENT EXERCISES

Kuinka käyttää alkuperäistä JSP:tä fragmetissä

Include esimerkki: alkuperäinen file on <jsp-nimi>.<portal|original>.jsp.

<liferay-util:include page="/create_account.portal.jsp" servletContext="<%= application %>"/>

Esimerkki create_account.jsp kentän lisäys.

<%@ include file="/init.jsp" %>
<liferay-util:buffer var="html">
	<liferay-util:include page="/create_account.portal.jsp" servletContext="<%= application %>"/>
</liferay-util:buffer>
<liferay-util:buffer var="openIdFieldHtml"><aui:input name="openId" type="hidden" value="<%= ParamUtil.getString(request, "openId") %>" /></liferay-util:buffer>
<liferay-util:buffer var="userNameFieldsHtml"><liferay-ui:user-name-fields /></liferay-util:buffer>

<liferay-util:buffer var="errorMessageHtml">
	<liferay-ui:error exception="<%= com.liferay.portal.kernel.exception.NoSuchOrganizationException.class %>" message="no-such-registration-code" />
</liferay-util:buffer>
<liferay-util:buffer var="registrationCodeFieldHtml">
			<aui:input name="registrationCode" type="text" value="">
					<aui:validator name="required" />
			</aui:input>
</liferay-util:buffer>
<%
	html = com.liferay.portal.kernel.util.StringUtil.replace(html, openIdFieldHtml, openIdFieldHtml + errorMessageHtml);
	html = com.liferay.portal.kernel.util.StringUtil.replace(html, userNameFieldsHtml, userNameFieldsHtml + registrationCodeFieldHtml);
%>
<%=html %>

AUTOLOGIN

https://github.com/sammso/localhost-autologin-hook/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment