Search in sources :

Example 1 with FolderResponseShapeType

use of com.microsoft.schemas.exchange.services._2006.types.FolderResponseShapeType in project zm-mailbox by Zimbra.

the class ExchangeEWSFreeBusyProvider method bindFolder.

BaseFolderType bindFolder(DistinguishedFolderIdNameType distinguishedFolderId, DefaultShapeNamesType shapeType) {
    final DistinguishedFolderIdType distinguishedFolderIdType = new DistinguishedFolderIdType();
    distinguishedFolderIdType.setId(distinguishedFolderId);
    final NonEmptyArrayOfBaseFolderIdsType nonEmptyArrayOfBaseFolderIdsType = new NonEmptyArrayOfBaseFolderIdsType();
    nonEmptyArrayOfBaseFolderIdsType.getFolderIdOrDistinguishedFolderId().add(distinguishedFolderIdType);
    GetFolderType getFolderRequest = new GetFolderType();
    getFolderRequest.setFolderIds(nonEmptyArrayOfBaseFolderIdsType);
    FolderResponseShapeType stResp = new FolderResponseShapeType();
    stResp.setBaseShape(shapeType);
    getFolderRequest.setFolderShape(stResp);
    RequestServerVersion serverVersion = new RequestServerVersion();
    serverVersion.setVersion(ExchangeVersionType.EXCHANGE_2010_SP_1);
    Holder<ServerVersionInfo> gfversionInfo = new Holder<ServerVersionInfo>();
    Holder<GetFolderResponseType> gfresponseHolder = new Holder<GetFolderResponseType>();
    MailboxCultureType mct = new MailboxCultureType();
    mct.setValue("EN");
    TimeZoneDefinitionType tzdt = new TimeZoneDefinitionType();
    tzdt.setId("Greenwich Standard Time");
    TimeZoneContextType tzct = new TimeZoneContextType();
    tzct.setTimeZoneDefinition(tzdt);
    service.getFolder(getFolderRequest, mct, serverVersion, tzct, gfresponseHolder, gfversionInfo);
    FolderInfoResponseMessageType firmtResp = (FolderInfoResponseMessageType) gfresponseHolder.value.getResponseMessages().getCreateItemResponseMessageOrDeleteItemResponseMessageOrGetItemResponseMessage().get(0).getValue();
    if (firmtResp.getFolders().getFolderOrCalendarFolderOrContactsFolder().size() > 0) {
        return firmtResp.getFolders().getFolderOrCalendarFolderOrContactsFolder().get(0);
    } else {
        ZimbraLog.fb.error("Could not find the folder in Exchange : " + distinguishedFolderId.toString());
    }
    return null;
}
Also used : NonEmptyArrayOfBaseFolderIdsType(com.microsoft.schemas.exchange.services._2006.types.NonEmptyArrayOfBaseFolderIdsType) Holder(javax.xml.ws.Holder) TimeZoneContextType(com.microsoft.schemas.exchange.services._2006.types.TimeZoneContextType) FolderInfoResponseMessageType(com.microsoft.schemas.exchange.services._2006.messages.FolderInfoResponseMessageType) FolderResponseShapeType(com.microsoft.schemas.exchange.services._2006.types.FolderResponseShapeType) DistinguishedFolderIdType(com.microsoft.schemas.exchange.services._2006.types.DistinguishedFolderIdType) GetFolderResponseType(com.microsoft.schemas.exchange.services._2006.messages.GetFolderResponseType) RequestServerVersion(com.microsoft.schemas.exchange.services._2006.types.RequestServerVersion) TimeZoneDefinitionType(com.microsoft.schemas.exchange.services._2006.types.TimeZoneDefinitionType) ServerVersionInfo(com.microsoft.schemas.exchange.services._2006.types.ServerVersionInfo) GetFolderType(com.microsoft.schemas.exchange.services._2006.messages.GetFolderType) MailboxCultureType(com.microsoft.schemas.exchange.services._2006.types.MailboxCultureType)

Example 2 with FolderResponseShapeType

use of com.microsoft.schemas.exchange.services._2006.types.FolderResponseShapeType in project zm-mailbox by Zimbra.

the class ExchangeEWSFreeBusyProvider method findFolderByPartialProp.

