Search in sources :

Example 1 with LdapMimeType

use of com.zimbra.cs.account.ldap.entry.LdapMimeType in project zm-mailbox by Zimbra.

the class LdapProvisioning method getMimeTypesByQuery.

@Override
public List<MimeTypeInfo> getMimeTypesByQuery(String mimeType) throws ServiceException {
    List<MimeTypeInfo> mimeTypes = new ArrayList<MimeTypeInfo>();
    try {
        ZSearchResultEnumeration ne = helper.searchDir(mDIT.mimeBaseDN(), filterFactory.mimeEntryByMimeType(mimeType), ZSearchControls.SEARCH_CTLS_SUBTREE());
        while (ne.hasMore()) {
            ZSearchResultEntry sr = ne.next();
            mimeTypes.add(new LdapMimeType(sr, this));
        }
        ne.close();
    } catch (ServiceException e) {
        throw ServiceException.FAILURE("unable to get mime types for " + mimeType, e);
    }
    return mimeTypes;
}
Also used : LdapMimeType(com.zimbra.cs.account.ldap.entry.LdapMimeType) AccountServiceException(com.zimbra.cs.account.AccountServiceException) AuthFailedServiceException(com.zimbra.cs.account.AccountServiceException.AuthFailedServiceException) ServiceException(com.zimbra.common.service.ServiceException) ZSearchResultEnumeration(com.zimbra.cs.ldap.ZSearchResultEnumeration) ArrayList(java.util.ArrayList) MimeTypeInfo(com.zimbra.cs.mime.MimeTypeInfo) ZSearchResultEntry(com.zimbra.cs.ldap.ZSearchResultEntry)

Example 2 with LdapMimeType

use of com.zimbra.cs.account.ldap.entry.LdapMimeType in project zm-mailbox by Zimbra.

the class LdapProvisioning method getAllMimeTypesByQuery.

@Override
public List<MimeTypeInfo> getAllMimeTypesByQuery() throws ServiceException {
    List<MimeTypeInfo> mimeTypes = new ArrayList<MimeTypeInfo>();
    try {
        ZSearchResultEnumeration ne = helper.searchDir(mDIT.mimeBaseDN(), filterFactory.allMimeEntries(), ZSearchControls.SEARCH_CTLS_SUBTREE());
        while (ne.hasMore()) {
            ZSearchResultEntry sr = ne.next();
            mimeTypes.add(new LdapMimeType(sr, this));
        }
        ne.close();
    } catch (ServiceException e) {
        throw ServiceException.FAILURE("unable to get mime types", e);
    }
    return mimeTypes;
}
Also used : LdapMimeType(com.zimbra.cs.account.ldap.entry.LdapMimeType) AccountServiceException(com.zimbra.cs.account.AccountServiceException) AuthFailedServiceException(com.zimbra.cs.account.AccountServiceException.AuthFailedServiceException) ServiceException(com.zimbra.common.service.ServiceException) ZSearchResultEnumeration(com.zimbra.cs.ldap.ZSearchResultEnumeration) ArrayList(java.util.ArrayList) MimeTypeInfo(com.zimbra.cs.mime.MimeTypeInfo) ZSearchResultEntry(com.zimbra.cs.ldap.ZSearchResultEntry)

Aggregations

ServiceException (com.zimbra.common.service.ServiceException)2 AccountServiceException (com.zimbra.cs.account.AccountServiceException)2 AuthFailedServiceException (com.zimbra.cs.account.AccountServiceException.AuthFailedServiceException)2 LdapMimeType (com.zimbra.cs.account.ldap.entry.LdapMimeType)2 ZSearchResultEntry (com.zimbra.cs.ldap.ZSearchResultEntry)2 ZSearchResultEnumeration (com.zimbra.cs.ldap.ZSearchResultEnumeration)2 MimeTypeInfo (com.zimbra.cs.mime.MimeTypeInfo)2 ArrayList (java.util.ArrayList)2