当前位置: 首页>>代码示例>>Java>>正文


Java SearchContext.getAttribute方法代码示例

本文整理汇总了Java中com.liferay.portal.kernel.search.SearchContext.getAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java SearchContext.getAttribute方法的具体用法?Java SearchContext.getAttribute怎么用?Java SearchContext.getAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.liferay.portal.kernel.search.SearchContext的用法示例。


在下文中一共展示了SearchContext.getAttribute方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: postProcessSearchQuery

import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
        SearchContext searchContext) throws Exception {
            
    boolean advancedSearch = GetterUtil.getBoolean(searchContext.getAttribute("advancedSearch"), false);

    addSearchTerm(searchQuery, searchContext, "description", false);
    if (!advancedSearch) {
        addSearchTerm(searchQuery, searchContext, "workPackage", true);
    }
    
    // TODO: add ticketURL

    LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");

    if (params != null) {
        String expandoAttributes = (String) params.get("expandoAttributes");

        if (Validator.isNotNull(expandoAttributes)) {
            addSearchExpando(searchQuery, searchContext, expandoAttributes);
        }
    }
}
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:24,代码来源:TaskRecordIndexer.java

示例2: postProcessSearchQuery

import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery,
        BooleanFilter fullQueryBooleanFilter, SearchContext searchContext)
        throws Exception {

    addSearchTerm(searchQuery, searchContext, "data", false);

    LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext
            .getAttribute("params");

    if (params != null) {
        String expandoAttributes = (String) params.get("expandoAttributes");

        if (Validator.isNotNull(expandoAttributes)) {
            addSearchExpando(searchQuery, searchContext, expandoAttributes);
        }
    }
}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:19,代码来源:MeasurementIndexer.java

示例3: postProcessSearchQuery

import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
        SearchContext searchContext) throws Exception {

    addSearchTerm(searchQuery, searchContext, "company", false);
    addSearchTerm(searchQuery, searchContext, "fullName", false);

    LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");

    if (params != null) {
        String expandoAttributes = (String) params.get("expandoAttributes");

        if (Validator.isNotNull(expandoAttributes)) {
            addSearchExpando(searchQuery, searchContext, expandoAttributes);
        }
    }
}
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:18,代码来源:ContactIndexer.java

示例4: postProcessSearchQuery

