Skip to content

Commit

Permalink
removed internal usage of public methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Jan 21, 2015
1 parent 2c1e396 commit 89bf9ad
Showing 1 changed file with 21 additions and 16 deletions.
Expand Up @@ -262,10 +262,10 @@ public ODocument(final String iFieldName, final Object iFieldValue, final Object

protected static void validateField(ODocument iRecord, OProperty p) throws OValidationException {
final Object fieldValue;

if (iRecord.containsField(p.getName())) {
ODocumentEntry entry = iRecord._fields.get(p.getName());
if (entry != null && entry.exist()) {
// AVOID CONVERSIONS: FASTER!
fieldValue = iRecord.rawField(p.getName());
fieldValue = entry.value;

if (p.isNotNull() && fieldValue == null)
// NULLITY
Expand Down Expand Up @@ -343,11 +343,11 @@ protected static void validateField(ODocument iRecord, OProperty p) throws OVali
throw new OValidationException("The field '" + p.getFullName()
+ "' has been declared as EMBEDDEDMAP but an incompatible type is used. Value: " + fieldValue);
if (p.getLinkedClass() != null) {
for (Entry<?, ?> entry : ((Map<?, ?>) fieldValue).entrySet())
validateEmbedded(p, entry.getValue());
for (Entry<?, ?> colleEntry : ((Map<?, ?>) fieldValue).entrySet())
validateEmbedded(p, colleEntry.getValue());
} else if (p.getLinkedType() != null) {
for (Entry<?, ?> entry : ((Map<?, ?>) fieldValue).entrySet())
validateType(p, entry.getValue());
for (Entry<?, ?> collEntry : ((Map<?, ?>) fieldValue).entrySet())
validateType(p, collEntry.getValue());
}
break;
}
Expand Down Expand Up @@ -2238,11 +2238,13 @@ protected void convertAllMultiValuesToTrackedVersions() {
continue;
}

OType fieldType = fieldType(fieldEntry.getKey());
OClass _clazz = getImmutableSchemaClass();
if (fieldType == null && _clazz != null) {
final OProperty prop = _clazz.getProperty(fieldEntry.getKey());
fieldType = prop != null ? prop.getType() : null;
OType fieldType = fieldEntry.getValue().type;
if (fieldType == null) {
OClass _clazz = getImmutableSchemaClass();
if (_clazz != null) {
final OProperty prop = _clazz.getProperty(fieldEntry.getKey());
fieldType = prop != null ? prop.getType() : null;
}
}
if (fieldType == null)
fieldType = OType.getTypeByValue(fieldValue);
Expand Down Expand Up @@ -2358,11 +2360,14 @@ private void fetchClassName() {
* @param _clazz
*/
private void convertFieldsToClass(OClass _clazz) {
if (_fields == null)
return;
for (OProperty prop : _clazz.properties()) {
OType type = fieldType(prop.getName());
if ((type == null && containsField(prop.getName())) || (type != null && type != prop.getType())) {
field(prop.getName(), field(prop.getName()), prop.getType());
}
ODocumentEntry entry = _fields.get(prop.getName());
if (entry != null && entry.exist())
if (entry.type == null || entry.type != prop.getType()) {
field(prop.getName(), entry.value, prop.getType());
}
}
}

Expand Down

0 comments on commit 89bf9ad

Please sign in to comment.