Package org.apache.james.user.api.model

Examples of org.apache.james.user.api.model.JamesUser


     */
    protected String getPrimaryName(String originalUsername) {
        String username;
        try {
            username = originalUsername;
            JamesUser user = (JamesUser) localusers.getUserByName(username);
            if (user.getAliasing()) {
                username = user.getAlias();
            }
        } catch (Exception e) {
            username = originalUsername;
        }
        return username;
View Full Code Here


        Collection<String> mappings = new ArrayList<String>();
        try {
            User user = getUserByName(username);

            if (user instanceof JamesUser) {
                JamesUser jUser = (JamesUser) user;

                if (enableAliases && jUser.getAliasing()) {
                    String alias = jUser.getAlias();
                    if (alias != null) {
                        mappings.add(alias + "@" + domain);
                    }
                }

                if (enableForwarding && jUser.getForwarding()) {
                    String forward;
                    if (jUser.getForwardingDestination() != null && ((forward = jUser.getForwardingDestination().toString()) != null)) {
                        mappings.add(forward);
                    } else {
                        String errorBuffer = "Forwarding was enabled for " + username + " but no forwarding address was set for this account.";
                        getLogger().error(errorBuffer);
                    }
View Full Code Here

    }

    @Override
    public void unsetAlias(String userName) throws Exception {
        try {
            JamesUser user = getJamesUser(userName);
            if (!user.getAliasing()) {
                throw new UsersRepositoryException("User " + user + " is no alias");
            }
            user.setAliasing(false);
            usersRepository.updateUser(user);
        } catch (UsersRepositoryException e) {
            throw new Exception(e.getMessage());
        }
    }
View Full Code Here

    }

    @Override
    public String getAlias(String userName) throws Exception {
        try {
            JamesUser user = getJamesUser(userName);
            if (!user.getAliasing()) {
                return null;
            }
            return user.getAlias();
        } catch (UsersRepositoryException e) {
            throw new Exception(e.getMessage());

        }
    }
View Full Code Here

    }

    @Override
    public void unsetForwardAddress(String userName) throws Exception {
        try {
            JamesUser user = getJamesUser(userName);
            if (!user.getForwarding()) {
                throw new UsersRepositoryException("User " + user + " is no forward");
            }
            user.setForwarding(false);
            usersRepository.updateUser(user);
        } catch (UsersRepositoryException e) {
            throw new Exception(e.getMessage());
        }
    }
View Full Code Here

    }

    @Override
    public String getForwardAddress(String userName) throws Exception {
        try {
            JamesUser user = getJamesUser(userName);
            if (!user.getForwarding()) {
                return null;
            }
            return user.getForwardingDestination().toString();
        } catch (UsersRepositoryException e) {
            throw new Exception(e.getMessage());
        }
    }
View Full Code Here

     */
    private String getPrimaryName(String originalUsername) {
        String username;
        try {
            username = originalUsername;
            JamesUser user = (JamesUser) localusers.getUserByName(username);
            if (user.getAliasing()) {
                username = user.getAlias();
            }
        } catch (Exception e) {
            username = originalUsername;
        }
        return username;
View Full Code Here

TOP

Related Classes of org.apache.james.user.api.model.JamesUser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.