[MMBASE CVS] contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search SearchServiceMMBaseImpl.java RedirectServlet.java

2009-02-13 Thread Nico Klasens
Update of 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
In directory 
james.mmbase.org:/tmp/cvs-serv27357/cmsc/search/src/java/com/finalist/cmsc/services/search

Modified Files:
  Tag: b1_5
SearchServiceMMBaseImpl.java RedirectServlet.java 
Log Message:
CMSC-1289 Create a readonly instance of the CMSc
Movinf ServerUtil to utilities


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
See also: http://www.mmbase.org/jira/browse/CMSC-1289


Index: SearchServiceMMBaseImpl.java
===
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search/SearchServiceMMBaseImpl.java,v
retrieving revision 1.28.2.1
retrieving revision 1.28.2.2
diff -u -b -r1.28.2.1 -r1.28.2.2
--- SearchServiceMMBaseImpl.java29 Dec 2008 13:48:30 -  1.28.2.1
+++ SearchServiceMMBaseImpl.java13 Feb 2009 21:26:27 -  1.28.2.2
@@ -26,6 +26,7 @@
 import com.finalist.cmsc.repository.RepositoryUtil;
 import com.finalist.cmsc.services.Properties;
 import com.finalist.cmsc.services.sitemanagement.SiteManagement;
+import com.finalist.cmsc.util.ServerUtil;
 
 public class SearchServiceMMBaseImpl extends SearchService {
 


Index: RedirectServlet.java
===
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search/RedirectServlet.java,v
retrieving revision 1.14.2.2
retrieving revision 1.14.2.3
diff -u -b -r1.14.2.2 -r1.14.2.3
--- RedirectServlet.java4 Feb 2009 17:02:13 -   1.14.2.2
+++ RedirectServlet.java13 Feb 2009 21:26:27 -  1.14.2.3
@@ -21,11 +21,11 @@
 import com.finalist.cmsc.beans.om.NavigationItem;
 import com.finalist.cmsc.mmbase.ResourcesUtil;
 import com.finalist.cmsc.navigation.PagesUtil;
-import com.finalist.cmsc.navigation.ServerUtil;
 import com.finalist.cmsc.portalImpl.PortalConstants;
 import com.finalist.cmsc.repository.ContentElementUtil;
 import com.finalist.cmsc.services.sitemanagement.SiteManagement;
 import com.finalist.cmsc.util.HttpUtil;
+import com.finalist.cmsc.util.ServerUtil;
 import com.finalist.pluto.portalImpl.core.PortalEnvironment;
 import com.finalist.pluto.portalImpl.core.PortalURL;
 
___
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs


[MMBASE CVS] contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search SearchServiceMMBaseImpl.java RedirectServlet.java

2008-12-29 Thread Nico Klasens
Update of 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
In directory 
james.mmbase.org:/tmp/cvs-serv13581/cmsc/search/src/java/com/finalist/cmsc/services/search

Modified Files:
  Tag: b1_4
SearchServiceMMBaseImpl.java RedirectServlet.java 
Log Message:
CMSC-1207 CollectionChannels are not always processed in the SearchService


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
See also: http://www.mmbase.org/jira/browse/CMSC-1207


Index: SearchServiceMMBaseImpl.java
===
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search/SearchServiceMMBaseImpl.java,v
retrieving revision 1.22.2.4
retrieving revision 1.22.2.5
diff -u -b -r1.22.2.4 -r1.22.2.5
--- SearchServiceMMBaseImpl.java15 Apr 2008 08:08:13 -  1.22.2.4
+++ SearchServiceMMBaseImpl.java29 Dec 2008 13:49:19 -  1.22.2.5
@@ -48,6 +48,7 @@
 
protected Map priorities = new HashMap();
protected boolean usePosition;
+   protected boolean preferContentChannels;
 
 
@Override
@@ -74,6 +75,7 @@
   }
 
   usePosition = aProperties.getBoolean("filter.usePosition", false);
+  preferContentChannels = 
aProperties.getBoolean("filter.preferContentChannels", true);
}
 
 
@@ -243,7 +245,7 @@
 
 
protected List findAllDetailPages(Node content, int pageId) {
-   List pages = findPagesForContent(content, null, pageId);
+   List pages = findPagesForContent(content, null, pageId, 
preferContentChannels);
   return convertToPageInfos(pages);
}
 
@@ -335,17 +337,20 @@
 
@Override
public boolean hasContentPages(Node content) {
-  NodeList pages = findPagesForContent(content, null);
+  NodeList pages = findPagesForContent(content, null, 
preferContentChannels);
   return (pages != null && pages.size() > 0);
}
 
