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


Java IndexerRegistryUtil.nullSafeGetIndexer方法代码示例

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


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

示例1: searchLucene

import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入方法依赖的package包/类
public Hits searchLucene(LinkedHashMap<String, Object> params, Sort[] sorts, int start, int end,
		SearchContext searchContext) throws ParseException, SearchException {
	String keywords = (String) params.get(Field.KEYWORD_SEARCH);
	String groupId = (String) params.get(Field.GROUP_ID);

	Indexer<Registration> indexer = IndexerRegistryUtil.nullSafeGetIndexer(Registration.class);

	searchContext.addFullQueryEntryClassName(CLASS_NAME);
	searchContext.setEntryClassNames(new String[] { CLASS_NAME });
	searchContext.setAttribute("paginationType", "regular");
	searchContext.setLike(true);
	searchContext.setStart(start);
	searchContext.setEnd(end);
	searchContext.setAndSearch(true);
	searchContext.setSorts(sorts);

	BooleanQuery booleanQuery = null;

	if (Validator.isNotNull(keywords)) {
		booleanQuery = BooleanQueryFactoryUtil.create(searchContext);
	} else {
		booleanQuery = indexer.getFullQuery(searchContext);
	}

	if (Validator.isNotNull(groupId)) {
		MultiMatchQuery query = new MultiMatchQuery(groupId);

		query.addFields(Field.GROUP_ID);

		booleanQuery.add(query, BooleanClauseOccur.MUST);
	}


	booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, CLASS_NAME);

	return IndexSearcherHelperUtil.search(searchContext, booleanQuery);
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:38,代码来源:RegistrationLogLocalServiceImpl.java

示例2: countLucense

import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入方法依赖的package包/类
public long countLucense(LinkedHashMap<String, Object> params, Sort[] sorts, int start, int end,
		SearchContext searchContext) throws ParseException, SearchException {
	String keywords = (String) params.get(Field.KEYWORD_SEARCH);
	String groupId = (String) params.get(Field.GROUP_ID);

	Indexer<Registration> indexer = IndexerRegistryUtil.nullSafeGetIndexer(Registration.class);

	searchContext.addFullQueryEntryClassName(CLASS_NAME);
	searchContext.setEntryClassNames(new String[] { CLASS_NAME });
	searchContext.setAttribute("paginationType", "regular");
	searchContext.setLike(true);
	searchContext.setAndSearch(true);

	BooleanQuery booleanQuery = null;

	if (Validator.isNotNull(keywords)) {
		booleanQuery = BooleanQueryFactoryUtil.create(searchContext);
	} else {
		booleanQuery = indexer.getFullQuery(searchContext);
	}

	if (Validator.isNotNull(groupId)) {
		MultiMatchQuery query = new MultiMatchQuery(groupId);

		query.addFields(Field.GROUP_ID);

		booleanQuery.add(query, BooleanClauseOccur.MUST);
	}

	booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, CLASS_NAME);

	return IndexSearcherHelperUtil.searchCount(searchContext, booleanQuery);
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:34,代码来源:RegistrationLogLocalServiceImpl.java

示例3: updateProcessStepRole

