本文整理汇总了Java中com.google.api.services.drive.model.Change类的典型用法代码示例。如果您正苦于以下问题:Java Change类的具体用法?Java Change怎么用?Java Change使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Change类属于com.google.api.services.drive.model包,在下文中一共展示了Change类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testFileAddedChange
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
@Test
public void testFileAddedChange() throws IOException {
// Given
File file1 = createTextFile("file1.txt", "the contents");
File file2 = createTextFile("file2.txt", "the contents");
// When
// sometimes, we have deleted files (from previous tests ?)
List<Change> changes = getChangesOperation.getChanges(startChangeId).stream()
.filter(change -> change.getDeleted() == false).collect(Collectors.toList());
// Then
assertEquals("There is not 2 changes as expected :" + changes, 2, changes.size());
assertThat(changes).filteredOn(change->change.getFileId().equals(file1.getId())).hasSize(1);
assertThat(changes).filteredOn(change->change.getFileId().equals(file2.getId())).hasSize(1);
}
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:17,代码来源:GetChangesOperationTest.java
示例2: isChangeInValidSubfolder
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
/** */
private boolean isChangeInValidSubfolder(Change change){
// If no folder specified, change is valid.
if (folderName == null){
return true;
}
// Else, check if parent of file changed is in valid subfolders.
if (change.getFile() != null){
List<ParentReference> references = change.getFile().getParents();
if (references != null && !references.isEmpty()){
for (ParentReference reference : references){
if (subfoldersId.contains(reference.getId())){
return true;
}
}
}
}
return false;
}
开发者ID:lbroudoux,项目名称:es-google-drive-river,代码行数:20,代码来源:DriveConnector.java
示例3: scan
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
/** Scan the Google Drive folder for last changes. */
private Long scan(String folder, Long lastChangesId) throws Exception{
if (logger.isDebugEnabled()){
logger.debug("Starting scanning of folder {} since {}", folder, lastChangesId);
}
DriveChanges changes = drive.getChanges(lastChangesId);
// Browse change and checks if its indexable before starting.
for (Change change : changes.getChanges()){
if (change.getFile() != null && DriveRiverUtil.isIndexable(change.getFile().getTitle(),
feedDefinition.getIncludes(), feedDefinition.getExcludes())){
if (change.getDeleted()){
esDelete(indexName, typeName, change.getFileId());
} else {
indexFile(change.getFile());
}
}
}
return changes.getLastChangeId();
}
开发者ID:lbroudoux,项目名称:es-google-drive-river,代码行数:21,代码来源:DriveRiver.java
示例4: getDriveChangesInfo
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
/**
* Gets the drive changes info in the My Tracks folder, including deleted
* files.
*
* @param changeId the largest change id
* @param changes a map of drive id to file for the changes
* @return an updated largest change id
*/
private long getDriveChangesInfo(long changeId, Map<String, File> changes) throws IOException {
Changes.List request = drive.changes().list().setStartChangeId(changeId + 1);
do {
ChangeList changeList = request.execute();
long newId = changeList.getLargestChangeId().longValue();
for (Change change : changeList.getItems()) {
if (change.getDeleted()) {
changes.put(change.getFileId(), null);
} else {
File file = change.getFile();
if (file.getLabels().getTrashed()) {
changes.put(change.getFileId(), null);
} else {
changes.put(change.getFileId(), file);
}
}
}
if (newId > changeId) {
changeId = newId;
}
request.setPageToken(changeList.getNextPageToken());
} while (request.getPageToken() != null && request.getPageToken().length() > 0);
Log.d(TAG, "Got drive changes: " + changes.size() + " " + changeId);
return changeId;
}
开发者ID:Plonk42,项目名称:mytracks,代码行数:35,代码来源:SyncAdapter.java
示例5: getChanges
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
public List<Change> getChanges(Long startChangeId) throws IOException {
List<Change> changes = new ArrayList<Change>();
Changes.List request = drive.changes().list();
if (startChangeId != null) {
request.setStartChangeId(startChangeId);
}
do {
ChangeList changeList = request.execute();
changes.addAll(changeList.getItems());
request.setPageToken(changeList.getNextPageToken());
} while (request.getPageToken() != null && request.getPageToken().length() > 0);
return changes;
}
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:14,代码来源:GetChangesOperation.java
示例6: fireBookmarksFileChanged
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
private void fireBookmarksFileChanged(BookmarkId bookmarkFolderId, Change change) {
for (IBookmarksFileChangeListener listener : listenerList) {
SafeRunner.run(new ISafeRunnable() {
public void run() throws Exception {
listener.bookmarksFileChanged(bookmarkFolderId, change);
}
public void handleException(Throwable exception) {
StatusHelper.logError("Error in bookmarks file change listener", exception);
}
});
}
}
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:15,代码来源:BookmarksFileChangeManager.java
示例7: testNoChanges
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
@Test
public void testNoChanges() throws IOException {
// Given
// When
List<Change> changes = getChangesOperation.getChanges(startChangeId);
// Then
assertEquals(0, changes.size());
}
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:11,代码来源:GetChangesOperationTest.java
示例8: testGetNextStartChangeId
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
@Test
public void testGetNextStartChangeId() throws Exception {
// Given
File file1 = createTextFile("file1.txt", "the contents");
waitUntilFileChange(startChangeId, file1.getId());
List<Change> changes = getChangesOperation.getChanges(startChangeId);
// When
startChangeId = changes.get(changes.size() - 1).getId() + 1;
File file2 = createTextFile("file2.txt", "the contents");
// Then
waitUntilFileChange(startChangeId, file2.getId());
}
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:15,代码来源:GetChangesOperationTest.java
示例9: testGet
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
@Test
public void testGet() throws Exception {
final com.google.api.services.drive.model.ChangeList list = requestBody("direct://LIST", null);
List<Change> items = list.getItems();
if (!items.isEmpty()) {
Change change = items.get(0);
Long id = change.getId();
// using String message body for single parameter "changeId"
final com.google.api.services.drive.model.Change result = requestBody("direct://GET", id);
assertNotNull("get result", result);
LOG.debug("get: " + result);
}
}
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:DriveChangesIntegrationTest.java
示例10: getNewDiffs
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
public List<String> getNewDiffs() throws Exception {
getDeviceFolderId(true); // required
Log.d(TAG, "Looking for updates in the device folder...");
List<String> result = new ArrayList<String>();
long lcid = session.driveLastChangeID();
ChangeList changes;
File file;
Changes.List request = service.changes().list().setIncludeDeleted(false).setIncludeSubscribed(
false).setFields("items/file,largestChangeId,nextPageToken").setStartChangeId(lcid + 1);
do {
try {
changes = request.execute();
for (Change change: changes.getItems()) {
file = change.getFile();
if (!file.getTitle().endsWith(".diff"))
continue;
// check for deleted (looks like List.setIncludeDeleted(false) has no effects)
Boolean deleted = change.getDeleted();
if (deleted != null && deleted)
continue;
deleted = file.getExplicitlyTrashed();
if (deleted != null && deleted)
continue;
for (ParentReference parent: file.getParents())
if (parent.getId().equals(deviceId)) {
result.add(file.getId());
break;
}
}
lcid = changes.getLargestChangeId();
request.setPageToken(changes.getNextPageToken());
} catch (Exception err) {
Log.e(TAG, "getNewDiffs", err);
request.setPageToken(null);
}
} while (request.getPageToken() != null && request.getPageToken().length() > 0);
session.setDriveLastChangeID(lcid);
Log.i(TAG, "Found " + Integer.toString(result.size()) + " diffs since last check.");
return result;
}
开发者ID:tarzasai,项目名称:Uoccin,代码行数:41,代码来源:GSA.java
示例11: webhook_receiveFolderChanges
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
@ApiMethod(
name = "webhook.receiveFolderChanges",
path = "webhook/receiveFolderChanges",
httpMethod = HttpMethod.POST
)
public void webhook_receiveFolderChanges(HttpServletRequest httpServletRequest, Change change) {
String projectKey = httpServletRequest.getHeader("X-Goog-Channel-Token");
Project project = ProjectService.getInstance().get(projectKey);
logger.info("Receiving folder changes for project "+projectKey);
//TODO: to be implemented
}
开发者ID:andryfailli,项目名称:teampot,代码行数:12,代码来源:WebhookEndpoint.java
示例12: waitUntilFileChange
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
private Change waitUntilFileChange(Long startChangeId, String fileId) throws TimeoutException {
return Waiter.waitUntil("No change for file " + fileId, () -> getChangesOperation.getChanges(startChangeId)
.stream().filter(change -> change.getFileId().equals(fileId)).findFirst()).get();
}
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:5,代码来源:GetChangesOperationTest.java
示例13: bookmarksFileChanged
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
@Override
public void bookmarksFileChanged(BookmarkId bookmarkFolderId, Change change) {
events.add(new BookmarksFileChange(bookmarkFolderId, change));
}
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:5,代码来源:BookmarksFileChangeManagerTest.java
示例14: BookmarksFileChange
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
public BookmarksFileChange(BookmarkId bookmarkFolderId, Change change) {
this.bookmarkFolderId = bookmarkFolderId;
this.change = change;
}
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:5,代码来源:BookmarksFileChangeManagerTest.java
示例15: getAllChanges
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
public List<Change> getAllChanges(Long startChangeId) {
return retrieveAllChangesImpl(startChangeId, 3);
}
开发者ID:andresoviedo,项目名称:google-drive-ftp-adapter,代码行数:4,代码来源:GoogleDrive.java
示例16: DriveChanges
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
public DriveChanges(Long lastChangeId, List<Change> changes){
this.lastChangeId = lastChangeId;
this.changes = changes;
}
开发者ID:lbroudoux,项目名称:es-google-drive-river,代码行数:5,代码来源:DriveChanges.java
示例17: getChanges
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
public List<Change> getChanges(){
return changes;
}
开发者ID:lbroudoux,项目名称:es-google-drive-river,代码行数:4,代码来源:DriveChanges.java
示例18: bookmarksFileChanged
import com.google.api.services.drive.model.Change; //导入依赖的package包/类
public void bookmarksFileChanged(BookmarkId bookmarkFolderId, Change change);
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:2,代码来源:IBookmarksFileChangeListener.java
注:本文中的com.google.api.services.drive.model.Change类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论