Esempio n. 1
0
 public <R extends AbstractBaseRecord> R add(R record) {
   if (record instanceof NodeRecord) {
     add(nodes, (NodeRecord) record);
   } else if (record instanceof RelationshipRecord) {
     add(relationships, (RelationshipRecord) record);
   } else if (record instanceof PropertyRecord) {
     add(properties, (PropertyRecord) record);
   } else if (record instanceof DynamicRecord) {
     DynamicRecord dyn = (DynamicRecord) record;
     if (dyn.getType() == PropertyType.STRING.intValue()) {
       addString(dyn);
     } else if (dyn.getType() == PropertyType.ARRAY.intValue()) {
       addArray(dyn);
     } else {
       throw new IllegalArgumentException("Invalid dynamic record type");
     }
   } else if (record instanceof RelationshipTypeRecord) {
     add(labels, (RelationshipTypeRecord) record);
   } else if (record instanceof PropertyIndexRecord) {
     add(keys, (PropertyIndexRecord) record);
   } else if (record instanceof NeoStoreRecord) {
     this.graph = new Delta<NeoStoreRecord>((NeoStoreRecord) record);
   } else {
     throw new IllegalArgumentException("Invalid record type");
   }
   return record;
 }
 public List<LegacyDynamicRecord> readDynamicRecords(LegacyPropertyRecord record) {
   if (record.getType() == LegacyPropertyType.STRING) {
     List<LegacyDynamicRecord> stringRecords =
         stringPropertyStore.getPropertyChain(record.getPropBlock());
     for (LegacyDynamicRecord stringRecord : stringRecords) {
       stringRecord.setType(PropertyType.STRING.intValue());
     }
     return stringRecords;
   } else if (record.getType() == LegacyPropertyType.ARRAY) {
     List<LegacyDynamicRecord> arrayRecords =
         arrayPropertyStore.getPropertyChain(record.getPropBlock());
     for (LegacyDynamicRecord arrayRecord : arrayRecords) {
       arrayRecord.setType(PropertyType.ARRAY.intValue());
     }
     return arrayRecords;
   }
   return null;
 }