import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入方法依赖的package包/类
public ProcessStepRole updateProcessStepRole(long processStepId, long roleId, boolean moderator, String condition) {
	ProcessStepRolePK pk = new ProcessStepRolePK(processStepId, roleId);

	ProcessStepRole processStepRole = processStepRolePersistence.fetchByPrimaryKey(pk);

	if (Validator.isNull(processStepRole)) {
		processStepRole = processStepRolePersistence.create(pk);

		processStepRole.setModerator(moderator);
		processStepRole.setCondition(condition);
	} else {
		processStepRole = processStepRolePersistence.fetchByPrimaryKey(pk);
		
		processStepRole.setModerator(moderator);
		processStepRole.setCondition(condition);
	}

	processStepRolePersistence.update(processStepRole);

	// Update index

	Indexer<ProcessStep> indexer = IndexerRegistryUtil.nullSafeGetIndexer(ProcessStep.class);

	ProcessStep processStep = processStepPersistence.fetchByPrimaryKey(processStepId);

	try {
		indexer.reindex(processStep);
	} catch (SearchException e) {
		e.printStackTrace();
	}

	return processStepRole;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:34,代码来源:ProcessStepRoleLocalServiceImpl.java

示例4: countLuceneSearchEngine

import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入方法依赖的package包/类
public long countLuceneSearchEngine(LinkedHashMap<String, Object> params,
		SearchContext searchContext) throws ParseException, SearchException {
	// TODO
	MultiMatchQuery query = null;
	String keywords = (String) params.get("keywords");
	String groupId = (String) params.get("groupId");
	String userId = (String) params.get("userId");
	Indexer<OfficeSite> indexer = IndexerRegistryUtil.nullSafeGetIndexer(OfficeSite.class);

	searchContext.addFullQueryEntryClassName(OfficeSite.class.getName());
	searchContext.setEntryClassNames(new String[] { OfficeSite.class.getName() });
	searchContext.setAttribute("paginationType", "regular");
	searchContext.setLike(true);
	searchContext.setAndSearch(true);

	BooleanQuery booleanQuery = null;

	booleanQuery = Validator.isNotNull((String) keywords)
			? BooleanQueryFactoryUtil.create((SearchContext) searchContext) : indexer.getFullQuery(searchContext);

	if (Validator.isNotNull(groupId)) {
		query = new MultiMatchQuery(groupId);

		query.addFields(OfficeSiteTerm.GROUP_ID);

		booleanQuery.add(query, BooleanClauseOccur.MUST);
	}

	if (Validator.isNotNull(userId)) {
		query = new MultiMatchQuery(userId);

		query.addFields(OfficeSiteTerm.USER_ID);

		booleanQuery.add(query, BooleanClauseOccur.MUST);
	}

	booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, OfficeSite.class.getName());

	return IndexSearcherHelperUtil.searchCount(searchContext, booleanQuery);
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:41,代码来源:OfficeSiteLocalServiceImpl.java

示例5: delete

import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入方法依赖的package包/类
public void delete(Data value) throws SearchException {
	Object uid = value.get(Field.UID);

	if (uid == null) {
		return;
	}

	String className = value.getEntryClassName();
	Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(className);

	indexer.delete(value.getCompanyId(), uid.toString());
}
 
开发者ID:jorgediaz-lr,项目名称:index-checker,代码行数:13,代码来源:IndexSearchHelper.java

示例6: removeServiceProcessRole

import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入方法依赖的package包/类
public ServiceProcessRole removeServiceProcessRole(long serviceProcessId, long roleId) {
	
	ServiceProcessRolePK pk = new ServiceProcessRolePK(serviceProcessId, roleId);

	ServiceProcessRole serviceProcessRole = serviceProcessRolePersistence.fetchByPrimaryKey(pk);
	
	serviceProcessRolePersistence.remove(serviceProcessRole);
	
	//Update Index
	Indexer<ServiceProcess> indexer = IndexerRegistryUtil.nullSafeGetIndexer(ServiceProcess.class);
	
	ServiceProcess serviceProcess = serviceProcessPersistence.fetchByPrimaryKey(serviceProcessId);
	
	try {
		indexer.reindex(serviceProcess);
	} catch (SearchException e) {
		e.printStackTrace();
	}
	
	return serviceProcessRole;

}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:23,代码来源:ServiceProcessRoleLocalServiceImpl.java

示例7: removeProcessStepRole

import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入方法依赖的package包/类
public ProcessStepRole removeProcessStepRole(long processStepId, long roleId) {

		ProcessStepRolePK pk = new ProcessStepRolePK(processStepId, roleId);

		ProcessStepRole processStepRole = processStepRolePersistence.fetchByPrimaryKey(pk);

		processStepRolePersistence.remove(processStepRole);

		// Update index

		Indexer<ProcessStep> indexer = IndexerRegistryUtil.nullSafeGetIndexer(ProcessStep.class);

		ProcessStep processStep = processStepPersistence.fetchByPrimaryKey(processStepId);

		try {
			indexer.reindex(processStep);
		} catch (SearchException e) {
			e.printStackTrace();
		}

		return processStepRole;

	}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:24,代码来源:ProcessStepRoleLocalServiceImpl.java

示例8: updateDossierAction

import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入方法依赖的package包/类
@Indexable(type = IndexableType.REINDEX)
public DossierAction updateDossierAction(long groupId, long dossierActionId, long dossierId, long serviceProcessId,
		long previousActionId, String actionCode, String actionUser, String actionName, String actionNote,
		int actionOverdue, String syncActionCode, boolean pending, boolean rollbackable, String stepCode,
		String stepName, Date dueDate, long nextActionId, String payload, String stepInstruction,
		ServiceContext context) throws PortalException {

	validateUpdateAction(groupId, dossierActionId, dossierId, serviceProcessId, previousActionId, actionCode,
			actionUser, actionName, actionNote, actionOverdue, syncActionCode, pending, rollbackable, stepCode,
			stepName, dueDate, nextActionId, payload, stepInstruction);

	DossierAction object = null;
	long userId = 0l;

	String fullName = StringPool.BLANK;

	Date now = new Date();

	if (context.getUserId() > 0) {
		User userAction = userLocalService.getUser(context.getUserId());

		userId = userAction.getUserId();
		fullName = userAction.getFullName();

	}

	if (dossierActionId == 0) {
		dossierActionId = counterLocalService.increment(DossierAction.class.getName());

		object = dossierActionPersistence.create(dossierActionId);

		// Add audit fields
		object.setCompanyId(context.getCompanyId());
		object.setGroupId(groupId);
		object.setCreateDate(now);
		object.setModifiedDate(now);
		object.setUserId(userId);
		object.setUserName(fullName);

		object.setDossierId(dossierId);
		object.setServiceProcessId(serviceProcessId);
		object.setPreviousActionId(previousActionId);
		object.setActionCode(actionCode);
		object.setActionUser(actionUser);
		object.setActionName(actionName);
		object.setActionNote(actionNote);
		object.setActionOverdue(actionOverdue);
		object.setSyncActionCode(syncActionCode);
		object.setPending(pending);
		object.setRollbackable(rollbackable);
		object.setStepCode(stepCode);
		object.setStepName(stepName);
		object.setDueDate(dueDate);
		object.setNextActionId(nextActionId);
		object.setPayload(payload);
		object.setStepInstruction(stepInstruction);

		// Add DossierActionId to Dossier

		// TODO add Indexer for Dossier after update DossierAction
		Dossier dossier = dossierPersistence.fetchByPrimaryKey(dossierId);
		dossier.setDossierActionId(dossierActionId);
		dossierPersistence.update(dossier);

		Indexer<Dossier> indexer = IndexerRegistryUtil.nullSafeGetIndexer(Dossier.class);

		try {
			indexer.reindex(dossier);
		} catch (SearchException e) {
			e.printStackTrace();
		}
		
		
	} else {

	}

	dossierActionPersistence.update(object);

	return object;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:82,代码来源:DossierActionLocalServiceImpl.java

示例9: _doReceiveKySoRequest

import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入方法依赖的package包/类
private void _doReceiveKySoRequest(Message message) {
	
	try {
		
		JSONObject msgData = (JSONObject) message.get("msgToEngine");
		
		long dossierFileId = msgData.getLong("dossierFileId");
		
		DossierFile dossierFile = DossierFileLocalServiceUtil.fetchDossierFile(dossierFileId);
		
		dossierFile.setIsNew(true);
		
		DossierFileLocalServiceUtil.updateDossierFile(dossierFile);
		
		Indexer<DossierFile> indexer = IndexerRegistryUtil.nullSafeGetIndexer(DossierFile.class);
		
		indexer.reindex(dossierFile);
		
	} catch (SearchException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:24,代码来源:Engine.java

示例10: luceneSearchEngine

import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入方法依赖的package包/类
public Hits luceneSearchEngine(LinkedHashMap<String, Object> params, Sort[] sorts, int start, int end,
		SearchContext searchContext) throws ParseException, SearchException {
	// TODO
	MultiMatchQuery query = null;
	String keywords = (String) params.get("keywords");
	String groupId = (String) params.get("groupId");
	String userId = (String) params.get("userId");
	Indexer<OfficeSite> indexer = IndexerRegistryUtil.nullSafeGetIndexer(OfficeSite.class);

	searchContext.addFullQueryEntryClassName(OfficeSite.class.getName());
	searchContext.setEntryClassNames(new String[] { OfficeSite.class.getName() });
	searchContext.setAttribute("paginationType", "regular");
	searchContext.setLike(true);
	searchContext.setStart(start);
	searchContext.setEnd(end);
	searchContext.setAndSearch(true);
	searchContext.setSorts(sorts);

	BooleanQuery booleanQuery = null;

	booleanQuery = Validator.isNotNull((String) keywords)
			? BooleanQueryFactoryUtil.create((SearchContext) searchContext) : indexer.getFullQuery(searchContext);

	if (Validator.isNotNull(groupId)) {
		query = new MultiMatchQuery(groupId);

		query.addFields(OfficeSiteTerm.GROUP_ID);

		booleanQuery.add(query, BooleanClauseOccur.MUST);
	}

	if (Validator.isNotNull(userId)) {
		query = new MultiMatchQuery(userId);

		query.addFields(OfficeSiteTerm.USER_ID);

		booleanQuery.add(query, BooleanClauseOccur.MUST);
	}

	booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, OfficeSite.class.getName());

	return IndexSearcherHelperUtil.search(searchContext, booleanQuery);
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:44,代码来源:OfficeSiteLocalServiceImpl.java

示例11: lockEmployeeAccount

import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入方法依赖的package包/类
@Override
public JSONObject lockEmployeeAccount(
	long userId, long companyId, long groupId, long id, boolean locked,
	ServiceContext serviceContext)
	throws PortalException {

	JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

	// Employee employee = EmployeeLocalServiceUtil.fetchEmployee(id);
	Employee employee = EmployeeLocalServiceUtil.getEmployee(id);

	if (Validator.isNotNull(employee) && employee.getMappingUserId() < 0) {

		throw new NoSuchUserException();
	}
	else {
		User user =
			UserLocalServiceUtil.fetchUser(employee.getMappingUserId());

		if (locked) {
			user.setStatus(WorkflowConstants.STATUS_INACTIVE);
		}
		else {
			user.setStatus(WorkflowConstants.STATUS_APPROVED);
		}

		UserLocalServiceUtil.updateUser(user);

		Indexer<User> indexer =
			IndexerRegistryUtil.nullSafeGetIndexer(User.class);

		indexer.reindex(user);

		jsonObject.put("screenName", user.getScreenName());
		jsonObject.put("email", user.getEmailAddress());
		jsonObject.put("exist", true);

		JSONObject payLoad = JSONFactoryUtil.createJSONObject();

		payLoad.put("USERNAME", user.getScreenName());
		payLoad.put("USEREMAIL", user.getEmailAddress());
		payLoad.put(
				"USERSTATUS",
				LanguageUtil.get(locale, "user-status-" + user.getStatus()));

		NotificationQueueLocalServiceUtil.addNotificationQueue(
			user.getUserId(), groupId, Constants.USER_02,
			User.class.getName(), String.valueOf(user.getUserId()),
			payLoad.toJSONString(), "SYSTEM", user.getFullName(),
			employee.getMappingUserId(), employee.getEmail(),
			employee.getTelNo(), new Date(), null, serviceContext);

	}

	return jsonObject;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:57,代码来源:EmployeeActions.java

示例12: reindex

import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入方法依赖的package包/类
public void reindex(Data value) throws SearchException {
	String className = value.getEntryClassName();
	Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(className);

	indexer.reindex(className, value.getPrimaryKey());
}
 
开发者ID:jorgediaz-lr,项目名称:index-checker,代码行数:7,代码来源:IndexSearchHelper.java

示例13: updateServiceProcessRole

import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入方法依赖的package包/类
public ServiceProcessRole updateServiceProcessRole(long groupId, long serviceProcessId, long roleId,
		boolean moderator, String condition) {

	ServiceProcessRole serviceProcessRole = null;
	
	ServiceProcessRolePK pk = new ServiceProcessRolePK(serviceProcessId, roleId);
	
	serviceProcessRole = serviceProcessRolePersistence.fetchByPrimaryKey(pk);
	
	if (Validator.isNotNull(serviceProcessRole)) {
		
		serviceProcessRole.setModerator(moderator);
		serviceProcessRole.setCondition(condition);
	} else {
		serviceProcessRole = serviceProcessRolePersistence.create(pk);
		
		serviceProcessRole.setModerator(moderator);
		serviceProcessRole.setCondition(condition);
		
	}
	
	serviceProcessRolePersistence.update(serviceProcessRole);
	
	//Add to Index
	
	Indexer<ServiceProcess> indexer = IndexerRegistryUtil.nullSafeGetIndexer(ServiceProcess.class);
	
	ServiceProcess serviceProcess = serviceProcessPersistence.fetchByPrimaryKey(serviceProcessId);
	
	try {
		indexer.reindex(serviceProcess);
	} catch (SearchException e) {
		e.printStackTrace();
	}

	return serviceProcessRole;
	
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:39,代码来源:ServiceProcessRoleLocalServiceImpl.java

示例14: removeDossierTag

import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入方法依赖的package包/类
/** 
 * Xóa bỏ thông tin một tag hồ sơ
 * 
 * Version: OEP 2.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  21-September-2015  trungdk    Xóa bỏ thông tin tag hồ sơ
 * @param dossierProc tag hồ sơ được xóa
 * @return
 */
public void removeDossierTag(DossierTag dossierTag) throws PortalException, SystemException {
	dossierTagPersistence.remove(dossierTag);
	Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(DossierTag.class);
	indexer.delete(dossierTag);
	resourceLocalService.deleteResource(dossierTag.getCompanyId(), DossierTag.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, dossierTag.getDossierTagId());
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:19,代码来源:DossierTagLocalServiceImpl.java

示例15: removeStatisticByAgency

import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入方法依赖的package包/类
/** 
 * Xóa bỏ thông tin một thống kê theo ngày
 * 
 * Version: OEP 2.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  21-September-2015  trungdk    Xóa bỏ thông tin thống kê theo ngày
 * @param statisticByAgency thống kê theo ngày được xóa
 * @return
 */
public void removeStatisticByAgency(StatisticByAgency statisticByAgency) throws PortalException, SystemException {
	statisticByAgencyPersistence.remove(statisticByAgency);
	Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(StatisticByAgency.class);
	indexer.delete(statisticByAgency);
	resourceLocalService.deleteResource(statisticByAgency.getCompanyId(), StatisticByAgency.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, statisticByAgency.getStatisticByAgencyId());
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:19,代码来源:StatisticByAgencyLocalServiceImpl.java


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