use of com.microsoft.schemas.exchange.services._2006.types.RequestServerVersion 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;
}
Aggregations