Search in sources :

Example 1 with ContainsExpressionType

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

Aggregations

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