List<BaseFolderType> findFolderByPartialProp(FolderIdType id, UnindexedFieldURIType prop, String val) {
    FindFolderType findFolderRequest = new FindFolderType();
    findFolderRequest.setTraversal(FolderQueryTraversalType.SHALLOW);
    final NonEmptyArrayOfBaseFolderIdsType ffEmptyArrayOfBaseFolderIdsType = new NonEmptyArrayOfBaseFolderIdsType();
    ffEmptyArrayOfBaseFolderIdsType.getFolderIdOrDistinguishedFolderId().add(id);
    FolderResponseShapeType stResp = new FolderResponseShapeType();
    stResp.setBaseShape(DefaultShapeNamesType.ID_ONLY);
    findFolderRequest.setParentFolderIds(ffEmptyArrayOfBaseFolderIdsType);
    findFolderRequest.setFolderShape(stResp);
    RestrictionType rtRestriction = new RestrictionType();
    ContainsExpressionType contains = new ContainsExpressionType();
    PathToUnindexedFieldType pix = new PathToUnindexedFieldType();
    pix.setFieldURI(prop);
    contains.setPath(new JAXBElement<PathToUnindexedFieldType>(new QName("http://schemas.microsoft.com/exchange/services/2006/types", "FieldURI"), PathToUnindexedFieldType.class, pix));
    FieldURIOrConstantType ct = new FieldURIOrConstantType();
    ConstantValueType cv = new ConstantValueType();
    cv.setValue(val);
    ct.setConstant(cv);
    contains.setConstant(cv);
    contains.setContainmentMode(ContainmentModeType.SUBSTRING);
    rtRestriction.setSearchExpression(new JAXBElement<SearchExpressionType>(new QName("http://schemas.microsoft.com/exchange/services/2006/types", "Contains"), SearchExpressionType.class, contains));
    findFolderRequest.setRestriction(rtRestriction);
    Holder<FindFolderResponseType> findFolderResponse = new Holder<FindFolderResponseType>();
    RequestServerVersion serverVersion = new RequestServerVersion();
    serverVersion.setVersion(ExchangeVersionType.EXCHANGE_2010_SP_1);
    Holder<ServerVersionInfo> gfversionInfo = new Holder<ServerVersionInfo>();
    MailboxCultureType mct = new MailboxCultureType();
    mct.setValue("EN");
    TimeZoneDefinitionType tzdt = new TimeZoneDefinitionType();
    tzdt.setId("Greenwich Standard Time");
    TimeZoneContextType tzct = new TimeZoneContextType();
    tzct.setTimeZoneDefinition(tzdt);
    service.findFolder(findFolderRequest, mct, serverVersion, tzct, findFolderResponse, gfversionInfo);
    FindFolderResponseMessageType ffRespMessage = (FindFolderResponseMessageType) findFolderResponse.value.getResponseMessages().getCreateItemResponseMessageOrDeleteItemResponseMessageOrGetItemResponseMessage().get(0).getValue();
    if (ResponseClassType.SUCCESS == ffRespMessage.getResponseClass()) {
        return ffRespMessage.getRootFolder().getFolders().getFolderOrCalendarFolderOrContactsFolder();
    }
    ZimbraLog.fb.warn("findFolderByPartialProp " + ffRespMessage.getResponseCode());
    return null;
}
Also used : ContainsExpressionType(com.microsoft.schemas.exchange.services._2006.types.ContainsExpressionType) ConstantValueType(com.microsoft.schemas.exchange.services._2006.types.ConstantValueType) NonEmptyArrayOfBaseFolderIdsType(com.microsoft.schemas.exchange.services._2006.types.NonEmptyArrayOfBaseFolderIdsType) FindFolderType(com.microsoft.schemas.exchange.services._2006.messages.FindFolderType) QName(javax.xml.namespace.QName) Holder(javax.xml.ws.Holder) TimeZoneContextType(com.microsoft.schemas.exchange.services._2006.types.TimeZoneContextType) FieldURIOrConstantType(com.microsoft.schemas.exchange.services._2006.types.FieldURIOrConstantType) FolderResponseShapeType(com.microsoft.schemas.exchange.services._2006.types.FolderResponseShapeType) SearchExpressionType(com.microsoft.schemas.exchange.services._2006.types.SearchExpressionType) RestrictionType(com.microsoft.schemas.exchange.services._2006.types.RestrictionType) RequestServerVersion(com.microsoft.schemas.exchange.services._2006.types.RequestServerVersion) TimeZoneDefinitionType(com.microsoft.schemas.exchange.services._2006.types.TimeZoneDefinitionType) PathToUnindexedFieldType(com.microsoft.schemas.exchange.services._2006.types.PathToUnindexedFieldType) ServerVersionInfo(com.microsoft.schemas.exchange.services._2006.types.ServerVersionInfo) FindFolderResponseType(com.microsoft.schemas.exchange.services._2006.messages.FindFolderResponseType) MailboxCultureType(com.microsoft.schemas.exchange.services._2006.types.MailboxCultureType) FindFolderResponseMessageType(com.microsoft.schemas.exchange.services._2006.messages.FindFolderResponseMessageType)

