mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-16 06:23:10 +00:00
r8475@libaxis1 (orig r2354): grahamtriggs | 2007-11-21 07:39:54 -0500
Fixed browsing of authors in Item Mapper so that you only need to specify a partial name git-svn-id: http://scm.dspace.org/svn/repo/trunk@2376 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -344,6 +344,13 @@ public interface BrowseDAO
|
||||
* @param value the value to which to constrain results
|
||||
*/
|
||||
public void setFilterValue(String value);
|
||||
|
||||
/**
|
||||
* Sets whether we will treat the filter value as partial (like match), or exact
|
||||
*
|
||||
* @param part true if partial, false if exact
|
||||
*/
|
||||
public void setFilterValuePartial(boolean part);
|
||||
|
||||
/**
|
||||
* Get the name of the field in which the value to constrain results is
|
||||
|
@@ -99,6 +99,9 @@ public class BrowseDAOOracle implements BrowseDAO
|
||||
|
||||
/** value to restrict browse to (e.g. author name) */
|
||||
private String value = null;
|
||||
|
||||
/** exact or partial matching of the value */
|
||||
private boolean valuePartial = false;
|
||||
|
||||
/** the table that defines the mapping for the relevant container */
|
||||
private String containerTable = null;
|
||||
@@ -613,6 +616,15 @@ public class BrowseDAOOracle implements BrowseDAO
|
||||
this.rebuildQuery = true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.dspace.browse.BrowseDAO#setFilterValuePartial(boolean)
|
||||
*/
|
||||
public void setFilterValuePartial(boolean part)
|
||||
{
|
||||
this.valuePartial = part;
|
||||
this.rebuildQuery = true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.dspace.browse.BrowseDAO#setValueField(java.lang.String)
|
||||
*/
|
||||
@@ -1029,15 +1041,31 @@ public class BrowseDAOOracle implements BrowseDAO
|
||||
buildWhereClauseOpInsert(queryBuf);
|
||||
queryBuf.append(" ");
|
||||
queryBuf.append(valueField);
|
||||
queryBuf.append("=? ");
|
||||
|
||||
if (valueField.startsWith("sort_"))
|
||||
if (valuePartial)
|
||||
{
|
||||
params.add(utils.truncateSortValue(value));
|
||||
queryBuf.append(" LIKE ? ");
|
||||
|
||||
if (valueField.startsWith("sort_"))
|
||||
{
|
||||
params.add("%" + utils.truncateSortValue(value) + "%");
|
||||
}
|
||||
else
|
||||
{
|
||||
params.add("%" + utils.truncateValue(value) + "%");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
params.add(utils.truncateValue(value));
|
||||
queryBuf.append("=? ");
|
||||
|
||||
if (valueField.startsWith("sort_"))
|
||||
{
|
||||
params.add(utils.truncateSortValue(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
params.add(utils.truncateValue(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -99,6 +99,9 @@ public class BrowseDAOPostgres implements BrowseDAO
|
||||
|
||||
/** value to restrict browse to (e.g. author name) */
|
||||
private String value = null;
|
||||
|
||||
/** exact or partial matching of the value */
|
||||
private boolean valuePartial = false;
|
||||
|
||||
/** the table that defines the mapping for the relevant container */
|
||||
private String containerTable = null;
|
||||
@@ -616,6 +619,15 @@ public class BrowseDAOPostgres implements BrowseDAO
|
||||
this.value = value;
|
||||
this.rebuildQuery = true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.dspace.browse.BrowseDAO#setFilterValuePartial(boolean)
|
||||
*/
|
||||
public void setFilterValuePartial(boolean part)
|
||||
{
|
||||
this.valuePartial = part;
|
||||
this.rebuildQuery = true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.dspace.browse.BrowseDAO#setValueField(java.lang.String)
|
||||
@@ -1034,15 +1046,31 @@ public class BrowseDAOPostgres implements BrowseDAO
|
||||
buildWhereClauseOpInsert(queryBuf);
|
||||
queryBuf.append(" ");
|
||||
queryBuf.append(valueField);
|
||||
queryBuf.append("=? ");
|
||||
|
||||
if (valueField.startsWith("sort_"))
|
||||
if (valuePartial)
|
||||
{
|
||||
params.add(utils.truncateSortValue(value));
|
||||
queryBuf.append(" LIKE ? ");
|
||||
|
||||
if (valueField.startsWith("sort_"))
|
||||
{
|
||||
params.add("%" + utils.truncateSortValue(value) + "%");
|
||||
}
|
||||
else
|
||||
{
|
||||
params.add("%" + utils.truncateValue(value) + "%");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
params.add(utils.truncateValue(value));
|
||||
queryBuf.append("=? ");
|
||||
|
||||
if (valueField.startsWith("sort_"))
|
||||
{
|
||||
params.add(utils.truncateSortValue(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
params.add(utils.truncateValue(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -291,6 +291,7 @@ public class BrowseEngine
|
||||
// set the values in the Browse Query
|
||||
dao.setFilterValueField("sort_value");
|
||||
dao.setFilterValue(value);
|
||||
dao.setFilterValuePartial(scope.getFilterValuePartial());
|
||||
}
|
||||
|
||||
// define a clause for the WHERE clause which will allow us to constraine
|
||||
|
@@ -69,6 +69,9 @@ public class BrowserScope
|
||||
/** the value to restrict the browse to */
|
||||
private String filterValue;
|
||||
|
||||
/** exact or partial matching of the value */
|
||||
private boolean filterValuePartial = false;
|
||||
|
||||
/** the language of the value to restrict the browse to */
|
||||
private String filterValueLang;
|
||||
|
||||
@@ -494,6 +497,24 @@ public class BrowserScope
|
||||
this.filterValue = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the filter value be treated as partial, or exact
|
||||
* @return true if partial, false if exact
|
||||
*/
|
||||
public boolean getFilterValuePartial()
|
||||
{
|
||||
return filterValuePartial;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the filter value be treated as partial, or exact
|
||||
* @param filterValuePartial true if partial, false if exact
|
||||
*/
|
||||
public void setFilterValuePartial(boolean filterValuePartial)
|
||||
{
|
||||
this.filterValuePartial = filterValuePartial;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the language.
|
||||
*/
|
||||
|
@@ -368,6 +368,7 @@ public class ItemMapServlet extends DSpaceServlet
|
||||
bs.setBrowseIndex(bi);
|
||||
bs.setOrder(SortOption.ASCENDING);
|
||||
bs.setFilterValue(name);
|
||||
bs.setFilterValuePartial(true);
|
||||
bs.setJumpToValue(null);
|
||||
bs.setResultsPerPage(10000); // an arbitrary number (large) for the time being
|
||||
bs.setSortBy(0);
|
||||
|
Reference in New Issue
Block a user