mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-10 11:33:11 +00:00
Additional replacements where schema, element & qualifier were separate
This commit is contained in:
@@ -890,10 +890,10 @@ public class MetadataImport extends DSpaceRunnable<MetadataImportScriptConfigura
|
||||
Entity relationEntity = getEntity(c, value);
|
||||
// Get relationship type of entity and item
|
||||
String relationEntityRelationshipType = itemService.getMetadata(relationEntity.getItem(),
|
||||
"relationship", "type",
|
||||
null, Item.ANY).get(0).getValue();
|
||||
String itemRelationshipType = itemService.getMetadata(item, "relationship", "type",
|
||||
null, Item.ANY).get(0).getValue();
|
||||
"dspace", "entity",
|
||||
"type", Item.ANY).get(0).getValue();
|
||||
String itemRelationshipType = itemService.getMetadata(item, "dspace", "entity",
|
||||
"type", Item.ANY).get(0).getValue();
|
||||
|
||||
// Get the correct RelationshipType based on typeName
|
||||
List<RelationshipType> relType = relationshipTypeService.findByLeftwardOrRightwardTypeName(c, typeName);
|
||||
@@ -1651,8 +1651,8 @@ public class MetadataImport extends DSpaceRunnable<MetadataImportScriptConfigura
|
||||
if (itemService.find(c, UUID.fromString(targetUUID)) != null) {
|
||||
targetItem = itemService.find(c, UUID.fromString(targetUUID));
|
||||
List<MetadataValue> relTypes = itemService.
|
||||
getMetadata(targetItem, "relationship", "type",
|
||||
null, Item.ANY);
|
||||
getMetadata(targetItem, "dspace", "entity",
|
||||
"type", Item.ANY);
|
||||
String relTypeValue = null;
|
||||
if (relTypes.size() > 0) {
|
||||
relTypeValue = relTypes.get(0).getValue();
|
||||
@@ -1710,8 +1710,8 @@ public class MetadataImport extends DSpaceRunnable<MetadataImportScriptConfigura
|
||||
originItem = itemService.find(c, UUID.fromString(originRefererUUID));
|
||||
if (originItem != null) {
|
||||
List<MetadataValue> mdv = itemService.getMetadata(originItem,
|
||||
"relationship",
|
||||
"type", null,
|
||||
"dspace",
|
||||
"entity", "type",
|
||||
Item.ANY);
|
||||
if (!mdv.isEmpty()) {
|
||||
String relTypeValue = mdv.get(0).getValue();
|
||||
|
@@ -51,7 +51,7 @@ public class EntityServiceImpl implements EntityService {
|
||||
@Override
|
||||
public EntityType getType(Context context, Entity entity) throws SQLException {
|
||||
Item item = entity.getItem();
|
||||
List<MetadataValue> list = itemService.getMetadata(item, "relationship", "type", null, Item.ANY, false);
|
||||
List<MetadataValue> list = itemService.getMetadata(item, "dspace", "entity", "type", Item.ANY, false);
|
||||
if (!list.isEmpty()) {
|
||||
return entityTypeService.findByEntityType(context, list.get(0).getValue());
|
||||
} else {
|
||||
|
@@ -63,11 +63,9 @@ public class RelationshipMetadataServiceImpl implements RelationshipMetadataServ
|
||||
public String getEntityTypeStringFromMetadata(Item item) {
|
||||
List<MetadataValue> list = item.getMetadata();
|
||||
for (MetadataValue mdv : list) {
|
||||
if (StringUtils.equals(mdv.getMetadataField().getMetadataSchema().getName(),
|
||||
"relationship")
|
||||
&& StringUtils.equals(mdv.getMetadataField().getElement(),
|
||||
"type")) {
|
||||
|
||||
if (StringUtils.equals(mdv.getMetadataField().getMetadataSchema().getName(), "dspace")
|
||||
&& StringUtils.equals(mdv.getMetadataField().getElement(), "entity")
|
||||
&& StringUtils.equals(mdv.getMetadataField().getQualifier(), "type")) {
|
||||
return mdv.getValue();
|
||||
}
|
||||
}
|
||||
|
@@ -257,8 +257,8 @@ public class RelationshipServiceImpl implements RelationshipService {
|
||||
}
|
||||
|
||||
private boolean verifyEntityTypes(Item itemToProcess, EntityType entityTypeToProcess) {
|
||||
List<MetadataValue> list = itemService.getMetadata(itemToProcess, "relationship", "type",
|
||||
null, Item.ANY, false);
|
||||
List<MetadataValue> list = itemService.getMetadata(itemToProcess, "dspace", "entity",
|
||||
"type", Item.ANY, false);
|
||||
if (list.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -96,7 +96,7 @@ public class ItemBuilder extends AbstractDSpaceObjectBuilder<Item> {
|
||||
}
|
||||
|
||||
public ItemBuilder withRelationshipType(final String relationshipType) {
|
||||
return addMetadataValue(item, "relationship", "type", null, relationshipType);
|
||||
return addMetadataValue(item, "dspace", "entity", "type", relationshipType);
|
||||
}
|
||||
|
||||
public ItemBuilder withType(final String type) {
|
||||
|
@@ -181,7 +181,7 @@ public class WorkspaceItemBuilder extends AbstractBuilder<WorkspaceItem, Workspa
|
||||
}
|
||||
|
||||
public WorkspaceItemBuilder withRelationshipType(final String relationshipType) {
|
||||
return addMetadataValue("relationship", "type", null, relationshipType);
|
||||
return addMetadataValue("dspace", "entity", "type", relationshipType);
|
||||
}
|
||||
|
||||
public WorkspaceItemBuilder grantLicense() {
|
||||
|
@@ -181,7 +181,7 @@ public class EntityServiceImplTest {
|
||||
|
||||
// Mock the state of objects utilized in getLeftRelationshipTypes()
|
||||
// to meet the success criteria of the invocation
|
||||
when(itemService.getMetadata(item, "relationship", "type", null, Item.ANY, false)).thenReturn(metsList);
|
||||
when(itemService.getMetadata(item, "dspace", "entity", "type", Item.ANY, false)).thenReturn(metsList);
|
||||
when(entity.getItem()).thenReturn(item);
|
||||
when(entityService.getType(context, entity)).thenReturn(entityType);
|
||||
when(relationshipTypeService.findByEntityType(context, entityService.getType(context, entity), true, -1, -1))
|
||||
@@ -209,7 +209,7 @@ public class EntityServiceImplTest {
|
||||
|
||||
// Mock the state of objects utilized in getRightRelationshipTypes()
|
||||
// to meet the success criteria of the invocation
|
||||
when(itemService.getMetadata(item, "relationship", "type", null, Item.ANY, false)).thenReturn(metsList);
|
||||
when(itemService.getMetadata(item, "dspace", "entity", "type", Item.ANY, false)).thenReturn(metsList);
|
||||
when(entity.getItem()).thenReturn(item);
|
||||
when(entityService.getType(context, entity)).thenReturn(entityType);
|
||||
when(relationshipTypeService.findByEntityType(context, entityService.getType(context, entity), false, -1, -1))
|
||||
|
@@ -77,10 +77,10 @@ public class RelationshipServiceImplPlaceTest extends AbstractUnitTest {
|
||||
WorkspaceItem authorIs = workspaceItemService.create(context, col, false);
|
||||
|
||||
item = installItemService.installItem(context, is);
|
||||
itemService.addMetadata(context, item, "relationship", "type", null, null, "Publication");
|
||||
itemService.addMetadata(context, item, "dspace", "entity", "type", null, "Publication");
|
||||
|
||||
authorItem = installItemService.installItem(context, authorIs);
|
||||
itemService.addMetadata(context, authorItem, "relationship", "type", null, null, "Person");
|
||||
itemService.addMetadata(context, authorItem, "dspace", "entity", "type", null, "Person");
|
||||
itemService.addMetadata(context, authorItem, "person", "familyName", null, null, "familyName");
|
||||
itemService.addMetadata(context, authorItem, "person", "givenName", null, null, "firstName");
|
||||
|
||||
@@ -156,7 +156,7 @@ public class RelationshipServiceImplPlaceTest extends AbstractUnitTest {
|
||||
// Here we create an Item so that we can create another relationship with this item
|
||||
WorkspaceItem authorIs = workspaceItemService.create(context, col, false);
|
||||
Item secondAuthorItem = installItemService.installItem(context, authorIs);
|
||||
itemService.addMetadata(context, secondAuthorItem, "relationship", "type", null, null, "Person");
|
||||
itemService.addMetadata(context, secondAuthorItem, "dspace", "entity", "type", null, "Person");
|
||||
itemService.addMetadata(context, secondAuthorItem, "person", "familyName", null, null, "familyNameTwo");
|
||||
itemService.addMetadata(context, secondAuthorItem, "person", "givenName", null, null, "firstNameTwo");
|
||||
Relationship relationshipTwo = relationshipService
|
||||
@@ -222,7 +222,7 @@ public class RelationshipServiceImplPlaceTest extends AbstractUnitTest {
|
||||
// Relationship a specific place as well
|
||||
WorkspaceItem authorIs = workspaceItemService.create(context, col, false);
|
||||
Item secondAuthorItem = installItemService.installItem(context, authorIs);
|
||||
itemService.addMetadata(context, secondAuthorItem, "relationship", "type", null, null, "Person");
|
||||
itemService.addMetadata(context, secondAuthorItem, "dspace", "entity", "type", null, "Person");
|
||||
itemService.addMetadata(context, secondAuthorItem, "person", "familyName", null, null, "familyNameTwo");
|
||||
itemService.addMetadata(context, secondAuthorItem, "person", "givenName", null, null, "firstNameTwo");
|
||||
Relationship relationshipTwo = relationshipService
|
||||
@@ -334,7 +334,7 @@ public class RelationshipServiceImplPlaceTest extends AbstractUnitTest {
|
||||
// Create an additional item for another relationship
|
||||
WorkspaceItem authorIs = workspaceItemService.create(context, col, false);
|
||||
Item secondAuthorItem = installItemService.installItem(context, authorIs);
|
||||
itemService.addMetadata(context, secondAuthorItem, "relationship", "type", null, null, "Person");
|
||||
itemService.addMetadata(context, secondAuthorItem, "dspace", "entity", "type", null, "Person");
|
||||
itemService.addMetadata(context, secondAuthorItem, "person", "familyName", null, null, "familyNameTwo");
|
||||
itemService.addMetadata(context, secondAuthorItem, "person", "givenName", null, null, "firstNameTwo");
|
||||
Relationship relationshipTwo = relationshipService
|
||||
|
@@ -227,8 +227,8 @@ public class RelationshipServiceImplTest {
|
||||
when(metsList.get(0).getValue()).thenReturn("Entitylabel");
|
||||
when(relationshipService
|
||||
.findByItemAndRelationshipType(context, leftItem, testRel, true)).thenReturn(leftTypelist);
|
||||
when(itemService.getMetadata(leftItem, "relationship", "type", null, Item.ANY, false)).thenReturn(metsList);
|
||||
when(itemService.getMetadata(rightItem, "relationship", "type", null, Item.ANY, false)).thenReturn(metsList);
|
||||
when(itemService.getMetadata(leftItem, "dspace", "entity", "type", Item.ANY, false)).thenReturn(metsList);
|
||||
when(itemService.getMetadata(rightItem, "dspace", "entity", "type", Item.ANY, false)).thenReturn(metsList);
|
||||
when(relationshipDAO.create(any(), any())).thenReturn(relationship);
|
||||
|
||||
// The reported Relationship should match our defined relationship
|
||||
@@ -305,8 +305,8 @@ public class RelationshipServiceImplTest {
|
||||
relationship = getRelationship(leftItem, rightItem, testRel, 0,0);
|
||||
|
||||
// Mock the state of objects utilized in update() to meet the success criteria of the invocation
|
||||
when(itemService.getMetadata(leftItem, "relationship", "type", null, Item.ANY, false)).thenReturn(metsList);
|
||||
when(itemService.getMetadata(rightItem, "relationship", "type", null, Item.ANY, false)).thenReturn(metsList);
|
||||
when(itemService.getMetadata(leftItem, "dspace", "entity", "type", Item.ANY, false)).thenReturn(metsList);
|
||||
when(itemService.getMetadata(rightItem, "dspace", "entity", "type", Item.ANY, false)).thenReturn(metsList);
|
||||
when(authorizeService.authorizeActionBoolean(context, relationship.getLeftItem(),
|
||||
Constants.WRITE)).thenReturn(true);
|
||||
|
||||
|
@@ -87,8 +87,8 @@ public class RelationshipDAOImplTest extends AbstractIntegrationTest {
|
||||
WorkspaceItem workspaceItemTwo = workspaceItemService.create(context, collection, false);
|
||||
itemOne = installItemService.installItem(context, workspaceItem);
|
||||
itemTwo = installItemService.installItem(context, workspaceItemTwo);
|
||||
itemService.addMetadata(context, itemOne, "relationship", "type", null, Item.ANY, "Publication");
|
||||
itemService.addMetadata(context, itemTwo, "relationship", "type", null, Item.ANY, "Person");
|
||||
itemService.addMetadata(context, itemOne, "dspace", "entity", "type", Item.ANY, "Publication");
|
||||
itemService.addMetadata(context, itemTwo, "dspace", "entity", "type", Item.ANY, "Person");
|
||||
itemService.update(context, itemOne);
|
||||
itemService.update(context, itemTwo);
|
||||
entityTypeOne = entityTypeService.create(context, "Person");
|
||||
|
@@ -82,8 +82,8 @@ public class RelationshipTypeDAOImplTest extends AbstractIntegrationTest {
|
||||
WorkspaceItem workspaceItemTwo = workspaceItemService.create(context, collection, false);
|
||||
itemOne = installItemService.installItem(context, workspaceItem);
|
||||
itemTwo = installItemService.installItem(context, workspaceItemTwo);
|
||||
itemService.addMetadata(context, itemOne, "relationship", "type", null, Item.ANY, "Publication");
|
||||
itemService.addMetadata(context, itemTwo, "relationship", "type", null, Item.ANY, "Person");
|
||||
itemService.addMetadata(context, itemOne, "dspace", "entity", "type", Item.ANY, "Publication");
|
||||
itemService.addMetadata(context, itemTwo, "dspace", "entity", "type", Item.ANY, "Person");
|
||||
itemService.update(context, itemOne);
|
||||
itemService.update(context, itemTwo);
|
||||
entityTypeOne = entityTypeService.create(context, "Person");
|
||||
|
@@ -263,8 +263,8 @@ public class ITIrusExportUsageEventListener extends AbstractIntegrationTestWithD
|
||||
when(usageEvent.getRequest()).thenReturn(request);
|
||||
when(usageEvent.getContext()).thenReturn(new Context());
|
||||
|
||||
itemService.clearMetadata(context, item, "relationship", "type", null, Item.ANY);
|
||||
itemService.addMetadata(context, item, "relationship", "type", null, null, "OrgUnit");
|
||||
itemService.clearMetadata(context, item, "dspace", "entity", "type", Item.ANY);
|
||||
itemService.addMetadata(context, item, "dspace", "entity", "type", null, "OrgUnit");
|
||||
itemService.update(context, item);
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
@@ -359,8 +359,8 @@ public class ITIrusExportUsageEventListener extends AbstractIntegrationTestWithD
|
||||
when(usageEvent.getRequest()).thenReturn(request);
|
||||
when(usageEvent.getContext()).thenReturn(new Context());
|
||||
|
||||
itemService.clearMetadata(context, item, "relationship", "type", null, Item.ANY);
|
||||
itemService.addMetadata(context, item, "relationship", "type", null, null, "OrgUnit");
|
||||
itemService.clearMetadata(context, item, "dspace", "entity", "type", Item.ANY);
|
||||
itemService.addMetadata(context, item, "dspace", "entity", "type", null, "OrgUnit");
|
||||
itemService.update(context, item);
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
Reference in New Issue
Block a user