~bjd/syncany/misc-fixes

« back to all changes in this revision

Viewing changes to syncany/src/org/syncany/index/requests/MoveIndexRequest.java

  • Committer: Philipp Heckel
  • Date: 2011-06-18 23:40:35 UTC
  • Revision ID: philipp.heckel@gmail.com-20110618234035-4lzgul0rsf4j09fd
sync alg; recursive move not working

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import org.syncany.config.Folder;
22
22
import java.io.File;
23
23
import java.util.Date;
 
24
import java.util.HashSet;
24
25
import java.util.List;
 
26
import java.util.Set;
25
27
import java.util.logging.Logger;
26
28
import javax.persistence.EntityManager;
27
29
import org.syncany.Constants;
28
30
import org.syncany.db.CloneFile;
29
31
import org.syncany.db.CloneFile.Status;
30
32
import org.syncany.gui.desktop.Desktop;
 
33
import org.syncany.util.FileLister;
31
34
import org.syncany.util.FileUtil;
32
35
 
33
36
/**
125
128
                logger.log(Level.INFO, "Indexer: Updating CHILDREN of {0} ...", toFile);
126
129
            }
127
130
            
128
 
            List<CloneFile> children = db.getChildren(dbFromFile);
129
 
 
 
131
            // Update database children
 
132
            final List<CloneFile> children = db.getChildren(dbFromFile);
 
133
            final Set<File> childrenFileList = new HashSet<File>();
 
134
            
130
135
            for (CloneFile child : children) {
131
136
                File childFromFile = child.getFile();
132
137
                File childToFile = new File(absToParentFolder+File.separator+toFile.getName()+File.separator+child.getName());
135
140
                    logger.log(Level.INFO, "Indexer: Updating children of moved file {0} TO {1}", new Object[]{childFromFile.getAbsolutePath(), childToFile.getAbsolutePath()});
136
141
                }
137
142
                
 
143
                // Fill hash set
 
144
                childrenFileList.add(childToFile);
 
145
                
138
146
                // Do it!
139
147
                new MoveIndexRequest(fromRoot, childFromFile, toRoot, childToFile).process();
140
148
            }
 
149
            
 
150
            // Find files recursively
 
151
            new FileLister(toFile, new FileLister.FileListerAdapter() {
 
152
                @Override
 
153
                public void proceedFile(File f) {
 
154
                    if (!childrenFileList.contains(f)) {
 
155
                        new CheckIndexRequest(toRoot, f).process();
 
156
                    }
 
157
                }                
 
158
            }).start();
141
159
        }
142
160
    }
143
161
}
 
 
b'\\ No newline at end of file'