bulk load source and target items for comparison
This commit is contained in:
-12
@@ -12,18 +12,6 @@
|
|||||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="bin/test" path="src/test/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="gradle_scope" value="test"/>
|
|
||||||
<attribute name="gradle_used_by_scope" value="test"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="bin/test" path="src/test/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="gradle_scope" value="test"/>
|
|
||||||
<attribute name="gradle_used_by_scope" value="test"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||||
<classpathentry kind="output" path="bin/default"/>
|
<classpathentry kind="output" path="bin/default"/>
|
||||||
|
|||||||
Binary file not shown.
@@ -82,12 +82,15 @@ public class CalendarQuickstart {
|
|||||||
System.out.println("\nEvents:");
|
System.out.println("\nEvents:");
|
||||||
int ct = 0;
|
int ct = 0;
|
||||||
int ex = 0;
|
int ex = 0;
|
||||||
|
int colCt = 0;
|
||||||
|
int hitCt = 0;
|
||||||
|
int pageCt = 0;
|
||||||
|
|
||||||
String srcId = "tero23q0dqqfc45r4jjcecl7bs@group.calendar.google.com";
|
String srcId = "tero23q0dqqfc45r4jjcecl7bs@group.calendar.google.com";
|
||||||
String trgId = "rpg91b8ls4e437a2gu63jhmlfk@group.calendar.google.com";
|
String trgId = "rpg91b8ls4e437a2gu63jhmlfk@group.calendar.google.com";
|
||||||
|
|
||||||
Events events = null;
|
Events events = null;
|
||||||
int pageCt = 0;
|
List<Event> srcItems = null;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
String nextPage = null;
|
String nextPage = null;
|
||||||
@@ -110,13 +113,42 @@ public class CalendarQuickstart {
|
|||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (srcItems == null)
|
||||||
|
srcItems = events.getItems();
|
||||||
|
else
|
||||||
|
srcItems.addAll(events.getItems());
|
||||||
|
|
||||||
List<Event> items = events.getItems();
|
pageCt++;
|
||||||
if (items.isEmpty()) {
|
} while (events.getNextPageToken() != null);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<Event> trgItems = null;
|
||||||
|
|
||||||
|
do {
|
||||||
|
String nextPage = null;
|
||||||
|
if (events != null) {
|
||||||
|
nextPage = events.getNextPageToken();
|
||||||
|
events = service.events().list(srcId)
|
||||||
|
.setPageToken(nextPage)
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
events = service.events().list(srcId).execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trgItems == null)
|
||||||
|
trgItems = events.getItems();
|
||||||
|
else
|
||||||
|
trgItems.addAll(events.getItems());
|
||||||
|
} while (events.getNextPageToken() != null);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (srcItems.isEmpty()) {
|
||||||
System.out.println("No upcoming events found.");
|
System.out.println("No upcoming events found.");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Upcoming events");
|
for (Event event : srcItems) {
|
||||||
for (Event event : items) {
|
|
||||||
|
|
||||||
String startStr = null;
|
String startStr = null;
|
||||||
if (event.getStart() != null && event.getStart().getDateTime() != null)
|
if (event.getStart() != null && event.getStart().getDateTime() != null)
|
||||||
@@ -131,8 +163,17 @@ public class CalendarQuickstart {
|
|||||||
+ ", DESCRIPTION: " + event.getDescription()
|
+ ", DESCRIPTION: " + event.getDescription()
|
||||||
+ ", SUMMARY: " + event.getSummary());
|
+ ", SUMMARY: " + event.getSummary());
|
||||||
|
|
||||||
|
if (event.getColorId() != null) {
|
||||||
|
|
||||||
event.setCreated(now);
|
colCt++;
|
||||||
|
|
||||||
|
for (Event trgEvent : trgItems) {
|
||||||
|
if (trgEvent.getId().equals(event.getId())) {
|
||||||
|
hitCt++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// try {
|
// try {
|
||||||
// Event eventCopy = service.events().insert(trgId, event).execute();
|
// Event eventCopy = service.events().insert(trgId, event).execute();
|
||||||
@@ -148,14 +189,10 @@ public class CalendarQuickstart {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pageCt++;
|
|
||||||
|
|
||||||
} while (events.getNextPageToken() != null);
|
|
||||||
|
|
||||||
System.out.println("Page count: " + pageCt);
|
System.out.println("Page count: " + pageCt);
|
||||||
|
System.out.println("Colored source events: " + colCt);
|
||||||
|
System.out.println("Target hits: " + hitCt);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user