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:
parent
2535750cfa
commit
6c9e21544a
1 changed files with 9 additions and 1 deletions
|
@ -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?
|
||||
if (property.isAddLinkSuppressed()) {
|
||||
return;
|
||||
|
@ -126,6 +126,10 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
|
|||
return;
|
||||
}
|
||||
|
||||
if (isNotAllowedToCreateOrSelect(property)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String rangeUri = (property instanceof ObjectProperty)
|
||||
? ((ObjectProperty) property).getRangeVClassURI()
|
||||
: "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.
|
||||
* Other options:
|
||||
|
|
Loading…
Add table
Reference in a new issue