Example 3 with FolderResponseShapeType

use of com.microsoft.schemas.exchange.services._2006.types.FolderResponseShapeType in project zm-mailbox by Zimbra.

the class ExchangeEWSFreeBusyProvider method findFolderByProp.

List<BaseFolderType> findFolderByProp(FolderIdType id, UnindexedFieldURIType prop, String val) {
    FindFolderType findFolderRequest = new FindFolderType();
    findFolderRequest.setTraversal(FolderQueryTraversalType.SHALLOW);
    final NonEmptyArrayOfBaseFolderIdsType ffEmptyArrayOfBaseFolderIdsType = new NonEmptyArrayOfBaseFolderIdsType();
    ffEmptyArrayOfBaseFolderIdsType.getFolderIdOrDistinguishedFolderId().add(id);
    FolderResponseShapeType stResp = new FolderResponseShapeType();
    stResp.setBaseShape(DefaultShapeNamesType.ID_ONLY);
    findFolderRequest.setParentFolderIds(ffEmptyArrayOfBaseFolderIdsType);
    findFolderRequest.setFolderShape(stResp);
    RestrictionType rtRestriction = new RestrictionType();
    IsEqualToType ieq = new IsEqualToType();
    PathToUnindexedFieldType pix = new PathToUnindexedFieldType();
    pix.setFieldURI(prop);
    ieq.setPath(new JAXBElement<PathToUnindexedFieldType>(new QName("http://schemas.microsoft.com/exchange/services/2006/types", "FieldURI"), PathToUnindexedFieldType.class, pix));
    FieldURIOrConstantType ct = new FieldURIOrConstantType();
    ConstantValueType cv = new ConstantValueType();
    cv.setValue(val);
    ct.setConstant(cv);
    ieq.setFieldURIOrConstant(ct);
    rtRestriction.setSearchExpression(new JAXBElement<SearchExpressionType>(new QName("http://schemas.microsoft.com/exchange/services/2006/types", "IsEqualTo"), SearchExpressionType.class, ieq));
    findFolderRequest.setRestriction(rtRestriction);
    Holder<FindFolderResponseType> findFolderResponse = new Holder<FindFolderResponseType>();
    RequestServerVersion serverVersion = new RequestServerVersion();
    serverVersion.setVersion(ExchangeVersionType.EXCHANGE_2010_SP_1);
    Holder<ServerVersionInfo> gfversionInfo = new Holder<ServerVersionInfo>();
    MailboxCultureType mct = new MailboxCultureType();
    mct.setValue("EN");
    TimeZoneDefinitionType tzdt = new TimeZoneDefinitionType();
    tzdt.setId("Greenwich Standard Time");
    TimeZoneContextType tzct = new TimeZoneContextType();
    tzct.setTimeZoneDefinition(tzdt);
    service.findFolder(findFolderRequest, mct, serverVersion, tzct, findFolderResponse, gfversionInfo);
    FindFolderResponseMessageType ffRespMessage = (FindFolderResponseMessageType) findFolderResponse.value.getResponseMessages().getCreateItemResponseMessageOrDeleteItemResponseMessageOrGetItemResponseMessage().get(0).getValue();
    if (ResponseClassType.SUCCESS == ffRespMessage.getResponseClass()) {
        return ffRespMessage.getRootFolder().getFolders().getFolderOrCalendarFolderOrContactsFolder();
    }
    ZimbraLog.fb.warn("findFolderByProp " + ffRespMessage.getResponseCode());
    return null;
}
Also used : ConstantValueType(com.microsoft.schemas.exchange.services._2006.types.ConstantValueType) NonEmptyArrayOfBaseFolderIdsType(com.microsoft.schemas.exchange.services._2006.types.NonEmptyArrayOfBaseFolderIdsType) FindFolderType(com.microsoft.schemas.exchange.services._2006.messages.FindFolderType) QName(javax.xml.namespace.QName) Holder(javax.xml.ws.Holder) TimeZoneContextType(com.microsoft.schemas.exchange.services._2006.types.TimeZoneContextType) FieldURIOrConstantType(com.microsoft.schemas.exchange.services._2006.types.FieldURIOrConstantType) FolderResponseShapeType(com.microsoft.schemas.exchange.services._2006.types.FolderResponseShapeType) SearchExpressionType(com.microsoft.schemas.exchange.services._2006.types.SearchExpressionType) RestrictionType(com.microsoft.schemas.exchange.services._2006.types.RestrictionType) RequestServerVersion(com.microsoft.schemas.exchange.services._2006.types.RequestServerVersion) IsEqualToType(com.microsoft.schemas.exchange.services._2006.types.IsEqualToType) TimeZoneDefinitionType(com.microsoft.schemas.exchange.services._2006.types.TimeZoneDefinitionType) PathToUnindexedFieldType(com.microsoft.schemas.exchange.services._2006.types.PathToUnindexedFieldType) ServerVersionInfo(com.microsoft.schemas.exchange.services._2006.types.ServerVersionInfo) FindFolderResponseType(com.microsoft.schemas.exchange.services._2006.messages.FindFolderResponseType) MailboxCultureType(com.microsoft.schemas.exchange.services._2006.types.MailboxCultureType) FindFolderResponseMessageType(com.microsoft.schemas.exchange.services._2006.messages.FindFolderResponseMessageType)