-
protected NodeList findPagesForContent(Node content, Node channel) {
-  return findPagesForContent(content, channel, ANY_PAGE);
+  return findPagesForContent(content, channel, preferContentChannels);
+   }
+   
+   protected NodeList findPagesForContent(Node content, Node channel, boolean 
preferContentChannels) {
+  return findPagesForContent(content, channel, ANY_PAGE, 
preferContentChannels);
}
 
 
-   protected NodeList findPagesForContent(Node content, Node channel, int 
pageid) {
+   protected NodeList findPagesForContent(Node content, Node channel, int 
pageid, boolean preferContentChannels) {
   Cloud cloud;
   if (content != null) {
   cloud = content.getCloud();
@@ -367,37 +372,61 @@
   else {
  channels = RepositoryUtil.getContentChannelsForContent(content);
   }
-
+  NodeList pages = null;
+  if (preferContentChannels) {
   if (content != null) {
  channels.add(content);
   }
 
   Query query = createPagesForContentQuery(cloud, channels, pageid);
 
-  NodeList pages = cloud.getList(query);
+ pages = cloud.getList(query);
   if (pages.isEmpty()) {
  if (content != null) {
 channels.remove(content);
  }
- NodeList collectionchannels = cloud.createNodeList();
- for (Iterator iter = channels.iterator(); iter.hasNext();) {
-Node contentchannel = iter.next();
-NodeList cc = RepositoryUtil.getCollectionChannels(contentchannel);
-if (!cc.isEmpty()) {
-   collectionchannels.addAll(cc);
-}
- }
+NodeList collectionchannels = getCollectionsForChannels(cloud, 
channels);
  if (!collectionchannels.isEmpty()) {
 Query collectionquery = createPagesForContentQuery(cloud, 
collectionchannels, pageid);
 pages = cloud.getList(collectionquery);
  }
   }
+  }
+  else {
+ NodeList collectionchannels = getCollectionsForChannels(cloud, 
channels);
+ channels.addAll(collectionchannels);
+ 
   if (content != null) {
- filterPageQueryNodes(pages, content);
+channels.add(content);
+ }
+   
+ Query query = createPagesForContentQuery(cloud, channels, pageid);
+ pages = cloud.getList(query);
   }
+  if (pages != null) {
 
+ if (content != null) {
+filterPageQueryNodes(pages, content);
+ }
   return pages;
}
+  else {
+ return cloud.createNodeList();
+  }
+   }
+
+
+   private NodeList getCollectionsForChannels(Cloud cloud, NodeList channels) {
+  NodeList collectionchannels = cloud.createNodeList();
+  for (Iterator iter = channels.iterator(); iter.hasNext();) {
+ Node contentchannel = iter.next();
+ NodeList cc = RepositoryUtil.getCollectionChannels(contentchannel);
+ if (!cc.isEmpty()) {
+collectionchannels.

[MMBASE CVS] contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search SearchServiceMMBaseImpl.java RedirectServlet.java

2008-12-29 Thread Nico Klasens
Update of 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
In directory 
james.mmbase.org:/tmp/cvs-serv13475/cmsc/search/src/java/com/finalist/cmsc/services/search

Modified Files:
SearchServiceMMBaseImpl.java RedirectServlet.java 
Log Message:
CMSC-1207 CollectionChannels are not always processed in the SearchService


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
See also: http://www.mmbase.org/jira/browse/CMSC-1207


Index: SearchServiceMMBaseImpl.java
===
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search/SearchServiceMMBaseImpl.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- SearchServiceMMBaseImpl.java7 Aug 2008 10:03:49 -   1.28
+++ SearchServiceMMBaseImpl.java29 Dec 2008 13:48:38 -  1.29
@@ -48,6 +48,7 @@
 
protected Map priorities = new HashMap();
protected boolean usePosition;
+   protected boolean preferContentChannels;
 
 
@Override
@@ -74,6 +75,7 @@
   }
 
   usePosition = aProperties.getBoolean("filter.usePosition", false);
+  preferContentChannels = 
aProperties.getBoolean("filter.preferContentChannels", true);
}
 
 
@@ -245,7 +247,7 @@
 
 
protected List findAllDetailPages(Node content, int pageId) {
-   List pages = findPagesForContent(content, null, pageId);
+   List pages = findPagesForContent(content, null, pageId, 
preferContentChannels);
   return convertToPageInfos(pages);
}
 
@@ -337,17 +339,20 @@
 
@Override
public boolean hasContentPages(Node content) {
-  NodeList pages = findPagesForContent(content, null);
+  NodeList pages = findPagesForContent(content, null, 
preferContentChannels);
   return (pages != null && pages.size() > 0);
}
 
-
protected NodeList findPagesForContent(Node content, Node channel) {
-  return findPagesForContent(content, channel, ANY_PAGE);
+  return findPagesForContent(content, channel, preferContentChannels);
+   }
+   
+   protected NodeList findPagesForContent(Node content, Node channel, boolean 
preferContentChannels) {
+  return findPagesForContent(content, channel, ANY_PAGE, 
preferContentChannels);
}
 
 
-   protected NodeList findPagesForContent(Node content, Node channel, int 
pageid) {
+   protected NodeList findPagesForContent(Node content, Node channel, int 
pageid, boolean preferContentChannels) {
   Cloud cloud;
   if (content != null) {
   cloud = content.getCloud();
@@ -369,37 +374,61 @@
   else {
  channels = RepositoryUtil.getContentChannelsForContent(content);
   }
-
+  NodeList pages = null;
+  if (preferContentChannels) {
   if (content != null) {
  channels.add(content);
   }
 
   Query query = createPagesForContentQuery(cloud, channels, pageid);
 
-  NodeList pages = cloud.getList(query);
+ pages = cloud.getList(query);
   if (pages.isEmpty()) {
  if (content != null) {
 channels.remove(content);
  }
- NodeList collectionchannels = cloud.createNodeList();
- for (Iterator iter = channels.iterator(); iter.hasNext();) {
-Node contentchannel = iter.next();
-NodeList cc = RepositoryUtil.getCollectionChannels(contentchannel);
-if (!cc.isEmpty()) {
-   collectionchannels.addAll(cc);
-}
- }
+NodeList collectionchannels = getCollectionsForChannels(cloud, 
channels);
  if (!collectionchannels.isEmpty()) {
 Query collectionquery = createPagesForContentQuery(cloud, 
collectionchannels, pageid);
 pages = cloud.getList(collectionquery);
  }
   }
+  }
+  else {
+ NodeList collectionchannels = getCollectionsForChannels(cloud, 
channels);
+ channels.addAll(collectionchannels);
+ 
   if (content != null) {
- filterPageQueryNodes(pages, content);
+channels.add(content);
+ }
+   
+ Query query = createPagesForContentQuery(cloud, channels, pageid);
+ pages = cloud.getList(query);
   }
+  if (pages != null) {
 
+ if (content != null) {
+filterPageQueryNodes(pages, content);
+ }
   return pages;
}
+  else {
+ return cloud.createNodeList();
+  }
+   }
+
+
+   private NodeList getCollectionsForChannels(Cloud cloud, NodeList channels) {
+  NodeList collectionchannels = cloud.createNodeList();
+  for (Iterator iter = channels.iterator(); iter.hasNext();) {
+ Node contentchannel = iter.next();
+ NodeList cc = RepositoryUtil.getCollectionChannels(contentchannel);
+ if (!cc.isEmpty()) {
+collectionchannels.addAll(cc);
+ }
+  }
+  

[MMBASE CVS] contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search SearchServiceMMBaseImpl.java RedirectServlet.java

2008-12-29 Thread Nico Klasens
Update of 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
In directory 
james.mmbase.org:/tmp/cvs-serv13422/cmsc/search/src/java/com/finalist/cmsc/services/search

Modified Files:
  Tag: b1_5
SearchServiceMMBaseImpl.java RedirectServlet.java 
Log Message:
CMSC-1207 CollectionChannels are not always processed in the SearchService


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
See also: http://www.mmbase.org/jira/browse/CMSC-1207


Index: SearchServiceMMBaseImpl.java
===
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search/SearchServiceMMBaseImpl.java,v
retrieving revision 1.28
retrieving revision 1.28.2.1
diff -u -b -r1.28 -r1.28.2.1
--- SearchServiceMMBaseImpl.java7 Aug 2008 10:03:49 -   1.28
+++ SearchServiceMMBaseImpl.java29 Dec 2008 13:48:30 -  1.28.2.1
@@ -48,6 +48,7 @@
 
protected Map priorities = new HashMap();
protected boolean usePosition;
+   protected boolean preferContentChannels;
 
 
@Override
@@ -74,6 +75,7 @@
   }
 
   usePosition = aProperties.getBoolean("filter.usePosition", false);
+  preferContentChannels = 
aProperties.getBoolean("filter.preferContentChannels", true);
}
 
 
@@ -245,7 +247,7 @@
 
 
protected List findAllDetailPages(Node content, int pageId) {
-   List pages = findPagesForContent(content, null, pageId);
+   List pages = findPagesForContent(content, null, pageId, 
preferContentChannels);
   return convertToPageInfos(pages);
}
 
@@ -337,17 +339,20 @@
 
@Override
public boolean hasContentPages(Node content) {
-  NodeList pages = findPagesForContent(content, null);
+  NodeList pages = findPagesForContent(content, null, 
preferContentChannels);
   return (pages != null && pages.size() > 0);
}
 
-
protected NodeList findPagesForContent(Node content, Node channel) {
-  return findPagesForContent(content, channel, ANY_PAGE);
+  return findPagesForContent(content, channel, preferContentChannels);
+   }
+   
+   protected NodeList findPagesForContent(Node content, Node channel, boolean 
preferContentChannels) {
+  return findPagesForContent(content, channel, ANY_PAGE, 
preferContentChannels);
}
 
 
-   protected NodeList findPagesForContent(Node content, Node channel, int 
pageid) {
+   protected NodeList findPagesForContent(Node content, Node channel, int 
pageid, boolean preferContentChannels) {
   Cloud cloud;
   if (content != null) {
   cloud = content.getCloud();
@@ -369,37 +374,61 @@
   else {
  channels = RepositoryUtil.getContentChannelsForContent(content);
   }
-
+  NodeList pages = null;
+  if (preferContentChannels) {
   if (content != null) {
  channels.add(content);
   }
 
   Query query = createPagesForContentQuery(cloud, channels, pageid);
 
-  NodeList pages = cloud.getList(query);
+ pages = cloud.getList(query);
   if (pages.isEmpty()) {
  if (content != null) {
 channels.remove(content);
  }
- NodeList collectionchannels = cloud.createNodeList();
- for (Iterator iter = channels.iterator(); iter.hasNext();) {
-Node contentchannel = iter.next();
-NodeList cc = RepositoryUtil.getCollectionChannels(contentchannel);
-if (!cc.isEmpty()) {
-   collectionchannels.addAll(cc);
-}
- }
+NodeList collectionchannels = getCollectionsForChannels(cloud, 
channels);
  if (!collectionchannels.isEmpty()) {
 Query collectionquery = createPagesForContentQuery(cloud, 
collectionchannels, pageid);
 pages = cloud.getList(collectionquery);
  }
   }
+  }
+  else {
+ NodeList collectionchannels = getCollectionsForChannels(cloud, 
channels);
+ channels.addAll(collectionchannels);
+ 
   if (content != null) {
- filterPageQueryNodes(pages, content);
+channels.add(content);
+ }
+   
+ Query query = createPagesForContentQuery(cloud, channels, pageid);
+ pages = cloud.getList(query);
   }
+  if (pages != null) {
 
+ if (content != null) {
+filterPageQueryNodes(pages, content);
+ }
   return pages;
}
+  else {
+ return cloud.createNodeList();
+  }
+   }
+
+
+   private NodeList getCollectionsForChannels(Cloud cloud, NodeList channels) {
+  NodeList collectionchannels = cloud.createNodeList();
+  for (Iterator iter = channels.iterator(); iter.hasNext();) {
+ Node contentchannel = iter.next();
+ NodeList cc = RepositoryUtil.getCollectionChannels(contentchannel);
+ if (!cc.isEmpty()) {
+collectionchannels.addAll(cc);

[MMBASE CVS] contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search SearchServiceMMBaseImpl.java

2008-08-07 Thread Nico Klasens
Update of 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
In directory 
james.mmbase.org:/tmp/cvs-serv1311/cmsc/search/src/java/com/finalist/cmsc/services/search

Modified Files:
SearchServiceMMBaseImpl.java 
Log Message:
CMSC-855 Add field to specify detail support to the views
Add check when not a ContentChannelPortlet


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
See also: http://www.mmbase.org/jira/browse/CMSC-855


Index: SearchServiceMMBaseImpl.java
===
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search/SearchServiceMMBaseImpl.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- SearchServiceMMBaseImpl.java15 Apr 2008 08:08:22 -  1.27
+++ SearchServiceMMBaseImpl.java7 Aug 2008 10:03:49 -   1.28
@@ -178,7 +178,9 @@
  int end = maxElements == null || maxElements.length() == 0 ? -1 : 
Integer.valueOf(maxElements);
 
  if (start > 0 || end > 0) {
-if (start <= 0) start = 1;
+if (start <= 0) {
+   start = 1;
+}
 List contenttypes = 
SiteManagement.getContentTypes(String.valueOf(portlet.getId()));
 
 String contentchannel = portlet.getParameterValue(CONTENTCHANNEL);
@@ -498,13 +500,20 @@
 return false;
  }
  else {
+ return isDetailView(portlet);
+ }
+  }
+  else {
+ return isDetailView(portlet);
+  }
+   }
+
+   protected boolean isDetailView(Portlet portlet) {
  int viewNumber = portlet.getView();
  if (viewNumber > 0) {
  View view = SiteManagement.getView(viewNumber);
  return view.isDetailsupport();
  }
- }
-  }
   return true;
}
 
___
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs


[MMBASE CVS] contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search SearchServiceMMBaseImpl.java

2008-04-15 Thread Nico Klasens
Update of 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
In directory 
james.mmbase.org:/tmp/cvs-serv17255/cmsc/search/src/java/com/finalist/cmsc/services/search

Modified Files:
SearchServiceMMBaseImpl.java 
Log Message:
CMSC-855 Add field to specify detail support to the views


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
See also: http://www.mmbase.org/jira/browse/CMSC-855


Index: SearchServiceMMBaseImpl.java
===
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search/SearchServiceMMBaseImpl.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- SearchServiceMMBaseImpl.java12 Apr 2008 14:26:07 -  1.26
+++ SearchServiceMMBaseImpl.java15 Apr 2008 08:08:22 -  1.27
@@ -269,6 +269,8 @@
  infos.add(pageInfo);
   }
}
+   // put the best page as first
+   Collections.sort(infos, new PageInfoComparator());
return infos;
 }
 
@@ -305,6 +307,12 @@
  if (portletId == -1) {
 return null;
  }
+ else {
+ Portlet portlet = SiteManagement.getPortlet(portletId);
+ if (!isDetailPortlet(portlet)) {
+ return null;
+ }
+ }
 
  String host = null;
  if (ServerUtil.useServerName()) {
@@ -489,6 +497,13 @@
  if (pageNumber != null) {
 return false;
  }
+ else {
+ int viewNumber = portlet.getView();
+ if (viewNumber > 0) {
+ View view = SiteManagement.getView(viewNumber);
+ return view.isDetailsupport();
+ }
+ }
   }
   return true;
}
___
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs


[MMBASE CVS] contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search SearchServiceMMBaseImpl.java

2008-04-15 Thread Nico Klasens
Update of 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
In directory 
james.mmbase.org:/tmp/cvs-serv17172/cmsc/search/src/java/com/finalist/cmsc/services/search

Modified Files:
  Tag: b1_4
SearchServiceMMBaseImpl.java 
Log Message:
CMSC-855 Add field to specify detail support to the views


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
See also: http://www.mmbase.org/jira/browse/CMSC-855


Index: SearchServiceMMBaseImpl.java
===
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search/SearchServiceMMBaseImpl.java,v
retrieving revision 1.22.2.3
retrieving revision 1.22.2.4
diff -u -b -r1.22.2.3 -r1.22.2.4
--- SearchServiceMMBaseImpl.java31 Mar 2008 09:03:46 -  1.22.2.3
+++ SearchServiceMMBaseImpl.java15 Apr 2008 08:08:13 -  1.22.2.4
@@ -263,13 +263,14 @@
 
protected List convertToPageInfos(List pages) {
List infos = new ArrayList();
-   for (Iterator iter = pages.iterator(); iter.hasNext();) {
-  Node pageNode = iter.next();
+   for (Node pageNode : pages) {
   PageInfo pageInfo = getPageInfo(pageNode, true);
   if (pageInfo != null && !infos.contains(pageInfo)) {
  infos.add(pageInfo);
   }
}
+   // put the best page as first
+   Collections.sort(infos, new PageInfoComparator());
return infos;
 }
 
@@ -306,6 +307,12 @@
  if (portletId == -1) {
 return null;
  }
+ else {
+ Portlet portlet = SiteManagement.getPortlet(portletId);
+ if (!isDetailPortlet(portlet)) {
+ return null;
+ }
+ }
 
  String host = null;
  if (ServerUtil.useServerName()) {
@@ -490,6 +497,13 @@
  if (pageNumber != null) {
 return false;
  }
+ else {
+ int viewNumber = portlet.getView();
+ if (viewNumber > 0) {
+ View view = SiteManagement.getView(viewNumber);
+ return view.isDetailsupport();
+ }
+ }
   }
   return true;
}
___
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs


[MMBASE CVS] contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search SearchServiceMMBaseImpl.java

2008-03-31 Thread Nico Klasens
Update of 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
In directory 
james.mmbase.org:/tmp/cvs-serv22752/cmsc/search/src/java/com/finalist/cmsc/services/search

Modified Files:
  Tag: b1_4
SearchServiceMMBaseImpl.java 
Log Message:
A little more robust


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search


Index: SearchServiceMMBaseImpl.java
===
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search/SearchServiceMMBaseImpl.java,v
retrieving revision 1.22.2.2
retrieving revision 1.22.2.3
diff -u -b -r1.22.2.2 -r1.22.2.3
--- SearchServiceMMBaseImpl.java27 Mar 2008 11:22:23 -  1.22.2.2
+++ SearchServiceMMBaseImpl.java31 Mar 2008 09:03:46 -  1.22.2.3
@@ -445,6 +445,7 @@
  for (Integer portletId : portlets) {
 Portlet portlet = SiteManagement.getPortlet(portletId);
 
+if (portlet != null) {
 if (detailOnly && !isDetailPortlet(portlet)) {
continue;
 }
@@ -476,6 +477,7 @@
 }
  }
   }
