Example usage for com.liferay.portal.kernel.search SearchContext setPortletIds

List of usage examples for com.liferay.portal.kernel.search SearchContext setPortletIds

Introduction

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

Prototype

public void setPortletIds(String[] portletIds) 

Source Link

Usage

From source file:vn.com.ecopharma.emp.service.impl.EmpAnnualLeaveLocalServiceImpl.java

License:Open Source License

public Document getIndexedDocument(long id, SearchContext searchContext) {
    searchContext.setPortletIds(new String[] { EMInfo.PORTLET_ID });
    BooleanQuery fullQuery = BooleanQueryFactoryUtil.create(searchContext);
    BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext);
    booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, EmpAnnualLeave.class.getName());
    booleanQuery.addExactTerm(EmpAnnualLeaveField.ID, id);

    try {/* w  ww .  jav  a  2s  .  c  o m*/
        fullQuery.add(booleanQuery, BooleanClauseOccur.MUST);
        Hits hits = SearchEngineUtil.search(searchContext, fullQuery);
        return !hits.toList().isEmpty() ? hits.toList().get(0) : null;
    } catch (ParseException e) {
        LogFactoryUtil.getLog(EmpDisciplineLocalServiceImpl.class).info(e);
    } catch (SearchException e) {
        LogFactoryUtil.getLog(EmpDisciplineLocalServiceImpl.class).info(e);
    }

    return null;
}

From source file:vn.com.ecopharma.emp.service.impl.EmpDisciplineLocalServiceImpl.java

License:Open Source License

public Document getIndexedDocument(long id, SearchContext searchContext) {
    searchContext.setPortletIds(new String[] { EMInfo.PORTLET_ID });
    BooleanQuery fullQuery = BooleanQueryFactoryUtil.create(searchContext);
    BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext);
    booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, EmpDiscipline.class.getName());
    booleanQuery.addExactTerm(EmpDisciplineField.ID, id);

    try {/*from www. j a v a  2s. com*/
        fullQuery.add(booleanQuery, BooleanClauseOccur.MUST);
        Hits hits = SearchEngineUtil.search(searchContext, fullQuery);
        return !hits.toList().isEmpty() ? hits.toList().get(0) : null;
    } catch (ParseException e) {
        LogFactoryUtil.getLog(EmpDisciplineLocalServiceImpl.class).info(e);
    } catch (SearchException e) {
        LogFactoryUtil.getLog(EmpDisciplineLocalServiceImpl.class).info(e);
    }

    return null;
}

From source file:vn.com.ecopharma.emp.service.impl.EmpLocalServiceImpl.java

License:Open Source License

@Override
public Document getIndexedEmp(long employeeId, SearchContext searchContext) {
    searchContext.setPortletIds(new String[] { EMInfo.PORTLET_ID });
    BooleanQuery fullQuery = BooleanQueryFactoryUtil.create(searchContext);
    BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext);
    booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, Emp.class.getName());
    booleanQuery.addExactTerm(EmpField.EMP_ID, employeeId);

    try {//from   w  w w.jav  a  2 s .  co m
        fullQuery.add(booleanQuery, BooleanClauseOccur.MUST);
        Hits hits = SearchEngineUtil.search(searchContext, fullQuery);
        return !hits.toList().isEmpty() ? hits.toList().get(0) : null;
    } catch (ParseException e) {
        LOGGER.info(e);
    } catch (SearchException e) {
        LOGGER.info(e);
    }

    return null;
}

From source file:vn.com.ecopharma.emp.service.impl.PromotedHistoryLocalServiceImpl.java

License:Open Source License

public Document getIndexedDocument(long id, SearchContext searchContext) {
    searchContext.setPortletIds(new String[] { EMInfo.PORTLET_ID });
    BooleanQuery fullQuery = BooleanQueryFactoryUtil.create(searchContext);
    BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext);
    booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, PromotedHistory.class.getName());
    booleanQuery.addExactTerm(PromotedHistoryField.ID, id);

    try {//  w ww .j av  a  2 s .c  om
        fullQuery.add(booleanQuery, BooleanClauseOccur.MUST);
        Hits hits = SearchEngineUtil.search(searchContext, fullQuery);
        return !hits.toList().isEmpty() ? hits.toList().get(0) : null;
    } catch (ParseException e) {
        LOGGER.info(e);
    } catch (SearchException e) {
        LOGGER.info(e);
    }

    return null;
}

From source file:vn.com.ecopharma.emp.service.impl.ResignationHistoryLocalServiceImpl.java

License:Open Source License

public Document getIndexedDocument(long id, SearchContext searchContext) {
    searchContext.setPortletIds(new String[] { EMInfo.PORTLET_ID });
    BooleanQuery fullQuery = BooleanQueryFactoryUtil.create(searchContext);
    BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext);
    booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, ResignationHistory.class.getName());
    booleanQuery.addExactTerm(ResignationHistoryField.ID, id);

    try {//from   w  w w.  j a  v a 2  s .  c om
        fullQuery.add(booleanQuery, BooleanClauseOccur.MUST);
        Hits hits = SearchEngineUtil.search(searchContext, fullQuery);
        return !hits.toList().isEmpty() ? hits.toList().get(0) : null;
    } catch (ParseException e) {
        LOGGER.info(e);
    } catch (SearchException e) {
        LOGGER.info(e);
    }

    return null;
}

