* Meine Author Angaben korrigiert

git-svn-id: https://svn.libreccm.org/ccm/trunk@2425 8810af33-2d31-482b-a856-94f89814c4df
master
quasi 2013-11-07 12:08:32 +00:00
parent c60db860b3
commit 075bd1c6d7
2 changed files with 62 additions and 39 deletions

View File

@ -9,50 +9,73 @@ import com.arsdigita.kernel.ACSObject;
import com.arsdigita.navigation.AbstractNavigationModel; import com.arsdigita.navigation.AbstractNavigationModel;
/** /**
* A subsite aware navigation model for search application
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class SearchNavigationModel extends AbstractNavigationModel { public class SearchNavigationModel extends AbstractNavigationModel {
@Override /**
protected ACSObject loadObject() { * Get the index item of the current category
Category category = getCategory(); *
if (category == null) { * @return the index item, or null if there is no current category
return null; */
} @Override
return category.getIndexObject(); protected ACSObject loadObject() {
} Category category = getCategory();
if (category == null) {
return null;
}
return category.getIndexObject();
}
@Override /**
protected Category loadCategory() { * Get the current category
Category[] path = getCategoryPath(); *
if (path == null * @return the current category, or null if category path is empty
|| path.length == 0) { */
return null; @Override
} protected Category loadCategory() {
return path[path.length - 1]; Category[] path = getCategoryPath();
} if (path == null
|| path.length == 0) {
return null;
}
return path[path.length - 1];
}
@Override /**
protected Category[] loadCategoryPath() { * Subsite aware loadCategoryPath method which uses {@link Subsite} to
if (Subsite.getContext().hasSite()) { * get the category path
Category path[] = new Category[1]; *
Site subsite = Subsite.getContext().getSite(); * @return category path, or null if not subsite is active
path[0] = subsite.getRootCategory(); */
return path; @Override
} else { protected Category[] loadCategoryPath() {
return null; if (Subsite.getContext().hasSite()) {
} Category path[] = new Category[1];
} Site subsite = Subsite.getContext().getSite();
path[0] = subsite.getRootCategory();
return path;
} else {
return null;
}
}
@Override /**
protected Category loadRootCategory() { * Subsite aware loadRootCaegory method which uses {@link Subsite} to
* get root category
*
* @return root category, or null if no subsite is active
*/
@Override
protected Category loadRootCategory() {
if (Subsite.getContext().hasSite()) { if (Subsite.getContext().hasSite()) {
Site subsite = Subsite.getContext().getSite(); Site subsite = Subsite.getContext().getSite();
return subsite.getRootCategory(); return subsite.getRootCategory();
} else { } else {
return null; return null;
} }
} }
} }

View File

@ -16,7 +16,7 @@ import java.util.List;
/** /**
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class SubsiteItemURLFinder extends ItemURLFinder { public class SubsiteItemURLFinder extends ItemURLFinder {