+  }
   log.debug("found: '" + result.size() + "' elements for page: '" + 
page.getNumber() + "'");
   return result;
}
___
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs


[MMBASE CVS] contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search SearchServiceMMBaseImpl.java

2008-03-31 Thread Nico Klasens
Update of 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
In directory 
james.mmbase.org:/tmp/cvs-serv22692/cmsc/search/src/java/com/finalist/cmsc/services/search

Modified Files:
SearchServiceMMBaseImpl.java 
Log Message:
A little more robust


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search


Index: SearchServiceMMBaseImpl.java
===
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search/SearchServiceMMBaseImpl.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- SearchServiceMMBaseImpl.java27 Mar 2008 11:27:32 -  1.24
+++ SearchServiceMMBaseImpl.java31 Mar 2008 09:02:37 -  1.25
@@ -445,6 +445,7 @@
  for (Integer portletId : portlets) {
 Portlet portlet = SiteManagement.getPortlet(portletId);
 
+if (portlet != null) {
 if (detailOnly && !isDetailPortlet(portlet)) {
continue;
 }
@@ -476,6 +477,7 @@
 }
  }
   }
+  }
   log.debug("found: '" + result.size() + "' elements for page: '" + 
page.getNumber() + "'");
   return result;
}
___
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs


[MMBASE CVS] contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search SearchServiceMMBaseImpl.java

