mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Renamed copyLeft and copyRight, added defaults for them in the test Relationship-types file and added a test for the place check after deleting a relationship and keeping the virtual metadata
This commit is contained in:
@@ -130,20 +130,20 @@ public class InitializeEntities {
|
||||
String rightType = eElement.getElementsByTagName("rightType").item(0).getTextContent();
|
||||
String leftwardType = eElement.getElementsByTagName("leftwardType").item(0).getTextContent();
|
||||
String rightwardType = eElement.getElementsByTagName("rightwardType").item(0).getTextContent();
|
||||
Node copyLeftNode = eElement.getElementsByTagName("copyLeft").item(0);
|
||||
Boolean copyLeft;
|
||||
if (copyLeftNode == null) {
|
||||
copyLeft = false;
|
||||
Node copyToLeftNode = eElement.getElementsByTagName("copyToLeft").item(0);
|
||||
Boolean copyToLeft;
|
||||
if (copyToLeftNode == null) {
|
||||
copyToLeft = false;
|
||||
} else {
|
||||
copyLeft = Boolean.valueOf(copyLeftNode.getTextContent());
|
||||
copyToLeft = Boolean.valueOf(copyToLeftNode.getTextContent());
|
||||
|
||||
}
|
||||
Node copyRightNode = eElement.getElementsByTagName("copyRight").item(0);
|
||||
Boolean copyRight;
|
||||
if (copyRightNode == null) {
|
||||
copyRight = false;
|
||||
Node copyToRightNode = eElement.getElementsByTagName("copyToRight").item(0);
|
||||
Boolean copyToRight;
|
||||
if (copyToRightNode == null) {
|
||||
copyToRight = false;
|
||||
} else {
|
||||
copyRight = Boolean.valueOf(copyRightNode.getTextContent());
|
||||
copyToRight = Boolean.valueOf(copyToRightNode.getTextContent());
|
||||
}
|
||||
|
||||
NodeList leftCardinalityList = eElement.getElementsByTagName("leftCardinality");
|
||||
@@ -170,7 +170,7 @@ public class InitializeEntities {
|
||||
}
|
||||
populateRelationshipType(context, leftType, rightType, leftwardType, rightwardType,
|
||||
leftCardinalityMin, leftCardinalityMax,
|
||||
rightCardinalityMin, rightCardinalityMax, copyLeft, copyRight);
|
||||
rightCardinalityMin, rightCardinalityMax, copyToLeft, copyToRight);
|
||||
|
||||
|
||||
}
|
||||
@@ -190,7 +190,7 @@ public class InitializeEntities {
|
||||
private void populateRelationshipType(Context context, String leftType, String rightType, String leftwardType,
|
||||
String rightwardType, String leftCardinalityMin, String leftCardinalityMax,
|
||||
String rightCardinalityMin, String rightCardinalityMax,
|
||||
Boolean copyLeft, Boolean copyRight)
|
||||
Boolean copyToLeft, Boolean copyToRight)
|
||||
throws SQLException, AuthorizeException {
|
||||
|
||||
EntityType leftEntityType = entityTypeService.findByEntityType(context,leftType);
|
||||
@@ -231,10 +231,10 @@ public class InitializeEntities {
|
||||
relationshipTypeService.create(context, leftEntityType, rightEntityType, leftwardType, rightwardType,
|
||||
leftCardinalityMinInteger, leftCardinalityMaxInteger,
|
||||
rightCardinalityMinInteger, rightCardinalityMaxInteger,
|
||||
copyLeft, copyRight);
|
||||
copyToLeft, copyToRight);
|
||||
} else {
|
||||
relationshipType.setCopyLeft(copyLeft);
|
||||
relationshipType.setCopyRight(copyRight);
|
||||
relationshipType.setCopyToLeft(copyToLeft);
|
||||
relationshipType.setCopyToRight(copyToRight);
|
||||
relationshipType.setLeftMinCardinality(leftCardinalityMinInteger);
|
||||
relationshipType.setLeftMaxCardinality(leftCardinalityMaxInteger);
|
||||
relationshipType.setRightMinCardinality(rightCardinalityMinInteger);
|
||||
|
@@ -317,8 +317,8 @@ public class RelationshipServiceImpl implements RelationshipService {
|
||||
|
||||
@Override
|
||||
public void delete(Context context, Relationship relationship) throws SQLException, AuthorizeException {
|
||||
delete(context, relationship, relationship.getRelationshipType().isCopyLeft(),
|
||||
relationship.getRelationshipType().isCopyRight());
|
||||
delete(context, relationship, relationship.getRelationshipType().isCopyToLeft(),
|
||||
relationship.getRelationshipType().isCopyToRight());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -364,9 +364,14 @@ public class RelationshipServiceImpl implements RelationshipService {
|
||||
relationshipMetadataService.findRelationshipMetadataValueForItemRelationship(context,
|
||||
relationship.getLeftItem(), entityTypeString, relationship, true);
|
||||
for (RelationshipMetadataValue relationshipMetadataValue : relationshipMetadataValues) {
|
||||
itemService.addMetadata(context, relationship.getLeftItem(),
|
||||
relationshipMetadataValue.getMetadataField(), null,
|
||||
relationshipMetadataValue.getValue() );
|
||||
itemService.addAndShiftRightMetadata(context, relationship.getLeftItem(),
|
||||
relationshipMetadataValue.getMetadataField().
|
||||
getMetadataSchema().getName(),
|
||||
relationshipMetadataValue.getMetadataField().getElement(),
|
||||
relationshipMetadataValue.getMetadataField().getQualifier(),
|
||||
relationshipMetadataValue.getLanguage(),
|
||||
relationshipMetadataValue.getValue(), null, -1,
|
||||
relationshipMetadataValue.getPlace());
|
||||
}
|
||||
itemService.update(context, relationship.getLeftItem());
|
||||
}
|
||||
@@ -377,9 +382,14 @@ public class RelationshipServiceImpl implements RelationshipService {
|
||||
relationshipMetadataService.findRelationshipMetadataValueForItemRelationship(context,
|
||||
relationship.getRightItem(), entityTypeString, relationship, true);
|
||||
for (RelationshipMetadataValue relationshipMetadataValue : relationshipMetadataValues) {
|
||||
itemService.addMetadata(context, relationship.getRightItem(),
|
||||
relationshipMetadataValue.getMetadataField(), null,
|
||||
relationshipMetadataValue.getValue() );
|
||||
itemService.addAndShiftRightMetadata(context, relationship.getRightItem(),
|
||||
relationshipMetadataValue.getMetadataField().
|
||||
getMetadataSchema().getName(),
|
||||
relationshipMetadataValue.getMetadataField().getElement(),
|
||||
relationshipMetadataValue.getMetadataField().getQualifier(),
|
||||
relationshipMetadataValue.getLanguage(),
|
||||
relationshipMetadataValue.getValue(), null, -1,
|
||||
relationshipMetadataValue.getPlace());
|
||||
}
|
||||
itemService.update(context, relationship.getRightItem());
|
||||
}
|
||||
|
@@ -105,14 +105,14 @@ public class RelationshipType implements ReloadableEntity<Integer> {
|
||||
/**
|
||||
* The boolean indicating whether the metadata should be copied on left item or not
|
||||
*/
|
||||
@Column(name = "copy_left", nullable = false)
|
||||
private boolean copyLeft;
|
||||
@Column(name = "copy_to_left", nullable = false)
|
||||
private boolean copyToLeft;
|
||||
|
||||
/**
|
||||
* The boolean indicating whether the metadata should be copied on right item or not
|
||||
*/
|
||||
@Column(name = "copy_right", nullable = false)
|
||||
private boolean copyRight;
|
||||
@Column(name = "copy_to_right", nullable = false)
|
||||
private boolean copyToRight;
|
||||
/**
|
||||
* Protected constructor, create object using:
|
||||
* {@link org.dspace.content.service.RelationshipTypeService#create(Context)} }
|
||||
@@ -256,35 +256,35 @@ public class RelationshipType implements ReloadableEntity<Integer> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic getter for the copyLeft
|
||||
* @return the copyLeft value of this RelationshipType
|
||||
* Generic getter for the copyToLeft
|
||||
* @return the copyToLeft value of this RelationshipType
|
||||
*/
|
||||
public boolean isCopyLeft() {
|
||||
return copyLeft;
|
||||
public boolean isCopyToLeft() {
|
||||
return copyToLeft;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic setter for the copyLeft
|
||||
* @param copyLeft The copyLeft to be set on this RelationshipType
|
||||
* Generic setter for the copyToLeft
|
||||
* @param copyToLeft The copyToLeft to be set on this RelationshipType
|
||||
*/
|
||||
public void setCopyLeft(boolean copyLeft) {
|
||||
this.copyLeft = copyLeft;
|
||||
public void setCopyToLeft(boolean copyToLeft) {
|
||||
this.copyToLeft = copyToLeft;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic getter for the copyRight
|
||||
* @return the copyRight value of this RelationshipType
|
||||
* Generic getter for the copyToRight
|
||||
* @return the copyToRight value of this RelationshipType
|
||||
*/
|
||||
public boolean isCopyRight() {
|
||||
return copyRight;
|
||||
public boolean isCopyToRight() {
|
||||
return copyToRight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic setter for the copyRight
|
||||
* @param copyRight The copyRight to be set on this RelationshipType
|
||||
* Generic setter for the copyToRight
|
||||
* @param copyToRight The copyToRight to be set on this RelationshipType
|
||||
*/
|
||||
public void setCopyRight(boolean copyRight) {
|
||||
this.copyRight = copyRight;
|
||||
public void setCopyToRight(boolean copyToRight) {
|
||||
this.copyToRight = copyToRight;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -121,15 +121,15 @@ public class RelationshipTypeServiceImpl implements RelationshipTypeService {
|
||||
public RelationshipType create(Context context, EntityType leftEntityType, EntityType rightEntityType,
|
||||
String leftwardType, String rightwardType, Integer leftCardinalityMinInteger,
|
||||
Integer leftCardinalityMaxInteger, Integer rightCardinalityMinInteger,
|
||||
Integer rightCardinalityMaxInteger, Boolean copyLeft, Boolean copyRight)
|
||||
Integer rightCardinalityMaxInteger, Boolean copyToLeft, Boolean copyToRight)
|
||||
throws SQLException, AuthorizeException {
|
||||
RelationshipType relationshipType = new RelationshipType();
|
||||
relationshipType.setLeftType(leftEntityType);
|
||||
relationshipType.setRightType(rightEntityType);
|
||||
relationshipType.setLeftwardType(leftwardType);
|
||||
relationshipType.setRightwardType(rightwardType);
|
||||
relationshipType.setCopyLeft(copyLeft);
|
||||
relationshipType.setCopyRight(copyRight);
|
||||
relationshipType.setCopyToLeft(copyToLeft);
|
||||
relationshipType.setCopyToRight(copyToRight);
|
||||
relationshipType.setLeftMinCardinality(leftCardinalityMinInteger);
|
||||
relationshipType.setLeftMaxCardinality(leftCardinalityMaxInteger);
|
||||
relationshipType.setRightMinCardinality(rightCardinalityMinInteger);
|
||||
|
@@ -174,6 +174,6 @@ public interface RelationshipTypeService extends DSpaceCRUDService<RelationshipT
|
||||
RelationshipType create(Context context, EntityType leftEntityType, EntityType rightEntityType,
|
||||
String leftwardType, String rightwardType, Integer leftCardinalityMinInteger,
|
||||
Integer leftCardinalityMaxInteger, Integer rightCardinalityMinInteger,
|
||||
Integer rightCardinalityMaxInteger, Boolean copyLeft, Boolean copyRight)
|
||||
Integer rightCardinalityMaxInteger, Boolean copyToLeft, Boolean copyToRight)
|
||||
throws SQLException, AuthorizeException;
|
||||
}
|
||||
|
@@ -10,5 +10,5 @@
|
||||
-- Create columns copy_left and copy_right for RelationshipType
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE relationship_type ADD copy_left BOOLEAN DEFAULT FALSE NOT NULL;
|
||||
ALTER TABLE relationship_type ADD copy_right BOOLEAN DEFAULT FALSE NOT NULL;
|
||||
ALTER TABLE relationship_type ADD copy_to_left BOOLEAN DEFAULT FALSE NOT NULL;
|
||||
ALTER TABLE relationship_type ADD copy_to_right BOOLEAN DEFAULT FALSE NOT NULL;
|
@@ -10,5 +10,5 @@
|
||||
-- Create columns copy_left and copy_right for RelationshipType
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE relationship_type ADD copy_left BOOLEAN DEFAULT FALSE NOT NULL;
|
||||
ALTER TABLE relationship_type ADD copy_right BOOLEAN DEFAULT FALSE NOT NULL;
|
||||
ALTER TABLE relationship_type ADD copy_to_left BOOLEAN DEFAULT FALSE NOT NULL;
|
||||
ALTER TABLE relationship_type ADD copy_to_right BOOLEAN DEFAULT FALSE NOT NULL;
|
@@ -10,5 +10,5 @@
|
||||
-- Create columns copy_left and copy_right for RelationshipType
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE relationship_type ADD copy_left BOOLEAN DEFAULT FALSE NOT NULL;
|
||||
ALTER TABLE relationship_type ADD copy_right BOOLEAN DEFAULT FALSE NOT NULL;
|
||||
ALTER TABLE relationship_type ADD copy_to_left BOOLEAN DEFAULT FALSE NOT NULL;
|
||||
ALTER TABLE relationship_type ADD copy_to_right BOOLEAN DEFAULT FALSE NOT NULL;
|
@@ -2,11 +2,13 @@
|
||||
|
||||
|
||||
<!ELEMENT relationships (type)*>
|
||||
<!ELEMENT type (leftType|rightType|leftwardType|rightwardType|leftCardinality|rightCardinality)*>
|
||||
<!ELEMENT type (leftType|rightType|leftwardType|rightwardType|leftCardinality|rightCardinality|copyToLeft|copyToRight)*>
|
||||
<!ELEMENT leftType (#PCDATA)>
|
||||
<!ELEMENT rightType (#PCDATA)>
|
||||
<!ELEMENT leftwardType (#PCDATA)>
|
||||
<!ELEMENT rightwardType (#PCDATA)>
|
||||
<!ELEMENT copyToLeft (#PCDATA)>
|
||||
<!ELEMENT copyToRight (#PCDATA)>
|
||||
<!ELEMENT leftCardinality (min|max)*>
|
||||
<!ELEMENT min (#PCDATA)>
|
||||
<!ELEMENT rightCardinality (min|max)*>
|
||||
|
@@ -13,6 +13,7 @@
|
||||
<rightCardinality>
|
||||
<min>0</min>
|
||||
</rightCardinality>
|
||||
<copyToLeft>true</copyToLeft>
|
||||
</type>
|
||||
<type>
|
||||
<leftType>Publication</leftType>
|
||||
@@ -25,6 +26,7 @@
|
||||
<rightCardinality>
|
||||
<min>0</min>
|
||||
</rightCardinality>
|
||||
<copyToLeft>true</copyToLeft>
|
||||
</type>
|
||||
<type>
|
||||
<leftType>Publication</leftType>
|
||||
@@ -37,6 +39,7 @@
|
||||
<rightCardinality>
|
||||
<min>0</min>
|
||||
</rightCardinality>
|
||||
<copyToLeft>true</copyToLeft>
|
||||
</type>
|
||||
<type>
|
||||
<leftType>Person</leftType>
|
||||
@@ -110,6 +113,7 @@
|
||||
<rightCardinality>
|
||||
<min>0</min>
|
||||
</rightCardinality>
|
||||
<copyToLeft>true</copyToLeft>
|
||||
</type>
|
||||
<type>
|
||||
<leftType>JournalIssue</leftType>
|
||||
@@ -123,5 +127,6 @@
|
||||
<min>0</min>
|
||||
<max>1</max>
|
||||
</rightCardinality>
|
||||
<copyToRight>true</copyToRight>
|
||||
</type>
|
||||
</relationships>
|
@@ -126,7 +126,7 @@ public class RelationshipMetadataServiceTest extends AbstractUnitTest {
|
||||
* Common function to convert leftItem to a publication item, convert rightItem to an author item,
|
||||
* and relating them to each other stored in the relationship field
|
||||
*/
|
||||
private void initPublicationAuthorWithCopyParams(boolean copyLeft, boolean copyRight)
|
||||
private void initPublicationAuthorWithCopyParams(boolean copyToLeft, boolean copyToRight)
|
||||
throws SQLException, AuthorizeException {
|
||||
context.turnOffAuthorisationSystem();
|
||||
itemService.addMetadata(context, leftItem, "relationship", "type", null, null, "Publication");
|
||||
@@ -138,7 +138,7 @@ public class RelationshipMetadataServiceTest extends AbstractUnitTest {
|
||||
RelationshipType isAuthorOfPublication = relationshipTypeService
|
||||
.create(context, publicationEntityType, authorEntityType,
|
||||
"isAuthorOfPublication", "isPublicationOfAuthor",
|
||||
null, null, null, null, copyLeft, copyRight);
|
||||
null, null, null, null, copyToLeft, copyToRight);
|
||||
|
||||
relationship = relationshipService.create(context, leftItem, rightItem, isAuthorOfPublication, 0, 0);
|
||||
context.restoreAuthSystemState();
|
||||
|
@@ -31,8 +31,8 @@ public class RelationshipTypeConverter implements DSpaceConverter<RelationshipTy
|
||||
relationshipTypeRest.setId(obj.getID());
|
||||
relationshipTypeRest.setLeftwardType(obj.getLeftwardType());
|
||||
relationshipTypeRest.setRightwardType(obj.getRightwardType());
|
||||
relationshipTypeRest.setCopyLeft(obj.isCopyLeft());
|
||||
relationshipTypeRest.setCopyRight(obj.isCopyRight());
|
||||
relationshipTypeRest.setCopyToLeft(obj.isCopyToLeft());
|
||||
relationshipTypeRest.setCopyToRight(obj.isCopyToRight());
|
||||
relationshipTypeRest.setLeftMinCardinality(obj.getLeftMinCardinality());
|
||||
relationshipTypeRest.setLeftMaxCardinality(obj.getLeftMaxCardinality());
|
||||
relationshipTypeRest.setRightMinCardinality(obj.getRightMinCardinality());
|
||||
|
@@ -22,8 +22,8 @@ public class RelationshipTypeRest extends BaseObjectRest<Integer> {
|
||||
|
||||
private String leftwardType;
|
||||
private String rightwardType;
|
||||
private boolean copyLeft;
|
||||
private boolean copyRight;
|
||||
private boolean copyToLeft;
|
||||
private boolean copyToRight;
|
||||
private Integer leftMinCardinality;
|
||||
private Integer leftMaxCardinality;
|
||||
private Integer rightMinCardinality;
|
||||
@@ -60,35 +60,35 @@ public class RelationshipTypeRest extends BaseObjectRest<Integer> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic getter for the copyLeft
|
||||
* @return the copyLeft value of this RelationshipTypeRest
|
||||
* Generic getter for the copyToLeft
|
||||
* @return the copyToLeft value of this RelationshipTypeRest
|
||||
*/
|
||||
public boolean isCopyLeft() {
|
||||
return copyLeft;
|
||||
public boolean isCopyToLeft() {
|
||||
return copyToLeft;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic setter for the copyLeft
|
||||
* @param copyLeft The copyLeft to be set on this RelationshipTypeRest
|
||||
* Generic setter for the copyToLeft
|
||||
* @param copyToLeft The copyToLeft to be set on this RelationshipTypeRest
|
||||
*/
|
||||
public void setCopyLeft(boolean copyLeft) {
|
||||
this.copyLeft = copyLeft;
|
||||
public void setCopyToLeft(boolean copyToLeft) {
|
||||
this.copyToLeft = copyToLeft;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic getter for the copyRight
|
||||
* @return the copyRight value of this RelationshipTypeRest
|
||||
* Generic getter for the copyToRight
|
||||
* @return the copyToRight value of this RelationshipTypeRest
|
||||
*/
|
||||
public boolean isCopyRight() {
|
||||
return copyRight;
|
||||
public boolean isCopyToRight() {
|
||||
return copyToRight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic setter for the copyRight
|
||||
* @param copyRight The copyRight to be set on this RelationshipTypeRest
|
||||
* Generic setter for the copyToRight
|
||||
* @param copyToRight The copyToRight to be set on this RelationshipTypeRest
|
||||
*/
|
||||
public void setCopyRight(boolean copyRight) {
|
||||
this.copyRight = copyRight;
|
||||
public void setCopyToRight(boolean copyToRight) {
|
||||
this.copyToRight = copyToRight;
|
||||
}
|
||||
|
||||
public Integer getLeftMinCardinality() {
|
||||
|
@@ -632,4 +632,36 @@ public class RelationshipDeleteRestRepositoryIT extends AbstractEntityIntegratio
|
||||
assertThat(projectRelationships.size(), equalTo(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deleteItemCopyVirtualMetadataToCorrectPlace() throws Exception {
|
||||
initPersonProjectPublication();
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
itemService.addMetadata(context, publicationItem, "dc", "contributor", "author", null, "Test Author");
|
||||
itemService.update(context, publicationItem);
|
||||
context.restoreAuthSystemState();
|
||||
getClient(adminAuthToken).perform(
|
||||
delete("/api/core/items/" + personItem.getID() + "?copyVirtualMetadata="
|
||||
+ publicationPersonRelationshipType.getID()))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
publicationItem = itemService.find(context, publicationItem.getID());
|
||||
List<MetadataValue> publicationAuthorList = itemService.getMetadata(publicationItem,
|
||||
"dc", "contributor", "author", Item.ANY);
|
||||
assertThat(publicationAuthorList.size(), equalTo(2));
|
||||
assertThat(publicationAuthorList.get(0).getValue(), equalTo("Smith, Donald"));
|
||||
assertNull(publicationAuthorList.get(0).getAuthority());
|
||||
List<MetadataValue> publicationRelationships = itemService.getMetadata(publicationItem,
|
||||
"relation", "isAuthorOfPublication", Item.ANY, Item.ANY);
|
||||
assertThat(publicationRelationships.size(), equalTo(0));
|
||||
|
||||
projectItem = itemService.find(context, projectItem.getID());
|
||||
List<MetadataValue> projectAuthorList = itemService.getMetadata(projectItem,
|
||||
"dc", "contributor", "author", Item.ANY);
|
||||
assertThat(projectAuthorList.size(), equalTo(0));
|
||||
List<MetadataValue> projectRelationships = itemService.getMetadata(projectItem,
|
||||
"relation", "isPersonOfProject", Item.ANY, Item.ANY);
|
||||
assertThat(projectRelationships.size(), equalTo(0));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -107,12 +107,12 @@ public class RelationshipTypeBuilder extends AbstractBuilder<RelationshipType, R
|
||||
return this;
|
||||
}
|
||||
|
||||
public RelationshipTypeBuilder withCopyLeft(boolean copyLeft) throws SQLException {
|
||||
relationshipType.setCopyLeft(copyLeft);
|
||||
public RelationshipTypeBuilder withCopyToLeft(boolean copyToLeft) throws SQLException {
|
||||
relationshipType.setCopyToLeft(copyToLeft);
|
||||
return this;
|
||||
}
|
||||
public RelationshipTypeBuilder withCopyRight(boolean copyRight) throws SQLException {
|
||||
relationshipType.setCopyRight(copyRight);
|
||||
public RelationshipTypeBuilder withCopyToRight(boolean copyToRight) throws SQLException {
|
||||
relationshipType.setCopyToRight(copyToRight);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@@ -46,14 +46,14 @@ public class RelationshipTypeMatcher {
|
||||
relationshipType.getRightMaxCardinality(),
|
||||
leftEntityTypeId, leftEntityTypeLabel,
|
||||
rightEntityTypeId, rightEntityTypeLabel,
|
||||
relationshipType.isCopyLeft(),
|
||||
relationshipType.isCopyRight());
|
||||
relationshipType.isCopyToLeft(),
|
||||
relationshipType.isCopyToRight());
|
||||
}
|
||||
|
||||
private static Matcher<? super Object> matchExplicitRelationshipTypeValuesAndExplicitEntityType(int id,
|
||||
String leftwardType, String rightwardType, Integer leftMinCardinality, Integer leftMaxCardinality,
|
||||
Integer rightMinCardinality, Integer rightMaxCardinality,
|
||||
EntityType leftEntityType, EntityType rightEntityType, boolean copyLeft, boolean copyRight) {
|
||||
EntityType leftEntityType, EntityType rightEntityType, boolean copyToLeft, boolean copyToRight) {
|
||||
return matchExplicitRelationshipTypeValuesAndExplicitEntityTypeValues(id, leftwardType, rightwardType,
|
||||
leftMinCardinality, leftMaxCardinality,
|
||||
rightMinCardinality,
|
||||
@@ -62,19 +62,19 @@ public class RelationshipTypeMatcher {
|
||||
leftEntityType.getLabel(),
|
||||
rightEntityType.getID(),
|
||||
rightEntityType.getLabel(),
|
||||
copyLeft, copyRight);
|
||||
copyToLeft, copyToRight);
|
||||
}
|
||||
|
||||
private static Matcher<? super Object> matchExplicitRelationshipTypeValuesAndExplicitEntityTypeValues(int id,
|
||||
String leftwardType, String rightwardType, Integer leftMinCardinality, Integer leftMaxCardinality,
|
||||
Integer rightMinCardinality, Integer rightMaxCardinality, int leftEntityTypeId, String leftEntityTypeLabel,
|
||||
int rightEntityTypeId, String rightEntityTypeLabel, boolean copyLeft, boolean copyRight) {
|
||||
int rightEntityTypeId, String rightEntityTypeLabel, boolean copyToLeft, boolean copyToRight) {
|
||||
return allOf(
|
||||
hasJsonPath("$.id", is(id)),
|
||||
hasJsonPath("$.leftwardType", is(leftwardType)),
|
||||
hasJsonPath("$.rightwardType", is(rightwardType)),
|
||||
hasJsonPath("$.copyLeft", is(copyLeft)),
|
||||
hasJsonPath("$.copyRight", is(copyRight)),
|
||||
hasJsonPath("$.copyToLeft", is(copyToLeft)),
|
||||
hasJsonPath("$.copyToRight", is(copyToRight)),
|
||||
hasJsonPath("$.leftMinCardinality", is(leftMinCardinality)),
|
||||
hasJsonPath("$.leftMaxCardinality", is(leftMaxCardinality)),
|
||||
hasJsonPath("$.rightMinCardinality", is(rightMinCardinality)),
|
||||
|
@@ -58,19 +58,19 @@ public class AbstractEntityIntegrationTest extends AbstractControllerIntegration
|
||||
|
||||
RelationshipTypeBuilder.createRelationshipTypeBuilder(context, publication, person, "isAuthorOfPublication",
|
||||
"isPublicationOfAuthor", 0, null, 0,
|
||||
null).withCopyLeft(false).withCopyRight(true).build();
|
||||
null).withCopyToLeft(false).withCopyToRight(true).build();
|
||||
|
||||
RelationshipTypeBuilder.createRelationshipTypeBuilder(context, publication, project, "isProjectOfPublication",
|
||||
"isPublicationOfProject", 0, null, 0,
|
||||
null).withCopyRight(true).build();
|
||||
null).withCopyToRight(true).build();
|
||||
|
||||
RelationshipTypeBuilder.createRelationshipTypeBuilder(context, publication, orgUnit, "isOrgUnitOfPublication",
|
||||
"isPublicationOfOrgUnit", 0, null, 0,
|
||||
null).withCopyLeft(false).build();
|
||||
null).withCopyToLeft(false).build();
|
||||
|
||||
RelationshipTypeBuilder.createRelationshipTypeBuilder(context, person, project, "isProjectOfPerson",
|
||||
"isPersonOfProject", 0, null, 0,
|
||||
null).withCopyLeft(true).withCopyRight(true).build();
|
||||
null).withCopyToLeft(true).withCopyToRight(true).build();
|
||||
|
||||
RelationshipTypeBuilder.createRelationshipTypeBuilder(context, person, orgUnit, "isOrgUnitOfPerson",
|
||||
"isPersonOfOrgUnit", 0, null, 0,
|
||||
@@ -82,7 +82,7 @@ public class AbstractEntityIntegrationTest extends AbstractControllerIntegration
|
||||
|
||||
RelationshipTypeBuilder.createRelationshipTypeBuilder(context, journal, journalVolume, "isVolumeOfJournal",
|
||||
"isJournalOfVolume", 0, null, 1,
|
||||
null).withCopyLeft(true).build();
|
||||
null).withCopyToLeft(true).build();
|
||||
|
||||
RelationshipTypeBuilder.createRelationshipTypeBuilder(context, journalVolume, journalIssue,
|
||||
"isIssueOfJournalVolume", "isJournalVolumeOfIssue", 0,
|
||||
|
Reference in New Issue
Block a user