SF Patch #1602185 for bug #1589902 Duplicate [field] checking error [on input-forms.xml]

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1692 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Scott Yeadon
2006-11-27 23:51:16 +00:00
parent 13abadf76e
commit 61e29037c0
2 changed files with 54 additions and 34 deletions

View File

@@ -13,6 +13,7 @@
- Update DIDL license and change coding style to DSpace standard - Update DIDL license and change coding style to DSpace standard
(Stuart Lewis) (Stuart Lewis)
- SF Patch #1602185 for bug #1589902 Duplicate [field] checking error [on input-forms.xml]
- SF Patch #1598323 Support stats from both 1.3 and 1.4 - SF Patch #1598323 Support stats from both 1.3 and 1.4
- SF Patch #1594208 for bug #1592984 Date comparisons strip time in org.dspace.harvest.Harvest - SF Patch #1594208 for bug #1592984 Date comparisons strip time in org.dspace.harvest.Harvest
- SF Patch #1596113 [dspace]/bin/update-handle-prefix needs to index-all - SF Patch #1596113 [dspace]/bin/update-handle-prefix needs to index-all

View File

@@ -52,6 +52,7 @@ import javax.xml.parsers.*;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.dspace.content.MetadataSchema;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
import org.dspace.app.webui.servlet.SubmitServlet; import org.dspace.app.webui.servlet.SubmitServlet;
@@ -460,40 +461,58 @@ public class DCInputsReader
*/ */
private String checkForDups(String formName, HashMap field, Vector pages) private String checkForDups(String formName, HashMap field, Vector pages)
{ {
int matches = 0; int matches = 0;
String err = null; String err = null;
String elem = (String)field.get("dc-element"); String schema = (String)field.get("dc-schema");
String qual = (String)field.get("dc-qualifier"); String elem = (String)field.get("dc-element");
String qual = (String)field.get("dc-qualifier");
for (int i = 0; i < pages.size(); i++) if ((schema == null) || (schema.equals("")))
{ {
Vector pg = (Vector)pages.get(i); schema = MetadataSchema.DC_SCHEMA;
for (int j = 0; j < pg.size(); j++) }
{ String schemaTest;
HashMap fld = (HashMap)pg.get(j);
if (((String)fld.get("dc-element")).equals(elem)) for (int i = 0; i < pages.size(); i++)
{ {
String ql = (String)fld.get("dc-qualifier"); Vector pg = (Vector)pages.get(i);
if (qual != null) for (int j = 0; j < pg.size(); j++)
{ {
if ((ql != null) && ql.equals(qual)) HashMap fld = (HashMap)pg.get(j);
{ if ((fld.get("dc-schema") == null) ||
matches++; (((String)fld.get("dc-schema")).equals("")))
} {
} schemaTest = MetadataSchema.DC_SCHEMA;
else if (ql == null) }
{ else
matches++; {
} schemaTest = (String)fld.get("dc-schema");
} }
}
} // Are the schema and element the same? If so, check the qualifier
if (matches > 1) if ((((String)fld.get("dc-element")).equals(elem)) &&
{ (schemaTest.equals(schema)))
err = "Duplicate field " + elem + "." + qual + " detected in form " + formName; {
} String ql = (String)fld.get("dc-qualifier");
if (qual != null)
return err; {
if ((ql != null) && ql.equals(qual))
{
matches++;
}
}
else if (ql == null)
{
matches++;
}
}
}
}
if (matches > 1)
{
err = "Duplicate field " + schema + "." + elem + "." + qual + " detected in form " + formName;
}
return err;
} }