Merge pull request #31 from KevinVdV/DS-1136

[DS-1136] Breadcrumb trail incorrect for community/collection browse and statistics
This commit is contained in:
Mark Diggory
2012-08-14 16:18:59 -07:00
10 changed files with 39 additions and 16 deletions

View File

@@ -244,7 +244,7 @@ public class SearchFacetFilter extends AbstractDSpaceTransformer implements Cach
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
if ((dso instanceof Collection) || (dso instanceof Community)) {
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath);
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath, true);
}
pageMeta.addTrail().addContent(message("xmlui.Discovery.AbstractSearch.type_" + facetField));

View File

@@ -88,7 +88,7 @@ public class SimpleSearch extends AbstractSearch implements CacheableProcessingC
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
if ((dso instanceof org.dspace.content.Collection) || (dso instanceof Community)) {
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath);
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath, true);
}
pageMeta.addTrail().addContent(T_trail);

View File

@@ -221,7 +221,7 @@ public class WithdrawnItems extends AbstractDSpaceTransformer implements
pageMeta.addTrailLink(contextPath + "/", T_dspace_home);
if (dso != null)
{
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath);
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath, true);
}
pageMeta.addTrail().addContent(getTrailMessage(info));

View File

@@ -114,7 +114,7 @@ public class AdvancedSearch extends AbstractSearch implements CacheableProcessin
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
if ((dso instanceof Collection) || (dso instanceof Community))
{
HandleUtil.buildHandleTrail(dso,pageMeta,contextPath);
HandleUtil.buildHandleTrail(dso,pageMeta,contextPath, true);
}
pageMeta.addTrail().addContent(T_trail);

View File

@@ -235,7 +235,7 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
pageMeta.addTrailLink(contextPath + "/", T_dspace_home);
if (dso != null)
{
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath);
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath, true);
}
pageMeta.addTrail().addContent(getTrailMessage(info));

View File

@@ -71,7 +71,7 @@ public class SimpleSearch extends AbstractSearch implements CacheableProcessingC
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
if ((dso instanceof Collection) || (dso instanceof Community))
{
HandleUtil.buildHandleTrail(dso,pageMeta,contextPath);
HandleUtil.buildHandleTrail(dso,pageMeta,contextPath, true);
}
pageMeta.addTrail().addContent(T_trail);

View File

@@ -51,7 +51,7 @@ public class StatisticsTransformer extends AbstractDSpaceTransformer {
if(dso != null)
{
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath);
HandleUtil.buildHandleTrail(dso, pageMeta, contextPath, true);
}
pageMeta.addTrailLink(contextPath + "/handle" + (dso != null && dso.getHandle() != null ? "/" + dso.getHandle() : "/statistics"), T_statistics_trail);

View File

@@ -229,7 +229,7 @@ public abstract class AbstractStep extends AbstractDSpaceTransformer
Collection collection = submission.getCollection();
pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath);
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath, true);
pageMeta.addTrail().addContent(T_submission_trail);
}
else if (submission instanceof WorkflowItem)
@@ -239,7 +239,7 @@ public abstract class AbstractStep extends AbstractDSpaceTransformer
Collection collection = submission.getCollection();
pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath);
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath, true);
pageMeta.addTrail().addContent(T_workflow_trail);
}
else

View File

@@ -94,7 +94,7 @@ public abstract class AbstractXMLUIAction extends AbstractDSpaceTransformer impl
Collection collection = workflowItem.getCollection();
pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath);
HandleUtil.buildHandleTrail(collection,pageMeta,contextPath, true);
pageMeta.addTrail().addContent(T_workflow_trail);
}

View File

@@ -142,16 +142,39 @@ public class HandleUtil
* or a bitstream, then the object is not included, but its collection and
* community parents are. However, if the item is a community or collection
* then it is included along with all parents.
*
*
* <p>
* If the terminal object in the trail is the passed object, do not link to
* it, because that is (presumably) the page at which the user has arrived.
*
* @param dso
* @param pageMeta
*
* @param dso the DSpace who's parents we wil add to the pageMeta
* @param pageMeta the object to which we link our trial
* @param contextPath The context path
*/
public static void buildHandleTrail(DSpaceObject dso, PageMeta pageMeta,
String contextPath) throws SQLException, WingException
String contextPath) throws SQLException, WingException
{
buildHandleTrail(dso, pageMeta, contextPath, false);
}
/**
* Build a list of trail metadata starting with the owning collection and
* ending with the root level parent. If the Object is an item, a bundle,
* or a bitstream, then the object is not included, but its collection and
* community parents are. However, if the item is a community or collection
* then it is included along with all parents.
*
* <p>
* If the terminal object in the trail is the passed object, do not link to
* it, because that is (presumably) the page at which the user has arrived.
*
* @param dso the DSpace who's parents we wil add to the pageMeta
* @param pageMeta the object to which we link our trial
* @param contextPath The context path
* @param linkOriginalObject whether or not to make a link of the original object
*/
public static void buildHandleTrail(DSpaceObject dso, PageMeta pageMeta,
String contextPath, boolean linkOriginalObject) throws SQLException, WingException
{
// Add the trail back to the repository root.
Stack<DSpaceObject> stack = new Stack<DSpaceObject>();
@@ -206,7 +229,7 @@ public class HandleUtil
DSpaceObject pop = stack.pop();
String target;
if (pop == dso)
if (pop == dso && !linkOriginalObject)
target = null; // Do not link "back" to the terminal object
else
target = contextPath + "/handle/" + pop.getHandle();