2008-03-27 Thread jkoster
Update of 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
In directory 
james.mmbase.org:/tmp/cvs-serv31663/cmsc/search/src/java/com/finalist/cmsc/services/search

Modified Files:
SearchServiceMMBaseImpl.java 
Log Message:
CMSC-836 - SearchService incorrectly searches for contentchannel positions


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
See also: http://www.mmbase.org/jira/browse/CMSC-836


Index: SearchServiceMMBaseImpl.java
===
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search/SearchServiceMMBaseImpl.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- SearchServiceMMBaseImpl.java14 Mar 2008 12:52:30 -  1.23
+++ SearchServiceMMBaseImpl.java27 Mar 2008 11:27:32 -  1.24
@@ -178,6 +178,7 @@
  int end = maxElements == null || maxElements.length() == 0 ? -1 : 
Integer.valueOf(maxElements);
 
  if (start > 0 || end > 0) {
+if (start <= 0) start = 1;
 List contenttypes = 
SiteManagement.getContentTypes(String.valueOf(portlet.getId()));
 
 String contentchannel = portlet.getParameterValue(CONTENTCHANNEL);
@@ -196,7 +197,7 @@
 Node channel = cloud.getNode(contentchannel);
 
 NodeList l = RepositoryUtil.getLinkedElements(channel, 
contenttypes, orderby, direction, useLifecycleBool,
-  archive, start, end, -1, -1, -1);
+  archive, start - 1, end, -1, -1, -1);
 for (Iterator iterator = l.iterator(); iterator.hasNext();) {
Node node = iterator.next();
if (node.getNumber() == content.getNumber()) {
___
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs


[MMBASE CVS] contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search SearchServiceMMBaseImpl.java

2008-03-27 Thread jkoster
Update of 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
In directory 
james.mmbase.org:/tmp/cvs-serv31563/cmsc/search/src/java/com/finalist/cmsc/services/search

Modified Files:
  Tag: b1_4
SearchServiceMMBaseImpl.java 
Log Message:
CMSC-836 - SearchService incorrectly searches for contentchannel positions


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
See also: http://www.mmbase.org/jira/browse/CMSC-836


Index: SearchServiceMMBaseImpl.java
===
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search/SearchServiceMMBaseImpl.java,v
retrieving revision 1.22.2.1
retrieving revision 1.22.2.2
diff -u -b -r1.22.2.1 -r1.22.2.2
--- SearchServiceMMBaseImpl.java10 Mar 2008 09:25:14 -  1.22.2.1
+++ SearchServiceMMBaseImpl.java27 Mar 2008 11:22:23 -  1.22.2.2
@@ -178,6 +178,7 @@
  int end = maxElements == null || maxElements.length() == 0 ? -1 : 
Integer.valueOf(maxElements);
 
  if (start > 0 || end > 0) {
+if (start <= 0) start = 1;
 List contenttypes = 
SiteManagement.getContentTypes(String.valueOf(portlet.getId()));
 
 String contentchannel = portlet.getParameterValue(CONTENTCHANNEL);
@@ -196,7 +197,7 @@
 Node channel = cloud.getNode(contentchannel);
 
 NodeList l = RepositoryUtil.getLinkedElements(channel, 
contenttypes, orderby, direction, useLifecycleBool,
-  archive, start, end, -1, -1, -1);
+  archive, start - 1, end, -1, -1, -1);
 for (Iterator iterator = l.iterator(); iterator.hasNext();) {
Node node = iterator.next();
if (node.getNumber() == content.getNumber()) {
___
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs


[MMBASE CVS] contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search SearchServiceMMBaseImpl.java RedirectServlet.java

2008-03-10 Thread Nico Klasens
Update of 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
In directory 
james.mmbase.org:/tmp/cvs-serv8918/cmsc/search/src/java/com/finalist/cmsc/services/search

Modified Files:
  Tag: b1_4
SearchServiceMMBaseImpl.java RedirectServlet.java 
Log Message:
CMSC-805 Add optional parameters to content url when redirected


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
See also: http://www.mmbase.org/jira/browse/CMSC-805


Index: SearchServiceMMBaseImpl.java
===
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search/SearchServiceMMBaseImpl.java,v
retrieving revision 1.22
retrieving revision 1.22.2.1
diff -u -b -r1.22 -r1.22.2.1
--- SearchServiceMMBaseImpl.java28 Jan 2008 21:15:44 -  1.22
+++ SearchServiceMMBaseImpl.java10 Mar 2008 09:25:14 -  1.22.2.1
@@ -44,10 +44,10 @@
protected static final String PAGE = "page";
protected static final String WINDOW = "window";
 
-   private static final int ANY_PAGE = -1;
+   protected static final int ANY_PAGE = -1;
 
-   private Map priorities = new HashMap();
-   private boolean usePosition;
+   protected Map priorities = new HashMap();
+   protected boolean usePosition;
 
 
@Override
@@ -77,7 +77,7 @@
}
 
 
-   private int getPriority(String name) {
+   protected int getPriority(String name) {
   Integer prio = priorities.get(name);
   if (prio != null) {
  return prio;
@@ -95,8 +95,15 @@
@Override
public PageInfo findDetailPageForContent(Node content, String serverName) {
   List pages = findPagesForContent(content, null);
+  return determineDetailPage(content, serverName, pages);
+   }
+
+
+   protected PageInfo determineDetailPage(Node content, String serverName, 
List pages) {
   if (!pages.isEmpty()) {
+ if (content != null) {
  filterPageQueryNodes(pages, content);
+ }
  if (!pages.isEmpty()) {
 List pageInfos = new ArrayList();
 for (Node pageNode : pages) {
@@ -115,7 +122,7 @@
}
 
 
-   private void filterPageQueryNodes(List pages, Node content) {
+   protected void filterPageQueryNodes(List pages, Node content) {
   for (Iterator iter = pages.iterator(); iter.hasNext();) {
  Node pageQueryNode = iter.next();
  boolean keep = evaluatePageQueryNode(pageQueryNode, content);
@@ -126,7 +133,7 @@
}
 
 
-   private boolean evaluatePageQueryNode(Node pageQueryNode, Node content) {
+   protected boolean evaluatePageQueryNode(Node pageQueryNode, Node content) {
   Page page = (Page) 
SiteManagement.getNavigationItem(pageQueryNode.getIntValue(PagesUtil.PAGE + 
".number"));
   String key = pageQueryNode.getStringValue(PortletUtil.NODEPARAMETER + 
"." + PortletUtil.KEY_FIELD);
   if (CONTENTCHANNEL.equals(key)) {
@@ -143,7 +150,7 @@
}
 
 
-   private boolean evaluateContentTypes(Integer portletId, Node content) {
+   protected boolean evaluateContentTypes(Integer portletId, Node content) {
   List nodeManagerNames = 
SiteManagement.getContentTypes(portletId.toString());
   if (!nodeManagerNames.isEmpty()) {
  for (String nmName : nodeManagerNames) {
@@ -157,13 +164,13 @@
}
 
 
-   private boolean evaluateArchive(Portlet portlet, Node content) {
+   protected boolean evaluateArchive(Portlet portlet, Node content) {
   String archive = portlet.getParameterValue(ARCHIVE);
   return ContentElementUtil.matchArchive(content, archive);
}
 
 
-   private boolean evalutateContentchannelPosition(Portlet portlet, Node 
content) {
+   protected boolean evalutateContentchannelPosition(Portlet portlet, Node 
content) {
   if (usePosition) {
  String startIndex = portlet.getParameterValue(START_INDEX);
  String maxElements = portlet.getParameterValue(MAX_ELEMENTS);
@@ -229,24 +236,14 @@
}
 
 
-   private List findAllDetailPages(Node content) {
+   protected List findAllDetailPages(Node content) {
   return findAllDetailPages(content, ANY_PAGE);
}
 
 
-   private List findAllDetailPages(Node content, int pageId) {
-  NodeList pages = findPagesForContent(content, null, pageId);
-
-  List infos = new ArrayList();
-  for (Iterator iter = pages.iterator(); iter.hasNext();) {
- Node pageNode = iter.next();
- PageInfo pageInfo = getPageInfo(pageNode, true);
- if (pageInfo != null && !infos.contains(pageInfo)) {
-infos.add(pageInfo);
- }
-  }
-
-  return infos;
+   protected List findAllDetailPages(Node content, int pageId) {
+   List pages = findPagesForContent(content, null, pageId);
+  return convertToPageInfos(pages);
}
 
 
@@ -258,13 +255,17 @@
 
@Override
public List findPagesForContentElement(Node content, Node 
channel) {
- 

[MMBASE CVS] contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search SearchServiceMMBaseImpl.java PageInfoComparator.java

2008-01-28 Thread Nico Klasens
Update of 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
In directory 
james.mmbase.org:/tmp/cvs-serv26804/cmsc/search/src/java/com/finalist/cmsc/services/search

Modified Files:
SearchServiceMMBaseImpl.java PageInfoComparator.java 
Log Message:
CMSC-755 Navigation code refactored to use navigationitem


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search
See also: http://www.mmbase.org/jira/browse/CMSC-755


Index: SearchServiceMMBaseImpl.java
===
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search/SearchServiceMMBaseImpl.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- SearchServiceMMBaseImpl.java7 Jan 2008 22:37:25 -   1.21
+++ SearchServiceMMBaseImpl.java28 Jan 2008 21:15:44 -  1.22
@@ -273,8 +273,9 @@
 
 
private PageInfo getPageInfo(Node pageQueryNode, boolean clicktopage) {
-  Page page = 
SiteManagement.getPage(pageQueryNode.getIntValue(PagesUtil.PAGE + ".number"));
-  if (page != null) {
+  NavigationItem item = 
SiteManagement.getNavigationItem(pageQueryNode.getIntValue(PagesUtil.PAGE + 
".number"));
+  if (item != null && Page.class.isInstance(item)) {
+ Page page = Page.class.cast(item);
  String portletWindowName = 
pageQueryNode.getStringValue(PortletUtil.PORTLETREL + "."
+ PortletUtil.LAYOUTID_FIELD);
  String parameterName = 
pageQueryNode.getStringValue(PortletUtil.NODEPARAMETER + "." + 
PortletUtil.KEY_FIELD);
@@ -289,12 +290,15 @@
if (portlet != null) {
   String pageNumber = portlet.getParameterValue(PAGE);
   if (pageNumber != null) {
- page = 
SiteManagement.getPage(Integer.valueOf(pageNumber));
+  NavigationItem clickItem = 
SiteManagement.getNavigationItem(Integer.valueOf(pageNumber)); 
+  if (clickItem != null && 
Page.class.isInstance(clickItem)) {
+  page = Page.class.cast(clickItem);
  portletWindowName = portlet.getParameterValue(WINDOW);
   }
}
 }
  }
+ }
  // Check if a portlet exists on this position
  Integer portletId = page.getPortlet(portletWindowName);
  if (portletId == -1) {
@@ -418,10 +422,12 @@
   if (page != null) {
  Cloud cloud = page.getCloud();
 
- Page pageObject = SiteManagement.getPage(page.getNumber());
- if (pageObject == null) {
+ NavigationItem item = 
SiteManagement.getNavigationItem(page.getNumber()); 
+ if (item == null || !Page.class.isInstance(item)) {
 return result;
  }
+ 
+ Page pageObject = Page.class.cast(item);
  Collection portlets = pageObject.getPortlets();
  for (Integer portletId : portlets) {
 Portlet portlet = SiteManagement.getPortlet(portletId);
@@ -499,7 +505,7 @@
 
 
@Override
-   public String getPortletWindow(int pageId, String elementNumber, String 
serverName) {
+   public String getPortletWindow(int pageId, String elementNumber) {
   Cloud cloud = 
ContextProvider.getDefaultCloudContext().getCloud("mmbase");
   Node content = cloud.getNode(elementNumber);
   if (ContentElementUtil.isContentElement(content)) {
@@ -509,7 +515,7 @@
  }
 
  if (!infos.isEmpty()) {
-Collections.sort(infos, new PageInfoComparator(serverName));
+Collections.sort(infos, new PageInfoComparator());
 for (PageInfo pageInfo : infos) {
if (pageId == pageInfo.getPageNumber()) {
   return pageInfo.getWindowName();


Index: PageInfoComparator.java
===
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/search/src/java/com/finalist/cmsc/services/search/PageInfoComparator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- PageInfoComparator.java 26 Nov 2007 11:43:45 -  1.4
+++ PageInfoComparator.java 28 Jan 2008 21:15:44 -  1.5
@@ -19,6 +19,10 @@
private String preferredSite;
 
 
+   public PageInfoComparator() {
+   // no preferred site
+   }
+
public PageInfoComparator(String serverName) {
   this.preferredSite = serverName;
}
___
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs