116542: fix issues with CSV importing and the Any language being set on metadata values

This commit is contained in:
Jens Vannerum
2024-07-22 15:08:59 +02:00
parent 374c93a5da
commit e03c402a9d
12 changed files with 118 additions and 72 deletions

View File

@@ -802,7 +802,7 @@ public class StructBuilder {
// default the short description to the empty string
collectionService.setMetadataSingleValue(context, collection,
MD_SHORT_DESCRIPTION, Item.ANY, " ");
MD_SHORT_DESCRIPTION, null, " ");
// import the rest of the metadata
for (Map.Entry<String, MetadataFieldName> entry : collectionMap.entrySet()) {

View File

@@ -188,6 +188,15 @@ public class DSpaceCSV implements Serializable {
// Verify that the heading is valid in the metadata registry
String[] clean = element.split("\\[");
String[] parts = clean[0].split("\\.");
// Check language if present, if it's ANY then throw an exception
if (clean.length > 1 && clean[1].equals(Item.ANY + "]")) {
throw new MetadataImportInvalidHeadingException("Language ANY (*) was found in the heading " +
"of the metadata value to import, " +
"this should never be the case",
MetadataImportInvalidHeadingException.ENTRY,
columnCounter);
}
if (parts.length < 2) {
throw new MetadataImportInvalidHeadingException(element,
@@ -223,6 +232,15 @@ public class DSpaceCSV implements Serializable {
}
}
// Verify there isnt already a header that is the same; if it already exists,
// throw MetadataImportInvalidHeadingException
String header = authorityPrefix + element;
if (headings.contains(header)) {
throw new MetadataImportInvalidHeadingException("Duplicate heading found: " + header,
MetadataImportInvalidHeadingException.ENTRY,
columnCounter);
}
// Store the heading
headings.add(authorityPrefix + element);
}

View File

@@ -229,7 +229,7 @@ public class Collection extends CacheableDSpaceObject implements DSpaceObjectLeg
* @throws SQLException if database error
*/
public void setLicense(Context context, String license) throws SQLException {
getCollectionService().setMetadataSingleValue(context, this, MD_LICENSE, Item.ANY, license);
getCollectionService().setMetadataSingleValue(context, this, MD_LICENSE, null, license);
}
/**

View File

@@ -19,6 +19,7 @@ import jakarta.persistence.ManyToOne;
import jakarta.persistence.SequenceGenerator;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import org.apache.commons.lang3.StringUtils;
import org.dspace.core.Context;
import org.dspace.core.HibernateProxyHelper;
import org.dspace.core.ReloadableEntity;
@@ -139,6 +140,9 @@ public class MetadataValue implements ReloadableEntity<Integer> {
* @param language new language
*/
public void setLanguage(String language) {
if (StringUtils.equals(language, Item.ANY)) {
language = null;
}
this.language = language;
}

View File

@@ -75,6 +75,31 @@ public class MetadataImportIT extends AbstractIntegrationTestWithDatabase {
context.restoreAuthSystemState();
}
@Test
public void metadataImportTestWithDuplicateHeader() {
String[] csv = {"id,collection,dc.title,dc.title,dc.contributor.author",
"+," + collection.getHandle() + ",\"Test Import 1\",\"Test Import 2\"," + "\"Donald, SmithImported\"," +
"+," + collection.getHandle() + ",\"Test Import 3\",\"Test Import 4\"," + "\"Donald, SmithImported\""};
// Should throw an exception because of duplicate header
try {
performImportScript(csv);
} catch (Exception e) {
assertTrue(e instanceof MetadataImportInvalidHeadingException);
}
}
@Test
public void metadataImportTestWithAnyLanguage() {
String[] csv = {"id,collection,dc.title[*],dc.contributor.author",
"+," + collection.getHandle() + ",\"Test Import 1\"," + "\"Donald, SmithImported\""};
// Should throw an exception because of invalid ANY language (*) in metadata field
try {
performImportScript(csv);
} catch (Exception e) {
assertTrue(e instanceof MetadataImportInvalidHeadingException);
}
}
@Test
public void metadataImportTest() throws Exception {
String[] csv = {"id,collection,dc.title,dc.contributor.author",
@@ -230,7 +255,7 @@ public class MetadataImportIT extends AbstractIntegrationTestWithDatabase {
itemService.getMetadata(item, "dc", "contributor", "author", Item.ANY).get(0).getValue(),
"TestAuthorToRemove"));
String[] csv = {"id,collection,dc.title,dc.contributor.author[*]",
String[] csv = {"id,collection,dc.title,dc.contributor.author",
item.getID().toString() + "," + personCollection.getHandle() + "," + item.getName() + ","};
performImportScript(csv);
item = findItemByName(itemTitle);

View File

@@ -18,7 +18,6 @@ import org.apache.logging.log4j.Logger;
import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.ResourcePolicy;
import org.dspace.content.DSpaceObject;
import org.dspace.content.Item;
import org.dspace.content.service.DSpaceObjectService;
import org.dspace.core.Constants;
import org.dspace.core.Context;
@@ -103,7 +102,7 @@ public abstract class AbstractDSpaceObjectBuilder<T extends DSpaceObject>
final String qualifier,
final String value) {
try {
getService().setMetadataSingleValue(context, dso, schema, element, qualifier, Item.ANY, value);
getService().setMetadataSingleValue(context, dso, schema, element, qualifier, null, value);
} catch (Exception e) {
return handleException(e);
}

View File

@@ -141,37 +141,37 @@ public class ItemComparatorTest extends AbstractUnitTest {
assertTrue("testCompare 0", result == 0);
ic = new ItemComparator("test", "one", Item.ANY, true);
itemService.addMetadata(context, one, "dc", "test", "one", Item.ANY, "1");
itemService.addMetadata(context, one, "dc", "test", "one", null, "1");
result = ic.compare(one, two);
assertTrue("testCompare 1", result >= 1);
itemService.clearMetadata(context, one, "dc", "test", "one", Item.ANY);
ic = new ItemComparator("test", "one", Item.ANY, true);
itemService.addMetadata(context, two, "dc", "test", "one", Item.ANY, "1");
itemService.addMetadata(context, two, "dc", "test", "one", null, "1");
result = ic.compare(one, two);
assertTrue("testCompare 2", result <= -1);
itemService.clearMetadata(context, two, "dc", "test", "one", Item.ANY);
//value in both items
ic = new ItemComparator("test", "one", Item.ANY, true);
itemService.addMetadata(context, one, "dc", "test", "one", Item.ANY, "1");
itemService.addMetadata(context, two, "dc", "test", "one", Item.ANY, "2");
itemService.addMetadata(context, one, "dc", "test", "one", null, "1");
itemService.addMetadata(context, two, "dc", "test", "one", null, "2");
result = ic.compare(one, two);
assertTrue("testCompare 3", result <= -1);
itemService.clearMetadata(context, one, "dc", "test", "one", Item.ANY);
itemService.clearMetadata(context, two, "dc", "test", "one", Item.ANY);
ic = new ItemComparator("test", "one", Item.ANY, true);
itemService.addMetadata(context, one, "dc", "test", "one", Item.ANY, "1");
itemService.addMetadata(context, two, "dc", "test", "one", Item.ANY, "1");
itemService.addMetadata(context, one, "dc", "test", "one", null, "1");
itemService.addMetadata(context, two, "dc", "test", "one", null, "1");
result = ic.compare(one, two);
assertTrue("testCompare 4", result == 0);
itemService.clearMetadata(context, one, "dc", "test", "one", Item.ANY);
itemService.clearMetadata(context, two, "dc", "test", "one", Item.ANY);
ic = new ItemComparator("test", "one", Item.ANY, true);
itemService.addMetadata(context, one, "dc", "test", "one", Item.ANY, "2");
itemService.addMetadata(context, two, "dc", "test", "one", Item.ANY, "1");
itemService.addMetadata(context, one, "dc", "test", "one", null, "2");
itemService.addMetadata(context, two, "dc", "test", "one", null, "1");
result = ic.compare(one, two);
assertTrue("testCompare 5", result >= 1);
itemService.clearMetadata(context, one, "dc", "test", "one", Item.ANY);
@@ -179,60 +179,60 @@ public class ItemComparatorTest extends AbstractUnitTest {
//multiple values (min, max)
ic = new ItemComparator("test", "one", Item.ANY, true);
itemService.addMetadata(context, one, "dc", "test", "one", Item.ANY, "0");
itemService.addMetadata(context, one, "dc", "test", "one", Item.ANY, "1");
itemService.addMetadata(context, two, "dc", "test", "one", Item.ANY, "2");
itemService.addMetadata(context, two, "dc", "test", "one", Item.ANY, "3");
itemService.addMetadata(context, one, "dc", "test", "one", null, "0");
itemService.addMetadata(context, one, "dc", "test", "one", null, "1");
itemService.addMetadata(context, two, "dc", "test", "one", null, "2");
itemService.addMetadata(context, two, "dc", "test", "one", null, "3");
result = ic.compare(one, two);
assertTrue("testCompare 3", result <= -1);
itemService.clearMetadata(context, one, "dc", "test", "one", Item.ANY);
itemService.clearMetadata(context, two, "dc", "test", "one", Item.ANY);
ic = new ItemComparator("test", "one", Item.ANY, true);
itemService.addMetadata(context, one, "dc", "test", "one", Item.ANY, "0");
itemService.addMetadata(context, one, "dc", "test", "one", Item.ANY, "1");
itemService.addMetadata(context, two, "dc", "test", "one", Item.ANY, "-1");
itemService.addMetadata(context, two, "dc", "test", "one", Item.ANY, "1");
itemService.addMetadata(context, one, "dc", "test", "one", null, "0");
itemService.addMetadata(context, one, "dc", "test", "one", null, "1");
itemService.addMetadata(context, two, "dc", "test", "one", null, "-1");
itemService.addMetadata(context, two, "dc", "test", "one", null, "1");
result = ic.compare(one, two);
assertTrue("testCompare 4", result == 0);
itemService.clearMetadata(context, one, "dc", "test", "one", Item.ANY);
itemService.clearMetadata(context, two, "dc", "test", "one", Item.ANY);
ic = new ItemComparator("test", "one", Item.ANY, true);
itemService.addMetadata(context, one, "dc", "test", "one", Item.ANY, "1");
itemService.addMetadata(context, one, "dc", "test", "one", Item.ANY, "2");
itemService.addMetadata(context, two, "dc", "test", "one", Item.ANY, "1");
itemService.addMetadata(context, two, "dc", "test", "one", Item.ANY, "-1");
itemService.addMetadata(context, one, "dc", "test", "one", null, "1");
itemService.addMetadata(context, one, "dc", "test", "one", null, "2");
itemService.addMetadata(context, two, "dc", "test", "one", null, "1");
itemService.addMetadata(context, two, "dc", "test", "one", null, "-1");
result = ic.compare(one, two);
assertTrue("testCompare 5", result >= 1);
itemService.clearMetadata(context, one, "dc", "test", "one", Item.ANY);
itemService.clearMetadata(context, two, "dc", "test", "one", Item.ANY);
ic = new ItemComparator("test", "one", Item.ANY, false);
itemService.addMetadata(context, one, "dc", "test", "one", Item.ANY, "1");
itemService.addMetadata(context, one, "dc", "test", "one", Item.ANY, "2");
itemService.addMetadata(context, two, "dc", "test", "one", Item.ANY, "2");
itemService.addMetadata(context, two, "dc", "test", "one", Item.ANY, "3");
itemService.addMetadata(context, one, "dc", "test", "one", null, "1");
itemService.addMetadata(context, one, "dc", "test", "one", null, "2");
itemService.addMetadata(context, two, "dc", "test", "one", null, "2");
itemService.addMetadata(context, two, "dc", "test", "one", null, "3");
result = ic.compare(one, two);
assertTrue("testCompare 3", result <= -1);
itemService.clearMetadata(context, one, "dc", "test", "one", Item.ANY);
itemService.clearMetadata(context, two, "dc", "test", "one", Item.ANY);
ic = new ItemComparator("test", "one", Item.ANY, false);
itemService.addMetadata(context, one, "dc", "test", "one", Item.ANY, "1");
itemService.addMetadata(context, one, "dc", "test", "one", Item.ANY, "2");
itemService.addMetadata(context, two, "dc", "test", "one", Item.ANY, "1");
itemService.addMetadata(context, two, "dc", "test", "one", Item.ANY, "5");
itemService.addMetadata(context, one, "dc", "test", "one", null, "1");
itemService.addMetadata(context, one, "dc", "test", "one", null, "2");
itemService.addMetadata(context, two, "dc", "test", "one", null, "1");
itemService.addMetadata(context, two, "dc", "test", "one", null, "5");
result = ic.compare(one, two);
assertTrue("testCompare 4", result == 0);
itemService.clearMetadata(context, one, "dc", "test", "one", Item.ANY);
itemService.clearMetadata(context, two, "dc", "test", "one", Item.ANY);
ic = new ItemComparator("test", "one", Item.ANY, false);
itemService.addMetadata(context, one, "dc", "test", "one", Item.ANY, "2");
itemService.addMetadata(context, one, "dc", "test", "one", Item.ANY, "3");
itemService.addMetadata(context, two, "dc", "test", "one", Item.ANY, "1");
itemService.addMetadata(context, two, "dc", "test", "one", Item.ANY, "4");
itemService.addMetadata(context, one, "dc", "test", "one", null, "2");
itemService.addMetadata(context, one, "dc", "test", "one", null, "3");
itemService.addMetadata(context, two, "dc", "test", "one", null, "1");
itemService.addMetadata(context, two, "dc", "test", "one", null, "4");
result = ic.compare(one, two);
assertTrue("testCompare 5", result >= 1);
itemService.clearMetadata(context, one, "dc", "test", "one", Item.ANY);

View File

@@ -518,11 +518,11 @@ public class ItemTest extends AbstractDSpaceObjectTest {
String schema = "dc";
String element = "contributor";
String qualifier = "author";
String lang = Item.ANY;
String lang = null;
String[] values = {"value0", "value1"};
itemService.addMetadata(context, it, schema, element, qualifier, lang, Arrays.asList(values));
List<MetadataValue> dc = itemService.getMetadata(it, schema, element, qualifier, lang);
List<MetadataValue> dc = itemService.getMetadata(it, schema, element, qualifier, Item.ANY);
assertThat("testAddMetadata_5args_1 0", dc, notNullValue());
assertTrue("testAddMetadata_5args_1 1", dc.size() == 2);
assertThat("testAddMetadata_5args_1 2", dc.get(0).getMetadataField().getMetadataSchema().getName(),
@@ -563,13 +563,13 @@ public class ItemTest extends AbstractDSpaceObjectTest {
String schema = "dc";
String element = "language";
String qualifier = "iso";
String lang = Item.ANY;
String lang = null;
List<String> values = Arrays.asList("en_US", "en");
List<String> authorities = Arrays.asList("accepted", "uncertain");
List<Integer> confidences = Arrays.asList(0, 0);
itemService.addMetadata(context, it, schema, element, qualifier, lang, values, authorities, confidences);
List<MetadataValue> dc = itemService.getMetadata(it, schema, element, qualifier, lang);
List<MetadataValue> dc = itemService.getMetadata(it, schema, element, qualifier, Item.ANY);
assertThat("testAddMetadata_7args_1 0", dc, notNullValue());
assertTrue("testAddMetadata_7args_1 1", dc.size() == 2);
assertThat("testAddMetadata_7args_1 2", dc.get(0).getMetadataField().getMetadataSchema().getName(),
@@ -600,13 +600,13 @@ public class ItemTest extends AbstractDSpaceObjectTest {
String schema = "dc";
String element = "contributor";
String qualifier = "author";
String lang = Item.ANY;
String lang = null;
List<String> values = Arrays.asList("value0", "value1");
List<String> authorities = Arrays.asList("auth0", "auth2");
List<Integer> confidences = Arrays.asList(0, 0);
itemService.addMetadata(context, it, schema, element, qualifier, lang, values, authorities, confidences);
List<MetadataValue> dc = itemService.getMetadata(it, schema, element, qualifier, lang);
List<MetadataValue> dc = itemService.getMetadata(it, schema, element, qualifier, Item.ANY);
assertThat("testAddMetadata_7args_1 0", dc, notNullValue());
assertTrue("testAddMetadata_7args_1 1", dc.size() == 2);
assertThat("testAddMetadata_7args_1 2", dc.get(0).getMetadataField().getMetadataSchema().getName(),
@@ -719,13 +719,13 @@ public class ItemTest extends AbstractDSpaceObjectTest {
String schema = "dc";
String element = "language";
String qualifier = "iso";
String lang = Item.ANY;
String lang = null;
String values = "en";
String authorities = "accepted";
int confidences = 0;
itemService.addMetadata(context, it, schema, element, qualifier, lang, values, authorities, confidences);
List<MetadataValue> dc = itemService.getMetadata(it, schema, element, qualifier, lang);
List<MetadataValue> dc = itemService.getMetadata(it, schema, element, qualifier, Item.ANY);
assertThat("testAddMetadata_7args_2 0", dc, notNullValue());
assertTrue("testAddMetadata_7args_2 1", dc.size() == 1);
assertThat("testAddMetadata_7args_2 2", dc.get(0).getMetadataField().getMetadataSchema().getName(),
@@ -748,13 +748,13 @@ public class ItemTest extends AbstractDSpaceObjectTest {
String schema = "dc";
String element = "contributor";
String qualifier = "editor";
String lang = Item.ANY;
String lang = null;
String values = "value0";
String authorities = "auth0";
int confidences = 0;
itemService.addMetadata(context, it, schema, element, qualifier, lang, values, authorities, confidences);
List<MetadataValue> dc = itemService.getMetadata(it, schema, element, qualifier, lang);
List<MetadataValue> dc = itemService.getMetadata(it, schema, element, qualifier, Item.ANY);
assertThat("testAddMetadata_7args_2 0", dc, notNullValue());
assertTrue("testAddMetadata_7args_2 1", dc.size() == 1);
assertThat("testAddMetadata_7args_2 2", dc.get(0).getMetadataField().getMetadataSchema().getName(),
@@ -811,13 +811,13 @@ public class ItemTest extends AbstractDSpaceObjectTest {
String schema = "dc";
String element = "contributor";
String qualifier = "author";
String lang = Item.ANY;
String lang = null;
String values = "value0";
itemService.addMetadata(context, it, schema, element, qualifier, lang, values);
itemService.clearMetadata(context, it, schema, element, qualifier, lang);
itemService.clearMetadata(context, it, schema, element, qualifier, Item.ANY);
List<MetadataValue> dc = itemService.getMetadata(it, schema, element, qualifier, lang);
List<MetadataValue> dc = itemService.getMetadata(it, schema, element, qualifier, Item.ANY);
assertThat("testClearMetadata 0", dc, notNullValue());
assertTrue("testClearMetadata 1", dc.size() == 0);
}
@@ -859,11 +859,11 @@ public class ItemTest extends AbstractDSpaceObjectTest {
context.turnOffAuthorisationSystem();
Collection collection = collectionService.create(context, owningCommunity);
collectionService.setMetadataSingleValue(context, collection, MetadataSchemaEnum.DC.getName(),
"title", null, Item.ANY, "collection B");
"title", null, null, "collection B");
it.addCollection(collection);
collection = collectionService.create(context, owningCommunity);
collectionService.setMetadataSingleValue(context, collection, MetadataSchemaEnum.DC.getName(),
"title", null, Item.ANY, "collection A");
"title", null, null, "collection A");
it.addCollection(collection);
context.restoreAuthSystemState();
assertThat("testGetCollections 0", it.getCollections(), notNullValue());
@@ -1772,7 +1772,7 @@ public class ItemTest extends AbstractDSpaceObjectTest {
// add new metadata to item
context.turnOffAuthorisationSystem();
itemService.addMetadata(context, it, schema, element, qualifier, Item.ANY, value);
itemService.addMetadata(context, it, schema, element, qualifier, null, value);
itemService.update(context, it);
context.restoreAuthSystemState();
@@ -1837,7 +1837,7 @@ public class ItemTest extends AbstractDSpaceObjectTest {
// add new metadata (with authority) to item
context.turnOffAuthorisationSystem();
itemService.addMetadata(context, it, schema, element, qualifier, Item.ANY, value, authority, confidence);
itemService.addMetadata(context, it, schema, element, qualifier, null, value, authority, confidence);
itemService.update(context, it);
context.restoreAuthSystemState();

View File

@@ -87,8 +87,8 @@ public class RelationshipDAOImplIT extends AbstractIntegrationTest {
WorkspaceItem workspaceItemTwo = workspaceItemService.create(context, collection, false);
itemOne = installItemService.installItem(context, workspaceItem);
itemTwo = installItemService.installItem(context, workspaceItemTwo);
itemService.addMetadata(context, itemOne, "dspace", "entity", "type", Item.ANY, "Publication");
itemService.addMetadata(context, itemTwo, "dspace", "entity", "type", Item.ANY, "Person");
itemService.addMetadata(context, itemOne, "dspace", "entity", "type", null, "Publication");
itemService.addMetadata(context, itemTwo, "dspace", "entity", "type", null, "Person");
itemService.update(context, itemOne);
itemService.update(context, itemTwo);
entityTypeOne = entityTypeService.create(context, "Person");

View File

@@ -82,8 +82,8 @@ public class RelationshipTypeDAOImplIT extends AbstractIntegrationTest {
WorkspaceItem workspaceItemTwo = workspaceItemService.create(context, collection, false);
itemOne = installItemService.installItem(context, workspaceItem);
itemTwo = installItemService.installItem(context, workspaceItemTwo);
itemService.addMetadata(context, itemOne, "dspace", "entity", "type", Item.ANY, "Publication");
itemService.addMetadata(context, itemTwo, "dspace", "entity", "type", Item.ANY, "Person");
itemService.addMetadata(context, itemOne, "dspace", "entity", "type", null, "Publication");
itemService.addMetadata(context, itemTwo, "dspace", "entity", "type", null, "Person");
itemService.update(context, itemOne);
itemService.update(context, itemTwo);
entityTypeOne = entityTypeService.create(context, "Person");

View File

@@ -261,7 +261,7 @@ public class PatchMetadataIT extends AbstractEntityIntegrationTest {
for (String author : authorsOriginalOrder) {
itemService.addMetadata(
context, publicationItem, "dc", "contributor", "author", Item.ANY, author
context, publicationItem, "dc", "contributor", "author", null, author
);
}

View File

@@ -818,7 +818,7 @@ public class RelationshipRestRepositoryIT extends AbstractEntityIntegrationTest
// Make sure we grab the latest instance of the Item from the database
publication1 = itemService.find(context, publication1.getID());
// Add a plain text dc.contributor.author value
itemService.addMetadata(context, publication1, "dc", "contributor", "author", Item.ANY, "plain text");
itemService.addMetadata(context, publication1, "dc", "contributor", "author", null, "plain text");
itemService.update(context, publication1);
List<MetadataValue> list = itemService.getMetadata(publication1, "dc", "contributor", "author", Item.ANY);
@@ -884,7 +884,7 @@ public class RelationshipRestRepositoryIT extends AbstractEntityIntegrationTest
// Ensure we have the latest instance of the Item from the database
publication1 = itemService.find(context, publication1.getID());
// Add a fourth dc.contributor.author mdv
itemService.addMetadata(context, publication1, "dc", "contributor", "author", Item.ANY, "plain text two");
itemService.addMetadata(context, publication1, "dc", "contributor", "author", null, "plain text two");
itemService.update(context, publication1);
context.restoreAuthSystemState();
@@ -953,7 +953,7 @@ public class RelationshipRestRepositoryIT extends AbstractEntityIntegrationTest
context.turnOffAuthorisationSystem();
// The following additions of Metadata will perform the same sequence of logic and tests as described above
publication1 = itemService.find(context, publication1.getID());
itemService.addMetadata(context, publication1, "dc", "contributor", "author", Item.ANY, "plain text three");
itemService.addMetadata(context, publication1, "dc", "contributor", "author", null, "plain text three");
itemService.update(context, publication1);
context.restoreAuthSystemState();
@@ -983,10 +983,10 @@ public class RelationshipRestRepositoryIT extends AbstractEntityIntegrationTest
context.turnOffAuthorisationSystem();
publication1 = itemService.find(context, publication1.getID());
itemService.addMetadata(context, publication1, "dc", "contributor", "author", Item.ANY, "plain text four");
itemService.addMetadata(context, publication1, "dc", "contributor", "author", Item.ANY, "plain text five");
itemService.addMetadata(context, publication1, "dc", "contributor", "author", Item.ANY, "plain text six");
itemService.addMetadata(context, publication1, "dc", "contributor", "author", Item.ANY, "plain text seven");
itemService.addMetadata(context, publication1, "dc", "contributor", "author", null, "plain text four");
itemService.addMetadata(context, publication1, "dc", "contributor", "author", null, "plain text five");
itemService.addMetadata(context, publication1, "dc", "contributor", "author", null, "plain text six");
itemService.addMetadata(context, publication1, "dc", "contributor", "author", null, "plain text seven");
itemService.update(context, publication1);
context.restoreAuthSystemState();
@@ -1114,7 +1114,7 @@ public class RelationshipRestRepositoryIT extends AbstractEntityIntegrationTest
publication1 = itemService.find(context, publication1.getID());
// Add a plain text metadatavalue to the publication
// After this addition, the list of authors should like like "Donald Smith", "plain text"
itemService.addMetadata(context, publication1, "dc", "contributor", "author", Item.ANY, "plain text");
itemService.addMetadata(context, publication1, "dc", "contributor", "author", null, "plain text");
itemService.update(context, publication1);
context.restoreAuthSystemState();
List<MetadataValue> list = itemService.getMetadata(publication1, "dc", "contributor", "author", Item.ANY);
@@ -1157,7 +1157,7 @@ public class RelationshipRestRepositoryIT extends AbstractEntityIntegrationTest
// Get the publication from the DB again to ensure that we have the latest object
publication1 = itemService.find(context, publication1.getID());
// Add a fourth metadata value to the publication
itemService.addMetadata(context, publication1, "dc", "contributor", "author", Item.ANY, "plain text two");
itemService.addMetadata(context, publication1, "dc", "contributor", "author", null, "plain text two");
itemService.update(context, publication1);
context.restoreAuthSystemState();
list = itemService.getMetadata(publication1, "dc", "contributor", "author", Item.ANY);
@@ -1195,7 +1195,7 @@ public class RelationshipRestRepositoryIT extends AbstractEntityIntegrationTest
context.turnOffAuthorisationSystem();
publication1 = itemService.find(context, publication1.getID());
// Create another plain text metadata value on the publication
itemService.addMetadata(context, publication1, "dc", "contributor", "author", Item.ANY, "plain text three");
itemService.addMetadata(context, publication1, "dc", "contributor", "author", null, "plain text three");
itemService.update(context, publication1);
context.restoreAuthSystemState();
list = itemService.getMetadata(publication1, "dc", "contributor", "author", Item.ANY);
@@ -1323,7 +1323,7 @@ public class RelationshipRestRepositoryIT extends AbstractEntityIntegrationTest
publication1 = itemService.find(context, publication1.getID());
// Add a plain text metadatavalue to the publication
// After this addition, the list of authors should like like "Donald Smith", "plain text"
itemService.addMetadata(context, publication1, "dc", "contributor", "author", Item.ANY, "plain text");
itemService.addMetadata(context, publication1, "dc", "contributor", "author", null, "plain text");
itemService.update(context, publication1);
context.restoreAuthSystemState();
List<MetadataValue> list = itemService.getMetadata(publication1, "dc", "contributor", "author", Item.ANY);
@@ -1367,7 +1367,7 @@ public class RelationshipRestRepositoryIT extends AbstractEntityIntegrationTest
// Get the publication from the DB again to ensure that we have the latest object
publication1 = itemService.find(context, publication1.getID());
// Add a fourth metadata value to the publication
itemService.addMetadata(context, publication1, "dc", "contributor", "author", Item.ANY, "plain text two");
itemService.addMetadata(context, publication1, "dc", "contributor", "author", null, "plain text two");
itemService.update(context, publication1);
context.restoreAuthSystemState();
list = itemService.getMetadata(publication1, "dc", "contributor", "author", Item.ANY);
@@ -1405,7 +1405,7 @@ public class RelationshipRestRepositoryIT extends AbstractEntityIntegrationTest
context.turnOffAuthorisationSystem();
publication1 = itemService.find(context, publication1.getID());
// Create another plain text metadata value on the publication
itemService.addMetadata(context, publication1, "dc", "contributor", "author", Item.ANY, "plain text three");
itemService.addMetadata(context, publication1, "dc", "contributor", "author", null, "plain text three");
itemService.update(context, publication1);
context.restoreAuthSystemState();
list = itemService.getMetadata(publication1, "dc", "contributor", "author", Item.ANY);