/** * Initialisation method. This should be called AFTER using the populate method if you are going * to use populate. It creates the internal convenience arrays etc needed for normal operation. */ public void initialise(ClassLoaderResolver clr, MetaDataManager mmgr) { if (hasExtension("field-name")) { // User has provided extension "field-name" meaning that we store the version in the column // for the specified field (like in JPA) String val = getValueForExtension("field-name"); if (!StringUtils.isWhitespace(val)) { this.fieldName = val; this.columnName = null; } } if (fieldName == null) { // Cater for user specifying column name, or column if (columnMetaData == null && columnName != null) { columnMetaData = new ColumnMetaData(); columnMetaData.setName(columnName); columnMetaData.parent = this; } // Interpret the "indexed" value to create our IndexMetaData where it wasn't specified that // way if (indexMetaData == null && columnMetaData != null && indexed != null && indexed != IndexedValue.FALSE) { indexMetaData = new IndexMetaData(); indexMetaData.setUnique(indexed == IndexedValue.UNIQUE); indexMetaData.addColumn(columnMetaData.getName()); indexMetaData.parent = this; } } else { if (getParent() instanceof AbstractClassMetaData) { AbstractMemberMetaData vermmd = ((AbstractClassMetaData) getParent()).getMetaDataForMember(fieldName); if (vermmd != null && java.util.Date.class.isAssignableFrom(vermmd.getType())) { NucleusLogger.GENERAL.debug( "Setting version-strategy of field " + vermmd.getFullFieldName() + " to DATE_TIME since is Date-based"); versionStrategy = VersionStrategy.DATE_TIME; } } } }