import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
		SearchContext searchContext) throws Exception {

	@SuppressWarnings("unchecked")
	LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");

	if (params != null) {
		String expandoAttributes = (String) params.get("expandoAttributes");

		if (Validator.isNotNull(expandoAttributes)) {
			addSearchExpando(searchQuery, searchContext, expandoAttributes);
		}
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:16,代码来源:JobPosIndexer.java

示例5: postProcessSearchQuery

import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
		SearchContext searchContext) throws Exception {

	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.OFFICE_SITE_ID, false);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.GROUP_ID, false);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.COMPANY_ID, false);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.USER_ID, false);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.USER_NAME, false);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.CREATE_DATE, false);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.MODIFIED_DATE, false);

	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.NAME, true);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.EN_NAME, true);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.GOV_AGENCY_CODE, true);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.ADDRESS, true);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.TEL_NO, true);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.FAX_NO, true);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.EMAIL, true);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.WEBSITE, true);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.LOGO_FILE_ENTRY_ID, true);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.SITE_GROUP_ID, true);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.ADMIN_USER_ID, true);
	addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.PREFERENCES, true);

	@SuppressWarnings("unchecked")
	LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");

	if (params != null) {
		String expandoAttributes = (String) params.get("expandoAttributes");

		if (Validator.isNotNull(expandoAttributes)) {
			addSearchExpando(searchQuery, searchContext, expandoAttributes);
		}
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:37,代码来源:OfficeSiteIndexer.java

示例6: postProcessSearchQuery

import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
		SearchContext searchContext) throws Exception {

	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.WORKINGUNIT_ID, false);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.GROUP_ID, false);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.COMPANY_ID, false);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.USER_ID, false);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.USER_NAME, false);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.CREATE_DATE, false);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.MODIFIED_DATE, false);
	
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.NAME, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.ENNAME, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.GOV_AGENCY_CODE, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.PARENT_WORKING_UNIT_ID, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.SIBLING, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.TREEINDEX, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.ADDRESS, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.TEL_NO, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.FAX_NO, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.EMAIL, true);
	addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.WEBSITE, true);
	
	@SuppressWarnings("unchecked")
	LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");

	if (params != null) {
		String expandoAttributes = (String) params.get("expandoAttributes");

		if (Validator.isNotNull(expandoAttributes)) {
			addSearchExpando(searchQuery, searchContext, expandoAttributes);
		}
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:36,代码来源:WorkingUnitIndexer.java

示例7: postProcessSearchQuery

import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
		SearchContext searchContext) throws Exception {

	LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");

	if (params != null) {
		String expandoAttributes = (String) params.get("expandoAttributes");

		if (Validator.isNotNull(expandoAttributes)) {
			addSearchExpando(searchQuery, searchContext, expandoAttributes);
		}
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:15,代码来源:FileAttachIndexer.java

示例8: postProcessSearchQuery

import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
		SearchContext searchContext) throws Exception {

	addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.NOTIFICATIONTEMPLATE_ID, false);
	addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.GROUP_ID, false);
	addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.COMPANY_ID, false);
	addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.USER_NAME, false);
	addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.USER_ID, false);
	addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.CREATE_DATE, false);
	addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.MODIFIED_DATE, false);

	addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.NOTIFICATTION_TYPE, true);
	addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.NOTIFICATION_EMAIL_SUBJECT, true);
	addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.NOTIFICATION_EMAIL_BODY, true);
	addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.NOTIFICATION_TEXT_MESSAGE, true);
	addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.NOTIFICATION_SEND_SMS, true);

	LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");

	if (params != null) {
		String expandoAttributes = (String) params.get("expandoAttributes");

		if (Validator.isNotNull(expandoAttributes)) {
			addSearchExpando(searchQuery, searchContext, expandoAttributes);
		}
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:29,代码来源:NotificationTemplateIndexer.java

示例9: postProcessContextBooleanFilter

import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessContextBooleanFilter(BooleanFilter contextBooleanFilter, SearchContext searchContext)
        throws Exception {
    
    addStatus(contextBooleanFilter, searchContext);

    // from- and until-date

    Date fromDate = GetterUtil.getDate(searchContext.getAttribute("fromDate"), DateFormat.getDateInstance(), null);
    Date untilDate = GetterUtil.getDate(searchContext.getAttribute("untilDate"), DateFormat.getDateInstance(),
            null);

    long max = Long.MAX_VALUE;
    long min = Long.MIN_VALUE;

    if (fromDate != null) {
        min = fromDate.getTime();
    }

    if (untilDate != null) {
        max = untilDate.getTime();
    }

    contextBooleanFilter.addRangeTerm("fromDate_Number_sortable", min, max);
    
    // workPackage

    boolean advancedSearch = GetterUtil.getBoolean(searchContext.getAttribute("advancedSearch"), false);
    String workPackage = (String) searchContext.getAttribute("workPackage");

    if (Validator.isNotNull(workPackage) && advancedSearch) {

        BooleanFilter booleanFilter = new BooleanFilter();

        // Use the sortable index field, since the regular field is
        // analyzed, which means, we can't use hyphens in workpackage
        // names.
        PrefixFilter prefixFilter = new PrefixFilter("workPackage_sortable", workPackage);

        booleanFilter.add(prefixFilter);
        contextBooleanFilter.add(booleanFilter, BooleanClauseOccur.MUST);
    }

}
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:45,代码来源:TaskRecordIndexer.java

示例10: postProcessSearchQuery

import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(
	BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
	SearchContext searchContext)
	throws Exception {

	addSearchTerm(
		searchQuery, searchContext, CommentTerm.COMMENT_ID, false);
	addSearchTerm(searchQuery, searchContext, CommentTerm.GROUP_ID, false);
	addSearchTerm(
		searchQuery, searchContext, CommentTerm.COMPANY_ID, false);
	addSearchTerm(searchQuery, searchContext, CommentTerm.USER_ID, false);
	addSearchTerm(searchQuery, searchContext, CommentTerm.USER_NAME, false);
	addSearchTerm(
		searchQuery, searchContext, CommentTerm.CREATE_DATE, false);
	addSearchTerm(
		searchQuery, searchContext, CommentTerm.MODIFIED_DATE, false);

	addSearchTerm(searchQuery, searchContext, CommentTerm.CLASS_NAME, true);
	addSearchTerm(searchQuery, searchContext, CommentTerm.CLASS_PK, true);
	addSearchTerm(searchQuery, searchContext, CommentTerm.FULL_NAME, true);
	addSearchTerm(searchQuery, searchContext, CommentTerm.EMAIL, true);
	addSearchTerm(searchQuery, searchContext, CommentTerm.PARENT, false);
	addSearchTerm(searchQuery, searchContext, CommentTerm.CONTENT, true);
	addSearchTerm(
		searchQuery, searchContext, CommentTerm.FILE_ENTRY_ID, false);
	addSearchTerm(
		searchQuery, searchContext, CommentTerm.UPVOTE_COUNT, false);
	addSearchTerm(
		searchQuery, searchContext, CommentTerm.USER_HAS_UPVOTED, true);
	addSearchTerm(searchQuery, searchContext, CommentTerm.PINGS, false);
	// addSearchTerm(searchQuery, searchContext,
	// CommentTerm.CREATED_BY_CURRENT_USER, false);

	@SuppressWarnings("unchecked")
	LinkedHashMap<String, Object> params =
		(LinkedHashMap<String, Object>) searchContext.getAttribute(
			"params");

	if (params != null) {
		String expandoAttributes = (String) params.get("expandoAttributes");

		if (Validator.isNotNull(expandoAttributes)) {
			addSearchExpando(searchQuery, searchContext, expandoAttributes);
		}
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:48,代码来源:CommentIndexer.java

示例11: postProcessContextBooleanFilter

import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessContextBooleanFilter(
        BooleanFilter contextBooleanFilter, SearchContext searchContext)
        throws Exception {

    addStatus(contextBooleanFilter, searchContext);

    // id

    String id = (String) searchContext.getAttribute(DataManagerField.ID);

    if (Validator.isNotNull(id)) {
        contextBooleanFilter.addRequiredTerm(DataManagerField.ID, id);
    }

    // timestamp

    long timestamp = GetterUtil.getLong(
            searchContext.getAttribute(DataManagerField.TIMESTAMP));

    if (timestamp > 0) {
        contextBooleanFilter.addRequiredTerm("timestamp_Number_sortable",
                timestamp);
    }

    // from- and until-date

    Date fromDate = GetterUtil.getDate(
            searchContext.getAttribute("fromDate"),
            DateFormat.getDateInstance(), null);
    Date untilDate = GetterUtil.getDate(
            searchContext.getAttribute("untilDate"),
            DateFormat.getDateInstance(), null);

    long max = Long.MAX_VALUE;
    long min = Long.MIN_VALUE;

    if (fromDate != null) {
        min = fromDate.getTime();
    }

    if (untilDate != null) {
        max = untilDate.getTime();
    }

    contextBooleanFilter.addRangeTerm("timestamp_Number_sortable", min,
            max);

}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:50,代码来源:MeasurementIndexer.java

示例12: postProcessFullQuery

import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
protected void postProcessFullQuery(BooleanQuery fullQuery,
        SearchContext searchContext) throws Exception {

    // resolution - 15', 60', 360', 720'

    String range = (String) searchContext.getAttribute("range");

    String[] patterns = new String[] { "*0000", "*1500", "*3000", "*4500" }; // by
                                                                             // default,
                                                                             // filter
                                                                             // timestamps
                                                                             // with
                                                                             // a
                                                                             // 15'
                                                                             // interval

    if ("week".equals(range)) {

        patterns = new String[] { "*0000" }; // 60' interval

    } else if ("month".equals(range)) {

        patterns = new String[] { "*000000", "*060000", "*120000",
                "*180000" }; // 360' interval

    } else if ("year".equals(range)) {

        patterns = new String[] { "*000000", "*120000" }; // 720' interval

    }

    BooleanQuery booleanQuery = new BooleanQueryImpl();

    for (String pattern : patterns) {
        booleanQuery.add(new WildcardQueryImpl("timestamp", pattern),
                BooleanClauseOccur.SHOULD);
    }

    fullQuery.add(booleanQuery, BooleanClauseOccur.MUST);

    super.postProcessFullQuery(fullQuery, searchContext);
}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:44,代码来源:MeasurementIndexer.java


注:本文中的com.liferay.portal.kernel.search.SearchContext.getAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。