Back to project page Campaign-Manager-Code-Sample.
The source code is released under:
Apache License
If you think the Android project Campaign-Manager-Code-Sample listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.microsoft.campaignmanager.datasource; //from w w w .j a v a 2s . c om import java.util.concurrent.ExecutionException; import com.microsoft.campaignmanager.CampaignApplication; public class GraphDataSource { /** The m application. */ private CampaignApplication mApplication; /** * Instantiates a new list items data source. * * @param application the application */ public GraphDataSource(CampaignApplication application) { mApplication = application; } /** * Gets the lists client. * * @return the lists client */ private GraphClient getGraphClient() { return mApplication.getCurrentGraphClient(); } public GraphApplication createApplication(GraphApplication application) { GraphClient client = (GraphClient) getGraphClient(); try { return client.createApplication(application).get(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } public GraphServicePrincipal createServicePrincipal(GraphApplication application) { GraphClient client = (GraphClient) getGraphClient(); try { return client.createServicePrincipal(application).get(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } public GraphPermission createPermission(GraphPermission permission) { // set some defaults GraphClient client = (GraphClient) getGraphClient(); try { return client.createPermission(permission).get(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } }