mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 10:04:21 +00:00
re-enable xml-ui with rudimentary identifier support. This involves having fitted a new resolving mechanism to work with the xmlui way of obtaining DSpaceObjects, and decoupling the handle specific dependencies. This has appeared to be successful with regard to communities and collections, but it is not currently possible to submit items through the UI.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2587 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -39,10 +39,6 @@
|
||||
*/
|
||||
package org.dspace.app.xmlui.aspect.administrative;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.apache.cocoon.caching.CacheableProcessingComponent;
|
||||
import org.apache.cocoon.environment.ObjectModelHelper;
|
||||
import org.apache.cocoon.environment.Request;
|
||||
@@ -51,8 +47,8 @@ import org.apache.excalibur.source.SourceValidity;
|
||||
import org.apache.excalibur.source.impl.validity.NOPValidity;
|
||||
import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
|
||||
import org.dspace.app.xmlui.utils.DSpaceValidity;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.UIException;
|
||||
import org.dspace.app.xmlui.utils.URIUtil;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.List;
|
||||
@@ -67,6 +63,10 @@ import org.dspace.core.Constants;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
*
|
||||
* Create the navigation options for everything in the administrative aspects. This includes
|
||||
@@ -187,7 +187,7 @@ public class Navigation extends AbstractDSpaceTransformer implements CacheablePr
|
||||
List admin = options.addList("administrative");
|
||||
|
||||
// Context Administrative options
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if (dso instanceof Item)
|
||||
{
|
||||
|
||||
@@ -270,7 +270,7 @@ public class Navigation extends AbstractDSpaceTransformer implements CacheablePr
|
||||
// How many options were added.
|
||||
int options = 0;
|
||||
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
if (dso instanceof Item)
|
||||
{
|
||||
|
@@ -51,6 +51,7 @@ import org.dspace.app.xmlui.utils.DSpaceValidity;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.RequestUtils;
|
||||
import org.dspace.app.xmlui.utils.UIException;
|
||||
import org.dspace.app.xmlui.utils.URIUtil;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
@@ -170,7 +171,7 @@ public class WithdrawnItems extends AbstractDSpaceTransformer implements
|
||||
|
||||
if (key != null)
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if (dso != null)
|
||||
key += "-" + IdentifierFactory.getCanonicalForm(dso);
|
||||
|
||||
@@ -192,7 +193,7 @@ public class WithdrawnItems extends AbstractDSpaceTransformer implements
|
||||
try
|
||||
{
|
||||
DSpaceValidity validity = new DSpaceValidity();
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
if (dso != null)
|
||||
validity.add(dso);
|
||||
@@ -240,7 +241,7 @@ public class WithdrawnItems extends AbstractDSpaceTransformer implements
|
||||
|
||||
pageMeta.addMetadata("title").addContent(getTitleMessage(info));
|
||||
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
pageMeta.addTrailLink(contextPath + "/", T_dspace_home);
|
||||
if (dso != null)
|
||||
@@ -598,7 +599,7 @@ public class WithdrawnItems extends AbstractDSpaceTransformer implements
|
||||
params.scope = new BrowserScope(context);
|
||||
|
||||
// Are we in a community or collection?
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if (dso instanceof Community)
|
||||
params.scope.setCommunity((Community) dso);
|
||||
if (dso instanceof Collection)
|
||||
|
@@ -39,12 +39,6 @@
|
||||
*/
|
||||
package org.dspace.app.xmlui.aspect.artifactbrowser;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cocoon.environment.ObjectModelHelper;
|
||||
import org.apache.cocoon.environment.Request;
|
||||
import org.apache.cocoon.util.HashUtil;
|
||||
@@ -54,33 +48,40 @@ import org.dspace.app.xmlui.utils.ContextUtil;
|
||||
import org.dspace.app.xmlui.utils.DSpaceValidity;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.UIException;
|
||||
import org.dspace.app.xmlui.utils.URIUtil;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
import org.dspace.app.xmlui.wing.element.Cell;
|
||||
import org.dspace.app.xmlui.wing.element.Division;
|
||||
import org.dspace.app.xmlui.wing.element.ReferenceSet;
|
||||
import org.dspace.app.xmlui.wing.element.Para;
|
||||
import org.dspace.app.xmlui.wing.element.ReferenceSet;
|
||||
import org.dspace.app.xmlui.wing.element.Row;
|
||||
import org.dspace.app.xmlui.wing.element.Select;
|
||||
import org.dspace.app.xmlui.wing.element.Table;
|
||||
import org.dspace.app.xmlui.wing.element.Row;
|
||||
import org.dspace.app.xmlui.wing.element.Cell;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.uri.ResolvableIdentifier;
|
||||
import org.dspace.uri.IdentifierFactory;
|
||||
import org.dspace.uri.dao.ExternalIdentifierDAO;
|
||||
import org.dspace.uri.dao.ExternalIdentifierDAOFactory;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.search.DSQuery;
|
||||
import org.dspace.search.QueryArgs;
|
||||
import org.dspace.search.QueryResults;
|
||||
import org.dspace.sort.SortOption;
|
||||
import org.dspace.sort.SortException;
|
||||
import org.dspace.sort.SortOption;
|
||||
import org.dspace.uri.IdentifierFactory;
|
||||
import org.dspace.uri.ResolvableIdentifier;
|
||||
import org.dspace.uri.dao.ExternalIdentifierDAO;
|
||||
import org.dspace.uri.dao.ExternalIdentifierDAOFactory;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This is an abstract search page. It is a collection of search methods that
|
||||
* are common between diffrent search implementation. An implementer must
|
||||
@@ -498,22 +499,20 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer
|
||||
ExternalIdentifierDAOFactory.getInstance(context);
|
||||
|
||||
// Are we in a community or collection?
|
||||
/*
|
||||
DSpaceObject dso;
|
||||
if (scopeString == null
|
||||
|| "".equals(scopeString)
|
||||
|| "/".equals(scopeString))
|
||||
if (scopeString == null || "".equals(scopeString) || "/".equals(scopeString))
|
||||
{
|
||||
// get the search scope from the url handle
|
||||
dso = HandleUtil.obtainHandle(objectModel);
|
||||
dso = URIUtil.resolve(objectModel);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the search scope from the location parameter
|
||||
// dso = HandleManager.resolveToObject(context, scopeString);
|
||||
ResolvableIdentifier ri = IdentifierFactory.resolve(context, scopeString);
|
||||
dso = ri.getObject(context);
|
||||
/*
|
||||
ExternalIdentifier identifier = dao.retrieve(scopeString);
|
||||
dso = identifier.getObjectIdentifier().getObject(context);*/
|
||||
}
|
||||
}*/
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
return dso;
|
||||
}
|
||||
@@ -583,7 +582,7 @@ public abstract class AbstractSearch extends AbstractDSpaceTransformer
|
||||
*/
|
||||
protected boolean variableScope() throws SQLException
|
||||
{
|
||||
if (HandleUtil.obtainHandle(objectModel) == null)
|
||||
if (URIUtil.resolve(objectModel) == null)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
@@ -39,10 +39,6 @@
|
||||
*/
|
||||
package org.dspace.app.xmlui.aspect.artifactbrowser;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.apache.cocoon.caching.CacheableProcessingComponent;
|
||||
import org.apache.cocoon.util.HashUtil;
|
||||
import org.apache.excalibur.source.SourceValidity;
|
||||
@@ -52,28 +48,33 @@ import org.dspace.app.xmlui.cocoon.DSpaceFeedGenerator;
|
||||
import org.dspace.app.xmlui.utils.DSpaceValidity;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.UIException;
|
||||
import org.dspace.app.xmlui.utils.URIUtil;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
import org.dspace.app.xmlui.wing.element.Division;
|
||||
import org.dspace.app.xmlui.wing.element.ReferenceSet;
|
||||
import org.dspace.app.xmlui.wing.element.List;
|
||||
import org.dspace.app.xmlui.wing.element.PageMeta;
|
||||
import org.dspace.app.xmlui.wing.element.Para;
|
||||
import org.dspace.app.xmlui.wing.element.ReferenceSet;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.browse.BrowseEngine;
|
||||
import org.dspace.browse.BrowseException;
|
||||
import org.dspace.browse.BrowseIndex;
|
||||
import org.dspace.browse.BrowserScope;
|
||||
import org.dspace.sort.SortOption;
|
||||
import org.dspace.sort.SortException;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.sort.SortException;
|
||||
import org.dspace.sort.SortOption;
|
||||
import org.dspace.uri.IdentifierFactory;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Display a single collection. This includes a full text search, browse by
|
||||
* list, community display and a list of recent submissions.
|
||||
@@ -126,7 +127,7 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
{
|
||||
try
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
return "0";
|
||||
@@ -154,7 +155,7 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
{
|
||||
try
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
return null;
|
||||
@@ -193,7 +194,7 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
WingException, UIException, SQLException, IOException,
|
||||
AuthorizeException
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if (!(dso instanceof Collection))
|
||||
return;
|
||||
|
||||
@@ -231,7 +232,7 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
public void addBody(Body body) throws SAXException, WingException,
|
||||
UIException, SQLException, IOException, AuthorizeException
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if (!(dso instanceof Collection))
|
||||
return;
|
||||
|
||||
|
@@ -48,6 +48,7 @@ import org.dspace.app.xmlui.cocoon.DSpaceFeedGenerator;
|
||||
import org.dspace.app.xmlui.utils.DSpaceValidity;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.UIException;
|
||||
import org.dspace.app.xmlui.utils.URIUtil;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
@@ -133,7 +134,7 @@ public class CommunityViewer extends AbstractDSpaceTransformer implements Cachea
|
||||
*/
|
||||
public Serializable getKey() {
|
||||
try {
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
return "0"; // no item, something is wrong
|
||||
@@ -159,7 +160,7 @@ public class CommunityViewer extends AbstractDSpaceTransformer implements Cachea
|
||||
if (this.validity == null)
|
||||
{
|
||||
try {
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
return null;
|
||||
@@ -209,7 +210,7 @@ public class CommunityViewer extends AbstractDSpaceTransformer implements Cachea
|
||||
WingException, UIException, SQLException, IOException,
|
||||
AuthorizeException
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if (!(dso instanceof Community))
|
||||
return;
|
||||
|
||||
@@ -249,7 +250,7 @@ public class CommunityViewer extends AbstractDSpaceTransformer implements Cachea
|
||||
UIException, SQLException, IOException, AuthorizeException
|
||||
{
|
||||
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if (!(dso instanceof Community))
|
||||
return;
|
||||
|
||||
|
@@ -40,16 +40,6 @@
|
||||
|
||||
package org.dspace.app.xmlui.aspect.artifactbrowser;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.cocoon.caching.CacheableProcessingComponent;
|
||||
import org.apache.cocoon.environment.ObjectModelHelper;
|
||||
import org.apache.cocoon.environment.Request;
|
||||
@@ -61,6 +51,7 @@ import org.dspace.app.xmlui.utils.DSpaceValidity;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.RequestUtils;
|
||||
import org.dspace.app.xmlui.utils.UIException;
|
||||
import org.dspace.app.xmlui.utils.URIUtil;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
@@ -85,13 +76,20 @@ import org.dspace.content.DCDate;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.sort.SortException;
|
||||
import org.dspace.sort.SortOption;
|
||||
import org.dspace.uri.IdentifierFactory;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Implements all the browse functionality (browse by title, subject, authors,
|
||||
* etc.) The types of browse available are configurable by the implementor. See
|
||||
@@ -173,7 +171,7 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
|
||||
if (key != null)
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if (dso != null)
|
||||
key += "-" + IdentifierFactory.getCanonicalForm(dso);
|
||||
|
||||
@@ -195,7 +193,7 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
try
|
||||
{
|
||||
DSpaceValidity validity = new DSpaceValidity();
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
if (dso != null)
|
||||
validity.add(dso);
|
||||
@@ -243,7 +241,7 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
|
||||
pageMeta.addMetadata("title").addContent(getTitleMessage(info));
|
||||
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
pageMeta.addTrailLink(contextPath + "/", T_dspace_home);
|
||||
if (dso != null)
|
||||
@@ -596,7 +594,7 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
params.scope = new BrowserScope(context);
|
||||
|
||||
// Are we in a community or collection?
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if (dso instanceof Community)
|
||||
params.scope.setCommunity((Community) dso);
|
||||
if (dso instanceof Collection)
|
||||
|
@@ -48,6 +48,7 @@ import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
|
||||
import org.dspace.app.xmlui.utils.DSpaceValidity;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.UIException;
|
||||
import org.dspace.app.xmlui.utils.URIUtil;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
@@ -100,7 +101,7 @@ public class ItemViewer extends AbstractDSpaceTransformer implements CacheablePr
|
||||
*/
|
||||
public Serializable getKey() {
|
||||
try {
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
return "0"; // no item, something is wrong.
|
||||
@@ -125,7 +126,7 @@ public class ItemViewer extends AbstractDSpaceTransformer implements CacheablePr
|
||||
if (this.validity == null)
|
||||
{
|
||||
try {
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
DSpaceValidity validity = new DSpaceValidity();
|
||||
validity.add(dso);
|
||||
@@ -148,7 +149,7 @@ public class ItemViewer extends AbstractDSpaceTransformer implements CacheablePr
|
||||
AuthorizeException
|
||||
{
|
||||
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if (!(dso instanceof Item))
|
||||
return;
|
||||
Item item = (Item) dso;
|
||||
@@ -173,7 +174,7 @@ public class ItemViewer extends AbstractDSpaceTransformer implements CacheablePr
|
||||
UIException, SQLException, IOException, AuthorizeException
|
||||
{
|
||||
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if (!(dso instanceof Item))
|
||||
return;
|
||||
Item item = (Item) dso;
|
||||
|
@@ -46,8 +46,8 @@ import org.apache.cocoon.util.HashUtil;
|
||||
import org.apache.excalibur.source.SourceValidity;
|
||||
import org.apache.excalibur.source.impl.validity.NOPValidity;
|
||||
import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.UIException;
|
||||
import org.dspace.app.xmlui.utils.URIUtil;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.List;
|
||||
@@ -114,7 +114,7 @@ public class Navigation extends AbstractDSpaceTransformer implements CacheablePr
|
||||
Request request = ObjectModelHelper.getRequest(objectModel);
|
||||
String key = request.getScheme() + request.getServerName() + request.getServerPort() + request.getSitemapURI() + request.getQueryString();
|
||||
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if (dso != null)
|
||||
key += "-" + IdentifierFactory.getCanonicalForm(dso);
|
||||
|
||||
@@ -173,7 +173,7 @@ public class Navigation extends AbstractDSpaceTransformer implements CacheablePr
|
||||
// Add the configured browse lists for 'top level' browsing
|
||||
addBrowseOptions(browseGlobal, contextPath + "/browse");
|
||||
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if (dso != null)
|
||||
{
|
||||
if (dso instanceof Item)
|
||||
@@ -225,7 +225,7 @@ public class Navigation extends AbstractDSpaceTransformer implements CacheablePr
|
||||
pageMeta.addMetadata("page","contactURL").addContent(contextPath + "/contact");
|
||||
pageMeta.addMetadata("page","feedbackURL").addContent(contextPath + "/feedback");
|
||||
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if (dso != null)
|
||||
{
|
||||
if (dso instanceof Item)
|
||||
|
@@ -44,6 +44,7 @@ import org.apache.cocoon.environment.Request;
|
||||
import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.UIException;
|
||||
import org.dspace.app.xmlui.utils.URIUtil;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
@@ -87,7 +88,7 @@ public class RestrictedItem extends AbstractDSpaceTransformer //implements Cache
|
||||
WingException, UIException, SQLException, IOException,
|
||||
AuthorizeException
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
pageMeta.addMetadata("title").addContent(T_title);
|
||||
|
||||
@@ -103,7 +104,7 @@ public class RestrictedItem extends AbstractDSpaceTransformer //implements Cache
|
||||
UIException, SQLException, IOException, AuthorizeException
|
||||
{
|
||||
Request request = ObjectModelHelper.getRequest(objectModel);
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
String type = null;
|
||||
String identifier = null;
|
||||
|
@@ -39,15 +39,12 @@
|
||||
*/
|
||||
package org.dspace.app.xmlui.aspect.artifactbrowser;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cocoon.caching.CacheableProcessingComponent;
|
||||
import org.apache.cocoon.environment.ObjectModelHelper;
|
||||
import org.apache.cocoon.environment.Request;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.UIException;
|
||||
import org.dspace.app.xmlui.utils.URIUtil;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
@@ -62,6 +59,10 @@ import org.dspace.content.Community;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Preform a simple search of the repository. The user provides a simple one
|
||||
* field query (the url parameter is named query) and the results are processed.
|
||||
@@ -100,7 +101,7 @@ public class SimpleSearch extends AbstractSearch implements CacheableProcessingC
|
||||
pageMeta.addMetadata("title").addContent(T_title);
|
||||
pageMeta.addTrailLink(contextPath + "/", T_dspace_home);
|
||||
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if ((dso instanceof Collection) || (dso instanceof Community))
|
||||
{
|
||||
HandleUtil.buildHandleTrail(dso,pageMeta,contextPath);
|
||||
|
@@ -40,21 +40,21 @@
|
||||
|
||||
package org.dspace.app.xmlui.aspect.general;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.avalon.framework.logger.AbstractLogEnabled;
|
||||
import org.apache.avalon.framework.parameters.Parameters;
|
||||
import org.apache.cocoon.matching.Matcher;
|
||||
import org.apache.cocoon.sitemap.PatternException;
|
||||
import org.dspace.app.xmlui.utils.ContextUtil;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.URIUtil;
|
||||
import org.dspace.authorize.AuthorizeManager;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Test the current URL to see if the user has access to the described
|
||||
* resources. The privelege tested against uses the pattern attribute, the
|
||||
@@ -108,7 +108,7 @@ public class HandleAuthorizedMatcher extends AbstractLogEnabled implements Match
|
||||
try
|
||||
{
|
||||
Context context = ContextUtil.obtainContext(objectModel);
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
return null;
|
||||
|
@@ -40,21 +40,21 @@
|
||||
|
||||
package org.dspace.app.xmlui.aspect.general;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.avalon.framework.logger.AbstractLogEnabled;
|
||||
import org.apache.avalon.framework.parameters.Parameters;
|
||||
import org.apache.cocoon.matching.Matcher;
|
||||
import org.apache.cocoon.sitemap.PatternException;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.URIUtil;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Constants;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Test the current URL to see if it or any of it's parants match against the
|
||||
* given handle.
|
||||
@@ -81,7 +81,7 @@ public class HandleMatcher extends AbstractLogEnabled implements Matcher
|
||||
{
|
||||
try
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if (dso == null)
|
||||
return null;
|
||||
|
||||
|
@@ -40,18 +40,18 @@
|
||||
|
||||
package org.dspace.app.xmlui.aspect.general;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.avalon.framework.logger.AbstractLogEnabled;
|
||||
import org.apache.avalon.framework.parameters.Parameters;
|
||||
import org.apache.cocoon.matching.Matcher;
|
||||
import org.apache.cocoon.sitemap.PatternException;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.URIUtil;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Constants;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Test the current URL to see if it contains a reference to a DSpaceObject, if
|
||||
* it dose then the object type is compared against the given pattern. The
|
||||
@@ -106,7 +106,7 @@ public class HandleTypeMatcher extends AbstractLogEnabled implements Matcher
|
||||
try
|
||||
{
|
||||
// HandleUtil handles caching if needed.
|
||||
dso = HandleUtil.obtainHandle(objectModel);
|
||||
dso = URIUtil.resolve(objectModel);
|
||||
}
|
||||
catch (SQLException sqle)
|
||||
{
|
||||
|
@@ -44,8 +44,8 @@ import org.apache.cocoon.util.HashUtil;
|
||||
import org.apache.excalibur.source.SourceValidity;
|
||||
import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
|
||||
import org.dspace.app.xmlui.utils.DSpaceValidity;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.UIException;
|
||||
import org.dspace.app.xmlui.utils.URIUtil;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
@@ -85,7 +85,7 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
{
|
||||
try
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
return "0";
|
||||
@@ -113,7 +113,7 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
{
|
||||
try
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
if (dso == null)
|
||||
return null;
|
||||
@@ -155,7 +155,7 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
public void addBody(Body body) throws SAXException, WingException,
|
||||
UIException, SQLException, IOException, AuthorizeException
|
||||
{
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
if (!(dso instanceof Collection))
|
||||
return;
|
||||
|
||||
|
@@ -97,7 +97,7 @@ public class Navigation extends AbstractDSpaceTransformer implements CacheablePr
|
||||
options.addList("administrative");
|
||||
|
||||
// This dosn't flow very well, lets remove it and see if anyone misses it.
|
||||
// DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
// DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
// if (dso != null && dso instanceof Collection)
|
||||
// {
|
||||
// Collection collection = (Collection) dso;
|
||||
|
@@ -40,23 +40,24 @@
|
||||
|
||||
package org.dspace.app.xmlui.cocoon;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.avalon.framework.logger.AbstractLogEnabled;
|
||||
import org.apache.avalon.framework.parameters.Parameters;
|
||||
import org.apache.cocoon.environment.ObjectModelHelper;
|
||||
import org.apache.cocoon.environment.Request;
|
||||
import org.apache.cocoon.matching.Matcher;
|
||||
import org.apache.cocoon.sitemap.PatternException;
|
||||
import org.dspace.app.xmlui.configuration.XMLUIConfiguration;
|
||||
import org.dspace.app.xmlui.configuration.Theme;
|
||||
import org.dspace.app.xmlui.configuration.XMLUIConfiguration;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.URIUtil;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* This class determines the correct Aspect to use. This is determined by the
|
||||
* url string, if it is prepended with a number followed by a slash (such as 1/
|
||||
@@ -94,7 +95,7 @@ public class ThemeMatcher extends AbstractLogEnabled implements Matcher {
|
||||
try {
|
||||
Request request = ObjectModelHelper.getRequest(objectModel);
|
||||
String uri = request.getSitemapURI();
|
||||
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
|
||||
DSpaceObject dso = URIUtil.resolve(objectModel);
|
||||
|
||||
List<Theme> rules = XMLUIConfiguration.getThemeRules();
|
||||
getLogger().debug("Checking if URL=" + uri + " matches any theme rules.");
|
||||
|
@@ -60,6 +60,9 @@ import org.dspace.core.Context;
|
||||
|
||||
/**
|
||||
* Simple utility class for extracting handles.
|
||||
*
|
||||
* NOTE: this class is effectively deprecated, and exists to provide legacy support for
|
||||
* handle resolution
|
||||
*
|
||||
* @author Scott Phillips
|
||||
*/
|
||||
@@ -96,26 +99,11 @@ public class HandleUtil
|
||||
|
||||
String handle = uri.substring(HANDLE_PREFIX.length());
|
||||
|
||||
int firstSlash = handle.indexOf('/');
|
||||
if (firstSlash < 0)
|
||||
// If there is no first slash then no match
|
||||
return null;
|
||||
|
||||
int secondSlash = handle.indexOf('/', firstSlash + 1);
|
||||
if (secondSlash < 0)
|
||||
// A trailing slash is not nesssary if there is nothing after
|
||||
// the handle.
|
||||
secondSlash = handle.length();
|
||||
|
||||
handle = handle.substring(0, secondSlash);
|
||||
// now fudge the legacy version of the handle
|
||||
handle = "hdl:" + handle;
|
||||
|
||||
Context context = ContextUtil.obtainContext(objectModel);
|
||||
// dso = HandleManager.resolveToObject(context, handle);
|
||||
/*
|
||||
ExternalIdentifierDAO dao =
|
||||
ExternalIdentifierDAOFactory.getInstance(context);
|
||||
ExternalIdentifier identifier = dao.retrieve(handle);
|
||||
dso = identifier.getObjectIdentifier().getObject(context);*/
|
||||
|
||||
ResolvableIdentifier ri = IdentifierFactory.resolve(context, handle);
|
||||
dso = ri.getObject(context);
|
||||
|
||||
|
@@ -0,0 +1,53 @@
|
||||
package org.dspace.app.xmlui.utils;
|
||||
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.uri.ResolvableIdentifier;
|
||||
import org.dspace.uri.IdentifierFactory;
|
||||
import org.apache.cocoon.environment.Request;
|
||||
import org.apache.cocoon.environment.ObjectModelHelper;
|
||||
|
||||
import java.util.Map;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class URIUtil
|
||||
{
|
||||
/** The URL prefix of all object uris */
|
||||
protected static final String URI_PREFIX = "resource/";
|
||||
|
||||
protected static final String DSPACE_OBJECT = "dspace.object";
|
||||
|
||||
/**
|
||||
* Obtain the current DSpace handle for the specified request.
|
||||
*
|
||||
* @param objectModel
|
||||
* The cocoon model.
|
||||
* @return A DSpace handle, or null if none found.
|
||||
*/
|
||||
public static DSpaceObject resolve(Map objectModel)
|
||||
throws SQLException
|
||||
{
|
||||
Request request = ObjectModelHelper.getRequest(objectModel);
|
||||
DSpaceObject dso = (DSpaceObject) request.getAttribute(DSPACE_OBJECT);
|
||||
|
||||
if (dso == null)
|
||||
{
|
||||
String uri = request.getSitemapURI();
|
||||
Context context = ContextUtil.obtainContext(objectModel);
|
||||
ResolvableIdentifier ri = IdentifierFactory.resolve(context, uri);
|
||||
if (ri == null)
|
||||
{
|
||||
// FIXME: this is not right, but there's not much choice just now
|
||||
|
||||
// maybe we have a legacy url problem
|
||||
dso = HandleUtil.obtainHandle(objectModel);
|
||||
return dso;
|
||||
}
|
||||
dso = ri.getObject(context);
|
||||
|
||||
request.setAttribute(DSPACE_OBJECT, dso);
|
||||
}
|
||||
|
||||
return dso;
|
||||
}
|
||||
}
|
@@ -153,7 +153,84 @@ and searching the repository.
|
||||
<map:transform type="ConfigurableBrowse"/>
|
||||
<map:serialize type="xml"/>
|
||||
</map:match>
|
||||
|
||||
|
||||
<!-- general identifier features -->
|
||||
<map:match pattern="resource/**">
|
||||
|
||||
<!-- Inform the user that the item they are viewing is a restricted resource -->
|
||||
<map:match pattern="resource/*/restricted-resource">
|
||||
<map:transform type="RestrictedItem"/>
|
||||
<map:serialize type="xml"/>
|
||||
</map:match>
|
||||
|
||||
<!-- Scoped browse by features -->
|
||||
<map:match type="HandleAuthorizedMatcher" pattern="READ">
|
||||
<map:match type="HandleTypeMatcher" pattern="community,collection">
|
||||
|
||||
<!-- Browse (by anything) -->
|
||||
<map:match pattern="resource/*/browse">
|
||||
<map:transform type="ConfigurableBrowse"/>
|
||||
<map:serialize type="xml"/>
|
||||
</map:match>
|
||||
|
||||
<!-- Simple search -->
|
||||
<map:match pattern="resource/*/search">
|
||||
<map:transform type="SimpleSearch"/>
|
||||
<map:serialize type="xml"/>
|
||||
</map:match>
|
||||
|
||||
<!-- Simple search again, but this time they said it -->
|
||||
<map:match pattern="resource/*/simple-search">
|
||||
<map:transform type="SimpleSearch"/>
|
||||
<map:serialize type="xml"/>
|
||||
</map:match>
|
||||
|
||||
<!-- Advanced search -->
|
||||
<map:match pattern="resource/*/advanced-search">
|
||||
<map:transform type="AdvancedSearch"/>
|
||||
<map:serialize type="xml"/>
|
||||
</map:match>
|
||||
|
||||
</map:match> <!-- End match community or collection -->
|
||||
</map:match> <!-- End match can read -->
|
||||
|
||||
|
||||
<!-- Community, Collection, and Item Viewers -->
|
||||
<map:match pattern="resource/**">
|
||||
<map:match type="HandleAuthorizedMatcher" pattern="READ">
|
||||
<map:match type="HandleTypeMatcher" pattern="community">
|
||||
<map:transform type="CommunityViewer"/>
|
||||
<map:serialize type="xml"/>
|
||||
</map:match>
|
||||
<map:match type="HandleTypeMatcher" pattern="collection">
|
||||
<map:transform type="CollectionViewer"/>
|
||||
<map:serialize type="xml"/>
|
||||
</map:match>
|
||||
<map:match type="HandleTypeMatcher" pattern="item">
|
||||
<map:transform type="ItemViewer"/>
|
||||
<map:serialize type="xml"/>
|
||||
</map:match>
|
||||
</map:match>
|
||||
|
||||
<map:match type="HandleAuthorizedMatcher" pattern="!READ">
|
||||
<map:select type="AuthenticatedSelector">
|
||||
<map:when test="eperson">
|
||||
<map:transform type="RestrictedItem"/>
|
||||
<map:serialize/>
|
||||
</map:when>
|
||||
<map:otherwise>
|
||||
<map:act type="StartAuthentication">
|
||||
<map:parameter name="header" value="xmlui.ArtifactBrowser.RestrictedItem.auth_header"/>
|
||||
<map:parameter name="message" value="xmlui.ArtifactBrowser.RestrictedItem.auth_message"/>
|
||||
</map:act>
|
||||
<map:serialize/>
|
||||
</map:otherwise>
|
||||
</map:select>
|
||||
</map:match>
|
||||
</map:match>
|
||||
|
||||
</map:match>
|
||||
|
||||
<!-- Handle specific features -->
|
||||
<map:match pattern="handle/*/**">
|
||||
|
||||
|
Reference in New Issue
Block a user