Search in sources :

Example 1 with ConstantValueType

use of com.microsoft.schemas.exchange.services._2006.types.ConstantValueType 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 2 with ConstantValueType

use of com.microsoft.schemas.exchange.services._2006.types.ConstantValueType 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)

Example 3 with ConstantValueType

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

the class ExchangeEWSFreeBusyProvider method findItemByProp.

List<ItemType> findItemByProp(FolderIdType id, UnindexedFieldURIType prop, String val, DefaultShapeNamesType shapeType) {
    FindItemType findItemRequest = new FindItemType();
    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));
    findItemRequest.setRestriction(rtRestriction);
    ItemResponseShapeType stShape = new ItemResponseShapeType();
    stShape.setBaseShape(shapeType);
    findItemRequest.setItemShape(stShape);
    NonEmptyArrayOfBaseFolderIdsType ids = new NonEmptyArrayOfBaseFolderIdsType();
    ids.getFolderIdOrDistinguishedFolderId().add(id);
    findItemRequest.setParentFolderIds(ids);
    findItemRequest.setTraversal(ItemQueryTraversalType.SHALLOW);
    RequestServerVersion serverVersion = new RequestServerVersion();
    serverVersion.setVersion(ExchangeVersionType.EXCHANGE_2010_SP_1);
    Holder<FindItemResponseType> fiResponse = new Holder<FindItemResponseType>();
    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.findItem(findItemRequest, mct, serverVersion, tzct, fiResponse, gfversionInfo);
    FindItemResponseMessageType fiRespMessage = (FindItemResponseMessageType) fiResponse.value.getResponseMessages().getCreateItemResponseMessageOrDeleteItemResponseMessageOrGetItemResponseMessage().get(0).getValue();
    if (ResponseClassType.SUCCESS == fiRespMessage.getResponseClass()) {
        return fiRespMessage.getRootFolder().getItems().getItemOrMessageOrCalendarItem();
    }
    ZimbraLog.fb.warn("findItemByProp " + fiRespMessage.getResponseCode());
    return null;
}
Also used : ConstantValueType(com.microsoft.schemas.exchange.services._2006.types.ConstantValueType) NonEmptyArrayOfBaseFolderIdsType(com.microsoft.schemas.exchange.services._2006.types.NonEmptyArrayOfBaseFolderIdsType) QName(javax.xml.namespace.QName) Holder(javax.xml.ws.Holder) TimeZoneContextType(com.microsoft.schemas.exchange.services._2006.types.TimeZoneContextType) ItemResponseShapeType(com.microsoft.schemas.exchange.services._2006.types.ItemResponseShapeType) FindItemResponseType(com.microsoft.schemas.exchange.services._2006.messages.FindItemResponseType) FieldURIOrConstantType(com.microsoft.schemas.exchange.services._2006.types.FieldURIOrConstantType) 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) FindItemType(com.microsoft.schemas.exchange.services._2006.messages.FindItemType) 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) MailboxCultureType(com.microsoft.schemas.exchange.services._2006.types.MailboxCultureType) FindItemResponseMessageType(com.microsoft.schemas.exchange.services._2006.messages.FindItemResponseMessageType)

Aggregations

ConstantValueType (com.microsoft.schemas.exchange.services._2006.types.ConstantValueType)3 FieldURIOrConstantType (com.microsoft.schemas.exchange.services._2006.types.FieldURIOrConstantType)3 MailboxCultureType (com.microsoft.schemas.exchange.services._2006.types.MailboxCultureType)3 NonEmptyArrayOfBaseFolderIdsType (com.microsoft.schemas.exchange.services._2006.types.NonEmptyArrayOfBaseFolderIdsType)3 PathToUnindexedFieldType (com.microsoft.schemas.exchange.services._2006.types.PathToUnindexedFieldType)3 RequestServerVersion (com.microsoft.schemas.exchange.services._2006.types.RequestServerVersion)3 RestrictionType (com.microsoft.schemas.exchange.services._2006.types.RestrictionType)3 SearchExpressionType (com.microsoft.schemas.exchange.services._2006.types.SearchExpressionType)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 QName (javax.xml.namespace.QName)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 FolderResponseShapeType (com.microsoft.schemas.exchange.services._2006.types.FolderResponseShapeType)2 IsEqualToType (com.microsoft.schemas.exchange.services._2006.types.IsEqualToType)2 FindItemResponseMessageType (com.microsoft.schemas.exchange.services._2006.messages.FindItemResponseMessageType)1 FindItemResponseType (com.microsoft.schemas.exchange.services._2006.messages.FindItemResponseType)1