Package com.google.gdata.data.analytics

Examples of com.google.gdata.data.analytics.DataEntry


    List<DataEntry> entries = feed.getEntries();
    if (entries.size() == 0) {
      System.out.println("No entries found");
      return;
    }
    DataEntry singleEntry = entries.get(0);

    // properties specific to all the entries returned in the feed
    System.out.println("Entry ID    = " + singleEntry.getId());
    System.out.println("Entry Title = " + singleEntry.getTitle().getPlainText());

    // iterate through all the dimensions
    List<Dimension> dimensions = singleEntry.getDimensions();
    for (Dimension dimension : dimensions) {
      System.out.println("Dimension Name  = " + dimension.getName());
      System.out.println("Dimension Value = " + dimension.getValue());
    }

    // iterate through all the metrics
    List<Metric> metrics = singleEntry.getMetrics();
    for (Metric metric : metrics) {
      System.out.println("Metric Name  = " + metric.getName());
      System.out.println("Metric Value = " + metric.getValue());
      System.out.println("Metric Type  = " + metric.getType());
      System.out.println("Metric CI    = " + metric.getConfidenceInterval().toString());
View Full Code Here


  public static String getFeedTable(DataFeed feed) {
    List<DataEntry> entries = feed.getEntries();
    if (entries.size() == 0) {
      return "No entries found";
    }
    DataEntry singleEntry = entries.get(0);
    List<Dimension> dimensions = singleEntry.getDimensions();
    List<Metric> metrics = singleEntry.getMetrics();
    List<String> feedDataNames = new ArrayList<String>();
    String feedDataValues = "";

    // put all the dimension and metric names into an array
    for (Dimension dimension : dimensions) {
View Full Code Here

  public void printRowHeaders(DataFeed feed) {
    if(feed.getEntries().size() == 0) {
      return;
    }

    DataEntry firstEntry = feed.getEntries().get(0);

    Iterator<Dimension> dimensions = firstEntry.getDimensions().iterator();
    while (dimensions.hasNext()) {
      printStream.print(sanitizeForCsv(dimensions.next().getName()));
      printStream.print(",");
    }

    Iterator<Metric> metrics = firstEntry.getMetrics().iterator();
    while (metrics.hasNext()) {
      printStream.print(sanitizeForCsv(metrics.next().getName()));
      if (metrics.hasNext()) {
        printStream.print(",");
      }
View Full Code Here

    DataFeed feed = new DataFeed();
    List<DataEntry> entryList = new ArrayList<DataEntry>();

    int numEntries = metrics[0].length;
    for (int entryIndex = 0; entryIndex < numEntries; entryIndex++) {
      DataEntry entry = new DataEntry();

      // Add all dimensions.
      for (int dimensionIndex = 0; dimensionIndex < dimensions.length; dimensionIndex++) {
        Dimension dimension = new Dimension();
        dimension.setValue(dimensions[dimensionIndex][entryIndex]);
        if (dimensionNames != null) {
          dimension.setName(dimensionNames[dimensionIndex]);
        }
        entry.addDimension(dimension);
      }
      // Add all metrics.
      for (int metricIndex = 0; metricIndex < metrics.length; metricIndex++) {
        Metric metric = new Metric();
        metric.setValue(metrics[metricIndex][entryIndex]);
        metric.setConfidenceInterval(confidenceInterval);
        entry.addMetric(metric);
      }
      entryList.add(entry);
    }

    feed.setEntries(entryList);
View Full Code Here

      // In the Analytics request, the data returned was grouped by AdWords Group ID and
      // Criterion ID.  Now those two pieces of information will be retrieved from the data received
      // from Google Analytics, and placed into a set of "filters" that will be part of the request
      // sent ot the AdWords API.

      DataEntry entry = analyticsData.getEntries().get(i);

      // All dimensions are returned from the API as Strings, but in the case of groupID and
      // criterionID, they're really longs.  Cast as long using Long.parseLong(str).
      Long groupID = Long.parseLong(entry.stringValueOf("ga:adwordsAdGroupID"));
      Long critID = Long.parseLong(entry.stringValueOf("ga:adwordsCriteriaID"));

      // Add AdWords IDs from Google Analytics to criteria filter array.
      AdGroupCriterionIdFilter critFilter = new AdGroupCriterionIdFilter();
      critFilter.setAdGroupId(groupID);
      critFilter.setCriterionId(critID);
View Full Code Here

  public void printDataForOneEntry() {
    System.out.println("\n-------- Important Entry Information --------\n");
    if (feed.getEntries().isEmpty()) {
      System.out.println("No entries found");
    } else {
      DataEntry singleEntry = feed.getEntries().get(0);

      // Properties specific to all the entries returned in the feed.
      System.out.println("Entry ID    = " + singleEntry.getId());
      System.out.println("Entry Title = " + singleEntry.getTitle().getPlainText());

      // Iterate through all the dimensions.
      for (Dimension dimension : singleEntry.getDimensions()) {
        System.out.println("Dimension Name  = " + dimension.getName());
        System.out.println("Dimension Value = " + dimension.getValue());
      }

      // Iterate through all the metrics.
      for (Metric metric : singleEntry.getMetrics()) {
        System.out.println("Metric Name  = " + metric.getName());
        System.out.println("Metric Value = " + metric.getValue());
        System.out.println("Metric Type  = " + metric.getType());
        System.out.println("Metric CI    = " + metric.getConfidenceInterval().toString());
      }
View Full Code Here

   */
  public String getEntriesAsTable() {
    if (feed.getEntries().isEmpty()) {
      return "No entries found";
    }
    DataEntry singleEntry = feed.getEntries().get(0);
    List<String> feedDataNames = new ArrayList<String>();
    StringBuffer feedDataValues = new StringBuffer("\n-------- All Entries In A Table --------\n");

    // Put all the dimension and metric names into an array.
    for (Dimension dimension : singleEntry.getDimensions()) {
      feedDataNames.add(dimension.getName());
    }
    for (Metric metric : singleEntry.getMetrics()) {
      feedDataNames.add(metric.getName());
    }

    // Put the values of the dimension and metric names into the table.
    for (DataEntry entry : feed.getEntries()) {
View Full Code Here

TOP

Related Classes of com.google.gdata.data.analytics.DataEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.