本文整理汇总了Java中com.liferay.portal.kernel.search.Indexer.reindex方法的典型用法代码示例。如果您正苦于以下问题:Java Indexer.reindex方法的具体用法?Java Indexer.reindex怎么用?Java Indexer.reindex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.search.Indexer
的用法示例。
在下文中一共展示了Indexer.reindex方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateProcessStepRole
import com.liferay.portal.kernel.search.Indexer; //导入方法依赖的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;
}
示例2: reindexAllIndices
import com.liferay.portal.kernel.search.Indexer; //导入方法依赖的package包/类
protected static void reindexAllIndices(final Class modelClass, final long id) {
Indexer indexer = IndexerRegistryUtil.getIndexer(modelClass);
try {
indexer.reindex(modelClass.getName(), id);
} catch (SearchException e) {
e.printStackTrace();
}
}
示例3: removeServiceProcessRole
import com.liferay.portal.kernel.search.Indexer; //导入方法依赖的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;
}
示例4: removeProcessStepRole
import com.liferay.portal.kernel.search.Indexer; //导入方法依赖的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;
}
示例5: updateDossierAction
import com.liferay.portal.kernel.search.Indexer; //导入方法依赖的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;
}
示例6: _doReceiveKySoRequest
import com.liferay.portal.kernel.search.Indexer; //导入方法依赖的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();
}
}
示例7: lockEmployeeAccount
import com.liferay.portal.kernel.search.Indexer; //导入方法依赖的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;
}
示例8: reindex
import com.liferay.portal.kernel.search.Indexer; //导入方法依赖的package包/类
public void reindex(Data value) throws SearchException {
String className = value.getEntryClassName();
Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(className);
indexer.reindex(className, value.getPrimaryKey());
}
示例9: addApplication
import com.liferay.portal.kernel.search.Indexer; //导入方法依赖的package包/类
public Application addApplication(Application application) throws SystemException {
try {
long applicationID = CounterLocalServiceUtil.increment(Application.class.getName());
_log.debug("addApplication:applicationID: " + applicationID);
_log.debug("application.getCompanyId(): " + application.getCompanyId());
_log.debug("application.getDescription(): " + application.getDescription());
_log.debug("application.getFee(): " + application.getFee());
_log.debug("application.getTargetOS(): " + application.getTargetOS());
_log.debug("application.getTargetCategory(): " + application.getTargetCategory());
_log.debug("application.getLegalDetails(): " + application.getLegalDetails());
_log.debug("application.getDeveloper(): " + application.getDeveloper());
_log.debug("application.getMinTargetOSVersion(): " + application.getMinTargetOSVersion());
_log.debug("application.getName(): " + application.getName());
_log.debug("application.getSize(): " + application.getSize());
_log.debug("application.getUserId(): " + application.getUserId());
_log.debug("application.getVersion(): " + application.getVersion());
_log.debug("application.getVersionInformation(): " + application.getVersionInformation());
Application model = applicationPersistence.create(applicationID);
model.setCompanyId(application.getCompanyId());
model.setCreateDate(new Date());
model.setDescription(application.getDescription());
model.setFee(application.getFee());
model.setLifeCycleStatus(Constants.APPLICATION_STATUS_SUBMITTED);
// model.setLifeCycleStatusString("neu erstellt - warten auf Freigabe");
model.setLogoImageId(application.getLogoImageId());
model.setMinTargetOSVersion(application.getMinTargetOSVersion());
model.setModifiedDate(new Date());
model.setName(application.getName());
model.setSize(application.getSize());
model.setTargetOS(application.getTargetOS());
model.setUserId(application.getUserId());
// model.setVerifiedDate(application.getVerifiedDate());
model.setVersion(application.getVersion());
model.setVersionInformation(application.getVersionInformation());
model.setTargetCategory(application.getTargetCategory());
model.setDeveloper(application.getDeveloper());
model.setFirstPublishingDate(application.getFirstPublishingDate());
model.setLastModifiedDate(application.getLastModifiedDate());
model.setLegalDetails(application.getLegalDetails());
if (application.getUseOpenData() == 1) {
model.setUseOpenData(application.getUseOpenData());
model.setLicense(application.getLicense());
model.setSector(application.getSector());
}
// Indexer
Indexer indexer = IndexerRegistryUtil.getIndexer(Application.class);
indexer.reindex(model);
Application res = applicationPersistence.update(model, true);
_log.debug("getApplicationId: " +res.getApplicationId());
_log.debug("getCompanyId: " +res.getCompanyId());
return res;
} catch (Exception e) {
_log.debug("Exception: " + e.getMessage());
_log.info("application.getCompanyId(): " + application.getCompanyId());
_log.info("application.getDescription(): " + application.getDescription());
_log.info("application.getFee(): " + application.getFee());
_log.info("application.getTargetOS(): " + application.getTargetOS());
_log.info("application.getTargetCategory(): " + application.getTargetCategory());
_log.info("application.getLegalDetails(): " + application.getLegalDetails());
_log.info("application.getDeveloper(): " + application.getDeveloper());
_log.info("application.getMinTargetOSVersion(): " + application.getMinTargetOSVersion());
_log.info("application.getName(): " + application.getName());
_log.info("application.getSize(): " + application.getSize());
_log.info("application.getUserId(): " + application.getUserId());
_log.info("application.getVersion(): " + application.getVersion());
_log.info("application.getVersionInformation(): " + application.getVersionInformation());
e.printStackTrace();
}
return null;
}
示例10: updateApplication
import com.liferay.portal.kernel.search.Indexer; //导入方法依赖的package包/类
public Application updateApplication(Application application, File imageFile) throws SystemException, PortalException {
Application model = applicationPersistence.fetchByPrimaryKey(application.getApplicationId());
model.setCompanyId(application.getCompanyId());
// model.setCreateDate(new Date());
model.setDescription(application.getDescription());
model.setFee(application.getFee());
model.setTargetCategory(application.getTargetCategory());
model.setDeveloper(application.getDeveloper());
model.setFirstPublishingDate(application.getFirstPublishingDate());
model.setLastModifiedDate(application.getLastModifiedDate());
model.setLifeCycleStatus(application.getLifeCycleStatus());
// model.setLifeCycleStatusString("geändert - warten auf Freigabe");
try {
_log.debug("imageFile.getName(): " + imageFile.getName());
byte[] imageBytes = null;
imageBytes = FileUtil.getBytes(imageFile);
if(imageBytes!=null) {
_log.debug("updateApplication::imageBytes.length: " + imageBytes.length);
if (imageBytes.length > 0) {
model.setLogoImageId(counterLocalService.increment());
saveImages(model.getLogoImageId(), imageFile, imageBytes);
} else {
_log.debug("updateApplication::imageBytes.length == 0");
_log.debug("model.getLogoImageId(): "+ model.getLogoImageId());
// model.setLogoImageId(model.getLogoImageId());
}
} else {
_log.debug("updateApplication::imageBytes == null! ");
_log.debug("model.getLogoImageId(): "+ model.getLogoImageId());
// model.setLogoImageId(model.getLogoImageId());
}
} catch (Exception e) {
_log.debug(e.getMessage());
}
_log.debug("model.getLogoImageId(): "+ model.getLogoImageId());
model.setMinTargetOSVersion(application.getMinTargetOSVersion());
model.setModifiedDate(new Date());
model.setName(application.getName());
model.setSize(application.getSize());
model.setTargetOS(application.getTargetOS());
model.setUserId(application.getUserId());
if (application.getLifeCycleStatus() >= Constants.APPLICATION_STATUS_VERIFIED ) {
model.setVerifiedDate(application.getVerifiedDate());
}
model.setVersion(application.getVersion());
model.setVersionInformation(application.getVersionInformation());
model.setLegalDetails(application.getLegalDetails());
// Indexer
Indexer indexer = IndexerRegistryUtil.getIndexer(Application.class);
indexer.reindex(model);
model = applicationPersistence.update(model, true);
_log.debug("model.getLogoImageId(): "+ model.getLogoImageId());
return model;
}
示例11: updateApplicationFileEntryWithOutRelIds
import com.liferay.portal.kernel.search.Indexer; //导入方法依赖的package包/类
private Application updateApplicationFileEntryWithOutRelIds(long newApplicationId, Application application, FileEntry tempImageFileEntry) throws SystemException, PortalException {
Application model = applicationPersistence.fetchByPrimaryKey(newApplicationId);
model.setCompanyId(application.getCompanyId());
// model.setCreateDate(new Date());
model.setDescription(application.getDescription());
model.setFee(application.getFee());
model.setTargetCategory(application.getTargetCategory());
model.setDeveloper(application.getDeveloper());
model.setFirstPublishingDate(application.getFirstPublishingDate());
model.setLastModifiedDate(application.getLastModifiedDate());
// model.setLifeCycleStatus(application.getLifeCycleStatus());
if(tempImageFileEntry!=null) {
model.setLogoImageId(tempImageFileEntry.getFileEntryId());
}
_log.debug("model.getLogoImageId(): "+ model.getLogoImageId());
model.setMinTargetOSVersion(application.getMinTargetOSVersion());
model.setModifiedDate(new Date());
model.setName(application.getName());
model.setSize(application.getSize());
model.setTargetOS(application.getTargetOS());
model.setUserId(application.getUserId());
if (application.getLifeCycleStatus() >= Constants.APPLICATION_STATUS_VERIFIED ) {
model.setVerifiedDate(application.getVerifiedDate());
}
model.setVersion(application.getVersion());
model.setVersionInformation(application.getVersionInformation());
model.setLegalDetails(application.getLegalDetails());
model.setRelatedApplicationId(application.getRelatedApplicationId());
model.setUseOpenData(application.getUseOpenData());
model.setLicense(application.getLicense());
model.setSector(application.getSector());
// Indexer
Indexer indexer = IndexerRegistryUtil.getIndexer(Application.class);
indexer.reindex(model);
Application result = applicationPersistence.update(model, true);
return result;
}
示例12: updateServiceProcessRole
import com.liferay.portal.kernel.search.Indexer; //导入方法依赖的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;
}
示例13: moveDependentsToTrash
import com.liferay.portal.kernel.search.Indexer; //导入方法依赖的package包/类
protected void moveDependentsToTrash(List<Song> songs, long trashEntryId)
throws PortalException {
for (Song song : songs) {
// Entry
if (song.isInTrash()) {
continue;
}
int oldStatus = song.getStatus();
song.setStatus(WorkflowConstants.STATUS_IN_TRASH);
songPersistence.update(song);
// Trash
int status = oldStatus;
if (oldStatus == WorkflowConstants.STATUS_PENDING) {
status = WorkflowConstants.STATUS_DRAFT;
}
if (oldStatus != WorkflowConstants.STATUS_APPROVED) {
trashVersionLocalService.addTrashVersion(
trashEntryId, Song.class.getName(), song.getSongId(),
status, null);
}
// Asset
assetEntryLocalService.updateVisible(
Song.class.getName(), song.getSongId(), false);
// Indexer
Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(
Song.class);
indexer.reindex(song);
}
}
示例14: restoreDependentsFromTrash
import com.liferay.portal.kernel.search.Indexer; //导入方法依赖的package包/类
protected void restoreDependentsFromTrash(
List<Song> songs, long trashEntryId)
throws PortalException {
for (Song song : songs) {
// Song
TrashEntry trashEntry = trashEntryLocalService.fetchEntry(
Song.class.getName(), song.getSongId());
if (trashEntry != null) {
continue;
}
TrashVersion trashVersion = trashVersionLocalService.fetchVersion(
trashEntryId, Song.class.getName(), song.getSongId());
int oldStatus = WorkflowConstants.STATUS_APPROVED;
if (trashVersion != null) {
oldStatus = trashVersion.getStatus();
}
song.setStatus(oldStatus);
songPersistence.update(song);
// Trash
if (trashVersion != null) {
trashVersionLocalService.deleteTrashVersion(trashVersion);
}
// Asset
if (oldStatus == WorkflowConstants.STATUS_APPROVED) {
assetEntryLocalService.updateVisible(
Song.class.getName(), song.getSongId(), true);
}
// Indexer
Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(
Song.class);
indexer.reindex(song);
}
}
示例15: moveSongFromTrash
import com.liferay.portal.kernel.search.Indexer; //导入方法依赖的package包/类
@Override
public Song moveSongFromTrash(long userId, long songId, long albumId)
throws PortalException {
Song song = getSong(songId);
TrashEntry trashEntry = song.getTrashEntry();
if (trashEntry.isTrashEntry(Song.class, songId)) {
restoreSongFromTrash(userId, songId);
}
else {
// Entry
TrashVersion trashVersion =
trashVersionLocalService.fetchVersion(
trashEntry.getEntryId(), Song.class.getName(), songId);
int status = WorkflowConstants.STATUS_APPROVED;
if (trashVersion != null) {
status = trashVersion.getStatus();
}
ServiceContext serviceContext = new ServiceContext();
// Entry
User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date();
song.setModifiedDate(serviceContext.getModifiedDate(now));
song.setStatus(status);
song.setStatusByUserId(user.getUserId());
song.setStatusByUserName(user.getFullName());
song.setStatusDate(serviceContext.getModifiedDate(now));
songPersistence.update(song);
// Asset
assetEntryLocalService.updateVisible(
Song.class.getName(), song.getSongId(), false);
// Indexer
Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(
Song.class);
indexer.reindex(song);
// Trash
if (trashVersion != null) {
trashVersionLocalService.deleteTrashVersion(trashVersion);
}
}
return songLocalService.moveSong(songId, albumId);
}