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:
Mark Diggory
2007-11-26 20:27:02 +00:00
parent 1228d50de5
commit a8801282b8
6 changed files with 96 additions and 10 deletions

View File

@@ -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));
}
}
}
}