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