You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2010/09/10 10:53:19 UTC
svn commit: r995704 - in
/ofbiz/trunk/applications/content/src/org/ofbiz/content:
content/ContentWorker.java search/SearchEvents.java
search/SearchServices.java search/SearchWorker.java
Author: lektran
Date: Fri Sep 10 08:53:18 2010
New Revision: 995704
URL: http://svn.apache.org/viewvc?rev=995704&view=rev
Log:
Generics markup, no functional changes
Modified:
ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchEvents.java
ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchServices.java
ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchWorker.java
Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java?rev=995704&r1=995703&r2=995704&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java Fri Sep 10 08:53:18 2010
@@ -747,7 +747,7 @@ public class ContentWorker implements or
return isWhen;
}
- public static List getAssociatedContent(GenericValue currentContent, String linkDir, List assocTypes, List contentTypes, String fromDate, String thruDate)
+ public static List<GenericValue> getAssociatedContent(GenericValue currentContent, String linkDir, List assocTypes, List contentTypes, String fromDate, String thruDate)
throws GenericEntityException {
Delegator delegator = currentContent.getDelegator();
Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchEvents.java?rev=995704&r1=995703&r2=995704&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchEvents.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchEvents.java Fri Sep 10 08:53:18 2010
@@ -28,6 +28,7 @@ import javolution.util.FastMap;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
+import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.GenericValue;
@@ -46,13 +47,13 @@ public class SearchEvents {
public static String indexTree(HttpServletRequest request, HttpServletResponse response) {
- Map result;
- Map serviceInMap = FastMap.newInstance();
+ Map<String, Object> result;
+ Map<String, Object> serviceInMap = FastMap.newInstance();
HttpSession session = request.getSession();
GenericValue userLogin = (GenericValue)session.getAttribute("userLogin");
serviceInMap.put("userLogin", userLogin);
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
- Map paramMap = UtilHttp.getParameterMap(request);
+ Map<String, Object> paramMap = UtilHttp.getParameterMap(request);
String siteId = (String)paramMap.get("contentId");
serviceInMap.put("contentId", siteId);
try {
@@ -67,7 +68,7 @@ public class SearchEvents {
if (Debug.infoOn()) Debug.logInfo("errMsg:" + errMsg, module);
if (Debug.infoOn()) Debug.logInfo("result:" + result, module);
if (UtilValidate.isEmpty(errMsg)) {
- List badIndexList = (List)result.get("badIndexList");
+ List<String> badIndexList = UtilGenerics.checkList(result.get("badIndexList"));
if (Debug.infoOn()) Debug.logInfo("badIndexList:" + badIndexList, module);
String badIndexMsg = StringUtil.join(badIndexList, "\n") + badIndexList.size() + " entities not indexed";
Integer goodIndexCount = (Integer)result.get("goodIndexCount");
Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchServices.java?rev=995704&r1=995703&r2=995704&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchServices.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchServices.java Fri Sep 10 08:53:18 2010
@@ -44,14 +44,14 @@ public class SearchServices {
String siteId = (String) context.get("contentId");
String path = (String) context.get("path");
- Map envContext = FastMap.newInstance();
+ Map<String, Object> envContext = FastMap.newInstance();
if (Debug.infoOn()) Debug.logInfo("in indexTree, siteId:" + siteId, module);
- List badIndexList = FastList.newInstance();
+ List<String> badIndexList = FastList.newInstance();
envContext.put("badIndexList", badIndexList);
envContext.put("goodIndexCount", Integer.valueOf(0));
- Map results;
+ Map<String, Object> results;
try {
results = SearchWorker.indexTree(dispatcher, delegator, siteId, envContext, path);
} catch (Exception e) {
Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchWorker.java?rev=995704&r1=995703&r2=995704&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchWorker.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchWorker.java Fri Sep 10 08:53:18 2010
@@ -28,6 +28,7 @@ import javolution.util.FastMap;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilDateTime;
+import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
@@ -52,25 +53,25 @@ public class SearchWorker {
public static final String module = SearchWorker.class.getName();
- public static Map indexTree(LocalDispatcher dispatcher, Delegator delegator, String siteId, Map context, String path) throws Exception {
+ public static Map<String, Object> indexTree(LocalDispatcher dispatcher, Delegator delegator, String siteId, Map<String, Object> context, String path) throws Exception {
- Map results = FastMap.newInstance();
+ Map<String, Object> results = FastMap.newInstance();
GenericValue content = delegator.makeValue("Content", UtilMisc.toMap("contentId", siteId));
if (Debug.infoOn()) Debug.logInfo("in indexTree, siteId:" + siteId + " content:" + content, module);
- List siteList = ContentWorker.getAssociatedContent(content, "From", UtilMisc.toList("SUBSITE", "PUBLISH_LINK"), null, UtilDateTime.nowTimestamp().toString(), null);
+ List<GenericValue> siteList = ContentWorker.getAssociatedContent(content, "From", UtilMisc.toList("SUBSITE", "PUBLISH_LINK"), null, UtilDateTime.nowTimestamp().toString(), null);
//if (Debug.infoOn()) Debug.logInfo("in indexTree, siteList:" + siteList, module);
if (siteList != null) {
- Iterator iter = siteList.iterator();
+ Iterator<GenericValue> iter = siteList.iterator();
while (iter.hasNext()) {
- GenericValue siteContent = (GenericValue)iter.next();
+ GenericValue siteContent = iter.next();
String siteContentId = siteContent.getString("contentId");
- List subContentList = ContentWorker.getAssociatedContent(siteContent, "From", UtilMisc.toList("SUBSITE", "PUBLISH_LINK", "SUB_CONTENT"), null, UtilDateTime.nowTimestamp().toString(), null);
+ List<GenericValue> subContentList = ContentWorker.getAssociatedContent(siteContent, "From", UtilMisc.toList("SUBSITE", "PUBLISH_LINK", "SUB_CONTENT"), null, UtilDateTime.nowTimestamp().toString(), null);
//if (Debug.infoOn()) Debug.logInfo("in indexTree, subContentList:" + subContentList, module);
if (subContentList != null) {
- List contentIdList = FastList.newInstance();
- Iterator iter2 = subContentList.iterator();
+ List<String> contentIdList = FastList.newInstance();
+ Iterator<GenericValue> iter2 = subContentList.iterator();
while (iter2.hasNext()) {
- GenericValue subContent = (GenericValue)iter2.next();
+ GenericValue subContent = iter2.next();
contentIdList.add(subContent.getString("contentId"));
}
//if (Debug.infoOn()) Debug.logInfo("in indexTree, contentIdList:" + contentIdList, module);
@@ -79,12 +80,12 @@ public class SearchWorker {
String subSiteId = siteContent.getString("contentId");
indexTree(dispatcher, delegator, subSiteId, context, path);
} else {
- List badIndexList = (List)context.get("badIndexList");
+ List<String> badIndexList = UtilGenerics.checkList(context.get("badIndexList"));
badIndexList.add(siteContentId + " had no sub-entities.");
}
}
} else {
- List badIndexList = (List)context.get("badIndexList");
+ List<String> badIndexList = UtilGenerics.checkList(context.get("badIndexList"));
badIndexList.add(siteId + " had no sub-entities.");
}
results.put("badIndexList", context.get("badIndexList"));
@@ -93,19 +94,19 @@ public class SearchWorker {
return results;
}
- public static void indexContentList(List idList, Delegator delegator, LocalDispatcher dispatcher, Map context) throws Exception {
+ public static void indexContentList(List<String> idList, Delegator delegator, LocalDispatcher dispatcher, Map<String, Object> context) throws Exception {
String path = null;
indexContentList(dispatcher, delegator, context, idList, path);
}
- public static void indexContentList(LocalDispatcher dispatcher, Delegator delegator, Map context, List idList, String path) throws Exception {
+ public static void indexContentList(LocalDispatcher dispatcher, Delegator delegator, Map<String, Object> context, List<String> idList, String path) throws Exception {
String indexAllPath = getIndexPath(path);
if (Debug.infoOn())
Debug.logInfo("in indexContent, indexAllPath:" + indexAllPath, module);
GenericValue content = null;
// Delete existing documents
- Iterator iter = null;
- List contentList = null;
+ Iterator<String> iter = null;
+ List<GenericValue> contentList = null;
IndexReader reader = null;
try {
reader = IndexReader.open(indexAllPath);
@@ -117,7 +118,7 @@ public class SearchWorker {
contentList = FastList.newInstance();
iter = idList.iterator();
while (iter.hasNext()) {
- String id = (String) iter.next();
+ String id = iter.next();
if (Debug.infoOn())
Debug.logInfo("in indexContent, id:" + id, module);
try {
@@ -145,9 +146,9 @@ public class SearchWorker {
}
//if (Debug.infoOn()) Debug.logInfo("in indexContent, writer:" +
// writer, module);
- iter = contentList.iterator();
- while (iter.hasNext()) {
- content = (GenericValue) iter.next();
+ Iterator<GenericValue> contentListIter = contentList.iterator();
+ while (contentListIter.hasNext()) {
+ content = contentListIter.next();
indexContent(dispatcher, delegator, context, content, writer);
}
writer.optimize();
@@ -185,7 +186,7 @@ public class SearchWorker {
}
- public static void indexContent(LocalDispatcher dispatcher, Delegator delegator, Map context, GenericValue content, String path) throws Exception {
+ public static void indexContent(LocalDispatcher dispatcher, Delegator delegator, Map<String, Object> context, GenericValue content, String path) throws Exception {
String indexAllPath = getIndexPath(path);
IndexWriter writer = null;
try {
@@ -201,7 +202,7 @@ public class SearchWorker {
writer.close();
}
- public static void indexContent(LocalDispatcher dispatcher, Delegator delegator, Map context, GenericValue content, IndexWriter writer) throws Exception {
+ public static void indexContent(LocalDispatcher dispatcher, Delegator delegator, Map<String, Object> context, GenericValue content, IndexWriter writer) throws Exception {
Document doc = ContentDocument.Document(content, context, dispatcher);
//if (Debug.infoOn()) Debug.logInfo("in indexContent, content:" + content, module);
if (doc != null) {
@@ -220,12 +221,12 @@ public class SearchWorker {
}
- public static void indexDataResource(Delegator delegator, Map context, String id) throws Exception {
+ public static void indexDataResource(Delegator delegator, Map<String, Object> context, String id) throws Exception {
String path = null;
indexDataResource(delegator, context, id, path);
}
- public static void indexDataResource(Delegator delegator, Map context, String id, String path) throws Exception {
+ public static void indexDataResource(Delegator delegator, Map<String, Object> context, String id, String path) throws Exception {
String indexAllPath = getIndexPath(path);
IndexWriter writer = null;
try {
@@ -239,7 +240,7 @@ public class SearchWorker {
}
- public static void indexDataResource(Delegator delegator, Map context, String id, IndexWriter writer) throws Exception {
+ public static void indexDataResource(Delegator delegator, Map<String, Object> context, String id, IndexWriter writer) throws Exception {
Document doc = DataResourceDocument.Document(id, delegator, context);
writer.addDocument(doc);
}