Search in sources :

Example 16 with CollectionStorage

use of com.tvd12.dahlia.core.storage.CollectionStorage in project dahlia by youngmonkeys.

the class DahliaCoreLoader method loadCollection.

protected void loadCollection(Collection collection, CollectionStorage storage) {
    CollectionSetting setting = collection.getSetting();
    FieldSetting idSetting = setting.getId();
    long recordPosition = collection.getDataSize();
    while (storage.hasMoreRecords(recordPosition)) {
        Record record = storage.readRecord(recordPosition, idSetting);
        if (record != null)
            collection.insert(record);
        recordPosition = collection.increaseDataSize();
    }
}
Also used : FieldSetting(com.tvd12.dahlia.core.setting.FieldSetting) CollectionSetting(com.tvd12.dahlia.core.setting.CollectionSetting) Record(com.tvd12.dahlia.core.entity.Record)

Aggregations

CollectionStorage (com.tvd12.dahlia.core.storage.CollectionStorage)15 CollectionSetting (com.tvd12.dahlia.core.setting.CollectionSetting)13 Collection (com.tvd12.dahlia.core.entity.Collection)11 Record (com.tvd12.dahlia.core.entity.Record)10 EzyObject (com.tvd12.ezyfox.entity.EzyObject)9 FieldSetting (com.tvd12.dahlia.core.setting.FieldSetting)8 ArrayList (java.util.ArrayList)6 RecordConsumer (com.tvd12.dahlia.core.function.RecordConsumer)5 CollectionNotFoundException (com.tvd12.dahlia.exception.CollectionNotFoundException)5 EzyArray (com.tvd12.ezyfox.entity.EzyArray)5 DatabaseSetting (com.tvd12.dahlia.core.setting.DatabaseSetting)2 DatabaseStorage (com.tvd12.dahlia.core.storage.DatabaseStorage)2 Storage (com.tvd12.dahlia.core.storage.Storage)2 EzyPair (com.tvd12.ezyfox.util.EzyPair)2 EzyWrap (com.tvd12.ezyfox.util.EzyWrap)2 List (java.util.List)2 CommandCreateCollection (com.tvd12.dahlia.core.command.CommandCreateCollection)1 Database (com.tvd12.dahlia.core.entity.Database)1 Databases (com.tvd12.dahlia.core.entity.Databases)1 CollectionFactory (com.tvd12.dahlia.core.factory.CollectionFactory)1