Search in sources :

Example 1 with ItemResponseShapeType

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

FindItemResponseMessageType (com.microsoft.schemas.exchange.services._2006.messages.FindItemResponseMessageType)1 FindItemResponseType (com.microsoft.schemas.exchange.services._2006.messages.FindItemResponseType)1 FindItemType (com.microsoft.schemas.exchange.services._2006.messages.FindItemType)1 ConstantValueType (com.microsoft.schemas.exchange.services._2006.types.ConstantValueType)1 FieldURIOrConstantType (com.microsoft.schemas.exchange.services._2006.types.FieldURIOrConstantType)1 IsEqualToType (com.microsoft.schemas.exchange.services._2006.types.IsEqualToType)1 ItemResponseShapeType (com.microsoft.schemas.exchange.services._2006.types.ItemResponseShapeType)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