From source file:vn.com.ecopharma.emp.service.impl.VacationLeaveLocalServiceImpl.java

License:Open Source License

public Document getIndexedDocument(long id, SearchContext searchContext) {
    searchContext.setPortletIds(new String[] { EMInfo.PORTLET_ID });
    BooleanQuery fullQuery = BooleanQueryFactoryUtil.create(searchContext);
    BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext);
    booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, VacationLeave.class.getName());
    booleanQuery.addExactTerm(VacationLeaveField.ID, id);

    try {/*from w  w w.  j  a va  2s.co  m*/
        fullQuery.add(booleanQuery, BooleanClauseOccur.MUST);
        Hits hits = SearchEngineUtil.search(searchContext, fullQuery);
        return !hits.toList().isEmpty() ? hits.toList().get(0) : null;
    } catch (ParseException e) {
        LOGGER.info(e);
    } catch (SearchException e) {
        LOGGER.info(e);
    }

    return null;
}

From source file:vn.com.ecopharma.hrm.rc.service.impl.CandidateLocalServiceImpl.java

License:Open Source License

public Document getIndexCandidateDocument(long id, SearchContext searchContext) {
    searchContext.setPortletIds(new String[] { ECO_RCUtils.PORTLET_ID });
    BooleanQuery fullQuery = BooleanQueryFactoryUtil.create(searchContext);
    BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext);
    booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, Candidate.class.getName());
    booleanQuery.addExactTerm(CandidateField.CANDIDATE_ID, id);

    try {//from  ww w.  j av a  2  s  .c o m
        fullQuery.add(booleanQuery, BooleanClauseOccur.MUST);
        Hits hits = SearchEngineUtil.search(searchContext, fullQuery);
        return !hits.toList().isEmpty() ? hits.toList().get(0) : null;
    } catch (ParseException e) {
        LOGGER.info(e);
    } catch (SearchException e) {
        LOGGER.info(e);
    }

    return null;
}

From source file:vn.com.ecopharma.hrm.rc.service.impl.InterviewScheduleLocalServiceImpl.java

License:Open Source License

public Document getIndexDocument(long id, SearchContext searchContext) {
    searchContext.setPortletIds(new String[] { ECO_RCUtils.PORTLET_ID });
    BooleanQuery fullQuery = BooleanQueryFactoryUtil.create(searchContext);
    BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext);
    booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, InterviewSchedule.class.getName());
    booleanQuery.addExactTerm(InterviewScheduleField.ID, id);

    try {//from   www .j av  a  2 s  .c o  m
        fullQuery.add(booleanQuery, BooleanClauseOccur.MUST);
        Hits hits = SearchEngineUtil.search(searchContext, fullQuery);
        return !hits.toList().isEmpty() ? hits.toList().get(0) : null;
    } catch (ParseException e) {
        LOGGER.info(e);
    } catch (SearchException e) {
        LOGGER.info(e);
    }

    return null;
}

From source file:vn.com.ecopharma.hrm.rc.service.impl.VacancyLocalServiceImpl.java

License:Open Source License

public Document getIndexVacancyDocument(long id, SearchContext searchContext) {
    searchContext.setPortletIds(new String[] { ECO_RCUtils.PORTLET_ID });
    BooleanQuery fullQuery = BooleanQueryFactoryUtil.create(searchContext);
    BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext);
    booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, Vacancy.class.getName());
    booleanQuery.addExactTerm(VacancyField.VACANCY_ID, id);

    try {// ww  w  . j  a  va 2 s.co m
        fullQuery.add(booleanQuery, BooleanClauseOccur.MUST);
        Hits hits = SearchEngineUtil.search(searchContext, fullQuery);
        return !hits.toList().isEmpty() ? hits.toList().get(0) : null;
    } catch (ParseException e) {
        LOGGER.info(e);
    } catch (SearchException e) {
        LOGGER.info(e);
    }

    return null;
}

From source file:vn.com.ecopharma.hrm.rc.service.impl.VacancyLocalServiceImpl.java

License:Open Source License

public Document getUndeletedIndexVacancyDocument(long id, SearchContext searchContext) {
    searchContext.setPortletIds(new String[] { ECO_RCUtils.PORTLET_ID });
    BooleanQuery fullQuery = BooleanQueryFactoryUtil.create(searchContext);
    BooleanQuery booleanQuery = BooleanQueryFactoryUtil.create(searchContext);
    BooleanQuery noneDeletedVacancyBooleanQuery = BooleanQueryFactoryUtil.create(searchContext);
    booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, Vacancy.class.getName());
    booleanQuery.addExactTerm(VacancyField.VACANCY_ID, id);

    noneDeletedVacancyBooleanQuery.addExactTerm(VacancyField.IS_DELETED, "false");
    try {/*from w  w w .j  a  v  a 2 s  . c  o  m*/
        fullQuery.add(booleanQuery, BooleanClauseOccur.MUST);
        fullQuery.add(noneDeletedVacancyBooleanQuery, BooleanClauseOccur.MUST);
        Hits hits = SearchEngineUtil.search(searchContext, fullQuery);
        return !hits.toList().isEmpty() ? hits.toList().get(0) : null;
    } catch (ParseException e) {
        LOGGER.info(e);
    } catch (SearchException e) {
        LOGGER.info(e);
    }

    return null;
}