don't create add url if neither of 'select from existing' nor 'provide selection' options set (#385)

Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
This commit is contained in:
Georgy Litvinov 2023-04-27 16:40:43 +02:00 committed by GitHub
parent 2535750cfa
commit 6c9e21544a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -113,7 +113,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
} }
} }
protected void setAddUrl(Property property) { protected void setAddUrl(ObjectProperty property) {
// Is the add link suppressed for this property? // Is the add link suppressed for this property?
if (property.isAddLinkSuppressed()) { if (property.isAddLinkSuppressed()) {
return; return;
@ -126,6 +126,10 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
return; return;
} }
if (isNotAllowedToCreateOrSelect(property)) {
return;
}
String rangeUri = (property instanceof ObjectProperty) String rangeUri = (property instanceof ObjectProperty)
? ((ObjectProperty) property).getRangeVClassURI() ? ((ObjectProperty) property).getRangeVClassURI()
: "data"; : "data";
@ -152,6 +156,10 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
} }
} }
private boolean isNotAllowedToCreateOrSelect(ObjectProperty property) {
return !property.getSelectFromExisting() && !property.getOfferCreateNewOption();
}
/** /**
* Pull this into a protected method so we can stub it out in the unit tests. * Pull this into a protected method so we can stub it out in the unit tests.
* Other options: * Other options: