Example usage for com.liferay.portal.kernel.search Field ENTRY_CLASS_PK

List of usage examples for com.liferay.portal.kernel.search Field ENTRY_CLASS_PK

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.search Field ENTRY_CLASS_PK.

Prototype

String ENTRY_CLASS_PK

To view the source code for com.liferay.portal.kernel.search Field ENTRY_CLASS_PK.

Click Source Link

Usage

From source file:org.xmlportletfactory.olafk.customer.util.CustomerIndexer.java

License:Open Source License

@Override
protected Summary doGetSummary(Document document, Locale locale, String snippet, PortletURL portletURL) {

    String title = document.get(Field.TITLE);

    String content = snippet;//from w  ww. j  ava2s  . co  m

    if (Validator.isNull(snippet)) {
        content = StringUtil.shorten(document.get(Field.CONTENT), 200);
    }

    String entryId = document.get(Field.ENTRY_CLASS_PK);
    String groupId = document.get(Field.GROUP_ID);

    long plid = 0;

    try {
        plid = CustomerUtil.getPlid(Long.parseLong(groupId));
    } catch (Exception e) {
    }

    portletURL.setParameter("p_l_id", String.valueOf(plid));
    portletURL.setParameter("view", "editCustomer");
    portletURL.setParameter("customerId", String.valueOf(entryId));
    portletURL.setParameter("editType", "view");

    return new Summary(title, content, portletURL);
}

From source file:org.xmlportletfactory.olafk.customer.util.InvoicesIndexer.java

License:Open Source License

@Override
protected Summary doGetSummary(Document document, Locale locale, String snippet, PortletURL portletURL) {

    String title = document.get(Field.TITLE);

    String content = snippet;/*from ww  w.ja  v  a  2 s . c o  m*/

    if (Validator.isNull(snippet)) {
        content = StringUtil.shorten(document.get(Field.CONTENT), 200);
    }

    String entryId = document.get(Field.ENTRY_CLASS_PK);
    String groupId = document.get(Field.GROUP_ID);

    long plid = 0;

    try {
        plid = InvoicesUtil.getPlid(Long.parseLong(groupId));
    } catch (Exception e) {
    }

    portletURL.setParameter("p_l_id", String.valueOf(plid));
    portletURL.setParameter("view", "editInvoices");
    portletURL.setParameter("invoiceId", String.valueOf(entryId));
    portletURL.setParameter("editType", "view");

    return new Summary(title, content, portletURL);
}