
com.microsoft.exchange.services.odata.model.Me Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mail-calendar-contact Show documentation
Show all versions of mail-calendar-contact Show documentation
Java SDK for Office 365 Mail-Calendar-Contact services
The newest version!
package com.microsoft.exchange.services.odata.model;
import com.msopentech.odatajclient.engine.client.http.HttpClientException;
import com.msopentech.odatajclient.engine.communication.ODataClientErrorException;
import com.msopentech.odatajclient.engine.communication.ODataServerErrorException;
import com.msopentech.odatajclient.proxy.api.AbstractEntitySet;
import com.microsoft.office.proxy.OfficeEntityContainerFactory;
import com.msopentech.odatajclient.proxy.api.annotations.EntitySet;
import com.msopentech.odatajclient.proxy.api.annotations.Singleton;
import com.msopentech.odatajclient.proxy.api.annotations.CompoundKey;
import com.msopentech.odatajclient.proxy.api.annotations.CompoundKeyElement;
import com.microsoft.exchange.services.odata.model.system.types.*;
import com.microsoft.exchange.services.odata.model.*;import com.microsoft.exchange.services.odata.model.types.*;
// EdmSimpleType property imports
import com.msopentech.odatajclient.engine.data.ODataDuration;
import com.msopentech.odatajclient.engine.data.ODataTimestamp;
import com.msopentech.odatajclient.engine.data.metadata.edm.geospatial.Geospatial;
import com.msopentech.odatajclient.engine.data.metadata.edm.geospatial.GeospatialCollection;
import com.msopentech.odatajclient.engine.data.metadata.edm.geospatial.LineString;
import com.msopentech.odatajclient.engine.data.metadata.edm.geospatial.MultiLineString;
import com.msopentech.odatajclient.engine.data.metadata.edm.geospatial.MultiPoint;
import com.msopentech.odatajclient.engine.data.metadata.edm.geospatial.MultiPolygon;
import com.msopentech.odatajclient.engine.data.metadata.edm.geospatial.Point;
import com.msopentech.odatajclient.engine.data.metadata.edm.geospatial.Polygon;
import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
import java.io.Serializable;
import java.util.Collection;
import java.util.concurrent.Callable;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
/** Represents Me singleton. */
public class Me {
/** Proxy to communicate with service. */
private static IUser sInstance = null;
/** Entity container instance. */
private static EntityContainer sContainer = null;
/**
* Pushes pending changes to endpoint.
*
* @return this singleton instance.
*/
public static IUser flush() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
OfficeEntityContainerFactory.getInstance().getEntityContainer(EntityContainer.class).flush();
return sInstance;
}
/**
* Pushes pending changes to endpoint asynchronously.
*
* @return future for {@link Me#flush()} operation.
*/
public static ListenableFuture flushAsync() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
return OfficeEntityContainerFactory.getInstance().getEntityContainer(EntityContainer.class).flushAsync();
}
/**
* Gets a value of DisplayName property.
*
* @return a value of DisplayName property.
*/
public static String getDisplayName() {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.getDisplayName();
}
/**
* Sets a value of DisplayName property.
*
* @param _displayName new DisplayName value.
* @return Me instance.
*/
public static IUser setDisplayName(final String _displayName) {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.setDisplayName(_displayName);
}
/**
* Gets a value of Alias property.
*
* @return a value of Alias property.
*/
public static String getAlias() {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.getAlias();
}
/**
* Sets a value of Alias property.
*
* @param _alias new Alias value.
* @return Me instance.
*/
public static IUser setAlias(final String _alias) {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.setAlias(_alias);
}
/**
* Gets a value of MailboxGuid property.
*
* @return a value of MailboxGuid property.
*/
public static UUID getMailboxGuid() {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.getMailboxGuid();
}
/**
* Sets a value of MailboxGuid property.
*
* @param _mailboxGuid new MailboxGuid value.
* @return Me instance.
*/
public static IUser setMailboxGuid(final UUID _mailboxGuid) {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.setMailboxGuid(_mailboxGuid);
}
/**
* Gets Folders entity set.
*
* @return Folders collection.
* @throws ODataClientErrorException if server returned status code from 400 to 499.
* @throws ODataServerErrorException if server returned status code from 500 to 599.
* @throws HttpClientException if any error occured during parsing server response.
*/
public static IFolders getFolders() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sContainer.getFolders();
}
/**
* Gets Messages entity set.
*
* @return Messages collection.
* @throws ODataClientErrorException if server returned status code from 400 to 499.
* @throws ODataServerErrorException if server returned status code from 500 to 599.
* @throws HttpClientException if any error occured during parsing server response.
*/
public static IMessages getMessages() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sContainer.getMessages();
}
/**
* Gets RootFolder navigation property.
*
* @return RootFolder.
*/
public static com.microsoft.exchange.services.odata.model.types.IFolder getRootFolder() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.getRootFolder();
}
/**
* Gets RootFolder navigation property asynchronously.
*
* @return future that retrieves RootFolder.
*/
public static ListenableFuture getRootFolderAsync() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.getRootFolderAsync();
}
/**
* Gets Inbox navigation property.
*
* @return Inbox.
*/
public static com.microsoft.exchange.services.odata.model.types.IFolder getInbox() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.getInbox();
}
/**
* Gets Inbox navigation property asynchronously.
*
* @return future that retrieves Inbox.
*/
public static ListenableFuture getInboxAsync() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.getInboxAsync();
}
/**
* Gets Drafts navigation property.
*
* @return Drafts.
*/
public static com.microsoft.exchange.services.odata.model.types.IFolder getDrafts() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.getDrafts();
}
/**
* Gets Drafts navigation property asynchronously.
*
* @return future that retrieves Drafts.
*/
public static ListenableFuture getDraftsAsync() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.getDraftsAsync();
}
/**
* Gets SentItems navigation property.
*
* @return SentItems.
*/
public static com.microsoft.exchange.services.odata.model.types.IFolder getSentItems() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.getSentItems();
}
/**
* Gets SentItems navigation property asynchronously.
*
* @return future that retrieves SentItems.
*/
public static ListenableFuture getSentItemsAsync() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.getSentItemsAsync();
}
/**
* Gets DeletedItems navigation property.
*
* @return DeletedItems.
*/
public static com.microsoft.exchange.services.odata.model.types.IFolder getDeletedItems() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.getDeletedItems();
}
/**
* Gets DeletedItems navigation property asynchronously.
*
* @return future that retrieves DeletedItems.
*/
public static ListenableFuture getDeletedItemsAsync() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.getDeletedItemsAsync();
}
/**
* Gets Calendars entity set.
*
* @return Calendars collection.
* @throws ODataClientErrorException if server returned status code from 400 to 499.
* @throws ODataServerErrorException if server returned status code from 500 to 599.
* @throws HttpClientException if any error occured during parsing server response.
*/
public static ICalendars getCalendars() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sContainer.getCalendars();
}
/**
* Gets Calendar navigation property.
*
* @return Calendar.
*/
public static com.microsoft.exchange.services.odata.model.types.ICalendar getCalendar() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.getCalendar();
}
/**
* Gets Calendar navigation property asynchronously.
*
* @return future that retrieves Calendar.
*/
public static ListenableFuture getCalendarAsync() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.getCalendarAsync();
}
/**
* Gets CalendarGroups entity set.
*
* @return CalendarGroups collection.
* @throws ODataClientErrorException if server returned status code from 400 to 499.
* @throws ODataServerErrorException if server returned status code from 500 to 599.
* @throws HttpClientException if any error occured during parsing server response.
*/
public static ICalendarGroups getCalendarGroups() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sContainer.getCalendarGroups();
}
/**
* Gets Events entity set.
*
* @return Events collection.
* @throws ODataClientErrorException if server returned status code from 400 to 499.
* @throws ODataServerErrorException if server returned status code from 500 to 599.
* @throws HttpClientException if any error occured during parsing server response.
*/
public static IEvents getEvents() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sContainer.getEvents();
}
/**
* Gets Contacts entity set.
*
* @return Contacts collection.
* @throws ODataClientErrorException if server returned status code from 400 to 499.
* @throws ODataServerErrorException if server returned status code from 500 to 599.
* @throws HttpClientException if any error occured during parsing server response.
*/
public static IContacts getContacts() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sContainer.getContacts();
}
/**
* Gets ContactFolders entity set.
*
* @return ContactFolders collection.
* @throws ODataClientErrorException if server returned status code from 400 to 499.
* @throws ODataServerErrorException if server returned status code from 500 to 599.
* @throws HttpClientException if any error occured during parsing server response.
*/
public static IContactFolders getContactFolders() throws HttpClientException, ODataServerErrorException, ODataClientErrorException {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sContainer.getContactFolders();
}
/**
* Gets a value of Id property.
*
* @return a value of Id property.
*/
public static String getId() {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.getId();
}
/**
* Sets a value of Id property.
*
* @param _id new Id value.
* @return Me instance.
*/
public static IEntity setId(final String _id) {
try {
init().get();
} catch (Exception e) {
throw new RuntimeException(e);
}
return sInstance.setId(_id);
}
/** Initializes private values of this Me instance on first invocation. */
public synchronized static ListenableFuture init() throws IllegalStateException {
return OfficeEntityContainerFactory.getInstance().getEntityContainer(EntityContainer.class).getExecutorService().submit(new Callable() {
@Override
public Void call() {
innerInit();
return null;
}
});
}
private static void innerInit() {
if (sInstance != null) {
return;
}
OfficeEntityContainerFactory factory = OfficeEntityContainerFactory.getInstance();
if (factory == null) {
throw new IllegalStateException("You must specify service base url in Configuration");
}
sContainer = factory.getEntityContainer(EntityContainer.class);
sInstance = sContainer.me();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy