Source:
<code>public RESULT onRecordBeforeCreate(ORecord iRecord) { RESULT result = RESULT.RECORD_NOT_CHANGED; if (!(iRecord instanceof ODocument)) { return result; } ODocument doc = (ODocument) iRecord; <START> if ("ArtifactEntry".equals(doc.getClassName())) <END> { doc.field("created", new Date()); result = RESULT.RECORD_CHANGED; } for (OClass oClass : doc.getSchemaClass().getAllSuperClasses()) { if ("GenericEntity".equals(oClass.getName())) { String uuid = doc.field("uuid"); if (uuid == null || uuid.trim().isEmpty()) { throw new OValidationException( String.format("Failed to persist document [%s]. UUID can't be empty or null.", doc.getSchemaClass())); } } else if ("ArtifactEntry".equals(oClass.getName())) { ODocument artifactCoordinates = doc.field("artifactCoordinates"); String artifactCoordinatesPath = artifactCoordinates == null ? "" : artifactCoordinates.field("path"); doc.field("created", new Date()); result = RESULT.RECORD_CHANGED; String artifactEntryPath = doc.field("artifactPath"); artifactEntryPath = artifactEntryPath == null ? "" : artifactEntryPath.trim(); if (artifactCoordinatesPath.trim().isEmpty() && artifactEntryPath.trim().isEmpty()) { throw new OValidationException( String.format("Failed to persist document [%s]. 'artifactPath' can't be empty or null.", doc.getSchemaClass())); } else if (artifactCoordinates != null && !artifactEntryPath.equals(artifactCoordinatesPath)) { throw new OValidationException( String.format("Failed to persist document [%s]. Paths [%s] and [%s] dont match.", doc.getSchemaClass(), artifactEntryPath, artifactCoordinatesPath)); } } } return result; }</code><technical_language>@mkuligowski change entity data in this hook, this changes client side explicitly refetch entity DB. validate created field is empy throw OValidationException in case of invalid field value. I suggest populate created field in ArtifactEntryServiceImpl.save method</technical_language>

Target:
public RESULT onRecordBeforeCreate(ORecord iRecord) { RESULT result = RESULT.RECORD_NOT_CHANGED; if (!(iRecord instanceof ODocument)) { return result; } ODocument doc = (ODocument) iRecord; if ("ArtifactEntry".equals(doc.getClassName())) { validateArtifactEntryCreatedProperty(doc); } for (OClass oClass : doc.getSchemaClass().getAllSuperClasses()) { if ("GenericEntity".equals(oClass.getName())) { String uuid = doc.field("uuid"); if (uuid == null || uuid.trim().isEmpty()) { throw new OValidationException( String.format("Failed to persist document [%s]. UUID can't be empty or null.", doc.getSchemaClass())); } } else if ("ArtifactEntry".equals(oClass.getName())) { ODocument artifactCoordinates = doc.field("artifactCoordinates"); String artifactCoordinatesPath = artifactCoordinates == null ? "" : artifactCoordinates.field("path"); String artifactEntryPath = doc.field("artifactPath"); artifactEntryPath = artifactEntryPath == null ? "" : artifactEntryPath.trim(); if (artifactCoordinatesPath.trim().isEmpty() && artifactEntryPath.trim().isEmpty()) { throw new OValidationException( String.format("Failed to persist document [%s]. 'artifactPath' can't be empty or null.", doc.getSchemaClass())); } else if (artifactCoordinates != null && !artifactEntryPath.equals(artifactCoordinatesPath)) { throw new OValidationException( String.format("Failed to persist document [%s]. Paths [%s] and [%s] dont match.", doc.getSchemaClass(), artifactEntryPath, artifactCoordinatesPath)); } validateArtifactEntryCreatedProperty(doc); } } return result; }