Warning: Attempt to read property "date" on null in /home/www/websvn.26th.net/html/blame.php on line 247

Warning: Attempt to read property "msg" on null in /home/www/websvn.26th.net/html/blame.php on line 247

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/www/websvn.26th.net/html/blame.php on line 247

Warning: Attempt to read property "date" on null in /home/www/websvn.26th.net/html/blame.php on line 247

Warning: Attempt to read property "msg" on null in /home/www/websvn.26th.net/html/blame.php on line 247

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/www/websvn.26th.net/html/blame.php on line 247

Warning: Attempt to read property "date" on null in /home/www/websvn.26th.net/html/blame.php on line 247

Warning: Attempt to read property "msg" on null in /home/www/websvn.26th.net/html/blame.php on line 247

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/www/websvn.26th.net/html/blame.php on line 247
WebSVN – general – Blame – /hostadmiral/trunk/src/ak/hostadmiral/core/model/MailAliasDestination.java/ – Rev 945

Subversion Repositories general

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
924 dev 1
package ak.hostadmiral.core.model;
919 dev 2
 
924 dev 3
import ak.hostadmiral.util.ModelException;
4
import ak.hostadmiral.util.ModelSecurityException;
922 dev 5
 
919 dev 6
/**
7
 *
8
 * @hibernate.class table="mailaliasdests"
9
 */
10
public class MailAliasDestination
11
	extends GeneralModelObject
12
{
13
	private MailAlias alias;
14
	private Mailbox   mailbox;
15
	private String    email;
16
 
17
	protected MailAliasDestination()
18
	{
19
	}
20
 
21
	/**
22
	 *
23
	 * @hibernate.many-to-one
24
	 */
25
	public MailAlias getAlias()
26
	{
27
		return alias;
28
	}
29
 
922 dev 30
	protected void setAlias(MailAlias alias)
919 dev 31
	{
32
		this.alias = alias;
33
	}
34
 
922 dev 35
	public void setAlias(User editor, MailAlias alias)
36
		throws ModelException
37
	{
38
		if(this.alias != null && !editableBy(editor))
39
			throw new ModelSecurityException();
40
 
41
		this.alias = alias;
42
	}
43
 
919 dev 44
	/**
45
	 *
46
	 * @hibernate.many-to-one
47
	 */
48
	public Mailbox getMailbox()
49
	{
50
		return mailbox;
51
	}
52
 
922 dev 53
	protected void setMailbox(Mailbox mailbox)
919 dev 54
	{
55
		this.mailbox = mailbox;
56
	}
57
 
922 dev 58
	public void setMailbox(User editor, Mailbox mailbox)
59
		throws ModelException
60
	{
61
		if(!editableBy(editor))
62
			throw new ModelSecurityException();
63
 
64
		this.mailbox = mailbox;
65
	}
66
 
919 dev 67
	/**
68
	 *
69
	 * @hibernate.property
70
	 */
71
	public String getEmail()
72
	{
73
		return email;
74
	}
75
 
922 dev 76
	protected void setEmail(String email)
919 dev 77
	{
78
		this.email = email;
79
	}
80
 
922 dev 81
	public void setEmail(User editor, String email)
82
		throws ModelException
83
	{
84
		if(!editableBy(editor))
85
			throw new ModelSecurityException();
86
 
87
		this.email = email;
88
	}
89
 
919 dev 90
	public String getTypeKey()
91
	{
924 dev 92
		return ak.hostadmiral.core.CoreResources.TYPE_MAIL_ALIAS_DESTINATION;
919 dev 93
	}
94
 
95
	public String getIdentKey()
96
	{
97
		if(getMailbox() == null)
924 dev 98
			return ak.hostadmiral.core.CoreResources.IDENT_MAIL_ALIAS_DESTINATION_EXTERNAL;
919 dev 99
		else
924 dev 100
			return ak.hostadmiral.core.CoreResources.IDENT_MAIL_ALIAS_DESTINATION_INTERNAL;
919 dev 101
	}
102
 
103
	public Object[] getIdentParams()
104
	{
105
		if(getMailbox() == null)
106
			return new Object[] { getEmail() };
107
		else
108
			return new Object[] { getMailbox().getLogin(), getMailbox().getDomain().getName() };
109
	}
110
 
111
	public boolean viewableBy(User user)
112
	{
113
		return alias.viewableBy(user);
114
	}
115
 
116
	public boolean editableBy(User user)
117
	{
922 dev 118
		return alias.mayChangeDestinations(user);
919 dev 119
	}
120
 
121
	public boolean deleteableBy(User user)
122
	{
922 dev 123
		return alias.mayChangeDestinations(user);
919 dev 124
	}
922 dev 125
 
126
	protected static boolean allowedToCreate(MailAliasDestinationManager manager, User editor)
127
		throws ModelException
128
	{
129
		return true;
130
	}
919 dev 131
}
922 dev 132