Aggregations

FolderResponseShapeType (com.microsoft.schemas.exchange.services._2006.types.FolderResponseShapeType)3 MailboxCultureType (com.microsoft.schemas.exchange.services._2006.types.MailboxCultureType)3 NonEmptyArrayOfBaseFolderIdsType (com.microsoft.schemas.exchange.services._2006.types.NonEmptyArrayOfBaseFolderIdsType)3 RequestServerVersion (com.microsoft.schemas.exchange.services._2006.types.RequestServerVersion)3 ServerVersionInfo (com.microsoft.schemas.exchange.services._2006.types.ServerVersionInfo)3 TimeZoneContextType (com.microsoft.schemas.exchange.services._2006.types.TimeZoneContextType)3 TimeZoneDefinitionType (com.microsoft.schemas.exchange.services._2006.types.TimeZoneDefinitionType)3 Holder (javax.xml.ws.Holder)3 FindFolderResponseMessageType (com.microsoft.schemas.exchange.services._2006.messages.FindFolderResponseMessageType)2 FindFolderResponseType (com.microsoft.schemas.exchange.services._2006.messages.FindFolderResponseType)2 FindFolderType (com.microsoft.schemas.exchange.services._2006.messages.FindFolderType)2 ConstantValueType (com.microsoft.schemas.exchange.services._2006.types.ConstantValueType)2 FieldURIOrConstantType (com.microsoft.schemas.exchange.services._2006.types.FieldURIOrConstantType)2 PathToUnindexedFieldType (com.microsoft.schemas.exchange.services._2006.types.PathToUnindexedFieldType)2 RestrictionType (com.microsoft.schemas.exchange.services._2006.types.RestrictionType)2 SearchExpressionType (com.microsoft.schemas.exchange.services._2006.types.SearchExpressionType)2 QName (javax.xml.namespace.QName)2 FolderInfoResponseMessageType (com.microsoft.schemas.exchange.services._2006.messages.FolderInfoResponseMessageType)1 GetFolderResponseType (com.microsoft.schemas.exchange.services._2006.messages.GetFolderResponseType)1 GetFolderType (com.microsoft.schemas.exchange.services._2006.messages.GetFolderType)1