Example usage for com.google.gwt.gdata.client.finance PortfolioEntry getEditLink

List of usage examples for com.google.gwt.gdata.client.finance PortfolioEntry getEditLink

Introduction

In this page you can find the example usage for com.google.gwt.gdata.client.finance PortfolioEntry getEditLink.

Prototype

public final native com.google.gwt.gdata.client.Link getEditLink() ;

Source Link

Document

Returns the link that provides the URI that can be used to edit the entry.

Usage

From source file:com.google.gwt.gdata.sample.hellogdata.client.FinanceCreateTransactionDemo.java

License:Apache License

/**
 * Retrieve the portfolios feed using the Finance service and
 * the portfolios feed uri. In GData all get, insert, update
 * and delete methods always receive a callback defining success
 * and failure handlers.//ww  w .  ja  v  a 2 s . co m
 * Here, the failure handler displays an error message while the
 * success handler obtains the first Portfolio entry with a title
 * starting with "GWT-Finance-Client" and calls createTransaction
 * to insert a transaction.
 * If no portfolio is found a message is displayed.
 * 
 * @param portfoliosFeedUri The uri of the portfolios feed
 */
private void getPortfolios(String portfoliosFeedUri) {
    showStatus("Loading portfolios feed...", false);
    service.getPortfolioFeed(portfoliosFeedUri, new PortfolioFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the portfolios feed: " + caught.getMessage(), true);
        }

        public void onSuccess(PortfolioFeed result) {
            PortfolioEntry[] entries = result.getEntries();
            PortfolioEntry targetPortfolio = null;
            for (PortfolioEntry entry : entries) {
                if (entry.getTitle().getText().startsWith("GWT-Finance-Client")) {
                    targetPortfolio = entry;
                    break;
                }
            }
            if (targetPortfolio == null) {
                showStatus("No portfolio found that contains 'GWT-Finance-Client' " + "in the title.", false);
            } else {
                String portfolioEditUri = targetPortfolio.getEditLink().getHref();
                createTransaction(portfolioEditUri);
            }
        }
    });
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.FinanceDeleteTransactionDemo.java

License:Apache License

/**
 * Retrieve the portfolios feed using the Finance service and
 * the portfolios feed uri. In GData all get, insert, update
 * and delete methods always receive a callback defining success
 * and failure handlers./*from  w w  w  . j a  v a2s  .  c  o m*/
 * Here, the failure handler displays an error message while the
 * success handler obtains the first Portfolio entry with a title
 * starting with "GWT-Finance-Client" and retrieves the first
 * transaction in the portfolio with the symbol "NASDAQ:GOOG",
 * this is the transaction that will be deleted.
 * If no transaction exists with this symbol, the request will fail.
 * If no portfolio is found, a message is displayed.
 * 
 * @param portfoliosFeedUri The uri of the portfolios feed
 */
private void getPortfolios(String portfoliosFeedUri) {
    showStatus("Loading portfolios feed...", false);
    service.getPortfolioFeed(portfoliosFeedUri, new PortfolioFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the portfolios feed: " + caught.getMessage(), true);
        }

        public void onSuccess(PortfolioFeed result) {
            PortfolioEntry[] entries = result.getEntries();
            PortfolioEntry targetPortfolio = null;
            for (PortfolioEntry entry : entries) {
                if (entry.getTitle().getText().startsWith("GWT-Finance-Client")) {
                    targetPortfolio = entry;
                    break;
                }
            }
            if (targetPortfolio == null) {
                showStatus("No portfolio found that contains 'GWT-Finance-Client' " + "in the title.", false);
            } else {
                final String ticker = "NASDAQ:GOOG";
                int transactionId = 1;
                String transactionEntryUri = targetPortfolio.getEditLink().getHref() + "/positions/" + ticker
                        + "/transactions/" + transactionId;
                getTransaction(transactionEntryUri);
            }
        }
    });
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.FinanceRetrieveTransactionsDemo.java

License:Apache License

/**
 * Retrieve the portfolios feed using the Finance service and
 * the portfolios feed uri. In GData all get, insert, update
 * and delete methods always receive a callback defining
 * success and failure handlers./*from   w w  w  . j  a  v  a 2s  .com*/
 * Here, the failure handler displays an error message while the
 * success handler obtains the first portfolio entry with a title
 * starting with "GWT-Finance-Client" and retrieves all transactions
 * with the ticker symbol "NASDAQ:GOOG".
 * If no transactions exist with this symbol, the request will fail.
 * If no portfolio is found, a message is displayed.
 * 
 * @param portfoliosFeedUri The uri of the portfolios feed
 */
private void getPortfolios(String portfoliosFeedUri) {
    showStatus("Loading portfolios feed...", false);
    service.getPortfolioFeed(portfoliosFeedUri, new PortfolioFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the portfolios feed: " + caught.getMessage(), true);
        }

        public void onSuccess(PortfolioFeed result) {
            PortfolioEntry[] entries = result.getEntries();
            PortfolioEntry targetPortfolio = null;
            for (PortfolioEntry entry : entries) {
                if (entry.getTitle().getText().startsWith("GWT-Finance-Client")) {
                    targetPortfolio = entry;
                    break;
                }
            }
            if (targetPortfolio == null) {
                showStatus("No portfolio found that contains 'GWT-Finance-Client' " + "in the title.", false);
            } else {
                String ticker = "NASDAQ:GOOG";
                String transactionFeedUri = targetPortfolio.getEditLink().getHref() + "/positions/" + ticker
                        + "/transactions";
                getTransactions(transactionFeedUri);
            }
        }
    });
}