use of org.structr.core.property.StartNodes in project structr by structr.
the class SchemaNode method getMultiplicity.
@Override
public String getMultiplicity(final String propertyNameToCheck) {
String multiplicity = getMultiplicity(this, propertyNameToCheck);
if (multiplicity == null) {
try {
final String parentClass = getProperty(SchemaNode.extendsClass);
if (parentClass != null) {
// check if property is defined in parent class
final SchemaNode parentSchemaNode = StructrApp.getInstance().nodeQuery(SchemaNode.class).andName(StringUtils.substringAfterLast(parentClass, ".")).getFirst();
if (parentSchemaNode != null) {
multiplicity = getMultiplicity(parentSchemaNode, propertyNameToCheck);
}
}
} catch (FrameworkException ex) {
logger.warn("Can't find schema node for parent class!", ex);
}
}
if (multiplicity != null) {
return multiplicity;
}
// fallback, search NodeInterface (this allows the owner relationship to be used in Notions!)
final PropertyKey key = StructrApp.getConfiguration().getPropertyKeyForJSONName(NodeInterface.class, propertyNameToCheck, false);
if (key != null) {
if (key instanceof StartNode || key instanceof EndNode) {
return "1X";
}
if (key instanceof StartNodes || key instanceof EndNodes) {
return "*X";
}
}
return null;
}
Aggregations