mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +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:
@@ -345,6 +345,13 @@ public interface BrowseDAO
|
|||||||
*/
|
*/
|
||||||
public void setFilterValue(String value);
|
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
|
* Get the name of the field in which the value to constrain results is
|
||||||
* contained
|
* contained
|
||||||
|
@@ -100,6 +100,9 @@ public class BrowseDAOOracle implements BrowseDAO
|
|||||||
/** value to restrict browse to (e.g. author name) */
|
/** value to restrict browse to (e.g. author name) */
|
||||||
private String value = null;
|
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 */
|
/** the table that defines the mapping for the relevant container */
|
||||||
private String containerTable = null;
|
private String containerTable = null;
|
||||||
|
|
||||||
@@ -613,6 +616,15 @@ public class BrowseDAOOracle implements BrowseDAO
|
|||||||
this.rebuildQuery = true;
|
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)
|
/* (non-Javadoc)
|
||||||
* @see org.dspace.browse.BrowseDAO#setValueField(java.lang.String)
|
* @see org.dspace.browse.BrowseDAO#setValueField(java.lang.String)
|
||||||
*/
|
*/
|
||||||
@@ -1029,6 +1041,21 @@ public class BrowseDAOOracle implements BrowseDAO
|
|||||||
buildWhereClauseOpInsert(queryBuf);
|
buildWhereClauseOpInsert(queryBuf);
|
||||||
queryBuf.append(" ");
|
queryBuf.append(" ");
|
||||||
queryBuf.append(valueField);
|
queryBuf.append(valueField);
|
||||||
|
if (valuePartial)
|
||||||
|
{
|
||||||
|
queryBuf.append(" LIKE ? ");
|
||||||
|
|
||||||
|
if (valueField.startsWith("sort_"))
|
||||||
|
{
|
||||||
|
params.add("%" + utils.truncateSortValue(value) + "%");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
params.add("%" + utils.truncateValue(value) + "%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
queryBuf.append("=? ");
|
queryBuf.append("=? ");
|
||||||
|
|
||||||
if (valueField.startsWith("sort_"))
|
if (valueField.startsWith("sort_"))
|
||||||
@@ -1041,6 +1068,7 @@ public class BrowseDAOOracle implements BrowseDAO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert an operator into the where clause, and reset to ' AND '
|
* Insert an operator into the where clause, and reset to ' AND '
|
||||||
|
@@ -100,6 +100,9 @@ public class BrowseDAOPostgres implements BrowseDAO
|
|||||||
/** value to restrict browse to (e.g. author name) */
|
/** value to restrict browse to (e.g. author name) */
|
||||||
private String value = null;
|
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 */
|
/** the table that defines the mapping for the relevant container */
|
||||||
private String containerTable = null;
|
private String containerTable = null;
|
||||||
|
|
||||||
@@ -617,6 +620,15 @@ public class BrowseDAOPostgres implements BrowseDAO
|
|||||||
this.rebuildQuery = true;
|
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)
|
/* (non-Javadoc)
|
||||||
* @see org.dspace.browse.BrowseDAO#setValueField(java.lang.String)
|
* @see org.dspace.browse.BrowseDAO#setValueField(java.lang.String)
|
||||||
*/
|
*/
|
||||||
@@ -1034,6 +1046,21 @@ public class BrowseDAOPostgres implements BrowseDAO
|
|||||||
buildWhereClauseOpInsert(queryBuf);
|
buildWhereClauseOpInsert(queryBuf);
|
||||||
queryBuf.append(" ");
|
queryBuf.append(" ");
|
||||||
queryBuf.append(valueField);
|
queryBuf.append(valueField);
|
||||||
|
if (valuePartial)
|
||||||
|
{
|
||||||
|
queryBuf.append(" LIKE ? ");
|
||||||
|
|
||||||
|
if (valueField.startsWith("sort_"))
|
||||||
|
{
|
||||||
|
params.add("%" + utils.truncateSortValue(value) + "%");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
params.add("%" + utils.truncateValue(value) + "%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
queryBuf.append("=? ");
|
queryBuf.append("=? ");
|
||||||
|
|
||||||
if (valueField.startsWith("sort_"))
|
if (valueField.startsWith("sort_"))
|
||||||
@@ -1046,6 +1073,7 @@ public class BrowseDAOPostgres implements BrowseDAO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert an operator into the where clause, and reset to ' AND '
|
* Insert an operator into the where clause, and reset to ' AND '
|
||||||
|
@@ -291,6 +291,7 @@ public class BrowseEngine
|
|||||||
// set the values in the Browse Query
|
// set the values in the Browse Query
|
||||||
dao.setFilterValueField("sort_value");
|
dao.setFilterValueField("sort_value");
|
||||||
dao.setFilterValue(value);
|
dao.setFilterValue(value);
|
||||||
|
dao.setFilterValuePartial(scope.getFilterValuePartial());
|
||||||
}
|
}
|
||||||
|
|
||||||
// define a clause for the WHERE clause which will allow us to constraine
|
// 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 */
|
/** the value to restrict the browse to */
|
||||||
private String filterValue;
|
private String filterValue;
|
||||||
|
|
||||||
|
/** exact or partial matching of the value */
|
||||||
|
private boolean filterValuePartial = false;
|
||||||
|
|
||||||
/** the language of the value to restrict the browse to */
|
/** the language of the value to restrict the browse to */
|
||||||
private String filterValueLang;
|
private String filterValueLang;
|
||||||
|
|
||||||
@@ -494,6 +497,24 @@ public class BrowserScope
|
|||||||
this.filterValue = value;
|
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.
|
* @return Returns the language.
|
||||||
*/
|
*/
|
||||||
|
@@ -368,6 +368,7 @@ public class ItemMapServlet extends DSpaceServlet
|
|||||||
bs.setBrowseIndex(bi);
|
bs.setBrowseIndex(bi);
|
||||||
bs.setOrder(SortOption.ASCENDING);
|
bs.setOrder(SortOption.ASCENDING);
|
||||||
bs.setFilterValue(name);
|
bs.setFilterValue(name);
|
||||||
|
bs.setFilterValuePartial(true);
|
||||||
bs.setJumpToValue(null);
|
bs.setJumpToValue(null);
|
||||||
bs.setResultsPerPage(10000); // an arbitrary number (large) for the time being
|
bs.setResultsPerPage(10000); // an arbitrary number (large) for the time being
|
||||||
bs.setSortBy(0);
|
bs.setSortBy(0);
|
||||||
|
Reference in New Issue
Block a user