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;
}
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);
}
}
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;
}
Aggregations