001 /****************************************************************
002 * Licensed to the Apache Software Foundation (ASF) under one *
003 * or more contributor license agreements. See the NOTICE file *
004 * distributed with this work for additional information *
005 * regarding copyright ownership. The ASF licenses this file *
006 * to you under the Apache License, Version 2.0 (the *
007 * "License"); you may not use this file except in compliance *
008 * with the License. You may obtain a copy of the License at *
009 * *
010 * http://www.apache.org/licenses/LICENSE-2.0 *
011 * *
012 * Unless required by applicable law or agreed to in writing, *
013 * software distributed under the License is distributed on an *
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
015 * KIND, either express or implied. See the License for the *
016 * specific language governing permissions and limitations *
017 * under the License. *
018 ****************************************************************/
019
020 package org.apache.james.user.lib.model;
021
022 import org.apache.james.user.api.model.JamesUser;
023 import org.apache.mailet.MailAddress;
024
025 /**
026 * Implementation of User Interface.
027 *
028 * @deprecated Use {@link DefaultUser}
029 */
030 @Deprecated
031 public class DefaultJamesUser extends DefaultUser implements JamesUser {
032
033 private static final long serialVersionUID = 6323959976390389529L;
034
035 /**
036 * Whether forwarding is enabled for this user.
037 */
038 private boolean forwarding;
039
040 /**
041 * The mail address to which this user's email is forwarded.
042 */
043 private MailAddress forwardingDestination;
044
045 /**
046 * Is this user an alias for another username on the system.
047 */
048 private boolean aliasing;
049
050 /**
051 * The user name that this user name is aliasing.
052 */
053 private String alias;
054
055 public DefaultJamesUser(String name, String alg) {
056 super(name, alg);
057 initialize();
058 }
059
060 public DefaultJamesUser(String name, String passwordHash, String hashAlg) {
061 super(name, passwordHash, hashAlg);
062 initialize();
063 }
064
065 /**
066 * Initializes default values for local fields.
067 */
068 public void initialize() {
069 forwarding = false;
070 forwardingDestination = null;
071 aliasing = false;
072 alias = "";
073 }
074
075 /**
076 * @see org.apache.james.user.api.model.JamesUser#setForwarding(boolean)
077 */
078 public void setForwarding(boolean forward) {
079 forwarding = forward;
080 }
081
082 /**
083 * @see org.apache.james.user.api.model.JamesUser#getForwarding()
084 */
085 public boolean getForwarding() {
086 return forwarding;
087 }
088
089 /**
090 * @see org.apache.james.user.api.model.JamesUser#setForwardingDestination(org.apache.mailet.MailAddress)
091 */
092 public boolean setForwardingDestination(MailAddress address) {
093 /* TODO: Some verification would be good */
094 forwardingDestination = address;
095 return true;
096 }
097
098 /**
099 * @see org.apache.james.user.api.model.JamesUser#getForwardingDestination()
100 */
101 public MailAddress getForwardingDestination() {
102 return forwardingDestination;
103 }
104
105 /**
106 * @see org.apache.james.user.api.model.JamesUser#setAliasing(boolean)
107 */
108 public void setAliasing(boolean alias) {
109 aliasing = alias;
110 }
111
112 /**
113 * @see org.apache.james.user.api.model.JamesUser#getAliasing()
114 */
115 public boolean getAliasing() {
116 return aliasing;
117 }
118
119 /**
120 * @see org.apache.james.user.api.model.JamesUser#setAlias(java.lang.String)
121 */
122 public boolean setAlias(String address) {
123 /* TODO: Some verification would be good */
124 alias = address;
125 return true;
126 }
127
128 /**
129 * @see org.apache.james.user.api.model.JamesUser#getAlias()
130 */
131 public String getAlias() {
132 return alias;
133 }
134 }