001
014
015 package com.liferay.portlet.exportimport.lar;
016
017 import com.liferay.portal.kernel.search.BaseIndexer;
018 import com.liferay.portal.kernel.search.Document;
019 import com.liferay.portal.kernel.search.Indexer;
020 import com.liferay.portal.kernel.search.IndexerRegistryUtil;
021 import com.liferay.portal.kernel.search.Summary;
022 import com.liferay.portal.kernel.spring.osgi.OSGiBeanProperties;
023 import com.liferay.portal.kernel.util.GetterUtil;
024
025 import java.util.Locale;
026 import java.util.Map;
027
028 import javax.portlet.PortletRequest;
029 import javax.portlet.PortletResponse;
030
031
034 @OSGiBeanProperties
035 public class PortletDataContextIndexer extends BaseIndexer {
036
037 public static final String CLASS_NAME = PortletDataContext.class.getName();
038
039 @Override
040 public String getClassName() {
041 return CLASS_NAME;
042 }
043
044 @Override
045 protected void doDelete(Object obj) throws Exception {
046 }
047
048 @Override
049 protected Document doGetDocument(Object obj) throws Exception {
050 return null;
051 }
052
053 @Override
054 protected Summary doGetSummary(
055 Document document, Locale locale, String snippet,
056 PortletRequest portletRequest, PortletResponse portletResponse)
057 throws Exception {
058
059 return null;
060 }
061
062 @Override
063 protected void doReindex(Object obj) throws Exception {
064 PortletDataContext portletDataContext = (PortletDataContext)obj;
065
066 Map<String, Map<?, ?>> newPrimaryKeysMaps =
067 portletDataContext.getNewPrimaryKeysMaps();
068
069 for (Map.Entry<String, Map<?, ?>> entry :
070 newPrimaryKeysMaps.entrySet()) {
071
072 String className = entry.getKey();
073
074 Indexer indexer = IndexerRegistryUtil.getIndexer(className);
075
076 if (indexer == null) {
077 continue;
078 }
079
080 Map<?, ?> newPrimaryKeysMap = entry.getValue();
081
082 for (Object object : newPrimaryKeysMap.values()) {
083 long classPK = GetterUtil.getLong(object);
084
085 if (classPK > 0) {
086 indexer.reindex(className, classPK);
087 }
088 }
089 }
090 }
091
092 @Override
093 protected void doReindex(String className, long classPK) throws Exception {
094 }
095
096 @Override
097 protected void doReindex(String[] ids) throws Exception {
098 }
099
100 }