use of com.google.api.services.analytics.model.Profiles in project pentaho-kettle by pentaho.
the class GaInputStepDialog method readGaProfiles.
// Collect profile list from the GA service for the given authentication
// information
public void readGaProfiles() {
try {
Analytics analytics = getAnalytics();
if (analytics == null) {
return;
}
Analytics.Management.Profiles.List profiles = analytics.management().profiles().list("~all", "~all");
Profiles profileList = profiles.execute();
profileTableIds.clear();
List<String> profileNames = new ArrayList<String>();
for (Profile profile : profileList.getItems()) {
String tableId = "ga:" + profile.getId();
String profileName = tableId + " - profile: " + profile.getName();
profileNames.add(profileName);
profileTableIds.put(profileName, tableId);
}
// put the profiles to the combo box and select first one
wGaProfile.setItems(profileNames.toArray(new String[profileNames.size()]));
if (profileNames.size() > 0) {
wGaProfile.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