VIVO-1247, remove duplicate code used with ConfigurationBeanLoader. (#47)
Now that the @Property annotation includes cardinality parameters, we can remove a lot of duplicate code.
This commit is contained in:
parent
877b54f4a6
commit
15638f6ac1
1 changed files with 5 additions and 25 deletions
|
@ -104,31 +104,19 @@ public class LabelsAcrossContextNodes implements IndexingUriFinder,
|
|||
this.rdfService = models.getRDFService();
|
||||
}
|
||||
|
||||
@Property(uri = "http://www.w3.org/2000/01/rdf-schema#label")
|
||||
@Property(uri = "http://www.w3.org/2000/01/rdf-schema#label", maxOccurs = 1)
|
||||
public void setLabel(String l) {
|
||||
label = l;
|
||||
}
|
||||
|
||||
@Property(uri = "http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationSetup#hasIncomingProperty")
|
||||
@Property(uri = "http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationSetup#hasIncomingProperty", minOccurs = 1, maxOccurs = 1)
|
||||
public void setIncomingProperty(String incomingUri) {
|
||||
if (incomingPropertyUri == null) {
|
||||
incomingPropertyUri = incomingUri;
|
||||
} else {
|
||||
throw new IllegalStateException(
|
||||
"Configuration includes multiple declarations for hasIncomingProperty: "
|
||||
+ incomingPropertyUri + ", and " + incomingUri);
|
||||
}
|
||||
incomingPropertyUri = incomingUri;
|
||||
}
|
||||
|
||||
@Property(uri = "http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationSetup#hasOutgoingProperty")
|
||||
@Property(uri = "http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationSetup#hasOutgoingProperty", minOccurs = 1, maxOccurs = 1)
|
||||
public void setOutgoingProperty(String outgoingUri) {
|
||||
if (outgoingPropertyUri == null) {
|
||||
outgoingPropertyUri = outgoingUri;
|
||||
} else {
|
||||
throw new IllegalStateException(
|
||||
"Configuration includes multiple declarations for hasOutgoingProperty: "
|
||||
+ outgoingPropertyUri + ", and " + outgoingUri);
|
||||
}
|
||||
outgoingPropertyUri = outgoingUri;
|
||||
}
|
||||
|
||||
@Property(uri = "http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationSetup#hasTypeRestriction")
|
||||
|
@ -149,14 +137,6 @@ public class LabelsAcrossContextNodes implements IndexingUriFinder,
|
|||
formatRestrictions(typeRestrictions),
|
||||
formatRestrictions(contextNodeClasses));
|
||||
}
|
||||
if (incomingPropertyUri == null) {
|
||||
throw new IllegalStateException(
|
||||
"Configuration did not declare hasIncomingProperty.");
|
||||
}
|
||||
if (outgoingPropertyUri == null) {
|
||||
throw new IllegalStateException(
|
||||
"Configuration did not declare hasOutgoingProperty.");
|
||||
}
|
||||
}
|
||||
|
||||
private String formatRestrictions(Set<String> uris) {
|
||||
|
|
Loading…
Add table
Reference in a new issue