Search in sources :

Example 1 with MimeTypeInfo

use of com.zimbra.cs.mime.MimeTypeInfo 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 MimeTypeInfo

use of com.zimbra.cs.mime.MimeTypeInfo in project zm-mailbox by Zimbra.

the class MockProvisioning method getMimeTypes.

@Override
public List<MimeTypeInfo> getMimeTypes(String mime) {
    List<MimeTypeInfo> result = mimeConfig.get(mime);
    if (result != null) {
        return result;
    } else {
        MockMimeTypeInfo info = new MockMimeTypeInfo();
        info.setHandlerClass(UnknownTypeHandler.class.getName());
        return Collections.<MimeTypeInfo>singletonList(info);
    }
}
Also used : MockMimeTypeInfo(com.zimbra.cs.mime.MockMimeTypeInfo) UnknownTypeHandler(com.zimbra.cs.mime.handler.UnknownTypeHandler) MimeTypeInfo(com.zimbra.cs.mime.MimeTypeInfo) MockMimeTypeInfo(com.zimbra.cs.mime.MockMimeTypeInfo)

Example 3 with MimeTypeInfo

use of com.zimbra.cs.mime.MimeTypeInfo 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

MimeTypeInfo (com.zimbra.cs.mime.MimeTypeInfo)3 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 ArrayList (java.util.ArrayList)2 MockMimeTypeInfo (com.zimbra.cs.mime.MockMimeTypeInfo)1 UnknownTypeHandler (com.zimbra.cs.mime.handler.UnknownTypeHandler)1