use of com.google.api.services.analytics.model.Segment in project pentaho-kettle by pentaho.
the class GaInputStepDialog method readGaSegments.
// Collect segment list from the GA service for the given authentication information
public void readGaSegments() {
try {
Analytics analytics = getAnalytics();
if (analytics == null) {
return;
}
Segments segments = analytics.management().segments().list().execute();
ArrayList<String> segmentNames = new ArrayList<String>(20);
segmentIds.clear();
for (Segment segmentEntry : segments.getItems()) {
segmentNames.add(segmentEntry.getName());
segmentIds.put(segmentEntry.getName(), "gaid::" + segmentEntry.getId());
}
// put the segments to the combo box and select first one
wQuSegment.setItems(segmentNames.toArray(new String[segmentNames.size()]));
if (segmentNames.size() > 0) {
wQuSegment.select(0);
}
} catch (Exception e) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setText(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.AuthenticationFailure.DialogTitle"));
mb.setMessage(BaseMessages.getString(PKG, "GoogleAnalyticsDialog.AuthenticationFailure.DialogMessage"));
mb.open();
}
}
Aggregations