LdapAccount ldapAccount = (LdapAccount) (account instanceof LdapAccount ? account : getAccountById(account.getId())); if (ldapAccount == null)
LdapEntry ldapEntry = (LdapEntry) (account instanceof LdapEntry ? account : getAccountById(account.getId())); if (ldapEntry == null)
    public List<Identity> getAllIdentities(Account account) throws ServiceException {        LdapAccount ldapAccount = (LdapAccount) (account instanceof LdapAccount ? account : getAccountById(account.getId()));        if (ldapAccount == null)             throw AccountServiceException.NO_SUCH_ACCOUNT(account.getName());        List<Identity> result = getIdentitiesByQuery(ldapAccount, "(objectclass=zimbraIdentity)", null);        addDefaultIdentity(result, account);        return result;    }