Пример #1
0
 @Override
 public boolean visitRelationshipGroupCommand(Command.RelationshipGroupCommand command)
     throws IOException {
   RelationshipGroupRecord record = command.getRecord();
   channel.put(NeoCommandType.REL_GROUP_COMMAND);
   channel.putLong(record.getId());
   channel.put((byte) (record.inUse() ? Record.IN_USE.intValue() : Record.NOT_IN_USE.intValue()));
   channel.putShort((short) record.getType());
   channel.putLong(record.getNext());
   channel.putLong(record.getFirstOut());
   channel.putLong(record.getFirstIn());
   channel.putLong(record.getFirstLoop());
   channel.putLong(record.getOwningNode());
   return false;
 }
 public RecordProxy<Long, RelationshipGroupRecord, Integer> getRelationshipGroup(
     NodeRecord node, int type) {
   long groupId = node.getNextRel();
   long previousGroupId = Record.NO_NEXT_RELATIONSHIP.intValue();
   Set<Integer> allTypes = new HashSet<>();
   while (groupId != Record.NO_NEXT_RELATIONSHIP.intValue()) {
     RecordProxy<Long, RelationshipGroupRecord, Integer> change =
         recordChangeSet.getRelGroupRecords().getOrLoad(groupId, type);
     RelationshipGroupRecord record = change.forReadingData();
     record.setPrev(previousGroupId); // not persistent so not a "change"
     allTypes.add(record.getType());
     if (record.getType() == type) {
       return change;
     }
     previousGroupId = groupId;
     groupId = record.getNext();
   }
   return null;
 }