@Override public String getDefaultValue() { return delegate.getDefaultValue(); }
public static void realizeMandatory(ODocument doc) { OClass oClass = doc.getSchemaClass(); if(oClass!=null) { for(OProperty property : oClass.properties()) { if(property.isMandatory() && Strings.isEmpty(property.getDefaultValue()) && !doc.containsField(property.getName())) { doc.field(property.getName(), (Object) null); } } } }
row.field("MAX", p.getMax() != null ? p.getMax() : ""); row.field("COLLATE", p.getCollate() != null ? p.getCollate().getName() : ""); row.field("DEFAULT", p.getDefaultValue() != null ? p.getDefaultValue() : "");
/** * Checks and convert the field of the document matching the types specified by the class. **/ private void convertFieldsToClass(final OClass _clazz) { for (OProperty prop : _clazz.properties()) { ODocumentEntry entry = _fields != null ? _fields.get(prop.getName()) : null; if (entry != null && entry.exist()) { if (entry.type == null || entry.type != prop.getType()) { boolean preChanged = entry.changed; boolean preCreated = entry.created; ; field(prop.getName(), entry.value, prop.getType()); if (_recordId.isNew()) { entry.changed = preChanged; entry.created = preCreated; } } } else { String defValue = prop.getDefaultValue(); if (defValue != null && /*defValue.length() > 0 && */!containsField(prop.getName())) { Object curFieldValue = OSQLHelper.parseDefaultValue(this, defValue); Object fieldValue = ODocumentHelper.convertField(this, prop.getName(), prop.getType(), null, curFieldValue); rawField(prop.getName(), fieldValue, prop.getType()); } } } }
if (p.getCollate() != null) writer.writeAttribute(0, false, "collate", p.getCollate().getName()); if (p.getDefaultValue() != null) writer.writeAttribute(0, false, "default-value", p.getDefaultValue()); if (p.getRegexp() != null) writer.writeAttribute(0, false, "regexp", p.getRegexp());
message("\nNot null.............: " + prop.isNotNull()); message("\nRead only............: " + prop.isReadonly()); message("\nDefault value........: " + prop.getDefaultValue()); message("\nMinimum value........: " + prop.getMin()); message("\nMaximum value........: " + prop.getMax());
if (p.isNotNull()) { validatable.error(newValidationError("required")); } else if (p.isMandatory() && Strings.isEmpty(p.getDefaultValue())) { ODocument doc = getDocument();
if (p.isNotNull()) { validatable.error(newValidationError("required")); } else if (p.isMandatory() && Strings.isEmpty(p.getDefaultValue())) { ODocument doc = getDocument();
min = property.getMin(); max = property.getMax(); defaultValue = property.getDefaultValue(); regexp = property.getRegexp(); customProperties = new HashMap<String, String>();
private OResultInternal getPropertyAsDocument(final OClass clazz, final OProperty prop) { database.activateOnCurrentThread(); final OType type = prop.getType(); OResultInternal res = new OResultInternal(); res.setProperty("TABLE_CAT", database.getName()); res.setProperty("TABLE_SCHEM", database.getName()); res.setProperty("TABLE_NAME", clazz.getName()); res.setProperty("COLUMN_NAME", prop.getName()); res.setProperty("DATA_TYPE", OrientJdbcResultSetMetaData.getSqlType(type)); res.setProperty("TYPE_NAME", type.name()); res.setProperty("COLUMN_SIZE", 1); res.setProperty("BUFFER_LENGTH", null); res.setProperty("DECIMAL_DIGITS", null); res.setProperty("NUM_PREC_RADIX", 10); res.setProperty("NULLABLE", !prop.isNotNull() ? columnNoNulls : columnNullable); res.setProperty("REMARKS", prop.getDescription()); res.setProperty("COLUMN_DEF", prop.getDefaultValue()); res.setProperty("SQL_DATA_TYPE", null); res.setProperty("SQL_DATETIME_SUB", null); res.setProperty("CHAR_OCTET_LENGTH", null); res.setProperty("ORDINAL_POSITION", prop.getId()); res.setProperty("IS_NULLABLE", prop.isNotNull() ? "NO" : "YES"); return res; }