Search in sources :

Example 1 with GetDataSourcesRequest

use of com.zimbra.soap.admin.message.GetDataSourcesRequest in project zm-mailbox by Zimbra.

the class GetDataSources method handle.

@Override
public Element handle(Element request, Map<String, Object> context) throws ServiceException {
    ZimbraSoapContext zsc = getZimbraSoapContext(context);
    Provisioning prov = Provisioning.getInstance();
    GetDataSourcesRequest req = JaxbUtil.elementToJaxb(request);
    String id = req.getId();
    Account account = prov.get(AccountBy.id, id, zsc.getAuthToken());
    defendAgainstAccountOrCalendarResourceHarvesting(account, AccountBy.id, id, zsc, Admin.R_adminLoginAs, Admin.R_adminLoginCalendarResourceAs);
    Element response = zsc.createElement(AdminConstants.GET_DATA_SOURCES_RESPONSE);
    List<DataSource> sources = Provisioning.getInstance().getAllDataSources(account);
    for (DataSource ds : sources) {
        com.zimbra.cs.service.account.ToXML.encodeDataSource(response, ds);
    }
    return response;
}
Also used : Account(com.zimbra.cs.account.Account) ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) Element(com.zimbra.common.soap.Element) Provisioning(com.zimbra.cs.account.Provisioning) GetDataSourcesRequest(com.zimbra.soap.admin.message.GetDataSourcesRequest) DataSource(com.zimbra.cs.account.DataSource)

Aggregations

Element (com.zimbra.common.soap.Element)1 Account (com.zimbra.cs.account.Account)1 DataSource (com.zimbra.cs.account.DataSource)1 Provisioning (com.zimbra.cs.account.Provisioning)1 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)1 GetDataSourcesRequest (com.zimbra.soap.admin.message.GetDataSourcesRequest)1