if (logger.isLoggable(Logger.FINE)) {
logger.log(Logger.FINE, "concept "+schema.getTypeName()+": adding slot "+slotName);
}
if (!sad.aggregate) {
TermSchema ts = (TermSchema)doAddSchema(sad.type, buildHierarchy, sad.manageAsSerializable);
schema.add(slotName, ts, sad.mandatory ? ObjectSchema.MANDATORY : ObjectSchema.OPTIONAL);
if (sad.defaultValue != null) {
schema.addFacet(slotName, new DefaultValueFacet(sad.defaultValue));
}
if (sad.regex != null) {
schema.addFacet(slotName, new RegexFacet(sad.regex));
}
if (sad.documentation != null) {
schema.addFacet(slotName, new DocumentationFacet(sad.documentation));
}
if (sad.permittedValues != null) {
// Adjust permitted values in correct class type
// This is necessary because in the annotation the permitted values are string
Object[] typizedPermittedValues = new Object[sad.permittedValues.length];
if (sad.type != null) {
for(int i=0; i<sad.permittedValues.length; i++) {
typizedPermittedValues[i] = BasicOntology.adjustPrimitiveValue(sad.permittedValues[i], sad.type);
}
}
schema.addFacet(slotName, new PermittedValuesFacet(typizedPermittedValues));
}
if ("true".equalsIgnoreCase(System.getProperty(SLCodec.PRESERVE_JAVA_TYPES)) &&
( sad.type == Long.class ||
sad.type == long.class ||
sad.type == Double.class ||
sad.type == double.class)) {
schema.addFacet(slotName, new JavaTypeFacet(sad.type.getName()));
}
} else {
TermSchema ats = null;
if (sad.aggregateClass != null) {
// try to get a schema for the contained type
ats = (TermSchema)doAddSchema(sad.aggregateClass, buildHierarchy, sad.manageAsSerializable);
}
schema.add(slotName, ats, sad.cardMin, sad.cardMax, getAggregateSchemaName(sad.type), sad.mandatory?ObjectSchema.MANDATORY:ObjectSchema.OPTIONAL);