本文整理汇总了Java中com.dropbox.core.DbxClient.getMetadataWithChildren方法的典型用法代码示例。如果您正苦于以下问题:Java DbxClient.getMetadataWithChildren方法的具体用法?Java DbxClient.getMetadataWithChildren怎么用?Java DbxClient.getMetadataWithChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.dropbox.core.DbxClient
的用法示例。
在下文中一共展示了DbxClient.getMetadataWithChildren方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ls
import com.dropbox.core.DbxClient; //导入方法依赖的package包/类
public static DbxEntry[] ls(String query, DbxClient client) throws DbxException {
DbxEntry.WithChildren listing = client.getMetadataWithChildren(query);
if(listing == null) {
return new DbxEntry[]{};
}
if(listing.entry.isFile()) {
return new DbxEntry[]{listing.entry};
}
DbxEntry[] dirents = new DbxEntry[listing.children.size()];
int idx = 0;
for (DbxEntry child : listing.children) {
dirents[idx++] = child;
}
return dirents;
}
示例2: listFilesAndDirectories
import com.dropbox.core.DbxClient; //导入方法依赖的package包/类
@Override
public FileInstanceAbstract[] listFilesAndDirectories() throws URISyntaxException, IOException {
try {
DbxClient dbxClient = connect();
DbxEntry.WithChildren entries;
entries = dbxClient.getMetadataWithChildren(getPath());
if (entries == null || entries.children == null)
return null;
FileInstanceAbstract[] fileInstances = new FileInstanceAbstract[entries.children.size()];
int i = 0;
for (DbxEntry entry : entries.children)
fileInstances[i++] = new DropboxFileInstance(filePathItem, this, entry);
return fileInstances;
} catch (DbxException e) {
throw new IOException(e);
}
}
示例3: collectDropboxEntries
import com.dropbox.core.DbxClient; //导入方法依赖的package包/类
private void collectDropboxEntries(DbxClient client, Map<String, Long> dropboxEntries, String path) throws DbxException {
WithChildren entries = client.getMetadataWithChildren(path);
for (DbxEntry entry : entries.children) {
if (entry.isFolder()) {
collectDropboxEntries(client, dropboxEntries, entry.path);
} else {
dropboxEntries.put(entry.path, entry.asFile().lastModified.getTime());
}
}
}
示例4: collectDropboxEntries
import com.dropbox.core.DbxClient; //导入方法依赖的package包/类
private void collectDropboxEntries(DbxClient client, Map<String, Long> dropboxEntries, String path)
throws DbxException {
WithChildren entries = client.getMetadataWithChildren(path);
for (DbxEntry entry : entries.children) {
if (entry.isFolder()) {
collectDropboxEntries(client, dropboxEntries, entry.path);
} else {
dropboxEntries.put(entry.path, entry.asFile().lastModified.getTime());
}
}
}
示例5: dropboxImport
import com.dropbox.core.DbxClient; //导入方法依赖的package包/类
public void dropboxImport() throws DCMAException {
DropboxHelper helper = new DropboxHelper(getProperties());
helper.setPluginName("dcma-dropboximport-plugin");
DbxClient client = helper.authenticateApp();
String[] bcs = getBatchClassConfig().split(";");
for (String batchClassIdentifier : bcs) {
LOGGER.debug("Importing the batch class " + batchClassIdentifier);
try {
String dropboxFolder = getProperty(batchClassIdentifier, "folder");
String filePattern = getProperty(batchClassIdentifier, "pattern");
String action = getProperty(batchClassIdentifier, "action");
String actionName = action.split("\\|")[0];
LOGGER.debug(" - Dropbox folder: " + dropboxFolder);
LOGGER.debug(" - File pattern: " + filePattern);
DbxEntry.WithChildren listing = client.getMetadataWithChildren(dropboxFolder);
LOGGER.debug(" - Files in the folder:");
if (listing != null) {
for (DbxEntry child : listing.children) {
System.out.println(" -- " + child.name);
if (child.name.matches(filePattern)) {
System.out.println(" -- Import file");
importFilesFromDropbox(child, batchClassIdentifier, client);
if (actionName.equalsIgnoreCase("moveTo")) {
String targetFolder = action.split("\\|")[1];
client.move(child.path, targetFolder + "/" + child.name);
} else if (actionName.equalsIgnoreCase("delete"))
client.delete(child.path);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}